﻿//选中状态
function getkeyval(val)
{
	this.value = val;
}
function bodyLoad()
{ 
    var a=0; 
    aArray =new Array();
    aArray[0]=new getkeyval("merchantHome");
    aArray[1]=new getkeyval("mealList");
    aArray[2]=new getkeyval("inviteList");
    aArray[3]=new getkeyval("Delsyn");
    aArray[4]=new getkeyval("coupons");
    aArray[5]=new getkeyval("sendInvite");
    aArray[6]=new getkeyval("reserve");
    aArray[7]=new getkeyval("storeMap");
    for(var i = 0; i < aArray.length; i++)
    {     
        if (strUrl.indexOf(aArray[i].value)!=-1)
        {
            if(strUrl.indexOf("merchantHome")!=-1 ||
                strUrl.indexOf("mealList")!=-1    ||
                strUrl.indexOf("inviteList")!=-1  ||
                strUrl.indexOf("Delsyn")!=-1      ||
                strUrl.indexOf("coupons")!=-1     ||
                strUrl.indexOf("sendInvite")!=-1  ||
                strUrl.indexOf("reserve")!=-1     ||
                strUrl.indexOf("storeMap")!=-1    )
           { 
            document.getElementById('menuID' + i ).className ='style04 style05';
            document.getElementById('Td' + i ).className='style04 style05';
             break;
           } 
        }
   }
}

function changeImage()//验证码
        {
            document.getElementById("img").src=document.getElementById("img").src+"?";
        }
var xScrollStickCssFilePath="sp\/css\/xframe.css";

var BROWSERNAME="";
switch(navigator.appName.toLowerCase()){
 case "netscape":
  BROWSERNAME="ns";
 break;
 case "microsoft internet explorer":
 default:
  BROWSERNAME="ie";
 break;
}


switch(BROWSERNAME){
 case "ns":
  window.addEventListener("load",_xScrollStick_init,false);
 break;
 case "ie":
 default:
  window.attachEvent("onload",_xScrollStick_init);
}

function _xScrollStick_init(){
 var allTheScrollSticks=document.getElementsByTagName("div");
 for(var i=0;i<allTheScrollSticks.length;i++){
  if(allTheScrollSticks[i].className.match(/^((xScrollStick)|(.+ +xScrollStick)|(xScrollStick +.+)|(.+ +xScrollStick +.+))$/))_xScrollStick_event_doInit(allTheScrollSticks[i]);
 }
 window_event_scroll();
}




function _xScrollStick_event_doInit(element){

 element.offX=element.offsetLeft;
 element.offY=element.offsetTop;
 

 element.Stick=_xScrollStick_method_Stick;
 

 switch(BROWSERNAME){
  case "ns":
   window.addEventListener("scroll",window_event_scroll,false);
  break;
  case "ie":
  default:
   window.attachEvent("onscroll",window_event_scroll);
 }

 document.body.parentNode.onscroll=window_event_scroll;

}

function window_event_scroll(){
 var allTheScrollSticks=document.getElementsByTagName("div");
 for(var i=0;i<allTheScrollSticks.length;i++){
  if(allTheScrollSticks[i].className.match(/^((xScrollStick)|(.+ +xScrollStick)|(xScrollStick +.+)|(.+ +xScrollStick +.+))$/))try{allTheScrollSticks[i].Stick();}catch(e){}
 }
}


function _xScrollStick_method_Stick(){
 var x=this.offX, y=this.offY, po=this;
 this.style.position="absolute";
 x+=document.body.parentNode.scrollLeft;
 y+=document.body.parentNode.scrollTop;
 this.style.left=x+"px";
 this.style.top=y+"px";

}

function G(id){
    return document.getElementById(id);
};
function GC(t){
   return document.createElement(t);
};
String.prototype.trim = function(){
          return this.replace(/(^\s*)|(\s*$)/g, '');
};
function isIE(){
      return (document.all && window.ActiveXObject && !window.opera) ? true : false;
} 
 
function cancelSign(){
    G("sign_div").style.display = 'none';
    G("cover_div").style.display = 'none';
   document.body.style.overflow = '';
};

