/* 
Methods for resizing the flash stage at runtime.

setFlashWidth(divid, newW)
divid: id of the div containing the flash movie.
newW: new width for flash movie

setFlashWidth(divid, newH)
divid: id of the div containing the flash movie.
newH: new height for flash movie

setFlashSize(divid, newW, newH)
divid: id of the div containing the flash movie.
newW: new width for flash movie
newH: new height for flash movie

canResizeFlash()
returns true if browser supports resizing flash, false if not. 
*/
var movingHeight;
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW;
}
function setFlashHeight(divid, newH){
	document.getElementById(divid).style.height = newH; //rem to add 'px'
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}

function tryPlayFlash()
{
	var winW = 980, winH = 650;
	var stageSize=650;//document.zooconsultancy.GetVariable("_root.screenSize");
	var stageWidth=980;//document.zooconsultancy.GetVariable("_root.screenWidth");

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}

if (winH>stageSize) {
	setFlashHeight('flashid','100%');
} else if (winH<stageSize) {
	setFlashHeight('flashid',stageSize+'px');
}
if (winW>stageWidth) {
	setFlashWidth('flashid','100%');
//	document.indexCnt.SetVariable("bgX",(950-winW)/2);
} else if (winW<stageWidth) {
	setFlashWidth('flashid',stageWidth+'px');
}
//document.indexCnt.SetVariable("myValue",winH);
//movingHeight=winH;
/*if (winH>600) {
	document.getElementById('flashid').style.height=100%;
} else if (winH<600) {
	document.getElementById('flashid').style.height=600px;
}*/
	/*
	if (document.indexCnt)
	{
			document.indexCnt.TPlay("_level0/forResizing");
	}
	else
		alert('Can\'t find the Flash movie')*/
}
var newwin;

function launchwin()
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin=window.open('winelist.php' , 'newwindow' , 'height=700,width=980,resizable=yes,scrollbars=yes');
//	newwin = window.open(winurl,winname,winfeatures);
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}