//$(document).ready(function() {
//	$('#blurb').fadeTo(5, 0);
//	$('#showcase').hover(
//	function() {$('#blurb').fadeTo('normal', 1);},
//	function() {$('#blurb').fadeTo('normal', 0);}
//	);
//});



//services drop down menu
//$(document).ready(function(){
	
	// COOKIES to remeber sub menu state

//	var menu = $.cookie('menu');
//	var submenu = $("#services-menu");
//	var services = $("a.services");

//	if (menu == 'collapsed') {
//		submenu.hide();
//		services.removeClass("selected");
//	};
	
//	if (menu == 'expanded') {
//		submenu.show();
//		services.addClass("selected");
//	};			   
						   
						   
						   			   
//	$('a.services').click(function(event) {
		
//	 if ($("#services-menu").is(":hidden")) {
 //       $("#services-menu").slideDown("medium");
//	$(this).addClass("selected");
//         $.cookie('menu', 'expanded');
//	return false;
//	} 
//		else {
 //       $("#services-menu").slideUp("medium");
//	$(this).removeClass("selected");
 //       $.cookie('menu', 'collapsed');
//	return false;

 //     }
	//	event.preventDefault();
//		
	  //$("#services-menu").slideToggle("medium");
	  //$(this).toggleClass("selected");
	  //$.cookie('menu', 'expanded');

//	});
	
	
//	$('#close-menu').click(function(){
//	  $("#services-menu").slideToggle("medium");
//	  $('a.services').toggleClass("selected");
//	  $.cookie('menu', 'collapsed');
//	});
	
//});

$(document).ready(function() {
	$('.twit a').hover(function() {
		$('.spk').show();
	 }, function() {
		 $('.spk').hide();
	 });
});



// randomize order of homepage gallery for every page refresh
$(document).ready(function() {
	function randomize(){
		return (Math.round(Math.random())-0.5); 
	} 					   
						   
	var li = $('ul#work').children().get();
	li.sort(randomize);
	
	$('ul#work').append(li);
});



//blurb
//$(document).ready(function() {
//	$bl = $('ul#work li').find('.blurb')
//	$('#gallery').hover(function(event) {
//		$('.navi').stop().fadeTo('normal', 1);
//		$bl.stop().animate({top: '222px'}, {duration:500});
//		}, function() {
//		$('.navi').stop().fadeTo('normal', 0);
//		$bl.stop().animate({top: '400px'}, {duration:500});
//	});
		
//});





$(document).ready(function() {
	$('#gallery').hoverIntent({
		sensitivity: 250,
		over: blurbShow,
		timeout: 500,
		out: blurbHide
	});
}); // close
$(document).ready(function() {
	$('#gallery2').hoverIntent({
		sensitivity: 100,
		over: blurbShow,
		timeout: 400,
		out: blurbHide
	});
}); // close
function blurbShow() { 
	$bl = $(this).find('.blurb');
	$bl.animate({top: '222px'}, {duration:500});
	$('.navi').fadeTo('normal', 0.9);
}
function blurbHide() { 
	$bl = $(this).find('.blurb');
	$bl.animate({top: '400px'}, {duration:500});
	$('.navi').fadeTo('normal', 0);
} 


$(document).ready(function() {
$('.navi').hover(function() {
	$bl.fadeTo('normal', 0.3);}, function() {
	$bl.fadeTo('normal', 0.9);
	});
});



$(document).ready(function() {
	$('ul.client li').hoverIntent({
		sensitivity: 100,
		over: testShow,
		timeout: 400,
		out: testHide
	});
});
$(document).ready(function() {
	$('ul.work li').hoverIntent({
		sensitivity: 100,
		over: testShow2,
		timeout: 400,
		out: testHide2
	});
});
function testShow() { 
	$tl = $(this).find('.t-link');
	$tl.animate({top: '75px'}, {duration:500});
}
function testHide() { 
	$tl = $(this).find('.t-link');
	$tl.animate({top: '130px'}, {duration:500});
}
function testShow2() { 
	$tl = $(this).find('.t-link2');
	$tl.show().animate({top: '70px'}, {duration:400});
}
function testHide2() { 
	$tl = $(this).find('.t-link2');
	$tl.animate({top: '112px'}, {duration:400});
}



//$(document).ready(function() {
//	$('a[href$=.pdf]').addClass('pdflink');
//});


//magnifying glass tooltip
this.magglass = function(){	
	/* CONFIG */		
		xOffset = 30;
		yOffset = 8;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.enlarge").hover(function(e){											  									  
		$("body").append("<div id='magtip'></div>");
		$("#magtip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){	
		$("#magtip").remove();
    });	
	$("a.enlarge").mousemove(function(e){
		$("#magtip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
	magglass();
});





//move link from whole image to inside the blurb div
$(document).ready(function() {
if ($('ul#work li').is('.gallery-item')) {
	$('ul#work li').each(function() {
		var $item = $(this);
		var $pic = $item.find('a.wrap img');
		var $link = $item.find('a.wrap');
		var $para = $item.find('p.moved');
		
		$pic.insertAfter($link);
		$para.prepend($link);
		$link.html('More about this project &gt;');
	})
}
});



//make services sections into 3 columns to scroll - show naigation menu
$(document).ready(function() {
	$('#inner').wrap('<div id="services-sections"></div>');
	$('#serv-nav').show();
	$('.service h3').hide();
});



//highlighting the service title on click
$(document).ready(function() {
	$('#serv-nav').click(function(event) {
		if ($(event.target).is('.serv')) {
			$(event.target).parent().siblings().children().removeClass('selected');
			$(event.target).addClass('selected');
		}
	});
	
});



$(document).ready(function() {
	$('.blurb').addClass('hide');
	$('.t-link2').addClass('hide2');
});

