	function openPage(page){
		return window.location.href = '/'+page;
	}
		
	function openSeries(page){
	return window.location.href = '/portfolio/'+page;
	}
	
	function openPortfolio(page,serie){
	return window.location.href = '/portfolio/'+page+'/'+serie;
	}
		
	function openPortfolioJSON(page,serie){
			$("#showcases").fadeIn("slow");
			$("#showcasesNav").fadeIn("slow");
			$("#credits").fadeIn("slow");
			
			$(document).ready(function() {	
				if($('#imgHolder div').length == 1) {
				 $("#nav a:eq(2)").bind("click",setnext);
				 $("#nav a:eq(1)").bind("click",setprev);	
				 $('#navnumber').html('1/1');
				}
				
			var i = 0;
					
			$('#imgHolder').cycle({
			fx:     'scrollHorz', 
		    prev:   '#prev', 
		    next:   '#next', 
			easing: 'easeInOutQuart',
			speedIn: 800,
			speedOut: 400,      
			containerResize: 1,
		    nowrap:  1, 
		 	after: onAfter,
		    timeout: 0
			});


			function onAfter(curr, next, opts) {

			    var index = opts.currSlide;
				 currentslide = index+1
				 totalslides = opts.slideCount
				 numbers = ''+currentslide+' / '+ totalslides +''
				 $('#navnumber').html(numbers)
			

			    if(index == totalslides-1){
				 	$("#nav a:eq(2)").removeAttr("id")
				 	$("#nav a:eq(2)").bind("click",setnext)
				 }
				 else
				 {
				 	$("#nav a:eq(2)").unbind("click",setnext)
				 	$("#nav a:eq(2)").attr("id","next")
				 }

				//previous
			    if(index==0){
					$("#nav a:eq(1)").bind("click",setprev)			
				 } 
				 else {
					 $("#nav a:eq(1)").removeClass("strike")
					 $("#nav a:eq(1)").unbind("click",setprev)	
				 }
				 if(index == 0){
					 $("#nav a:eq(1)").addClass("strike")
					 $("#nav a:eq(1)").unbind("click",setprev)		
				 }

			// end onafter
			}

			function setnext(){
			
			}
			function setprev(){
				
			}
			
			// end document ready
			});
			
			
			jQuery(function( $ ){	
				/**
				 * All the functions below, are used to update the summary div
				 * That is not the objective of the plugin, the really important part 
				 * is the one right below. The option placeholder, and threshold.
				 */
				$.preload( '#imgHolder img', {//the first argument is a selector to the images
					onRequest:request,
					onComplete:complete,
					onFinish:finish,
					placeholder:'/assets/images/empty.gif',//this is the really important option
					notFound:'/assets/images/empty.gif',//optional image if an image wasn't found
					threshold: 2 //'2' is the default, how many at a time, to load.
				});

				function update( data ){
					$('#done').css('width',(((data.done/data.total)*100))+'%');
					//alert(data.failed)
				};
				function complete( data ){
					update( data );
				};
				function request( data ){
					update( data );
				};
				function finish(){//hide the summary
				$('#done').fadeOut("slow");
				setTimeout('hideload()',500);
				};
				});
				
			
	// end openportfolio		
	}
	
	
		function showIndex() {
			 $('#showcases, #showcasesNav').css('display','none');
			 $(thumbholder).show();
			
			 int = setInterval("fader(i)",50);
			 }

		function fader() {
			var imgs = $('#thumbholder li').length;
			if (i >= imgs) {
				clearInterval(int);
			}
			$('#thumbholder li:hidden').eq(0).fadeIn('slow','easeInOutQuart');
			i++;
		}

		function hideload(){
			$('#loader').fadeOut("slow")	;
			setTimeout('showinfo()',500)
		}
		function showinfo(){
		//	$('#navnumber').fadeIn("slow")	
		}
