function mo(o) {o.className=='stateoff'?o.className='stateon': o.className=o.className; return false}
function mx(o) {o.className=='stateon'?o.className='stateoff': o.className=o.className; return false}

function GetElementById(s)
{
	o=(document.getElementById?document.getElementById(s):document.all[s])
	return o==null?false:o
}

function NavTo(sURL)
{
	window.location.href=sURL+".aspx";return false
}

function OpenTo(sURL)
{
	OpenWin(sURL, 800, 800, "yes", "yes", true, true);return false
}

function mailto(domain,user)
{
	 document.write("<a href='mailto:"+user+"@"+domain+"'>"+user+"@"+domain+"<\/a>")
}

var g_objOpenedWindow
function OpenWin(sURL, wdh, hgt, scroll, resize, center, toolbar)
{
	if(hgt>=screen.availHeight-26)hgt=screen.availHeight-26
	y=0;x=(screen.width-wdh-10)	
	if(center){x/=2;y=(screen.availHeight-26-hgt)/2}
	if(g_objOpenedWindow!=null && !g_objOpenedWindow.closed) g_objOpenedWindow.close()
	g_objOpenedWindow = window.open(sURL.replace('/\s/g', "+"), "_blank", "width="+wdh+",height="+hgt+",top="+y+",left="+x+","+(toolbar?"toolbar=yes,menubar=yes,status=yes,location=yes":"toolbar=no,menubar=no,status=no,location=no")+",scrollbars="+scroll+",resizable="+resize)
	g_objOpenedWindow.focus()
	return g_objOpenedWindow
}

var g_PrevStatus=''
function AsLog()
{
	window.focus()
	if (window.status && window.status!=g_PrevStatus) new Image().src='/Ebay/AsLog.ashx?Url='+escape(window.location.pathname.replace("/", ""))+'&AsUrl='+escape(window.status.substring(6))
	g_PrevStatus=window.status
}

function InitAsTrack()
{
	oElmts=document.getElementsByTagName("iframe")
	for (i=0; oElmts!=null && i<oElmts.length; i++)
	{
		if (oElmts[i].src.indexOf('googlesyndication.com')>-1)
		{
			if (document.layers) oElmts[i].captureEvents(Events.ONFOCUS)
			oElmts[i].onfocus=AsLog
			break
		}
	}
}


function SetCookie(sName, vValue)
{
	argv=SetCookie.arguments,argc=SetCookie.arguments.length
	sExpDate=(argc>2)?";expires="+argv[2].toGMTString():""
	sPath=(argc>3)?";path="+argv[3]:""
	sDomain=(argc>4)?";domain="+argv[4]:""
	sSecure=(argc>5)&&argv[5]?";secure":""
	document.cookie=sName+"="+escape(vValue,0)+sExpDate+sPath+sDomain+sSecure+";"
}

function DeleteCookie(sName)
{
	document.cookie=sName+"="+GetCookie(sName)+";expires="+(newDate()).toGMTString()+";"
}

function GetCookie(sCookieName)
{
	sName=sCookieName+"=",ichSt,ichEnd
	sCookie=document.cookie
	if (sCookie.length&&(-1!=(ichSt=sCookie.indexOf(sName))))
	{
		if (-1==(ichEnd=sCookie.indexOf(";",ichSt+sName.length)))ichEnd=sCookie.length
		return unescape(sCookie.substring(ichSt+sName.length,ichEnd))
	}
	return null
}

function OnKeyDown()
{
	if (window.navigator.userAgent.indexOf("MSIE")>=1)
	{
		oSource=window.event.srcElement
		if(oSource.tagName.toLowerCase()=="textarea")return
		if(window.event.keyCode==13)window.event.keyCode=9
	}
}
