﻿var oTQ;
function _re(id){
	if(navigator.appName.indexOf("Microsoft")!=-1){
		return window[id];
	}
	else{
		return document[id];
	}
}
function loadTQ(){	
	oTQ=window.setInterval("addStyle(_re('pageImLayer'),50)",150);//window.clearInterval(oTQ);	
}
//modi stage size
function modistage(w){
	switch(w){
		case 30:			
			_re("TQ").width=w;
			_re("TQ").height=151;			
			window.clearInterval(oTQ);
			oTQ=window.setInterval("addStyle(_re('pageImLayer'),50)",150);			
			break;
		case 200:			
			_re("TQ").width=w;
			_re("TQ").height=380;
			window.clearInterval(oTQ);
			oTQ=window.setInterval("addStyle(_re('pageImLayer'),220)",150);					
			break;			
	}
	
}
function addStyle(o,w){
	if(o){
		with(o.style){
			display="block";
			position="absolute";
			zIndex=20;
			left=document.body.offsetWidth+document.body.scrollLeft-w;
			top=document.body.scrollTop;
			//top=1;
		}
	}
}

function getDomain(){
	//return document.domain;
	return window.location.href.toString();
}
function getUrl(){
	
	window.location.href="http://passport.toshop.com.cn/logon.aspx?src="+escape(window.location.href);//适用于腾讯浏览器
}
function logout(){
	window.location.href="http://passport.toshop.com.cn/logout.aspx?src="+escape(window.location.href);	
}
function exDate(n){
	var expdate = new Date(); 
   	expdate.setMinutes(expdate.getMinutes()+n);
	return expdate;
}
//设置
function setCookie (sName, vValue)
{	
    var argv = setCookie.arguments, argc = setCookie.arguments.length;
    var sExpDate = (argc > 2) ? "; expires="+argv[2].toGMTString() : "";
    var sPath = (argc > 3) ? "; path="+argv[3] : "";
    var sDomain = (argc > 4) ? "; domain="+argv[4] : "";
    var sSecure = (argc > 5) && argv[5] ? "; secure" : "";
    document.cookie = sName + "=" + escape(vValue,0) + sExpDate + sPath + sDomain + sSecure + ";";
}
//获取
function getCookie (sCookieName)
{
	var sName=sCookieName+"=", ichSt, ichEnd;
    var 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));
    }
	else return null;
}
//删除
function deleteCookie(sName)
{
    document.cookie = sName + "=" + getCookie(sName) + "; path=/; expires=" + (new Date()).toGMTString() + ";";
}
//cookie延时
function delayCookie(sName){
	document.cookie = sName + "=" + getCookie(sName) + "; path=/; expires=" + exDate(30).toGMTString() + ";";	
}
function winFocus(){
	//window.focus();	
}
function printStr(str){
	alert(str);
}
