var webtv = {};

webtv.showOverlay = function() {
	if (webtv.overlay == undefined) {
		webtv.overlay = document.getElementById('overlay');
	}
	
	var width, height;
	if (window.innerHeight && window.scrollMaxY) {	
		width = window.innerWidth + window.scrollMaxX;
		height = window.innerHeight + window.scrollMaxY;
		if (document.body.scrollWidth) {
			width -= (width-document.body.scrollWidth);
		}
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight) {
		width = document.body.scrollWidth;
		height = document.body.scrollHeight;
	} 
	else {
		width = document.body.offsetWidth;
		height = document.body.offsetHeight;
	}	
	
	webtv.overlay.style.width = width + 'px';
	webtv.overlay.style.height = height + 'px';
	webtv.overlay.style.display = 'block';
	if ($('#silverlightControlHost').length) {
		$('#silverlightControlHost').css('visibility', 'hidden');
		$('#silverlightControlHost object').get(0).Content.Page.Pause();
	}
};
webtv.hideOverlay = function() {
	if (webtv.overlay == undefined) {
		webtv.overlay = document.getElementById('overlay');
	}
	webtv.overlay.style.display = 'none';
	$('#silverlightControlHost').css('visibility', 'visible');
};
webtv.showLogin = function(url) {
	if (url != undefined) {
		$('#loginoverlay input[name=next]').val(url);
	}
	webtv.showOverlay();
	$('#loginoverlay').show();
};
webtv.hideLogin = function() {
	webtv.hideOverlay();
	$('#loginoverlay').hide();
};

