function initSelect(div, input){
div=$(div);
var on=false;
var t;
var ul=div.getElementsByTagName("ul")[0];
var text=div.getElementsByTagName("span")[0];
div.onclick=function(){
clearTimeout(t);
on=(on)?false:true;
ul.className=(on)?"hidden":"";};
div.onmouseover=function(){
clearTimeout(t);
on=true;}
div.onmouseout=function(){
on=false;
t=setTimeout(function(){
ul.className="hidden";}, 1000);};
var a=ul.getElementsByTagName("a");
}


function by(id)
{
	return document.getElementById(id);
}
function $(id)
{
	return document.getElementById(id);
}
function confirmDel(id){
if ( confirm("你确定要取消这个订单吗？")) {
window.location.href = "chkorder.asp?action=save&id=" + id
  }
}
function $(obj){
return document.getElementById(obj);
}
function showLayer(obj){
$(obj).style.display='block';
}
function hideLayer(obj){
$(obj).style.display='none';
}
function submsg(lg){
var username = document.loginx.username.value;
var password = document.loginx.password.value;
if (lg=1)
{
var login="login";
var data = 'username=' + escape(username) + '&password=' + escape(password) + '&login=' + escape(login);

}
else
{
var repassword= $('repassword').value;
var login="reg";
var data = 'username=' + escape(username) + '&password=' + escape(password) + '&repassword=' + escape(repassword) + '&login=' + escape(login);
}
var page = 'http://www.waalk.com/Asp/login1.asp';
new UpData(page,data);

}

function showredata(data) {
if (data=='ok')
{
document.getElementById("uLogin").style.display='none';
$('uMember').innerHTML = "<span class=welcome>欢迎您:" + getCookie("username")+"</span>  [<a href=user/usercenter.asp target=_blank>我的万客</a>]-[<a href=user/myorder.asp target=_blank>我的订单</a>]-[<a href=user/logout.asp target=_blank>退出</a>]           ";
document.getElementById("uMember").style.display='block';

}
else
{
}
}
function hideBody(){
with($('hiddenBody').style)
{
  display = 'block';
  height = document.documentElement.clientHeight + 'px';
}
}
function createAjaxObj(){
var httprequest = false;

if(window.XMLHttpRequest){
  //if Mozilla,Safari etc
  httprequest = new XMLHttpRequest();
  if(httprequest.overrideMimeType){
  httprequest.overrideMimeType('text/xml');
  }
}else if(window.ActiveXObject){
  //IE
  try{
  httprequest = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(e){
  try{
    httprequest = new ActiveXObject("Microsoft.XMLHTTP");
  }catch(e){}
  }
}

return httprequest;
}

function UpData(posturl,data){
this.posturl = posturl;
this.data = data;
this.ajaxobj = createAjaxObj();
this.updata();

}

UpData.prototype.updata=function(){
if(this.ajaxobj)
{
  var instanceOfTicker = this;
  this.ajaxobj.onreadystatechange = function(){instanceOfTicker.initialize();}

  var submitURL = this.posturl;
  //alert(submitURL);
  this.ajaxobj.open('post',submitURL,true);

  this.ajaxobj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  this.ajaxobj.send(this.data);
}
}
UpData.prototype.initialize=function(){
if(this.ajaxobj.readyState == 4)
{
  if(this.ajaxobj.status==200)
  {
  var retext = this.ajaxobj.responseText;
  showredata(retext);

  }
}
}
function SetCookie(name,value)
{
    var Days = 1;
    var exp  = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

  if(document.all){
     window.XMLHttpRequest=function(){
         var $=['Microsoft.XMLHTTP','Msxml2.XMLHTTP'];
                 for(var i=0;i<$.length;i++){try{return new ActiveXObject($[i])}catch(e){}};
     };
 }
 webDate=function(fn){
        var QQ=new XMLHttpRequest();
        QQ.onreadystatechange=function(){QQ.readyState==4&&(fn(new Date(QQ.getResponseHeader('Date'))))};
        QQ.open('HEAD', '/?_='+(-new Date));
        QQ.send(null);
 }
 window.time=new Date();

 time2String=function (t){
                 with(t)return [getFullYear(),'年'
                         ,('0'+(getMonth()+1)).slice(-2),'月'
                         ,('0'+getDate()).slice(-2),'日 '
                         ,('0'+getHours()).slice(-2),': '
                         ,('0'+getMinutes()).slice(-2),': '
                         ,('0'+getSeconds()).slice(-2)].join('')
 }
 int2time=function (m){
         m-=(D=parseInt(m/86400000))*86400000;
         m-=(H=parseInt(m/3600000))*3600000;
         S=parseInt((m-=(M=parseInt(m/60000))*60000)/1000);
         return D+'天'+H+'小时'+M+'分'+S+'秒'
 }

 targetTime=new Date('2010/2/10');
 setInterval(function (){
         webDate(function (webTime){
         document.getElementById("web").style.display='none';
                 $('web').innerHTML=time2String(time=webTime);
         })
         var targetTime=new Date($('ED').value);
         
         $('TimeCounter').innerHTML=int2time(targetTime-time);
 },1000)
 
  