$(document).ready(function(){
	$("ul#primarynav ul li").hover(function () {
		var depth = 0;
		var _this = $(this);
		while(!$(_this).is("div")){
			_this = $(_this).parent().parent();
			depth++;
		}
		
		if(depth <= 3) {
			$("ul", this).height($(this).parent().height());
		}
	
		if(depth == 3) {
			var lvl4 = $(this).parent().height()-195;
			$("ul", this).height(lvl4);
		}
	});

	$(".btn").click(function(){
		window.location=$(this).find("a").attr("href"); return false;
		});
		
	$(".click").click(function(){
		window.location=$(this).find("a").attr("href"); return false;
		});

	$("ul#topnav.dropdown li a").mouseover(function() {
	  $(".subnav").hide();
	});
	/*
	$("#navwebsites").mouseover(function() {
	  	$("#subwebsites").show();
	});
	*/

	$("#navlanguage").mouseover(function() {
		var position = $('#navlanguage').position();
		$("#sublanguages").css({left: position.left-15});					 
	  	$("#sublanguages").show();
	});
	
	$(".subnav").mouseleave(function() {
	  $(".subnav").hide();
	});
	
	//$(".gallery a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_rounded'});
	//Cufon.replace('h1,h2,h3,h4,h5,h6,.btn a', {hover: true});
	//$(".surveybox_de").prettyPhoto({animationSpeed:'fast',theme:'light_rounded',hideflash:true,opacity: 0.40});
	//$(".surveybox_en").prettyPhoto({animationSpeed:'fast',theme:'light_rounded',hideflash:true,opacity: 0.40});
});

function setCookieVal(name,val) {
	$.cookie(name,val,{ path: '/',expires: 365 });
}
