// JavaScript Document
$(document).ready(function(){
		$("#superWrapper").pngfix();
		$("#headerWrapper").pngfix();
		$("#logo").pngfix();
		$("#tagline").pngfix();
		$("#pageWrapper").pngfix();
		$("#navWrapper").pngfix();
		
		
   // Preload all rollovers
		$("#navWrapper img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"Over.png");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("#navWrapper img").mouseover(function(){
			imgsrc = $(this).attr("src");
			matches = imgsrc.match(/Over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"Over.png"); // strip off extension
			$(this).attr("src", imgsrcON);
			}
			
		});
		$("#navWrapper img").mouseout(function(){
			$(this).attr("src", imgsrc);
		});


		
		
		$(".gallerySet > a > img").hover( function() {
				$(this).addClass("hover");
			}, function() {
				$(this).removeClass("hover");
		});
		
		$("#galleryWrapper > .galleryThumb > img").hover( function() {
				$(this).addClass("hover");
				$(this).css({"cursor":"pointer"});
			}, function() {
				$(this).removeClass("hover");
		});
		
		$("#galleryWrapper > .galleryThumb > img").click( function() {
			rel = $(this).attr("rel");
			$(this).css({"cursor":"pointer"});
			$("div#pageWrapper > .photoLarge[rel = '"+rel+"']").show();
			$("div#pageWrapper > .photoLarge[rel != '"+rel+"']").hide();
		});
		
		
		$(".photoLarge > .closeWrap").hover( function() {
				$(this).addClass("hover");
				$(this).css({"cursor":"pointer"});
			}, function() {
				
		});
		
		
		$(".photoLarge > .closeWrap").click( function() {
			$(this).css({"cursor":"pointer"});
			$(this).parent(".photoLarge").hide();
		});
		

//$(function() {
		 $('#rotate').cycle();
		 $('#photo').cycle();
		// $('#youTubeVideo').cycle();
	//});

	

		
	});
