var overDesc =false;
var set;
$(document).ready(function(){

	//Font replacement
	Cufon.replace('div.desc h3');
	
	//Logo hover
	$("h1 a").hover(
	  function () {
		//$(this).parent().parent().find("div.desc-wrap").slideDown(300);
		$(this).parent().parent().find("div.desc-wrap").show("slide", { direction: "left" }, 300);
	  },
	  function () {
		//$(this).parent().parent().find("div.desc-wrap").slideUp(300);
		//$(this).parent().parent().find("div.desc-wrap").hide("slide", { direction: "right" }, 300);
		//$(this).parent().parent().find("div.desc-wrap").css('display','none');
		var cur = $(this).parent().parent().find("div.desc-wrap");
		set = setTimeout(function(){doIFade(cur)}, 200);
	  }
	);
	
	
	//Products hover
	$("h2 a").hover(
	  function () {
		$("div.desc-wrap").css('display','none');
		$(this).parent().parent().find("div.desc-wrap").stop().removeAttr("style").slideDown(300);
	  },
	  function () {
		//$(this).parent().parent().find("div.desc-wrap").fadeOut(300);
		var cur = $(this).parent().parent().find("div.desc-wrap");
		set = setTimeout(function(){doIFade(cur)}, 200);
	  }
	);
	
	$("div.desc-wrap").mouseenter(function(){
		overDesc = true;
	});
	$("div.desc-wrap").mouseleave(function(){
		overDesc = false;
		$(this).css('display','none');
	});
	
	
	
	//Video popup
	$('a.modal-open').click(function (e) {
		$('#popup').modal({
			opacity: 50,
			containerId: 'simplemodal-video',
			autoResize: true
			
		});

		return false;
	});
});
function doIFade(o) {
	//alert(overDesc);
	if(!overDesc) {
		$(o).css('display', 'none');
	}
	clearInterval(set);
}
