var now = new Date();

function Obj(sID) 
{
	return document.getElementById(sID);
}

function Go(sURL)
{
	this.location.href = sURL;
}

function Hide(sID) 
{
	Obj(sID).style.display = "none";
}

function Show(sID, sType) 
{
	Obj(sID).style.display = sType;
}

function Move(sID, iTop, iLeft)
{
	Obj(sID).style.top = iTop + "px";
	Obj(sID).style.left = iLeft + "px";
}

function Resize(sID, iWidth, iHeight)
{
	if ( iWidth > 0 )
	{
		Obj(sID).style.width = iWidth + "px";
	}
	
	if ( iHeight > 0 )
	{
		Obj(sID).style.height = iHeight + "px";
	}
}

function ChangeZIndex(sID, z)
{
	Obj(sID).style.zIndex = z;
}

function ChangeImage(sID, sSrc)
{
	document.images[sID].src = sSrc;
}

function ChangeClass(sID, sClass)
{	
	Obj(sID).setAttribute("class", sClass);
	Obj(sID).setAttribute("className", sClass); // IE 6.0
}

function ChangeAttribute(sID, sAttribute, sValue)
{
	Obj(sID).setAttribute(sAttribute, sValue);
}

function OpenPopup(sURL, iWidth, iHeight)
{
	var popup = window.open(sURL, null,"location=0, status=0, scrollbars=0, width=" + iWidth + ", height=" + iHeight);
	popup.focus();	
}

function GetRandomNumber(iLower, iUpper)
{
	return Math.floor((Math.random() * iUpper) + iLower);
}

function GetWindowHeight()
{
	var i = 0;
	if ( typeof( window.innerHeight ) == "number" ) 
	{
		i = window.innerHeight;
	} 
	else if ( document.documentElement && document.documentElement.clientHeight ) 
	{
		i = document.documentElement.clientHeight;
	} 
	else if ( document.body && document.body.clientHeight  ) 
	{
		i = document.body.clientHeight;
	}
	return i;
}

function GetWindowWidth()
{
	var i = 0;
	if ( typeof( window.innerWidth ) == "number" ) 
	{
		i = window.innerWidth;
	} 
	else if ( document.documentElement && document.documentElement.clientWidth ) 
	{
		i = document.documentElement.clientWidth;
	} 
	else if ( document.body && document.body.clientWidth ) 
	{
		i = document.body.clientWidth;
	}
	return i;
}

//function GetObjectHeight(sID)
//{
//	return Obj(sID).offsetHeight;
//}

function GetObjectWidth(sID)
{
	return Obj(sID).offsetWidth;
}

function CreateCookie(name, value, days) 
{
	if (days) 
	{
		var date = new Date();
		date.setTime(date.getTime() + (days*24*60*60*1000));
		var expires = "; expires=" + date.toGMTString();
	}
	else var expires = "";
	document.cookie = name + "=" + value + expires + "; path=/";
}

function ReadCookie(name) 
{
	var nameEQ = name + "=";
	var namevaluepairs = document.cookie.split(';');
	for(var i = 0; i < namevaluepairs.length; i++) 
	{
		var value = namevaluepairs[i];
		while (value.charAt(0)==' ') 
		{
			value = value.substring(1, value.length);
		}
		if (value.indexOf(nameEQ) == 0) 
		{
			return value.substring(nameEQ.length, value.length);
		}
	}
	return null;
}

function DeleteCookie(name) 
{
	createCookie(name, "", -1);
}

