﻿function insertFlash(elm, url, w, h,w1,align) {
if (!document.getElementById(elm)) return;
var str = '';
str += '<object width="'+ w1 +'" height="'+ h +'"  align="'+align+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0">';
str += '<param name="movie" value="'+ url +'">';
str += '<param value="false" name="menu"/> ';
str += '<param value="opaque" name="wmode"/>';
str += '<param name="wmode" value="transparent">';
str += '<param name="quality" value="autohigh">';
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
str += '</object>';
document.getElementById(elm).innerHTML = str;
}

   
function checkmobile1()
{
        var label4=window.document.all("ctl00_ContentPlaceHolder1_UC_MyOK1_TextBox2").value;
        if (label4 == "") 
        {
          alert('请输入接收短信的手机号码！');
          return false ;
        }
        else if (label4.length !=11) 
        {
          alert('接收短信的手机号码长度不对！');
          return false ;
        }
         else  if(label4!=""   &&   label4.search(/^([0-9]*)([.]?)([0-9]*)$/)   ==   -1)
        { 
           alert("手机号码必须为数字！"); 
            return   false; 
        } 
        else
        {
           return true;
        }
}

function checkmobile2()
{
        var label4=window.document.all("ctl00_ContentPlaceHolder1_UC_MyOK1_txt_Mobile").value;
        if (label4 == "") 
        {
          alert('请输入接收短信的手机号码！');
          return false ;
        }
        else if (label4.length !=11) 
        {
          alert('接收短信的手机号码长度不对！');
          return false ;
        }
        else  if(label4!=""   &&   label4.search(/^([0-9]*)([.]?)([0-9]*)$/)   ==   -1)
        { 
          alert("手机号码必须为数字！"); 
            return   false; 
        } 
        else
        {
           return true;
        }
}


function checkmobile3()
{
        var label4=window.document.all("ctl00_ContentPlaceHolder1_UC_Coupon1_txt_Mobile").value;
        if (label4 == "") 
        {
          alert('请输入接收短信的手机号码！');
          return false ;
        }
        else if (label4.length !=11) 
        {
          alert('接收短信的手机号码长度不对！');
          return false ;
        }
        else  if(label4!=""   &&   label4.search(/^([0-9]*)([.]?)([0-9]*)$/)   ==   -1)
        { 
           alert("手机号码必须为数字！"); 
            return   false; 
        } 
        else
        {
           return true;
        }
}



//function   document.onkeydown()       
//  {   
//        
//      if( window.event.keyCode==13)
//      {
//           var button=window.document.getElementById("ctl00_ContentPlaceHolder1_UC_Query1_Button_query");
//	       if (button != null)
//	       {	        
//	          button.submit;
//	          return true;
//	       }
//	       else
//	       {   
//	          return false;
//	       }
//      }
//    
//  } 
  
  function KeyDown()
   { 
    if(event.keyCode==13)
      {
            //在页面form中，按回车不触发事件
            return false;
      }
   }
      
      function doButton()
       { 
         if(event.keyCode==13)
           {
              //btSubmit指对应的提交按扭的id名称
              document.all.Button_query.click(); 
           }
     }
     
   


///////////////////////////////////////////////////////////////////////////////
//MSN冒泡提示框
////////////////////////////////////////////////////////////////////////////////
//*   
//   消息构造   
//
function CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target){   
    this.id     = id;   
    this.title  = title;   
    this.caption= caption;   
    this.message= message;   
    this.target = target;   
    this.width    = width?width:200;   
    this.height = height?height:120;   
    this.timeout= 150;   
    this.speed    = 20;  
    this.step    = 1;  
    this.right    = screen.width -1;   
    this.bottom = screen.height;  
    this.left    = this.right - this.width;  
    this.top    = this.bottom - this.height;  
    this.timer    = 0;  
    this.pause    = false; 
    this.close    = false; 
    this.autoHide    = true; 
    
}   
   
