function getexpirydate(nodays) {
	var UTCstring;
	Today = new Date();
	nomilli = Date.parse(Today);
	Today.setTime(nomilli + nodays * 24 * 60 * 60 * 1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function setcookie(name, value, duration, domain) {
	cookiestring = name + "=" + escape(value) + ";expires=" + getexpirydate(duration);
	if (domain != ""){
		cookiestring = cookiestring + ";domain=" + domain;
	}
	document.cookie = cookiestring;
}

$(window).load( function() {
	if ($("html").width() < 1100) {
		$("html").css("overflow-x", "hidden");
	}
	// $('#loginwindow').jqm({ajax:
	// '<?e($html->url('/users/login/'.$this->params['url']['url'])) ?>',
	// trigger: 'a.logintrigger'});
		var h1 = 0;
		var h2 = 0;
		var bcount1 = 0;
		var bcount2 = 0;
		$("#rightcol-193 div.box").each( function(i) {
			h1 = h1 + $(this).height();
			bcount1++;
		});
		$("#rightcol-204 div.box").each( function(i) {
			h2 = h2 + $(this).height();
			bcount2++;
		});
		if (h1 > h2) {
			$("#rightcol-204 div.box:last div.inner").css(
					{
						height :$("#rightcol-204 div.box:last div.inner")
								.height()
								+ (h1 - h2) + (5 * (bcount1 - bcount2))
					})
		}
		if (h2 > h1) {
			$("#rightcol-193 div.box:last div.inner").css(
					{
						height :$("#rightcol-193 div.box:last div.inner")
								.height()
								+ (h2 - h1) - (5 * (bcount1 - bcount2))
					})
		}
		scaleBoxes();
/*
		$('#topsticker').css({
			backgroundImage:"url(/downloads/NYGAFFAsne_til_web.png)",
			height:"192px",
			left:"770px",
			top:"55px",
			width:"263px"
		})
*/
	});

$(window).resize( function() {
	$("html").css("overflow-x", "hidden");
	if ($("html").width() > 1000) {
		$("html").css("overflow-x", "hidden");
	} else {
		$("html").css("overflow-x", "auto");
	}
});

function scaleBoxes() {
	heights = new Array();
	$("#sectionboxes-wrapper .sectionbox .inner").each( function(i) {
		heights[heights.length] = $(this).height();
	});
	$("#fpsecbox1 .inner").height(Math.max(heights[0], heights[1]));
	$("#fpsecbox2 .inner").height(Math.max(heights[0], heights[1]));
	$("#fpsecbox3 .inner").height(Math.max(heights[2], heights[3]));
	$("#fpsecbox4 .inner").height(Math.max(heights[2], heights[3]));
}
