/*headshots redirect messgae */
$(document).ready(function(){
	$('#menu-item-64 a').click(function(){
		$('#headshotAlert').fadeIn(function(){
			var t = setTimeout(function(){
				window.location = "http://www.headshotsbylukevarley.com/";
			},1500);
		});
		return false;
	});
});
/* menu dropdown */
$(document).ready(function(){
	$('#menu ul>li>ul').hide();
	$('#menu .current_page_parent ul, #menu .client_area ul').show();
	$('#menu li').has('ul').find('>a').addClass('parent');
	$('#menu>ul>li').has('ul').find('>a').toggle(
		function(){
				$(this).siblings('ul').show('fast');
				return false;
		},
		function(){
				$(this).siblings('ul').hide('fast');
				return false;
		}
	);
});
/* landing image resize */
$(document).ready(function(){
function imageresize(){
		var imgratio = imgwidth/imgheight;
		var brwidth = $('#landingimage').width();
		var brheight = $('#landingimage').height();
		if(brwidth/brheight > imgratio){
			$('#landingimage img').css('width','100%');
			$('#landingimage img').css('height','auto');
		}else{
			$('#landingimage img').css('width','auto');
			$('#landingimage img').css('height','100%');		
		}
}
	imageresize();
	$(window).bind('resize',imageresize);
});
/* hide menu */
$(document).ready(function(){
	$('#menuhide').show();
	$('#menuhide').toggle(
		function(){
			$('#menu>ul').animate({left:'-500px'},1000,function(){$('#menu>ul').hide('slow');});
			$('#menu').animate({opacity:0.5},1000);
			$(this).html('MENU <span id="arrow">&#9658;</span>');
			$('#menu').hover(
			function(){
				$('#menu').css('opacity','1');
			},function(){
				$('#menu').css('opacity','0.5');
			});
			$('#homelink').click(function(){
				$('#menuhide').trigger('click');
				return false;
			});
		},function(){
			$('#menu>ul').show('slow');
			$('#menu>ul').animate({left:'0'},1000);
			$('#menu').animate({opacity:1},1000);
			$(this).html('HIDE <span id="arrow">&#9668;</span>');
			$('#menu').unbind('mouseenter mouseleave');
			$('#homelink').unbind('click');
		}	
	);
});
/* hide menu & scroll indicator when we scroll beyond 300px */
$(document).ready(function(){
	$(window).scroll(function(){
		hidecheck = $('#menu>ul').css('display');
		var leftoffset = $(window).scrollLeft();
		if(leftoffset>300 && (hidecheck=='block')){
				$('#scrollindicator').fadeOut();
				$('#scrollleft').fadeIn();
				$('#menuhide').trigger('click');
				$(window).unbind('scroll');
		}
	});
});
