jQuery(document).ready(function($){
	
	/*=== Home menu function ===*/
	
	$('#sidebar .nav ul li a.case').addClass('active');
	
	$('#sidebar .nav ul li a').mouseover(function(){
		var navname = $(this).attr('id');
		$(this).addClass('active');
		$(this).parent('li').siblings('li').children('a').removeClass('active');
		$('#content-wrap img.head').attr('src','/about/images/site/home-' + navname + '.jpg');
	});
	
	
	/*=== Home menu function ===*/
	
	$('#content-wrap #video02').css("position","absolute").css("left","-10000px").css("top","-10000px");
	
	$('#content-wrap #video01 a.last ').click(function(){
		$('#content-wrap #video02').css("position","static").css("left","auto").css("top","auto");
		$('#content-wrap #video01').css("position","absolute").css("left","-10000px").css("top","-10000px");
	});
	
	$('#content-wrap #video02 a.first').click(function(){
		$('#content-wrap #video01').css("position","static").css("left","auto").css("top","auto");
		$('#content-wrap #video02').css("position","absolute").css("left","-10000px").css("top","-10000px");
	});
	
	$('#content-wrap .videobox a').mouseover(function() {
		var alttext = $(this).children("img").attr("alt");
		var nametext = $(this).children("img").attr("name");
		$(this).siblings("div.wrap").children("span").text(nametext);
		$(this).siblings("div.wrap").children("h3").text(alttext);
	});
	$('#content-wrap .videobox a').mouseout(function() {
		var alttext = $(this).siblings("img").attr("alt");
		var nametext = $(this).siblings("img").attr("name");
		$(this).siblings("div.wrap").children("span").text(nametext);
		$(this).siblings("div.wrap").children("h3").text(alttext);
	});
	
	
});



jQuery(window).ready(function($){
	
	/*=== Image container resize function, runs after images are loaded in the browser ===*/
	
	setTimeout(function(){
		$('.image img').each( function(i){
			var wide = $(this).width();
			$(this).parent('div').width(wide);
		})	
	}, 150)
	
});	