/**//*   
*    隐藏消息方法   
*/   
CLASS_MSN_MESSAGE.prototype.hide = function(){   
    if(this.onunload()){   
        var offset  = this.height>this.bottom-this.top?this.height:this.bottom-this.top;  
        var me  = this;   
        if(this.timer>0){    
            window.clearInterval(me.timer);   
        }   
        var fun = function(){   
            if(me.pause==false||me.close){ 
                var x  = me.left;  
                var y  = 0;  
                var width = me.width;  
                var height = 0;  
                if(me.offset>0){  
                    height = me.offset;  
                }  
      
                y  = me.bottom - height;  
      
                if(y>=me.bottom){  
                    window.clearInterval(me.timer);   
                    me.Pop.hide();   
                } else {  
                    me.offset = me.offset - me.step;   
                }  
                me.Pop.show(x,y,width,height);     
            }              
        }   
        this.timer = window.setInterval(fun,this.speed)       
    }   
}   
   
/**//*   
*    消息卸载事件，可以重写   
*/   
CLASS_MSN_MESSAGE.prototype.onunload = function() {   
    return true;   
}   
/**//*   
*    消息命令事件，要实现自己的连接，请重写它   
*   
*/   
CLASS_MSN_MESSAGE.prototype.oncommand = function(){   
    this.hide();   
 window.open(this.target); 
}  
/**//*   
*    消息显示方法   
*/   
CLASS_MSN_MESSAGE.prototype.show = function(){   
    var oPopup = window.createPopup(); //IE5.5+   
     
    this.Pop = oPopup;   
   
    var w = this.width;   
    var h = this.height;   
   
    var str = "<DIV style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: " + w + "px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: " + h + "px; BACKGROUND-COLOR: #c9d3f3'>"   
        str += "<TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0>"   
        str += "<TR>"   
        str += "<TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD>"   
        str += "<TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; PADDING-TOP: 4px' vAlign=center width='100%'>" + this.caption + "</TD>"   
        str += "<TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19>"   
        str += "<SPAN title=关闭 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD>"   
        str += "</TR>"   
        str += "<TR>"   
        str += "<TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height=" + (h-28) + ">"   
        str += "<DIV style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%'>" + this.title + "<BR><BR>"   
        str += "<DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=false id='btCommand'><FONT color=#ff0000>" + this.message + "</FONT></A></DIV>"   
        str += "</DIV>"   
        str += "</TD>"   
        str += "</TR>"   
        str += "</TABLE>"   
        str += "</DIV>"   
   
    oPopup.document.body.innerHTML = str;  
     
   
    this.offset  = 0;  
    var me  = this;   
    oPopup.document.body.onmouseover = function(){me.pause=true;} 
    oPopup.document.body.onmouseout = function(){me.pause=false;} 
    var fun = function(){   
        var x  = me.left;  
        var y  = 0;  
        var width    = me.width;  
        var height    = me.height;  
            if(me.offset>me.height){  
                height = me.height;  
            } else {  
                height = me.offset;  
            }  
        y  = me.bottom - me.offset;  
        if(y<=me.top){  
            me.timeout--;  
            if(me.timeout==0){  
                window.clearInterval(me.timer);   
                if(me.autoHide){ 
                    me.hide();  
                } 
            }  
        } else {  
            me.offset = me.offset + me.step;  
        }  
        me.Pop.show(x,y,width,height);     
    }   
   
    this.timer = window.setInterval(fun,this.speed)       
   
      
   
    var btClose = oPopup.document.getElementById("btSysClose");   
   
    btClose.onclick = function(){   
        me.close = true; 
        me.hide();   
    }   
   
    var btCommand = oPopup.document.getElementById("btCommand");   
    btCommand.onclick = function(){   
        me.oncommand();   
    }        
}   
/**//*  
** 设置速度方法  
**/  
CLASS_MSN_MESSAGE.prototype.speed = function(s){  
    var t = 20;  
    try {  
        t = praseInt(s);  
    } catch(e){}  
    this.speed = t;  
}  
/**//*  
** 设置步长方法  
**/  
CLASS_MSN_MESSAGE.prototype.step = function(s){  
    var t = 1;  
    try {  
        t = praseInt(s);  
    } catch(e){}  
    this.step = t;  
}  
   
CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){  
    try {  
        this.left        = left    !=null?left:this.right-this.width;  
        this.right        = right    !=null?right:this.left +this.width;  
        this.bottom        = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height;  
        this.top        = top    !=null?top:this.bottom - this.height;  
    } catch(e){}  
} 

function mainLoop()
{
      var   t=new   Date();  
      var   time=t.getSeconds() 
      if (time%5==0)
      {
          CheckGif();
      }  
      else
      {
          CheckMessage();
     }   
      var Loop=''; 
      Loop=parseInt(Math.random()*(10000-60000+1) + 60000);
      setTimeout("mainLoop()",Loop); 
 
} 

function CheckMessage()
{
       var ds=Secretaire.GetMessage().value;
       if (ds==null) return;  
       if (ds.Tables.Count<=0) return; 
       var tb_message=ds.Tables[0];
       if (tb_message == null) return;
       if (tb_message.Rows.Count<=0) return; 
       var title= "滚动新闻";
       var message=tb_message.Rows[0].title; 
       var targetprompt="查看详细信息...";
       var target="FormMessage.aspx?id="+tb_message.Rows[0].id; 
       var MSG1 = new CLASS_MSN_MESSAGE("aa",200,120,title,message,targetprompt,target);  
       MSG1.rect(null,null,null,screen.height-50); 
       MSG1.speed    = 40; 
       MSG1.step    = 1; 
       MSG1.show();  
} 

function CheckGif()
{
 
       var ds=Secretaire.GetMenuInfo().value;
       if (ds==null) return; 
       if (ds.Tables.Count<=0) return; 
       var tb_message=ds.Tables[0];
       if (tb_message == null) return;
       if (tb_message.Rows.Count<=0) return;  
       var title= "点餐秘书小辛提醒您";
       var message=" 辛香汇刚刚为辛友们提供了一份小礼物-<FONT color=#ff0000>["+tb_message.Rows[0].menu_name+"]</FONT>，快快点击礼品专柜，就有机会成为我们的幸运之星"; 
       var targetprompt="进入礼品专柜...";
       var target="FormGiftCounter.aspx?MenuCode="+tb_message.Rows[0].menu_code+"&id="+tb_message.Rows[0].id; 
       var MSG1 = new CLASS_MSN_MESSAGE("aa",200,120,title,message,targetprompt,target);  
       MSG1.rect(null,null,null,screen.height-50); 
       MSG1.speed    = 45; 
       MSG1.step    = 1; 
       MSG1.show();  
} 

var Loop=''; 
Loop=parseInt(Math.random()*(20000-60000+1) + 60000);
setTimeout("mainLoop()",Loop);



nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;
    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}



var i=0
var aaa=0.00
var MImg=0
var w=145
var h=99

function max(object){
if (object==null) return;
MImg=object.style.pixelWidth+=20
object.style.pixelHeight=MImg*aaa
}

//变小
function min(object){
if (object==null) return;
MImg=object.style.pixelWidth-=20
object.style.pixelHeight=MImg*aaa

}

function init(object){
aaa=object.height/object.width
object.style.pixelWidth=w
object.style.pixelHeight=h
}




///////////////////////////////////////////////////////
var offsetfromcursorX = 12;
var offsetfromcursorY = 10;
var offsetdivfrompointerX = 10;
var offsetdivfrompointerY = 14;

document.write('<div id="dhtmltooltip"></div>');
document.write('<img id="dhtmlpointer" src="Table/Images/tooltiparrow.gif">');

var ie = document.all;
var ns6 = document.getElementById && ! document.all;
var enabletip = false;

if (ie || ns6)
  var tipobj = document.all ? document.all["dhtmltooltip"] : document.getElementById ? document.getElementById("dhtmltooltip") : "";

