

$(document).ready(function(){


var docheight = $(window).height(); //The height of the browser window
var docwidth = $(window).width();	//The width of the browser window
var splash_posx = docheight*.5 -172;	//x position where the splash needs to be to be centered in the window 
var splash_posy = docwidth*.5 -310;	//y position where the splash needs to be to be centered in the window 

$("#splash_image").css({top:(splash_posx),left:(splash_posy)});  //center the splash usign the coordinates splash_posx & splash_posy

$("#splash_image").click(function(){								//WHEN the splash is clicked
			$("#splash_image").hide('clip',{ direction: "vertical" }, 500); 	//HIDE the splash using a clip effect
			$("#black_box").hide('clip',{ direction: "vertical" }, 500,function(){	//HIDE the 'page screen' using a clip effect THEN 			
			
																	
				$("#container").show(0).animate({left:"378px"}, 1500, function(){		//slide in the content container from the right THEN
								 $("#slide_container").fadeIn(1500);	//fade in the slide container div
								 $("#pointer").fadeIn(500);		//fade in the pointer
													   });
				$("#container_shadow").show(0).animate({left:"376px"}, 1500);	//slide the drop shadow for the container in from the right
				$("#menu, #menu_shadow").animate({left:"0px"}, 1500);	// slide the menu div and it's drop shadow in from the left													
																	
																	
																	
								});

		
								
								});





$(".blockNav, .gal_button").click(function(){  //TURN OFF THE DEFAULT CLICK FUNCTION FOR THESE BUTTONS 
return false;
});

/* MAIN NAVIGATION BUTTONS

These are the buttons for the main three sections. 

For each, main container is moved left or right to expose the requested section.

The pointer is also moved to correspond with the button that was pushed.


*/
//NAV1 (INFO)
$("#nav1").click(function(){				
$("#slider").stop().animate({left:"0px"},1000);
$("#pointer").stop().animate({top:"157px"},1000);
});



//NAV2 (GALLERY)

$("#nav2").click(function(){
$("#slider").stop().animate({left:"-640px"},1000);
$("#pointer").stop().animate({top:"265px"},1000);
var gal_con = $("#gallery_viewer").width();
var current_gal = $("#gal_forward").attr('class');
var full = $(current_gal).width();
var num_pages = Math.ceil(full / gal_con);
$("#gal_page_total").text(num_pages);
});



//NAV3 (CONTACT)

$("#nav3").click(function(){
$("#slider").stop().animate({left:"-1280px"},1000);
$("#pointer").stop().animate({top:"373px"},1000);
});



//this function uses the  'rel' attribute of the gallery navigation buttons to move the div that contains the gallery sections
$(".gal_button").click(function(){
	
var x = $(this).attr('rel');  				//the contents of the 'rel' attribute
var this_href = $(this).attr('href');			//the contents of the 'href' attribute
var current_gal = $("#gal_forward").attr('class');	//the current gallery beign shown based on the 'class' attribute of the forward button
var cg_pos = $(current_gal).position().left;//the x position of the current gallery

var gal_con = $("#gallery_viewer").width();
var target_width = $(this_href).width();
var num_pages = Math.ceil(target_width / gal_con);


if (cg_pos == 0){					//IF the position of the current gallery is 0 
	//alert(num_pages);
$("#gallery_slide").stop().animate({top:(x)});		//slide to the next gallery	
$("#gal_forward, #gal_backward").removeClass();		//remove the current class attribute from #gal_forward and #gal_backward
$("#gal_forward, #gal_backward").addClass(this_href);	//add the new class attribute to #gal_forward and #gal_backward from the 'href' attribute of the current button
$("#gal_page_number").text('1');
$("#gal_page_total").text(num_pages);
}
else{							//IF the position of the current gallery is NOT 0
	//alert(num_pages);
$(".gallery_div").animate({left:"0px" },500,function(){   //return the position of the current gallery div to 0 THEN
$("#gallery_slide").stop().animate({top:(x)});		  //slide to the next gallery
$("#gal_forward, #gal_backward").removeClass();		  //remove the current class attribute from #gal_forward and #gal_backward
$("#gal_forward, #gal_backward").addClass(this_href);	 //add the new class attribute to #gal_forward and #gal_backward from the 'href' attribute of the current button
$("#gal_page_number").text('1');
$("#gal_page_total").text(num_pages);
	});	}					
					   }); 


//GALLERY FORWARD BUTTON
$("#gal_forward").click(function(){
var target = $(this).attr('class'); 		// The class of the link is the name of the div that is being manipulated
var target_width = $(target).width();		//the width of the div
var target_x = $(target).position().left; 	//the position of the div in relation to the edge of its containing div
var gal_con = $("#gallery_viewer").width();	// the width of the containing div
var diff = gal_con - target_width;		//if we subtract the width of the gallery div from the container

var current_page = parseInt($("#gal_page_number").text());
var this_page = current_page+ 1;
if (target_x < diff ){				// if the x-position of gallery div is less than 'diff' do nothing. 
//$(target).animate({left:"0px"});		//this prevents the gallery from going forward forever
return false;

}
else {
$("#gal_page_number").text(this_page);
$("#gal_forward").hide(0);
$("#gal_backward").hide(0);
$("#gal_forward_false").show(0);
$("#gal_backward_false").show(0);
$(target).animate({left:(target_x - gal_con)}, function(){
	$("#gal_forward_false").hide(0);
	$("#gal_backward_false").hide(0);
	$("#gal_forward").show(0);
	$("#gal_backward").show(0);
	
	
});  // if not move the gallery div forward an amount equal to the width of the containing div

}
});

//GALLERY BACKWARD BUTTON

$("#gal_backward").click(function(){
var target = $(this).attr('class');		// The class of the link is the name of the div that is being manipulated
var target_width = $(target).width();		//the width of the div
var target_x = $(target).position().left;	//the position of the div in relation to the edge of its containing div
var gal_con = $("#gallery_viewer").width();	// the width of the containing div
var diff = gal_con - target_width;		//if we subtract the width of the gallery div from the container
var current_page = parseInt($("#gal_page_number").text());
var this_page = current_page- 1;
if (target_x >= 0 ){				// if the x-position of gallery div is greater than or equal to '0' do nothing
return false;					//this prevents the gallery from going backward forever
}
else {
	$("#gal_page_number").text(this_page);
	$("#gal_forward").hide(0);
	$("#gal_backward").hide(0);
	$("#gal_forward_false").show(0);
	$("#gal_backward_false").show(0);
$(target).animate({left:(target_x + gal_con)},function(){
	$("#gal_forward_false").hide(0);
	$("#gal_backward_false").hide(0);
	$("#gal_forward").show(0);
	$("#gal_backward").show(0);
	
}); // if not move the gallery div backward an amount equal to the width of the containing div


}
});

$("#gal_menu_up").click(function(){
var target_height=$("#gallery_menu").height();
var target_y=$("#gallery_menu").position().top;
var gal_view=$("#gallery_menu_container").height();
var diff = gal_view - target_height;
//alert(gal_view);
if (target_y < diff ){	
return false;

}
else {
	$("#gal_menu_up").hide(0);
	$("#gal_menu_down").hide(0);
	$("#gal_menu_up_false").show(0);
	$("#gal_menu_down_false").show(0);
$("#gallery_menu").animate({top:(target_y - gal_view)}, function(){
	$("#gal_menu_up_false").hide(0);
	$("#gal_menu_down_false").hide(0);
	$("#gal_menu_up").show(0);
	$("#gal_menu_down").show(0);												 
																 });
}
});


$("#gal_menu_down").click(function(){
var target_height=$("#gallery_menu").height();
var target_y=$("#gallery_menu").position().top;
var gal_view=$("#gallery_menu_container").height();
var diff = gal_view - target_height;
//alert(gal_view);
if (target_y >=0 ){	
return false;

}
else {
	$("#gal_menu_up").hide(0);
	$("#gal_menu_down").hide(0);
	$("#gal_menu_up_false").show(0);
	$("#gal_menu_down_false").show(0);
$("#gallery_menu").animate({top:(target_y + gal_view)},function(){
		$("#gal_menu_up_false").hide(0);
	$("#gal_menu_down_false").hide(0);
	$("#gal_menu_up").show(0);
	$("#gal_menu_down").show(0);														
																});
}
});


/*-----------------------------------------------------------INFO CONTROLS*/

$("#info_fastforward").click(function(){
var slider= $("#info_slider").width();
var reposition = 0 - slider + 520;
	$("#info_nav").hide(0);
	$("#info_nav_false").show(0);
$("#info_slider").animate({left:(reposition)},1500,function(){
	$("#info_nav_false").hide(0);
	$("#info_nav").show(0);
	
});
});

$("#info_start").click(function(){
	$("#info_nav").hide(0);
	$("#info_nav_false").show(0);
$("#info_slider").animate({left:"0px"},1500, function(){
	$("#info_nav_false").hide(0);
	$("#info_nav").show(0);
	
});
});



$("#info_forward").click(function(){
$("#info_nav").hide(0);
$("#info_nav_false").show(0);
var target_x = $("#info_slider").position().left;
//var slider= 2440;
var slider= $("#info_slider").width();
var reposition = 0 - slider + 520;
var slide = target_x - 320;

if (target_x <= reposition){  
$("#info_nav_false").hide(0);
$("#info_nav").show(0);

return_false;
}
else{

$("#info_slider").stop().animate({left:(slide)},function(){
$("#info_nav_false").hide(0);
$("#info_nav").show(0);
});
}
});

$("#info_backward").click(function(){
$("#info_nav").hide(0);
$("#info_nav_false").show(0);
var target_x = $("#info_slider").position().left;
var slider= $("#info_slider").width();
var reposition = 0 - slider + 520;
var slide = target_x + 320;

if (target_x >= 0){
$("#info_nav_false").hide(0);
$("#info_nav").show(0);

return_false;
}
else{

$("#info_slider").animate({left:(slide)}, function(){
$("#info_nav_false").hide(0);
$("#info_nav").show(0);
});
}
});




}); //END OF DOCUMENT 




	
	

		$(document).ready(function(){
		    base_url = document.location.href.substring(0, document.location.href.indexOf('index.html'), 0);
		    
			$(".lightbox").lightbox({
			    fitToScreen: true,
			    imageClickClose: false
		    });
			
			$(".lightbox-2").lightbox({
			    fitToScreen: true
		    });
			
			$(".lightbox-json").lightbox({
			    fitToScreen: true,
			    jsonData: new Array(
			        {url: base_url + 'images/lightbox/blank.gif', title: 'Image 1 loaded using JSON data' },
			        {url: base_url + 'images/lightbox/blank.gif', title: 'Image 2 loaded using JSON data' },
			        {url: base_url + 'images/lightbox/blank.gif', title: 'Image 3 loaded using JSON data' },
			        {url: base_url + 'images/lightbox/blank.gif', title: 'Image 4 loaded using JSON data' }
		        ),
		        loopImages: true,
		        imageClickClose: false,
		        disableNavbarLinks: true
		    });
		    
		    
		});

	



	


