// JavaScript Document
	//functions for interval delay
	function hoverShow() {
		$('#workMenuTip:visible').slideUpFade(500);
		this.tip = $(this).next().text();  //Select text of hidden link span
		$('#workMenuTip span').text(this.tip); //Assign text to details
		$('#workMenuTip').slideDownFade(500);
		};
	function hoverHide() {
		$('#workMenuTip').slideUpFade(500);
		}; 
	
	jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
		return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);  
	};
	jQuery.fn.fadeToggle = function(speed, easing, callback) {
  return this.animate({opacity: 'toggle'}, speed, easing, callback);  
	};
	jQuery.fn.slideDownFade = function(speed, easing) {
		return this.animate({opacity:'.9', height: 'show'}, speed, easing);	
	};
	jQuery.fn.slideUpFade = function(speed, easing) {
		return this.animate({opacity:'0', height: 'hide'}, speed, easing);		
	};
	
$(document).ready(function() {
	// Turn off current link
	var noClick = '.pgCurrent a, .portfolio li#portfolio a, .bio li#bio a';
	$(noClick).click(function() {
			return false;														 
	});	
	
	// create a fade/slide toggle switch

	// hide dynamic elements
	$('.caseDetailWrap, #workMenuTip, .detailWrap:not(:first)').hide(); //:not(:first) hides all but the first element
	
	// Show Case Details
	$('.caseDetails').click(function(){
		$(this).toggleClass('collapse');
		$(this).next().slideFadeToggle(500);
		return false;
	});

	//Lightbox - a separate one for each gallery so they do not become grouped
	$(function() {
        $('#gallery1 a').lightBox();
				$('#gallery2 a').lightBox();
				$('#gallery3 a').lightBox();
				$('#gallery4 a').lightBox();
				$('#gallery5 a').lightBox();
				$('#gallery6 a').lightBox();
				$('#gallery7 a').lightBox();
    });
	
	//Tooltip
	$('.processWorkflow tbody td span').hover(
    function() {
		$(this).addClass('spanHover', 'slow');
  	},
    function() {
		$(this).removeClass('spanHover', 'slow');	
	});	
	
	$('.processWorkflow tbody td span').tooltip({
			delay:100,
			fade:300,
			showURL:false,
			opacity:.95,
			left:15,
			top:15,
			showBody:'-'
		});


//WorkMenu ToolTip (delay)
	var config = {    
			 sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
			 interval: 200, // number = milliseconds for onMouseOver polling interval    
			 over: hoverShow, // function = onMouseOver callback (REQUIRED)    
			 timeout: 100, // number = milliseconds delay before onMouseOut    
			 out: hoverHide // function = onMouseOut callback (REQUIRED)    
	};

//WorkMenu Tooltip
	$('.workMenu li a img').hoverIntent(config);
		

//Case Detail Panel
	$('.workMenu li a').click(function(){
		var tarID = $(this).attr("href");
		$('.detailWrap:visible').hide();
		$("div#" + tarID).show();
		return false;
	});
	
	//HOMEPAGE BANNER
	$('.homeBanner ul li a').each(function(){
		$(this).hover(function(){
			$(this).animate({width:'325px'}, {queue:false, duration:450});
      },function() {
		  $(this).animate({width:'120px'}, {queue:false, duration:450});
	  	});
    });
	
	//End functions
});
