$(document).ready(function(){




// check if this works everytime 

/*
$('.current').hide();

$('.current').bind("load",function(){
	$('.current').fadeIn('slow');
	$("#loader").hide();
});
*/

/*

$("#thumbs2 > a > img").fadeOut();
 $("#thumbs2 > a > img").bind("load",function(){
	$(this).fadeIn('slow');
});
*/


/*
$("#loader").hide();
*/

	



$("#left > a, #right > a").click(function(){return false;});
$('#thumbs_2 .nav_link').click(function(){ 
return false;
});
$('.nav_link').click(function(){ 

	printMe(this.id);
	
});

function printMe(id){
	id = id.substring(1);
	changepic(id);
}



// CAROUSEL CONTROLS
$("#left >a").click(function(){

	
	temp = $('.current').prev();
	
	if($(temp).is("img")){	
		
		id = $(temp).attr("id").substring(1);
		changepic(id);
	}
	
});

$("#right>a").click(function(){

	temp = $('.current').next();
	
	if($(temp).is("img")){
		id = $(temp).attr("id").substring(1);
		changepic(id);
	}	
});
 
});

function changepic(id){
$("#loader").hide();
		$('#gallery_wall > img').hide();	
		$('#gallery_wall > img').removeClass("current");
	
		$("#quotes > .quoteclass").hide();
		$("#quotes > .quoteclass").removeClass("current");
	
		$("#picture_title > .titleclass").hide();
		$("#picture_title > .titleclass").removeClass("current");
	
		
		/*
if($("#p"+id).height() < 584){
			pad = (584 - $("#p"+id).height()) / 2;
			$("#p"+id).css("padding-top",pad);
		} else {
			$("#p"+id).css("padding-top","0")
		}
*/
		$('#p'+id).fadeIn(1000);
		$('#p'+id).addClass("current");
	
		$('#q'+id).fadeIn();
		$('#q'+id).addClass("current");
		
		$('#title_'+id).fadeIn();
		$('#title_'+id).addClass("current");
}
