function GetWindowWidth()
{
	var width = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{//Non-IE
		width = window.innerWidth;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth
		|| document.documentElement.clientHeight ) ) 
	{//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{//IE 4 compatible
		width = document.body.clientWidth;
	}
	return width;	
}

function GetWindowHeight()
{
	var height = 0;
	if( typeof( window.innerHeight ) == 'number' ) 
	{//Non-IE
		width = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth
		|| document.documentElement.clientHeight ) ) 
	{//IE 6+ in 'standards compliant mode'
		height = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{//IE 4 compatible
		height = document.body.clientHeight;
	}
	return height;	
}

function ResizeW()
{
	var width = GetWindowWidth();
	if ( typeof(maxwidth) != "undefined" )
		if ( width > maxwidth )
			return;
	if( control )
	{
		control.width = width - 20;
	}
	if ( typeof(control2) != "undefined" )
		if( control2 )
		{
			control2.width = width - 20;
		}
}

function ResizeH()
{
	var height = GetWindowHeight();
	if ( typeof(maxheight) != "undefined" )
		if ( height > maxheight )
			return;
	if( control )
	{
		control.height = height - 20;
	}
	if ( typeof(control2) != "undefined" )
		if( control2 )
		{
			control2.height = height - 20;
		}
}

function KeyDownHandler(btn)
{
	if (event.keyCode == 13)
	{
		event.returnValue=false;
		event.cancel = true;
		btn.click();
	}
}

function createCookie(name,value,days)
{
	var expires = "";
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}