var hovering = false;
var oThat;
$(document).ready(function(){
	$('.headerMenu ul li').bind("mouseenter",function(){
		if ($('ul',this).length > 0)  {
			hovering = true;
			$('ul',this).css('margin-left', '5px');
		} else {
			hovering = false;
		}
	});
	$('.headerMenu ul li').mouseover(function(){
		hovering = true;
		if ($('ul',this).length > 0)  {
			$('ul',this).css('margin-left', '5px');
		}
	});
	$('.headerMenu ul li').bind("mouseleave",function(){
		if ($('ul',this).length > 0)  {
			hovering = false;
			setTimeout('closeNow()',100);
			oThat = $('ul',this);
		}
	});
	$('.headerMenu ul li ul').bind("mouseleave",function(){
			hovering = false;
			setTimeout('closeNow()',300);
			oThat = $('ul',this);
	});
	if(vIE() == 6) {
		var ieW = $(document).width();
		var ieH = $(document).height();
		var nwwidth = ((ieW - 900) / 2)+ 629;
		var nwheight = ieH - 410;
		var plcWidth = nwwidth+"px "+nwheight+"px";
		$('.pageWrapper').css("background", "transparent url('/templates/hotel_gorinchem_new/images/circle.gif') right bottom no-repeat");
		$('.pageWrapper').css("background-position", plcWidth);
	};
	$(window).resize(function(){
	  if(vIE() == 6) {
			var ieW = $(document).width();
			var ieH = $(document).height();
			var nwwidth = ((ieW - 900) / 2)+ 629;
			var nwheight = ieH - 420;
			var plcWidth = nwwidth+"px "+nwheight+"px";
			$('.pageWrapper').css("background-position", plcWidth);
		};
	});
});
function closeNow() {
	if (!hovering) {
		$(oThat).css("margin-left","-9000px");
	}
}
function vIE(){return (navigator.appName=='Microsoft Internet Explorer')?parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]):-1;}