var pointerobj = document.all ? document.all["dhtmlpointer"] : document.getElementById ? document.getElementById("dhtmlpointer") : "";

function ietruebody() {
  return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

function showtip(thetext, thewidth, thecolor) {
  if (ns6 || ie) {
    if (typeof thewidth != "undefined")
      tipobj.style.width = thewidth + "px";
    if (typeof thecolor != "undefined" && thecolor != "")

      tipobj.style.backgroundColor = thecolor;
      thetext="1.如没有注册，请先注册会员，然后登录.<br>"+

                "2.选择好就餐日期、店铺、市别后方可点餐.<br>"+

                "3.选择所要点的菜品大类.<br>"+

                "4.选中所要点的菜品点击我要点单.<br>"+

                "5.重复4、5步骤点好菜后，核对所点菜品.<br>"+

                "6.确认后按点击此处保存您的点餐信息保存所点菜品.<br>"+

                "7.保存好后点击打印我的菜单打印点餐明细；您至店内就餐时将打印单交与服务员即可.<br>"+

                "8.您也可将点餐单据号发送到您的手机，凭点餐单据号和验证码在"+

                     "网上或各家分店的点餐柜上打印和修改您的点餐信息，或提供点餐"+

                    "单据号信息由服务台为您服务.";


    tipobj.innerHTML = thetext;
    tipobj.onmouseout = hidetip;
    enabletip = true;
    return false;
  }
}

function positiontip(e) {
  if (enabletip) {
    var nondefaultpos = false;
    var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
    var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
    
    var winwidth = ie && ! window.opera ? ietruebody().clientWidth : window.innerWidth - 20;
    var winheight = ie && ! window.opera ? ietruebody().clientHeight : window.innerHeight - 20;

    var rightedge = ie && ! window.opera ? winwidth - event.clientX - offsetfromcursorX : winwidth - e.clientX - offsetfromcursorX;
    var bottomedge = ie && ! window.opera ? winheight - event.clientY - offsetfromcursorY : winheight - e.clientY - offsetfromcursorY;

    var leftedge = (offsetfromcursorX < 0) ? offsetfromcursorX * (- 1) : - 1000;

    if (rightedge < tipobj.offsetWidth) {
      tipobj.style.left = curX - tipobj.offsetWidth + "px";
      nondefaultpos = true;
    }
    else if (curX < leftedge)
      tipobj.style.left = "5px";
    else {
      tipobj.style.left = curX + offsetfromcursorX - offsetdivfrompointerX + "px";
      pointerobj.style.left = curX + offsetfromcursorX + "px";
    }

    if (bottomedge < tipobj.offsetHeight) {
      tipobj.style.top = curY - tipobj.offsetHeight - offsetfromcursorY + "px";
      nondefaultpos = true;
    }
    else {
      tipobj.style.top = curY + offsetfromcursorY + offsetdivfrompointerY + "px";
      pointerobj.style.top = curY + offsetfromcursorY + "px";
    }

    tipobj.style.visibility = "visible";

    if (! nondefaultpos)
      pointerobj.style.visibility = "visible";
    else
      pointerobj.style.visibility = "hidden";
  }
}

function hidetip() {
  if (ns6 || ie) {
    enabletip = false;
    tipobj.style.visibility = "hidden";
    pointerobj.style.visibility = "hidden";
    tipobj.style.left = "-1000px";
    tipobj.style.backgroundColor = '';
    tipobj.style.width = '';
  }
}

if ( typeof window.addEventListener != "undefined" )
document.addEventListener( "mousemove", positiontip, false );
else if ( typeof window.attachEvent != "undefined" )
document.attachEvent( "onmousemove", positiontip );
else {
if ( document.onmousemove != null ) {
var oldOnmousemove = document.onmousemove;
document.onmousemove = function ( e ) {
oldOnmousemove( e );
positiontip(e);
};
}
else
document.onmousemove = positiontip;
}










