$(document).ready(function(){
	

	/*************************************************************
						BROWSER CHECK	
	/************************************************************/
	
	var ie6 = $.browser_detect('ie',6);
	
	//	 set styles for different browsers

	/*************************************************************
							NEW WINDOW	
	/************************************************************/
	
	//	Open new window on clicking link
	$.new_window();
	
	/*************************************************************
							SCROLL TO TOP	
	/************************************************************/
	
	$('#to_top').click(
					   
				function(){
						to_top('#container');
						return false;
	});
	
	
	/*************************************************************
							INSERT EMAIL	
	/************************************************************/
	// Insert email to protect against spam botties !!!	
	var emailE = ("'.MAIL_EMAIL1.'" + "'.MAIL_EMAIL2.'");
	
	if($("span.insert_email").length>0)
	{
		$("span.insert_email").html("<a href=\'mailto:" + emailE + "\'>" + emailE + "</a>");
	}
	if($("span.insert_email_void").length>0)
	{
		$("span.insert_email_void").html("<a href=\'mailto:" + emailE + "\'></a>");
	}
	
	/*************************************************************
						RETURN TO HOME PAGE	
	/************************************************************/
	
	//	Create header link back to home page
	$('header').css({cursor:'pointer'}).click(function(){location.href = 'http://madebyb.com/dev';});
	
	
	/*************************************************************
								TOOLTIP	
	/************************************************************/
	
	// Add opacity property not validating in CSS2.1
	if($('.tooltip').length!=0){
		
		$('#tooltip').css({opacity: 0.85});
	
		// Insert email for tooltip
		$('a.tooltip_email').attr({title:' - '+emailE });
		
		// Tooltip
		$('.tooltip').tooltip({ 
							  
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - ", 
		fade: 250 
		
		});
	}


	/*************************************************************
							NAV BUTTON FADE EFFECT	
	/************************************************************/
	
	// Not IE6
	if(!ie6)
	{
		$('#nav_1 li.nav_links a').blend(300);
	}


	
	$("ul li ul li:last-child").each(function(index) { $(this).addClass("last-item"); });
	
	/*************************************************************
							COLORBOX
	/************************************************************/
	if($('a.colorbox').length>0)
	{
		$('a.colorbox').colorbox({speed:1000, initialHeight:100, initialWidth:100, opacity:0.7});
	}
	
	
	/*************************************************************
							MASK SLIDE
	/************************************************************/
	// Slide info panel up IF PRESENT
	if($('#portfolio_cards li').length>0)
	{
		$('#portfolio_cards li').not('#portfolio_cards ul.portfolio_cards_square li').prepend('<div class="carousel_mask">Click image to view designs</div>');
		$('div.carousel_mask').css({'opacity':.8});
		//$('div.carousel_mask').hide();
		$('#portfolio_cards li').hover(function(){//alert('show');
											  $(this).find('div.carousel_mask').stop().animate({
																						top: '0px'
																						},
																						1000);
											  },
									 function(){
											  $(this).find('div.carousel_mask').stop().animate({
																						top: '-46px'
																						},
																						1000);}
									);
		
		$('#portfolio_cards ul.portfolio_cards_square li').prepend('<div class="carousel_mask_small">Click image to view design</div>');
		$('div.carousel_mask_small').css({'opacity':.8});
		$('#portfolio_cards ul.portfolio_cards_square li').hover(function(){//alert('show');
											  $(this).find('div.carousel_mask_small').stop().animate({
																						top: '0px'
																						},
																						1000);
											  },
									 function(){
											  $(this).find('div.carousel_mask_small').stop().animate({
																						top: '-46px'
																						},
																						1000);}
									);
	}
	

						   
});
