
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function SetwanghaoHeight(obj)
{
 var wanghao=obj;
 if (document.getElementById)
 {
  if (wanghao && !window.opera)
  {
   if (wanghao.contentDocument && wanghao.contentDocument.body.offsetHeight) 

    wanghao.height = wanghao.contentDocument.body.offsetHeight; 
   else if(wanghao.Document && wanghao.Document.body.scrollHeight)
    wanghao.height = wanghao.Document.body.scrollHeight;
  }
 }
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function SetWinHeight(obj)
{
 var win=obj;
 if (document.getElementById)
 {
  if (win && !window.opera)
  {
   if (win.contentDocument && win.contentDocument.body.offsetHeight) 

    win.height = win.contentDocument.body.offsetHeight; 
   else if(win.Document && win.Document.body.scrollHeight)
    win.height = win.Document.body.scrollHeight;
  }
 }
}

function tijiao_guest() 
{ 
if (document.form1.zssm.value ==false)
{
alert("请填写您的用户名！")
document.form1.zssm.focus()
document.form1.zssm.select()
return
}
if (document.form1.dingdianhua.value ==false) 
{
alert("请填写您的联系电话！")
document.form1.dingdianhua.focus()
document.form1.dingdianhua.select()
return
}






if (document.form1.rqa.value =="") 
{ 
alert("请填写您的入住时间！")
document.form1.rqa.focus()
document.form1.rqa.select()
return 
} 





if (document.form1.rqb.value =="") 
{ 
alert("请填写您的离店时间！")
document.form1.rqb.focus()
document.form1.rqb.select()
return
} 

document.form1.submit()
}  


function getTodayNum(){
var today=new Date();
var num=(parseInt(today.getMonth())+1)*100+parseInt(today.getDate());
return num;
}

function BrowserType() {
	var ua=navigator.userAgent;
	if ((ua.indexOf('Opera')!=-1)&&(ua.charAt(ua.indexOf('Opera')+6)>=6)) return 'OP6';
	if ((ua.indexOf('MSIE')!=-1)&&(ua.charAt(ua.indexOf('MSIE')+5)>=4)) return 'IE4';
	if ((ua.indexOf('Mozilla/')!=-1)&&(ua.charAt(ua.indexOf('Mozilla/')+8)>=5)) {
		return 'NS6';
	} else {
		return 'NS4';
	}
	return 'UNKNOW';
}
function WindowSize() {
	if (BrowserType()=="IE4") {
		this.w=window.document.body.offsetWidth;
		this.h=window.document.body.offsetHeight;
		this.l=window.document.body.scrollLeft;
		this.t=window.document.body.scrollTop;
	} else {
		this.w=window.innerWidth;
		this.h=window.innerHeight;
		this.l=window.pageXOffset;
		this.t=window.pageYOffset;
	}
}
function TagSize (obj) {
	this.w=obj.offsetWidth;
	this.h=obj.offsetHeight;
	var t=0;var l=0;
	while (obj && obj.tagName!="BODY") {
		t+=obj.offsetTop;
		l+=obj.offsetLeft;
		obj=obj.offsetParent;
	}
	this.t=t;
	this.l=l;
}			
function getObj(n,doc) {
	var x;
	if(!doc) var doc=document;
	if (n.indexOf('*')>-1){
		var tmp=n.split('*');
		x=eval('document.'+tmp[0]+'.'+tmp[1]+';');
		return x;
	}
	if(!(x=doc[n])&&doc.all) x=doc.all[n];
	for (i=0;!x&&i<doc.forms.length;i++) x=doc.forms[i][n];
	for(i=0;!x&&doc.layers&&i<doc.layers.length;i++) x=getStyle(n,doc.layers[i].document);
	if(!x && doc.getElementById) x=doc.getElementById(n);
	return x;
}	
					
function getStyle(n) {
	var s=getObj(n);
//alert(n+'='+s);
	if (s.style) s=s.style;
	return s;
}
					
function moveLayer(n,x,y) {
	var obj=getStyle(n);
	obj.left=x;obj.top=y;
}			
			
function moveToTag(strTag,strDivid,intDw,intDh) {
	var t=new TagSize(getObj(strTag));
	var w=new WindowSize();
	var top=0;var left=0;
	if (w.h-(t.t-w.t)>=intDh) {
		top=t.t;
	} else {
		top=t.t-intDh+t.h;
	}
	if (w.w-(t.l-w.l)>=intDw) {
		left=t.l;
	} else {
		left=t.l-intDw+t.w;
	}
	moveLayer(strDivid,left,top);
}			
		
function shObj(strObjid,strAction) {
	var v,obj;
	if ((obj=getStyle(strObjid))!=null) {
		v=strAction;
		v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		obj.visibility=v;
	}
}		
		
// Calendar table
var cw=156;//日历宽度
var ch=178;//日历高度
var bcolor='#7DB6C7';//背景色
var hfcolor='#FFFFFF';//抬头文字颜色
var hfsize='12px';//抬头文字字号
var wbcolor='#FFFFFF';//星期栏背景色
var wfcolor='#000000';//星期栏文字颜色
var wfsize='12px';//星期栏文字字号
var dbcolor='#E2F0F6';//日期背景色
var dfcolor='#0C687F';//日期文字颜色
var dfsize='12px';//日期文字字号
var dcbcolor='#FFFFFF';//当前日期背景颜色
var dcfcolor='#CC0000';//当前日期文字颜色

if (BrowserType()!='OP6') {
	document.write('<div id="newcalendar" style="Z-INDEX:100; position:absolute;visibility:hidden;width:'+cw+'px;height:'+ch+';background:'+bcolor+';">');
	document.write('<iframe src="calendar.htm" name="framecalendar" width="'+cw+'" height="'+ch+'" border="0" frameborder="0" marginheight="0" marginwidth="0" noresize scrolling="no"></iframe>');
	document.write('</div>');
}
//for Canendar
function showCalendar(strTag,strDivid,intDw,intDh,strTarget)
{
	if (BrowserType()=='OP6') {alert('请依照YYYY-MM-DD的格式自行填写日期。');return;}
	moveToTag(strTag,strDivid,intDw,intDh);
	shObj(strDivid,'show');
	window.frames['framecalendar'].document.printCal.transfer.value=strTarget;
}
function SettoopHeight(obj)
{
 var toop=obj;
 if (document.getElementById)
 {
  if (toop && !window.opera)
  {
   if (toop.contentDocument && toop.contentDocument.body.offsetHeight) 

    toop.height = toop.contentDocument.body.offsetHeight; 
   else if(toop.Document && toop.Document.body.scrollHeight)
    toop.height = toop.Document.body.scrollHeight;
  }
 }
}

