var panelcount = 0;                    // Which panEl is being displayed
var lastPanel;   // How may panels are thre in total

	function init() {
		//alert("hai!");
	}; //  ent init function   
	

   function init_pgallery() {
		$(".pgallery-image").css("display","none");
		panelcount = 0;
		$(".pgallery-image").first().css("display","block");
		lastPanel = $(".pgallery-image").length;
	}; //  ent init vgallery function           
	
	function pgallery_next(){
   //panel calculators
		if (panelcount == (lastPanel-1)) {
	        panelcount = 0;
		 } else {
         	panelcount = panelcount + 1;
		}      
		//hide active galleries
		$(".pgallery-image").css("display","none");		
        //switch the carousel                 
		$(".pgallery-image:eq("+panelcount+")").fadeIn(); 			
		
		}
	function pgallery_prev(){
   
   	//panel calculators
    if (panelcount == 0) {
		panelcount = (lastPanel - 1);
	} else {
		panelcount = panelcount - 1;
	}                     
		//hide active galleries
		$(".pgallery-image").css("display","none");
        //switch the carousel                 
		$(".pgallery-image:eq("+panelcount+")").fadeIn(); 			
		
		}		
		
		
	////	
			
    function init_vgallery() {
		$(".vgallery-video").css("display","none");
		panelcount = 0;
		$(".vgallery-video").first().css("display","block");
		lastPanel = $(".vgallery-video").length;
	}; //  ent init vgallery function           
	
	function vgallery_next(){
   //panel calculators
		if (panelcount == (lastPanel-1)) {
	        panelcount = 0;
		 } else {
         	panelcount = panelcount + 1;
		}      
		//hide active galleries
		$(".vgallery-video").css("display","none");		
        //switch the carousel                 
		$(".vgallery-video:eq("+panelcount+")").fadeIn(); 			
		
		}
	function vgallery_prev(){
   
   	//panel calculators
    if (panelcount == 0) {
		panelcount = (lastPanel - 1);
	} else {
		panelcount = panelcount - 1;
	}                     
		//hide active galleries
		$(".vgallery-video").css("display","none");
        //switch the carousel                 
		$(".vgallery-video:eq("+panelcount+")").fadeIn(); 			
		
		}		
	
	$(document).ready(function(){
   		//alert("hai!");
		init();
	
	//MENU ITEM CLICK
	$("#navdossier").click(function() {	
		//fade out homepage
		$('#mugshots').fadeOut();		
		$('#surveillance').fadeOut();			
		$('#bookhim').fadeOut();			

        //transition effect    
        $('#dossier').fadeIn();
		
	}); // end function - thumbnail
	
	//MENU ITEM CLICK
	$("#navmugshots").click(function() {	
		//fade out homepage
		$('#dossier').fadeOut();
		$('#surveillance').fadeOut();
		$('#bookhim').fadeOut();
		
        //transition effect    
        $('#mugshots').fadeIn();
		
		//init_pgallery();		
	
	}); // end function - thumbnail		
	
	
	//MENU ITEM CLICK
	$("#navsurveillence").click(function() {	
		
		//fade out homepage
		$('#dossier').fadeOut();
		$('#mugshots').fadeOut();
		$('#bookhim').fadeOut();

        //transition effect    
        $('#surveillence').fadeIn();	; 
		
		init_vgallery();
		
	}); // end function - thumbnail	
	
	
	//MENU ITEM CLICK
	$("#navbookhim").click(function() {	
		
		//fade out	
		$('#dossier').fadeOut();
		$('#mugshots').fadeOut();
		$('#surveillance').fadeOut();					

        //transition effect
        $('#bookhim').fadeIn();	
			
												
	}); // end function - thumbnail		

	
	

	// MASK
	$(".mask").click(function() {	
			$('.mask').fadeOut();
			$('#overlay').fadeOut();
			$('#dossier').fadeOut();	
			$('#mugshots').fadeOut();			
			$('#surveillance').fadeOut();
			$('#contact').fadeOut();
			$('#home').fadeIn();
			
	 }); // end function - thumbnail
	

/// PHOTO GALLERY

		//change the color of the link when we mouse over.
		$("#pgallery-next").mouseover(function() {
			//$("#vgallery-next").css("color","red");	
		 }); // end function - next mouse over	
	
		//change teh color of the link when we mouse over.
		$("#pgallery-next").mouseout(function() {
			//$("#vgallery-next").css("color","#000");	
		 }); // end function - next mouse out		

		//change teh color of the link when we mouse over.
		$("#pgallery-next").click(function() {
	 			pgallery_next();										   
			//do something	
		 }); // end function - next mouse out	
		
	
		$("#pgallery-prev").mouseover(function() {
			//$("#vgallery-prev").css("color","red");	 
		 }); // end function - thumbnail	
		
		//change teh color of the link when we mouse over.
		$("#pgallery-prev").mouseout(function() {
			//$("#vgallery-prev").css("color","#000");	
		 }); // end function - next mouse out	
		
		//change teh color of the link when we mouse over.
		$("#pgallery-prev").click(function() {
			//do something	
				pgallery_prev();
		 }); // end function - next mouse out


///VIDEO GALLERY

		//change the color of the link when we mouse over.
		$("#vgallery-next").mouseover(function() {
			//$("#vgallery-next").css("color","red");	
		 }); // end function - next mouse over	
	
		//change teh color of the link when we mouse over.
		$("#vgallery-next").mouseout(function() {
			//$("#vgallery-next").css("color","#000");	
		 }); // end function - next mouse out		

		//change teh color of the link when we mouse over.
		$("#vgallery-next").click(function() {
	 			vgallery_next();										   
			//do something	
		 }); // end function - next mouse out	
		
	
		$("#vgallery-prev").mouseover(function() {
			//$("#vgallery-prev").css("color","red");	 
		 }); // end function - thumbnail	
		
		//change teh color of the link when we mouse over.
		$("#vgallery-prev").mouseout(function() {
			//$("#vgallery-prev").css("color","#000");	
		 }); // end function - next mouse out	
		
		//change teh color of the link when we mouse over.
		$("#vgallery-prev").click(function() {
			//do something	
				vgallery_prev();
		 }); // end function - next mouse out
	
	

	//MENU ITEM CLICK
	$("#donut").click(function() {	

		//Get the screen height and width
        //var maskHeight = $(document).height();
        //var maskWidth = $(window).width();
     
        //Set height and width to mask to fill up the whole screen
        //$('.mask').css({'width':maskWidth,'height':maskHeight});
         
        //transition effect    
        //$('.mask').fadeIn();   
        //$('.mask').fadeTo("slow",0.5);  
		
		//$('html, body').animate({ scrollTop: 0 }, 'slow');
												
	}); // end function - thumbnail
	
	//MENU ITEM CLICK
	$("#cuffs").click(function() {	

		//fade out homepage
		$('#cuffs').fadeOut();
												
	}); // end function - thumbnail


	//MENU ITEM CLICK
	$("#mugshot").click(function() {	
		
		//fade out homepage
		$('#home').fadeOut();

		//transition effect    
        $('#mugshots').fadeIn();	
			
		init_pgallery();
										
	}); // end function - thumbnail		


	//MENU ITEM CLICK
	$("#phone").click(function() {	
		
		//fade out homepage
		$('#home').fadeOut();

		//transition effect    
        $('#surveillance').fadeIn();	
			
		init_vgallery();
									
	}); // end function - thumbnail	
	
}); // end doc ready


