var currentAnchor = null;

jQuery(document).ready(function(){
	$(".link").hover(
		function(){
			$(this).css("z-index","10");
		},
		function(){
		  $(this).css("z-index","100");
		}
	);
	
	$(".hi_link").hover(
		function(){
			$(this).css("z-index","150");
		},
		function(){
		  $(this).css("z-index","50");
		}
	);
	
	initialiseGallery('front page');

   $('a').focus(function() {
     this.blur();
   });
	
});

function initialiseGallery(gal)
{  
  query="gallery="+gal;
  $.get("serverSide.php",query,function(){getImage('next')});
	if(gal!="front page"){
  	  $(".nav_but").fadeIn("slow");
  	  markSection(gal);
  }	
}

function getImage(dirn){
  $("#frame").fadeOut("fast");
	$("#message").fadeIn("slow");

	query="getImage="+dirn;
	
	$.ajax({url:"serverSide.php",
				  data:query,
				  success:function(data){
									 updateGal(data);}
									 });
}

function updateGal(data){
  $("#message").fadeOut("slow");
  $("#frame").html(data);
	setTimeout('$("#frame").fadeIn("slow").jScrollPane()',1000);
}

function markSection(sect){
	$(".dot").fadeOut("slow");
	$("#" + sect + "_dot").fadeIn("slow");
}

function showContact(){
	if($("#email_add").css("display")=="none"){
		$("#email_add").fadeIn("slow");	
	}
	else{
		$("#email_add").fadeOut("slow");	
	}
}

function getPage(page)
{
 	if(page.indexOf('#')!=-1){
    page=page.replace(/#/,"");	
	}
	$("#frame").fadeOut("fast");
	$(".nav_but").fadeOut("fast");
	markSection(page);
	
	query="page="+page;
	$.ajax({url:"serverSide.php",
				  data:query,
				  success:function(data){
									 updateGal(data);}
									 });

}
