function openBingoWindow(link, windowName)
{
	try
	{
		try
		{
			width = window.screen.availWidth;
			height = window.screen.availHeight;
		}
		catch (e)
		{
			width = window.screen.width;
			height = window.screen.height;
		}
		_openWindow(link, 'GameWindow', 'auto', 'auto', width, height, 'no', 'no', 'no', 'yes', 'x', 'no', 'no', windowName);
                window.close();
	}
	catch (exception)
	{
		// do nothing.
	}
}
function openWWWindow(link, windowName, params)
{
	try
	{
		window.open(link, windowName, params);
		window.close();
		//_openWindow(link, 'GameWindow', 'auto', 'auto', width, height, 'no', 'no', 'no', 'yes', 'x', 'no', 'no', windowName);
	}
	catch (exception)
	{
		// do nothing.
	}
}
function openSmallWindow(link, windowName, params)
{

try{
            var dmn= document.domain.substring(document.domain.indexOf(".")+1);
            document.domain = dmn;
        }catch (exception){
            // do nothing.
}

		try
		{
			width = window.screen.availWidth;
			height = window.screen.availHeight;
		}
		catch (e)
		{
			width = window.screen.width;
			height = window.screen.height;
		}
	xpoint=(width/2)-256; //ie +12.+31  firefox +8.+81 window margins
	ypoint=(height/2)-160;
	//alert('open window at coordinates:'+xpoint+' '+ypoint);
	try
	{
		window.open(link, windowName, params+',left='+xpoint+',top='+ypoint);
		//_openWindow(link, 'GameWindow', 'auto', 'auto', width, height, 'no', 'no', 'no', 'yes', 'x', 'no', 'no', windowName);
	}
	catch (exception)
	{
		// do nothing.
	}
}

function openWindowRegDepFlash(link, windowName, params)
{
        try{
            var dmn= document.domain.substring(document.domain.indexOf(".")+1);
            document.domain = dmn;
        }catch (exception){
            // do nothing.
	}
        
	try
		{
			width = window.screen.availWidth;
			height = window.screen.availHeight;
		}
		catch (e)
		{
			width = window.screen.width;
			height = window.screen.height;
		}
	xpoint=(width/2)-356; //ie +12.+31  firefox +8.+81 window margins
	ypoint=(height/2)-330;
	//alert('open window at coordinates:'+xpoint+' '+ypoint);
	try
	{
		window.open(link, windowName, params+',left='+xpoint+',top='+ypoint);
		//_openWindow(link, 'GameWindow', 'auto', 'auto', width, height, 'no', 'no', 'no', 'yes', 'x', 'no', 'no', windowName);
	}
	catch (exception)
	{
		// do nothing.
	}
}


function reportSize()
{
	myWidth = 0, myHeight = 0;
	
	if(typeof( window.innerWidth ) == 'number')
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else
	{
		if(document.documentElement &&
				(document.documentElement.clientWidth ||
					document.documentElement.clientHeight))
		{
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		}
		else
		{
			if(document.body && (document.body.clientWidth || document.body.clientHeight))
			{
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			}
		}
	}
}

function setInnerWidth(w,h)
{
	window.resizeTo(w,h);
	reportSize();
	var oX = w - myWidth;
	var oY = h - myHeight;
	//alert(w+" - "+myWidth+" = "+oX+"  "+h+" - "+myHeight+" = "+oY+"  "+(w+oX)+"  "+(h+oY));
	window.resizeTo( (w+oX) , (h+oY) );
}
function resizeWindow(width, height)
        {
        	window.focus();
			if(width>700){
				if(typeof( window.screenX ) == 'number'){
					//Non-IE
					window.moveBy(-((width-600)/2),0);
					//600 is the small window width. if this changes, this function should be modified
				}else{
					//alert(height+"..."+window.screen.height);
					if(height>(window.screen.height-80)){ 
						//alert("too big "+height);
						height=(window.screen.height-80);
						//alert("changed "+height);
					}
					window.moveBy(-((width-600)/2),-((height-430)/2));
					//600 is the small window width. if this changes, this function should be modified
					//400 is the small window height. if it changes it should be modified here too
				}
			}
			//setInnerWidth(width, height);
			window.resizeTo(width+10, height+40);
			if(window.outerHeight > screen.availHeight)
			{
				var adj = window.outerHeight - screen.availHeight;
				window.resizeTo(window.outerWidth - adj, window.outerHeight - adj);
				window.moveTo(window.screenX, 0);
			}
        }
		
		
		
		
		
		
		
		
