//判断浏览器类型
if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=='Netscape')?1:0;
	var isIE=(navigator.appName.indexOf('Microsoft')!=-1)?1:0;
}

//public function
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

//################### cookie start ###################
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (';', offset);
	if (endstr == -1) {
        endstr = document.cookie.length;
    }
	return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name) {  
	var arg = name + '=';  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg){      
            return getCookieVal (j);
        }
        i = document.cookie.indexOf(' ', i) + 1;    
        if (i == 0) { 
            break;
        }  
	}  
	return null;
}

function setCookie(name, value) {
    var expdate = new Date();
    var argv = setCookie.arguments;
    var argc = setCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : 1;
    var path = (argc > 3) ? argv[3] : "/";
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    if(expires!=null){
        expdate.setTime(expdate.getTime() + ( expires*24*60*60*1000 )); 
	}
    document.cookie = name + "=" + escape (value)
    +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
    +((path == null) ? "" : ("; path=" + path))
    +((domain == null) ? "" : ("; domain=" + domain))
    +((secure == true) ? "; secure" : "");
} 

function deleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = getCookie (name);  
	document.cookie = name + '=' + cval + '; expires=' + exp.toGMTString();
}

//################### cookie end ###################

//################### Login or Logout start ###################

    /*
    功能：判断浏览者是否已经登录
    */
    function isLogin() {
        var a = getCookie('MyID');
        return (a != null && a != '');
    }

    /* 功能： 执行退出 */
    function execLogout() {
        if(window.confirm('您确定要退出吗？')){
            window.location.href='/php5/login_out.php';
       }
    } 
      
    /* 
    功能： 显示登陆窗口
    返回值：用于显示的HTML字符串
    */
    function getLoginInfo() {
        var bLogined = isLogin();
        var sLoginInfo = '';
        if (bLogined) 
        {
          document.write (' <table border="0" cellspacing="0" cellpadding="0" width="95%">'
                         +'    <tr>'
                         +'      <td height="75" colspan="3" align="center" class="wt13">您好，'+ getCookie('MyName') +'<br /> '
                         +'        <a href="#" onclick="execLogout(); return false;" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image8\',\'\',\'/images/quit2.gif\',1)" ><img src="/images/quit.gif" name="Image8" border="0" id="Image8" /></a> '
                         +'		  <a href="/php5/member/index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image7\',\'\',\'/images/myhome2.gif\',1)"><img src="/images/myhome.gif" name="Image7" width="76" height="18" border="0" id="Image7" /></a></td> '
                         +'      </tr>'
                         +'   </table>'
                         +'');
                         
        }else {
           document.write('<script language=JavaScript  src="/js/utils.js"></script> ' 
                       +'  <script language=JavaScript  src="/js/member/chklng.js"></script> '
                       +' <table border="0" cellspacing="0" cellpadding="0">'
                       +'   <form name="FrmLogn" method="post"> '
                       +'   <input type=hidden name=opFlag value="login" > '
                       +'   <tr>'
                       +'     <td width="64" height="22" align="center"><img src="/images/idicon.gif" width="44" height="18" /></td>'
                       +'     <td height="22" colspan="2"><input name="UserName" type="text" class="login" size="16"  maxlength=20 /></td>'
                       +'     </tr>'
                       +'     <tr>'
                       +'     <td width="64" height="22" align="center"><img src="/images/pwicon.gif" width="44" height="18" /></td>'
                       +'     <td height="22" colspan="2" ><input name="Password" type="password" class="login" size="16" maxlength=20/></td>'
                       +'     </tr>'
                       +'	<tr>'
                       +'     <td width="64" height="22" align="center"><img src="/images/yzcode.gif" width="44" height="18" /></td>'
                       +'     <td height="22" colspan="2">'
                       +'       <input name="Authinput" type="text" class="login" size="6" />'
                       +'        <img src="/php5/img1.php?id=init" alt="验证码：由六位大写字母和数字组成！" >'
                       +'      </td>'
                       +'     </tr>'
                       +'       <tr>'
                       +'         <td colspan="3" id=tdPrompt>'
                       +'          <a href="#" onClick="javascript:CheckLng(FrmLogn,1);"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image11\',\'\',\'/images/dsnericon2.gif\',1)"><img src="/images/dsnericon.gif" name="Image11" width="60" height="18" border="0" id="Image11" /></a> '
                       +'          <a href="#" onClick="javascript:CheckLng(FrmLogn,2);" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image10\',\'\',\'/images/coicon2.gif\',1)"><img src="/images/coicon.gif" name="Image10" width="60" height="18" border="0" id="Image10" /></a> '
                       +'          <a href="#" onClick="MM_goToURL(\'parent\',\'/php5/member/getpwd.php\');return document.MM_returnValue" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image12\',\'\',\'/images/getpwdicon2.gif\',1)"><img src="/images/getpwdicon.gif" name="Image12" width="60" height="18" border="0" id="Image12" /></a></td>'
                       +'         </tr>'
                       +'        </form>' 
                       +'     </table>');
        } 
    }   





//首页跳转
function go_url()
{
	var src = window.location.href;
	var I = src.indexOf("www.91pf.cn");
	if(I < 0)
	{
	    var T = src.indexOf("http://");
	    var domain = "";
	    if(T < 0)
	    {
    	    domain = src.substr(0,src.indexOf(".91pf.cn"));
    	    
    	    if(domain == "news")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/NewsInfo/";
    	    }
    	    else if(domain == "mall")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/product/";
    	    }
    	    else if(domain == "shop")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/ml.htm";
    	    }
    	    else if(domain == "bbs")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/";
    	    }
    	    //location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/" + domain;
	    }
	    else
	    {
	        var domain = src.substr(7,src.indexOf(".91pf.cn")-7);
    	     if(domain == "news")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/NewsInfo/";
    	    }
    	    else if(domain == "mall")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/product/";
    	    }
    	    else if(domain == "shop")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/ml.htm";
    	    }
    	     else if(domain == "bbs")
    	    {
    	        location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/";
    	    }
    	    //location.href= src.substr(0,src.indexOf(".91pf.cn") + 8) + "/" + domain;    
	    }
	}
}

