/* --------------------------------------------------------
 * MMG-CRM - developed for Tabcorp
 * Tabaret Membership Program
 * Copyright (C) 2004-2006 MMG interactive
 * 
 * MMG interactive versioning:
 * ---------------
 * $Revision: 2403 $
 * $Author: Mark $
 * $Date: 2007-03-02 16:50:38 +1100 (Fri, 02 Mar 2007) $ 
 * 
 * Tabcorp versioning:
 * -------------------
 * $Tag1$
 * $Tag2$
 * $Tag3$
 * --------------------------------------------------------
 */

function PopupPic(sPicURL) {
	window.open("PopUpImage.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}
 
function setPageSize() {
	var winHeight = document.body.clientHeight;
	var pgHeight = readStyle(document.getElementById("pageHolder"),'height');
	if(pgHeight.indexOf("px")) {
		var thePageHeight = Math.round(pgHeight.substring(0,pgHeight.indexOf('px')));
	} else {
		var thePageHeight = pgHeight;
	}
	if(thePageHeight + 30 < winHeight) {
		document.getElementById("pageHolder").style.height=winHeight-30;
	}
}

function dynamicPageSize() {
	var winHeight = document.body.clientHeight;
	var pgHeight = readStyle(document.getElementById("pageHolder"),'height');
	var newHeight = readStyle(document.getElementById("channelContent"),'height');
	var disHeight = readStyle(document.getElementById("disclaimerFooter"),'height');
	if(pgHeight.indexOf("px")) {
		var thePageHeight = Math.round(pgHeight.substring(0,pgHeight.indexOf('px')));
	} else {
		var thePageHeight = pgHeight;
	}
	if(newHeight.indexOf("px")) {
		var theNewHeight = Math.round(newHeight.substring(0,newHeight.indexOf('px')));
	} else {
		var theNewHeight = newHeight;
	}
	if(disHeight.indexOf("px")) {
		var theDisHeight = Math.round(disHeight.substring(0,disHeight.indexOf('px')));
	} else {
		var theDisHeight = disHeight;
	}
	if(thePageHeight + 30 < winHeight) {
		document.getElementById("pageHolder").style.height=winHeight-30;
	}
	//alert(theDisHeight);
	document.getElementById("pageHolder").style.height=theNewHeight + 340 + theDisHeight;
	setPageSize();
}

function readStyle(element, property) {
	if (element.style[property]) {
		return element.style[property]
	} else if (element.currentStyle) {
		return element.currentStyle[property]
	} else if (document.defaultView && document.defaultView.getComputedStyle) {
		var style = document.defaultView.getComputedStyle(element, null)
		return style.getPropertyValue(property)
	} else {
		return null
	}
}


var g_popup;
function GamespopupLink(strURL, nWidth, nHeight)	{
	g_popup = window.open(strURL, '', 'width=' + nWidth + ',height=' + nHeight + ',scrollbars=0');
//	win.creator = self;
}

function launchPreview(strUrl) {
	prevWin = window.open(strUrl, 'winPreview', 'height=150 width=350 scrollbars=yes menubar=no toolbar=no resizable=no');
	prevWin.focus();
}