

/**
 * jQuery Delay - A delay function
 * Copyright (c) 2009 Clint Helfers - chelfers(at)gmail(dot)com | http://blindsignals.com
 * Dual licensed under MIT and GPL.
 * Date: 7/01/2009
 * @author Clint Helfers
 * @version 1.0.0
 *
 * http://blindsignals.com/index.php/2009/07/jquery-delay/
 */


$.fn.delay = function( time, name ) {

    return this.queue( ( name || "fx" ), function() {
        var self = this;
        setTimeout(function() { $.dequeue(self); } , time );
    } );

};


// [ Fadeto jQuery ]
$(document).ready(function() {
	
	$(".js").delay(500).fadeIn("slow");
	$(".fadeElement").delay(3500).fadeIn("slow");
	
  });

  // supersized script
		$(function(){
			$.fn.supersized.options = {  
				
				vertical_center: 1,
				slideshow: 0,
				navigation: 0,
				transition: 0, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
				pause_hover: 0,
				slide_counter: 0,
				slide_captions: 0,
				slide_interval: 000  
			};
	        $('#supersize').delay(2900).fadeIn("slow").supersized(); 
	    });


// Rollover script - replace file1.jpg with fileOVR.jpg

$(document).ready(function() {
		
		// Preload all rollovers -- trick courtesy of Atlanta Jones
		$("#linksBox img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollOVR = rollsrc.replace('1', 'OVR');
			newImg = new Image(); // create new image obj
			$(newImg).attr("src", rollOVR); // set new obj's src
		});

		
		// Navigation rollovers
		$("#linksBox img").mouseover(function(){
			imgsrc = $(this).attr("src");
			
			if (typeof(imgsrc) != 'undefined') {
			imgsrcOVR = imgsrc.replace('1', 'OVR');
			$(this).attr("src", imgsrcOVR);
			}
			
		});
		
		// on mouseout
		$("#linksBox img").mouseout(function(){
			if (typeof(imgsrc) != 'undefined') {
			$(this).attr("src", imgsrc);
			}
		});
	
	
		// handy variables
		  // ABOUT
		var $aboutLink = $('#aboutLink');
		var $aboutWrapper = $('#aboutWrapper');
		  // PORTFOLIO
		var $portfolioWrapper = $('#portfolioWrapper');
		var $pLink = $('#portfolioLink');
		var $ptriggerBox = $('#contentBoxPortfolio');
		var $webGallery = $('#webGallery');
		var $photoGallery = $('#photoGallery');
		var $printGallery = $('#printGallery');
		   // CONTACT
		var $contactWrapper = $('#contactWrapper');
		var $contactLink = $('#contactLink');
		
		// spacegallery function
	$(function(){
			$webGallery.spacegallery();
			$photoGallery.spacegallery();
			$printGallery.spacegallery();
		});
		// Portfolio Page
		// "portfolio" link -> "web", "photo", "print" -> spacegallery
	$aboutWrapper.hide();
	$ptriggerBox.hide();
	$webGallery.hide();
	$photoGallery.hide();
	$printGallery.hide();
	$contactWrapper.hide();
	
		$aboutLink.click(function() {
			$ptriggerBox.fadeOut('slow');
			$webGallery.fadeOut('slow');
			$photoGallery.fadeOut('slow');
			$printGallery.fadeOut('slow');
			$contactWrapper.fadeOut('slow');
			$aboutWrapper.slideToggle('slow');
	});
	
		$pLink.click(function() {
			$aboutWrapper.fadeOut('slow');
			$contactWrapper.fadeOut('slow');
			$webGallery.fadeOut('slow');
			$photoGallery.fadeOut('slow');
			$printGallery.fadeOut('slow');
			$ptriggerBox.slideToggle('slow');
	});
				
		$('.activateWeb').click(function() {
			$photoGallery.fadeOut('700');
			$printGallery.fadeOut('700');
			$webGallery.slideToggle('slow');
	});	
		$('.activatePhoto').click(function() {
			$webGallery.hide('700');
			$printGallery.hide('700');
			$photoGallery.slideToggle('slow');
	});
		$('.activatePrint').click(function() {
			$webGallery.hide('700');
			$photoGallery.hide('700');
			$printGallery.slideToggle('slow');
	});
		
	
		$contactLink.click(function() {
			$aboutWrapper.fadeOut('slow');
			$ptriggerBox.fadeOut('slow');
			$webGallery.fadeOut('slow');
			$photoGallery.fadeOut('slow');
			$printGallery.fadeOut('slow');
			$contactWrapper.slideToggle('slow');
	});		
		
		
	
});