﻿function IsText(txt,minlen,msg,lblid)
    {
      if($C(txt).value.length>minlen)
       {
         return true;
       }
       else
       {
         $C(lblid).innerHTML="Please Enter  "+msg+"!";
         return false;
       }        
    }  
 //check mobile  
function IsMobile(lbl,txt)
    {
       if(!IsText(txt,10,"Mobile Phone ！",txt))return false;
        var reg=/^1(3\d|59|58|56)\d{8}$/;
	    if(!reg.test($C(txt).value))
	    {
	      $C(lbl).innerHTML="Mobile Phone Numbere is wrong!";
	      return false;
	    }
	    else
	    {
	      $C(lbl).innerHTML="";
	      return true;
	    }
    }
function IsEmail(lbl,txt)
    {
     
        var reg=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	    if(!reg.test($C(txt).value))
	    {
	      $C(lbl).innerHTML="The E-mail address you provided is incorrect.";
	      return false;
	    }
	    else
	    {
	      $C(lbl).innerHTML="";
	      return true;
	    }
	    
    }
function CheckEmail(mail)
    {
       var reg=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	   return reg.test(mail);
    }
    //打印
function popprint(title,div)
{
var printPop=window.open("","Print","status=yes,toolbar=no,menubar=yes,location=no,resizable=yes,scrollbars=yes");
document.onload = printPop; 
printPop.focus(); 
printPop.document.open(); 
printPop.document.write("<html>\n<head>\n<title>"+title+"</title>\n<META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
printPop.document.write("<style type=\"text/css\"> ");
printPop.document.write("body{ ");
printPop.document.write("	font: 12px Arial, Helvetica, sans-serif; ");
printPop.document.write("	color: #333333; ");
printPop.document.write("} ");
printPop.document.write(".MainContents {	background: #FFFFFF; ");
printPop.document.write("	padding-right: 5px; ");
printPop.document.write("	padding-left: 5px; ");
printPop.document.write("} ");
printPop.document.write(".MainContentsTable1 {	padding: 10px; ");
printPop.document.write("} ");
printPop.document.write(".STYLE1 {	 ");
printPop.document.write("    color: #003399; ");
printPop.document.write("	font: bold; ");
printPop.document.write("} ");
printPop.document.write("h1 { ");
printPop.document.write("	color: #0a50a1; ");
printPop.document.write("	border-left: 8px outset #0A50A1; ");
printPop.document.write("	font-size: 20px; ");
printPop.document.write("	line-height: 18px; ");
printPop.document.write("	padding: 0px 0px 0px 10px; ");
printPop.document.write("} ");
printPop.document.write(".MainContentsTable { ");
printPop.document.write("	padding: 10px; ");
printPop.document.write("	line-height: 150%; ");
printPop.document.write("} ");
printPop.document.write("#MainContent h4, #MainContent th{ ");
printPop.document.write("	padding: 5px 10px; ");
printPop.document.write("	text-align: left; ");
printPop.document.write("	margin:0px; ");
printPop.document.write("	} ");
printPop.document.write("#MainContent h4  { ");
printPop.document.write("	background: #0A50A1; ");
printPop.document.write("	color: #FFFFFF; ");
printPop.document.write("	font-size: 12px; ");
printPop.document.write("} ");
printPop.document.write("#MainContent th { ");
printPop.document.write("	background: #E3EAF4; ");
printPop.document.write("} ");
printPop.document.write("#MainContent .TableList  th ,  #MainContent .TableList td { ");
printPop.document.write("	font-size: 11px; ");
printPop.document.write("	text-align: center; ");
printPop.document.write("} ");
printPop.document.write(".TableList td { ");
printPop.document.write("	border-bottom: 1px solid #e0e0e0; ");
printPop.document.write("	line-height: 180%; ");
printPop.document.write("} ");
printPop.document.write(".TableList ul { ");
printPop.document.write("	padding: 10px; ");
printPop.document.write("	text-align: left; ");
printPop.document.write("} ");
printPop.document.write(".TotalRoomCost { ");
printPop.document.write("	font-weight: bold; ");
printPop.document.write("	color: #0A50A1; ");
printPop.document.write("	font-size: 12px; ");
printPop.document.write("	padding: 20px; ");
printPop.document.write("	text-align: left; ");
printPop.document.write("} ");
printPop.document.write(".xsnazzy {background: transparent;} ");
printPop.document.write(".xtop, .xbottom {display:block; background:transparent; font-size:1px;} ");
printPop.document.write(".xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;} ");
printPop.document.write(".xb1, .xb2, .xb3 {height:1px;} ");
printPop.document.write(".xb2, .xb3, .xb4 {background:#fff;border-left:1px solid #CCCCCC;	border-right:1px solid #CCCCCC;} ");
printPop.document.write(".xb1 {margin:0 5px; background:#CCCCCC;} ");
printPop.document.write(".xb2 {margin:0 3px;border-width:0 2px;} ");
printPop.document.write(".xb3 {margin:0 2px;} ");
printPop.document.write(".xb4 {height:2px; margin:0 1px;} ");
printPop.document.write(".xboxcontent { ");
printPop.document.write("	display:block; ");
printPop.document.write("	border:0 solid #CCCCCC; ");
printPop.document.write("	border-width:0 1px; ");
printPop.document.write("	padding: 5px 10px; ");
printPop.document.write("} ");
printPop.document.write("* html .xboxcontent {height:1px;} ");
printPop.document.write(".color_a {} ");
printPop.document.write(".color_SidebarLeft {background: #E3EAF4;} ");
printPop.document.write(".pagenum{ ");
printPop.document.write("	padding: 5px; ");
printPop.document.write("} ");
printPop.document.write("</style> ");
printPop.document.write("<style> .printbutton,#lblDesc,.font4{display:none;} P,td{font-size:11px;}input,.button{display:none}.print{display:block;}@media print{input,.button,.print{display:none}}</style>");
printPop.document.write("</head>\n");
printPop.document.write("<body rightmargin=\"0\" bottommargin=\"0\" leftmargin=\"0\" topmargin=\"0\">\n");
printPop.document.write("<script> function fSetOutLinkIframe(){}</script>\n");
printPop.document.write("<div id=\"MainContent\" >");
printPop.document.write(div);
printPop.document.write("<br/><center><input type=button class=\"print\" value=Print onclick=\"window.print();\"></center>");
printPop.document.write("</div>");
printPop.document.write("</body>\n</html>");
printPop.document.close();
}
//view images
function ViewImg(imgurl,title){ 
imgurl=imgurlChange(imgurl);
newwin=window.open("","img","width=100,height=100,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes"); 
newwin.document.clear();
newwin.document.open(); 
newwin.document.write("<html><head><title>"+title+"</title></head>");
newwin.document.write('<body style="background-color:#BFDBFF" leftmargin=0 topmargin=0><center><img onclick="window.close();" title="close" style="cursor:pointer" src='+imgurl+' onload="self.resizeTo(this.offsetWidth+12,this.offsetHeight+80);"><br>'+title+'</center></body></html>'); 
newwin.document.close();
newwin.resizeBy(200,100);
newwin.focus();

} 
function ViewImgInit(imgclass)
{
    var imgs=document.getElementsByTagName("IMG");
    for(var i=0;i<imgs.length;i++)
    {
      if(imgs[i].className==imgclass)
      {
         imgs[i].title=imgs[i].alt;
         imgs[i].onclick=function(){ViewImg(this.src,this.title);};
      }
    }
}
function imgurlChange(url)
{
  return url.replace("wwf.",'.')
}
//find contrl
function $C(id){ return document.getElementById(id);}
function $V(id){ return $C(id).value;}
function $H(id){ return $C(id).innerHTML;}
function $Hide(id){$C(id).style.display="none";};
function $Display(id){$C(id).style.display="";}
function ChangeInt(txt){return parseInt(parseFloat("0"+txt.value));}
function ChangeFloat(txt){return parseFloat("0"+txt.value);}
function EnterKey(e,script){var key = window.event ? e.keyCode : e.which;if(key.toString() == "13"){eval(script);}}
function textfocus(id){ $C(id).focus();$C(id).select();}
function Link(url,param){if(location.href.indexOf(weburl)<0){url=weburl+url;}if(url.indexOf("aspx?")>-1){location.href=url+"&"+uidurl.replace("?","")}else{location.href=url+uidurl+param}}
function WriteCookie(tag,value){var d = new Date();d.setFullYear(d.getFullYear() +1);var CookieInfo = tag + "=" + escape(value) + ";expires="+d.toGMTString()+" path=/;";document.cookie = CookieInfo;}
function ReadCookie(tag){var mycookie=document.cookie;var start = mycookie.indexOf(tag + "=");if (start== -1){return null;}else{start=mycookie.indexOf("=",start)+1;var end = mycookie.indexOf(";",start);if (end==-1){end=mycookie.length;}return unescape(mycookie.substring(start,end));}}
function StringCheck(id,min,max){var txt= $C(id);var flag=true;var str =txt.value;if (str == ""){flag=false;}if (str.length < min ||str.length > max){flag=false;}var temp="";for (index=0; index<str.length; index++){check = str.charAt(index);if (!((("0"<=check) && (check<="9"))||(check=="_")||(("a"<=check) && (check<="z"))||(("A"<=check) && (check<="Z")))){flag=false;}else{temp=temp+check;}}if(!flag){txt.value=temp;}return flag;}
function newsopen(url){var win=window.open(url,"news","width=650,height=400,resizable=yes,scrollbars=yes,toolbar=no,menubar=no");win.focus();}
function pageopen(url){var win=window.open(url,"book","resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes");win.focus();}
function Redirect(url){ location.href=url; }
function LoadCSS(file,cssid){var cssTag = document.getElementById(cssid);var head = document.getElementsByTagName("head").item(0);if(cssTag){ head.removeChild(cssTag);}css = document.createElement("link");css.href = file;css.rel ="stylesheet";css.type= "text/css";css.id = cssid;head.appendChild(css)}
function LoadJavaScript(file,scrid){var scriptTag = document.getElementById(scrid);var head = document.getElementsByTagName('head').item(0);if(scriptTag) head.removeChild(scriptTag);script = document.createElement('script'); script.src = file;script.type = 'text/javascript';script.id = scrid;head.appendChild(script)}   
function popCommonWindow(url,width,height){ var left=(window.screen.width-width)/2; var top=(window.screen.height-height)/2; var params='left='+left+',top='+top+'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height; var win=window.open(url, 'pop', params);win.focus();}
function popCustomerWindow(url,width,height,popname){ var left=(window.screen.width-width)/2; var top=(window.screen.height-height)/2; var params='left='+left+',top='+top+'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height; var win=window.open(url, popname, params);win.focus();}
function pagination(page,total,pagesize,chagefunction){var pagestr="";if(page<1){page=1;}var allpage=1;allpage=parseInt(total/pagesize);allpage=parseInt((total%pagesize)!=0?allpage+1:allpage);allpage=parseInt(allpage==0?1:allpage);var next=page+1;if(next>allpage){next=allpage;}var pre=page-1;if(pre<1){pre=1;}var startcount=(page+5)>allpage?allpage-9:page-4;var endcount=page<5?10:page+5;pagestr+="<div class=\"pagenum\">";pagestr+="<span class=\"left\">page "+page+" of "+allpage+" </strong></span>";pagestr+="<div align=\"right\">";if(startcount<1){startcount=1;}if(allpage<endcount){endcount=allpage;}pagestr+=page>1?"<a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"(1)\" ><img src=\"images/page/nav_first.gif\" width=\"15\" height=\"10\" hspace=\"5\" border=\"0\"></a><a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"("+pre+")\" ><img src=\"images/page/nav_left.gif\" hspace=\"5\" border=\"0\"></a>":"<img src=\"images/page/nav_first1.gif\" width=\"15\" height=\"10\" hspace=\"5\"><img src=\"images/page/nav_left1.gif\" hspace=\"5\">";for(var i=startcount;i<=endcount;i++){pagestr+=page==i?"&nbsp;&nbsp;<font color=\"#ff0000\">"+i+"</font>":"&nbsp;&nbsp;<a href=\"javascript:void(0);\"  onclick=\"ChangePage("+i+")\" >"+i+"</a>";}pagestr+=page!=allpage?"&nbsp;<a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"("+next+")\" ><img src=\"images/page/nav_right.gif\" hspace=\"5\" border=\"0\"></a><a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"("+allpage+")\" ><img src=\"images/page/nav_last.gif\" width=\"15\" height=\"10\" hspace=\"5\" border=\"0\"></a>":"<img src=\"images/page/nav_right1.gif\" hspace=\"5\"><img src=\"images/page/nav_last1.gif\" width=\"15\" height=\"10\" hspace=\"5\" border=\"0\">";pagestr+="</div>";pagestr+="</div>";return pagestr;}
function minpagination(page,total,pagesize,chagefunction){var pagestr="";if(page<1){page=1;}var allpage=1;allpage=parseInt(total/pagesize);allpage=parseInt((total%pagesize)!=0?allpage+1:allpage);allpage=parseInt(allpage==0?1:allpage);var next=page+1;if(next>allpage){next=allpage;}var pre=page-1;if(pre<1){pre=1;}var startcount=(page+5)>allpage?allpage-9:page-4;var endcount=page<5?10:page+5;pagestr+="<div class=\"pagenum\">";pagestr+="<span class=\"left\">page "+page+" of "+allpage+" </strong></span>";pagestr+="<div align=\"right\">";pagestr+=page>1?"<a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"(1)\" ><img src=\"images/page/nav_first.gif\" width=\"15\" height=\"10\" hspace=\"5\" border=\"0\"></a><a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"("+pre+")\" ><img src=\"images/page/nav_left.gif\" hspace=\"5\" border=\"0\"></a>":"<img src=\"images/page/nav_first1.gif\" width=\"15\" height=\"10\" hspace=\"5\"><img src=\"images/page/nav_left1.gif\" hspace=\"5\">";pagestr+=page!=allpage?"&nbsp;<a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"("+next+")\" ><img src=\"images/page/nav_right.gif\" hspace=\"5\" border=\"0\"></a><a href=\"javascript:void(0);\"  onclick=\""+chagefunction+"("+allpage+")\" ><img src=\"images/page/nav_last.gif\" width=\"15\" height=\"10\" hspace=\"5\" border=\"0\"></a>":"<img src=\"images/page/nav_right1.gif\" hspace=\"5\"><img src=\"images/page/nav_last1.gif\" width=\"15\" height=\"10\" hspace=\"5\" border=\"0\">";pagestr+="</div>";pagestr+="</div>";return pagestr;}function SelectSetValue(drp,htxt,hval){for(var i=0;i<drp.options.length;i++){if(drp.options[i].selected){htxt.value = drp.options[i].text;hval.value = drp.options[i].value;break;}}}
function setTab(name,cursel,n){for(i=1;i<=n;i++){var menu=document.getElementById(name+i);var con=document.getElementById("con_"+name+"_"+i);menu.className=i==cursel?"hover":"";con.style.display=i==cursel?"block":"none";} fSetOutLinkIframe();}
function GetMaxString(msg,max){if(msg.length <= max){return msg;}else{return msg.substring(0, max- 1) + "...";}}
function IsStringInner(value,txt){if(txt==""){return true;}if(txt=="null"||txt==null){return true;}txt=","+txt.toUpperCase()+",";var temp=","+value.toUpperCase()+",";if(txt.indexOf(temp)>-1){return true;}return false;}
function TableAddRow(tb,tds)
{
    var tb=$C(tb);
    var index= tb.rows.length;
    var otr=tb.insertRow(-1);    
    for(var i=0;i<tds.length;i++)
    {
        otd=document.createElement("td");
        otd.innerHTML =tds[i];
        otr.appendChild(otd);
    }
}
function TabledeleteRow(tb,index)
{
  var tb=$C(tb);
  tb.deleteRow(index);
}
function GetTrusted(type)
{
 if(type+""=="1")
{
  return "<img title='Trusted Hotel' src=images/hotel/cxgy.jpg>";  
}
else
{
  return "";
}

}
//------------------------web--------------------------
function GetExpoimage(hid)
{
// var key="P"+hid;
// var o=ExpoHotel[key];
// if(typeof(o)!="undefined")
//{
//  return "<img src=images/ico_Expo.gif>";  
//}
//else
//{
  return "";
//}

}

function fSetOutLinkIframe()
{ try{
    var min=400;
   var h = parseInt(document.documentElement.scrollHeight);
    h=h<min?min:h;  
    var iframehide = document.getElementById('resetiframe');
   iframehide.src=domain+"/resetiframe.html?h="+ h ;  
       iframehide.src=domainurl+"/resetiframe.html?h="+ h ;

    }
    catch(e)
    { 
    
     // alert(e.message);
    }
}