function popCoverDiv(){
   if (G("cover_div")) {
    G("cover_div").style.display = '';
   } else {
    var coverDiv = GC('div');
    document.body.appendChild(coverDiv);
    coverDiv.id = 'cover_div';
    with(coverDiv.style) {
     position = 'absolute';
     background = '#000000';
     left = '0px';
     top = '0px';
     var bodySize = getBodySize();
     width = bodySize[0] + 'px'
     height = bodySize[1] + 'px';
     zIndex = 98;
     if (isIE()) {
      filter = "Alpha(Opacity=60)";
     } else {
      opacity = 0.6;
     }
    }
   }
}
function getBodySize(){
   var bodySize = [];
   with(document.documentElement) {
    bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
    bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
   }
   return bodySize;
}
function popSign(az_id){
   var loginDivWidth = 250;
   var sign_in_flow = '<div style="padding-top:8px; padding-bottom:8px"><table border="0" cellspacing="0" cellpadding="0" width="234"><tr bgcolor="#eeeeee"><td height="24" style="padding-left:12px;"><strong>会员登录</strong></td><td align="right" style="padding-right:8px;"><img src="../images/cannel02.gif" style="cursor:pointer" onclick="cancelSign();"></td></tr><tr><td colspan="2" height="8"></td></tr><tr><td align="right" height="28" width="75">用 户 名：</td><td><input type="text" id="sign_email" style="width:130px;"/></td></tr><tr><td align="right" height="28">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</td><td><input type="password" id="sign_pwd" style="width:130px;"/></td></tr><tr><td>&nbsp;</td><td><input type="button"  id="login" value="登录" class="btnSave04" onclick=loginUser("sign_email","sign_pwd") >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" class="btnSave04" onclick="cancelSign();"></td></tr><tr><td colspan="2" height="24" align="center"><a href="../member/registUser.aspx">新用户注册</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../member/RecoverPasswd.aspx">忘记密码？</a></td></tr><tr><td colspan="2" align="center"  ><span id="spanRegUserID" style="display:none;" ></span></td></tr></table></div>';

   if (G("sign_div")) {
    G("sign_div").style.display = '';
   } else {
    var signDiv = GC('div');
    document.body.appendChild(signDiv);
    signDiv.id = 'sign_div';
    signDiv.align = "center";
  
    with (signDiv.style) {
     position = 'absolute';
     left = (document.documentElement.clientWidth - loginDivWidth)/2 + 'px';
     top = (document.documentElement.clientHeight - 300)/2 + 'px';
     width = loginDivWidth + 'px';
     zIndex = 99;
     background = '#FFFFFF';
     border = '#cccccc solid 1px';
    }
   }
    G("sign_div").innerHTML = sign_in_flow;  
}
function popSignFlow(az_id) {
   popCoverDiv();  
   popSign(az_id); 
   document.body.style.overflow = "hidden";  
}
function popSignFlow_login(az_id) {
   popCoverDiv();  
   popSign(az_id);  
   document.body.style.overflow = "hidden";    
}
function loginUser(user,pwd)
{
var u= G(user);
var P=G(pwd);
   
     var url=window.location.protocol + "//" + window.location.host + "/member/LoginAjax.aspx";          
     var date="user=" +u.value  + "&pwd="+P.value;       
     PostRequest(url,date);
  
       
}

 function PostRequest(url, data)
    {
        var AjaxRequestObj = InitRequest();
        if (AjaxRequestObj != null)
        {
            AjaxRequestObj.onreadystatechange = function ()
            {
                if (AjaxRequestObj.readyState == 4 && AjaxRequestObj.responseText)
                {
                    ProcessAjaxData(AjaxRequestObj.responseText);
                }
            };
            AjaxRequestObj.open("POST", url, true);
            AjaxRequestObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            AjaxRequestObj.send(data);
        }
     
    }
    function ProcessAjaxData(data){
    eval(data);}
     function InitRequest()
    {
        var C_req = null;
        try
        {
            C_req = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                C_req = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(oc)
            {
                C_req = null;
            }
        }
        if (!C_req && typeof XMLHttpRequest != "undefined")
        {
            try
            {
                C_req = new XMLHttpRequest();
            }
            catch(fa)
            {
               
                C_req = null;
            }
        }
        return C_req;
    }
    
    function cancelIt1(){
    document.getElementById("sign_div1").style.display = 'none';
    document.getElementById("cover_div1").style.display = 'none';
    document.body.style.overflow = '';
}

function popCoverDiv1(){
   if (G("cover_div1")) {
    G("cover_div1").style.display = '';
   } else {
    var coverDiv = GC('div');
    document.body.appendChild(coverDiv);
    coverDiv.id = 'cover_div1';
    with(coverDiv.style) {
     position = 'absolute';
     background = '#000000';
     left = '0px';
     top = '0px';
     var bodySize = getBodySize1();
     width = bodySize[0] + 'px'
     height = bodySize[1] + 'px';
     zIndex = 98;
     if (isIE()) {
      filter = "Alpha(Opacity=60)";
     } else {
      opacity = 0.6;
     }
    }
   }
}

function getBodySize1(){
   var bodySize = [];
   with(document.documentElement) {
    bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
    bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
   }
   return bodySize;
}

function popSign1(er_id){
   var loginDivWidth = 250;
   var sign_in_flow = '<div style="padding-top:1px; padding-bottom:8px" ><table border="0" cellspacing="0" cellpadding="0" width="248"><tr bgcolor="#eeeeee"><td width="75" height="24" style="padding-left:12px;"><strong>系统信息</strong></td><td align="right" style="padding-right:8px;"><img src="/images/cannel02.gif" style="cursor:pointer" onclick="cancelIt1();"></td></tr><tr><td colspan="2" height="8"></td></tr><tr align="left"><td height="50" colspan="2" style="padding-left:24px;">' + er_id + '</td></tr><tr><td colspan="2" align="center"><input type=image src="/images/confirm01.gif" border="0" onclick="cancelIt1();return false;" style="cursor:pointer" id="confirmcancel1"></td></tr><tr><td colspan="2" height="5"></td></tr></table></div>';

   if (G("sign_div1")) {
    G("sign_div1").style.display = '';
   } else {
    var signDiv = GC('div');
    document.body.appendChild(signDiv);
    signDiv.id = 'sign_div1';
    signDiv.align = "center";
  
    with (signDiv.style) {
     position = 'absolute';
     left = (document.documentElement.clientWidth - loginDivWidth)/2 + 'px';
     top = (document.documentElement.clientHeight - 300)/2 + 'px';
     width = loginDivWidth + 'px';
     zIndex = 99;
     background = '#FFFFFF';
     border = '#cccccc solid 1px';
    }
   }
    G("sign_div1").innerHTML = sign_in_flow;
 
  
}
function popSign2(er_id) { 
    popCoverDiv1();  
   popSign1(er_id);  
   document.body.style.overflow = "hidden";
}
