var dtCh="/",minYear=1900,maxYear=2100,timechange=true,modifychange=false,ori=new Array(),roomDtls=new Array(5);
for(var t=0;
t<5;
t++){var roomRec=new Array(2);
roomRec[0]=2;
roomRec[1]=0;
roomDtls[t]=roomRec
}function getGUID(){var B="";
for(var A=0;
A<16;
A++){B+=Math.floor(Math.random()*15).toString(15)+(A==4||A==6||A==8||A==10?"|":"")
}B=B+"_";
return B
}function homeSearchFormSubmit(){var C=true;
var F=getGUID();
var B=document.getElementById("selorigin").value;
if(B==null||B==""||B=="0"){alert("Please select a leaving from city");
document.getElementById("selorigin").focus();
return 
}var E=document.getElementById("seldestination").value;
if(E==null||E==""||E=="0"){alert("Please select a going to city");
document.getElementById("seldestination").focus();
return 
}for(var D=0;
D<document.forms[0].radtripType.length;
D++){if(document.forms[0].radtripType[D].checked){var A=document.forms[0].radtripType[D].value;
if(A=="O"){deptdate=document.forms[0].txtdeptDateOway.value;
retndate=""
}else{if(A=="M"){retndate="";
deptdate=document.forms[0].txtdeptDateMcity.value;
if(homeValidateOriginDestination()){if(multicitySectorCheck()){deptdate=document.forms[0].txtdeptDateMcity.value
}else{return 
}}else{return 
}}else{deptdate=document.forms[0].txtdeptDateRtrip.value;
retndate=document.forms[0].txtretnDateRtrip.value
}}}}document.forms[0].depdate.value=deptdate;
document.forms[0].retndate.value=retndate;
C=homeValidateOriginDestination();
if(C){writePersistentCookie("_ffc",document.getElementById("selorigin").value,"months",1);
writePersistentCookie("_ftc",document.getElementById("seldestination").value,"months",1);
document.forms[0].action="http://www.makemytrip.co.in/makemytrip/searchFlightProgress.do?mapTo=searchExactProgress&frompage=modify&searchKey="+F;
document.forms[0].submit()
}}function citieslist(){var A="<option value='0'>---------------</option><option value='BLR'>Bangalore</option><option value='MAA'>Chennai</option><option value='DEL'>Delhi</option><option value='GOI'>Goa</option><option value='HYD'>Hyderabad</option><option value='CCU'>Kolkata</option><option value='BOM'>Mumbai</option><option value='PNQ'>Pune</option><option value='0'>---------------</option><option value='IXA'>Agartala</option><option value='AGX'>Agatti Island</option><option value='AGR'>Agra</option><option value='AMD'>Ahmedabad</option><option value='AJL'>Aizawl</option><option value='IXD'>Allahabad</option><option value='ATQ'>Amritsar</option><option value='IXU'>Aurangabad</option><option value='IXB'>Bagdogra</option><option value='BLR'>Bangalore</option><option value='IXG'>Belgaum</option><option value='BEP'>Bellary</option><option value='BHU'>Bhavnagar</option><option value='BHO'>Bhopal</option><option value='BBI'>Bhubaneshwar</option><option value='BHJ'>Bhuj</option><option value='CCJ'>Calicut</option><option value='IXC'>Chandigarh</option><option value='MAA'>Chennai</option><option value='COK'>Cochin</option><option value='CJB'>Coimbatore</option><option value='DED'>Dehradun</option><option value='DHM'>Dharamshala</option><option value='XDL'>Dholpur</option><option value='DIB'>Dibrugarh</option><option value='DMU'>Dimapur</option><option value='DIU'>Diu</option><option value='GAY'>Gaya</option><option value='GOI'>Goa</option><option value='GOP'>Gorakhpur</option><option value='GAU'>Guwahati</option><option value='GWL'>Gwalior</option><option value='HBX'>Hubli</option><option value='HYD'>Hyderabad</option><option value='IMF'>Imphal</option><option value='IDR'>Indore</option><option value='JLR'>Jabalpur</option><option value='JAI'>Jaipur</option><option value='JSA'>Jaisalmer</option><option value='IXJ'>Jammu</option><option value='JGA'>Jamnagar</option><option value='IXW'>Jamshedpur</option><option value='JDH'>Jodhpur</option><option value='JRH'>Jorhat</option><option value='IXY'>Kandla</option><option value='KNU'>Kanpur</option><option value='HJR'>Khajuraho</option><option value='KLH'>Kolhapur</option><option value='CCU'>Kolkata</option><option value='KUU'>Kullu</option><option value='LTU'>Latur</option><option value='IXL'>Leh</option><option value='IXI'>Lilabari</option><option value='LKO'>Lucknow</option><option value='LUH'>Ludhiana</option><option value='IXM'>Madurai</option><option value='IXE'>Mangalore</option><option value='BOM'>Mumbai</option><option value='NAG'>Nagpur</option><option value='ISK'>Nasik</option><option value='NDC'>Nanded</option><option value='DEL'>New Delhi</option><option value='PGH'>Pantnagar</option><option value='IXP'>Pathankot</option><option value='PAT'>Patna</option><option value='PBD'>Porbandar</option><option value='IXZ'>Port Blair</option><option value='PNQ'>Pune</option><option value='PUT'>Puttaparthi</option><option value='RPR'>Raipur</option><option value='RJA'>Rajahmundry</option><option value='RAJ'>Rajkot</option><option value='IXR'>Ranchi</option><option value='SHL'>Shillong</option><option value='SLV'>Shimla</option><option value='SSE'>Sholapur</option><option value='IXS'>Silchar</option><option value='SXR'>Srinagar</option><option value='STV'>Surat</option><option value='TEZ'>Tezpur</option><option value='TRZ'>Tiruchirapally</option><option value='TIR'>Tirupati</option><option value='TRV'>Trivandrum</option><option value='TCR'>Tuticorin</option><option value='UDR'>Udaipur</option><option value='BDQ'>Vadodara</option><option value='VNS'>Varanasi</option><option value='VGA'>Vijaywada</option><option value='VTZ'>Vishakhapatnam</option>";
return A
}function pop_dv_cit(C,B,A){document.getElementById(C).innerHTML='<select name="'+B+'" id="'+B+'" class="listcities" tabindex="'+A+'" >'+citieslist()+"</select>"
}function populatecities(){pop_dv_cit("selorigin_list","selorigin",3);
pop_dv_cit("seldestination_list","seldestination",4);
pop_dv_cit("seloriginSector2_list","seloriginSector2",7);
pop_dv_cit("seldestinationSector2_list","seldestinationSector2",8);
pop_dv_cit("seloriginSector3_list","seloriginSector3",12);
pop_dv_cit("seldestinationSector3_list","seldestinationSector3",13);
pop_dv_cit("seloriginSector4_list","seloriginSector4",17);
pop_dv_cit("seldestinationSector4_list","seldestinationSector4",18);
pop_dv_cit("seloriginSector5_list","seloriginSector5",22);
pop_dv_cit("seldestinationSector5_list","seldestinationSector5",23)
}function onewayfn(){document.getElementById("fphButton").style.display="block";
for(var B=0;
B<document.forms[0].radtripType.length;
B++){if(document.forms[0].radtripType[B].checked){var A=document.forms[0].radtripType[B].value;
trip=A;
if(A=="O"){document.getElementById("roundtrip").style.display="none";
document.getElementById("multicity").style.display="none";
document.getElementById("oneway").style.display="";
document.forms[0].txtdeptDateOway.value=document.forms[0].txtdeptDateRtrip.value;
document.forms[0].txtretnDateOway.value=document.forms[0].txtretnDateRtrip.value;
if(timechange==true){document.forms[0].seldeptTimeOway.value=document.forms[0].seldeptTimeRtrip.value;
document.forms[0].selretnTimeOway.value=document.forms[0].selretnTimeRtrip.value
}else{timechange=false
}if(timechange==false&&modifychange==true){document.forms[0].seldeptTimeRtrip.value=document.forms[0].seldeptTimeOway.value;
document.forms[0].selretnTimeRtrip.value=document.forms[0].selretnTimeOway.value
}else{modifychange==false
}}else{if(A=="M"){document.getElementById("fphButton").style.display="none";
document.getElementById("roundtrip").style.display="none";
document.getElementById("oneway").style.display="none";
document.getElementById("multicity").style.display="block"
}else{if(A=="R"){document.getElementById("oneway").style.display="none";
document.getElementById("multicity").style.display="none";
document.getElementById("roundtrip").style.display="";
document.forms[0].txtdeptDateRtrip.value=document.forms[0].txtdeptDateOway.value;
document.forms[0].txtretnDateRtrip.value=document.forms[0].txtretnDateOway.value;
if(timechange==true){document.forms[0].seldeptTimeRtrip.value=document.forms[0].seldeptTimeOway.value;
document.forms[0].selretnTimeRtrip.value=document.forms[0].selretnTimeOway.value
}else{timechange=false
}if(timechange==false&&modifychange==true){document.forms[0].seldeptTimeOway.value=document.forms[0].seldeptTimeRtrip.value;
document.forms[0].selretnTimeOway.value=document.forms[0].selretnTimeRtrip.value
}else{modifychange==false
}}}}}}}if(typeof Zapatec=="undefined"){Zapatec={}
}Zapatec.Utils={};
Zapatec.Utils.getAbsolutePos=function(E){var A=0,D=0;
var C=/^div$/i.test(E.tagName);
if(C&&E.scrollLeft){A=E.scrollLeft
}if(C&&E.scrollTop){D=E.scrollTop
}var F={x:E.offsetLeft-A,y:E.offsetTop-D};
if(E.offsetParent){var B=this.getAbsolutePos(E.offsetParent);
F.x+=B.x;
F.y+=B.y
}return F
};
Zapatec.Utils.fixBoxPosition=function(D){if(D.x<0){D.x=0
}if(D.y<0){D.y=0
}var E=Zapatec.Utils.createElement("div");
var C=E.style;
C.position="absolute";
C.right=C.bottom=C.width=C.height="0px";
window.document.body.appendChild(E);
var B=Zapatec.Utils.getAbsolutePos(E);
window.document.body.removeChild(E);
if(Zapatec.is_ie){B.y+=window.document.body.scrollTop;
B.x+=window.document.body.scrollLeft
}else{B.y+=window.scrollY;
B.x+=window.scrollX
}var A=D.x+D.width-B.x;
if(A>0){D.x-=A
}A=D.y+D.height-B.y;
if(A>0){D.y-=A
}};
Zapatec.Utils.isRelated=function(C,A){A||(A=window.event);
var E=A.relatedTarget;
if(!E){var B=A.type;
if(B=="mouseover"){E=A.fromElement
}else{if(B=="mouseout"){E=A.toElement
}}}try{while(E){if(E==C){return true
}E=E.parentNode
}}catch(D){}return false
};
Zapatec.Utils.removeClass=function(E,D){if(!(E&&E.className)){return 
}var A=E.className.split(" ");
var B=[];
for(var C=A.length;
C>0;
){if(A[--C]!=D){B[B.length]=A[C]
}}E.className=B.join(" ")
};
Zapatec.Utils.addClass=function(B,A){Zapatec.Utils.removeClass(B,A);
B.className+=" "+A
};
Zapatec.Utils.getElement=function(A){if(Zapatec.is_ie){return window.event.srcElement
}else{return A.currentTarget
}};
Zapatec.Utils.getTargetElement=function(A){if(Zapatec.is_ie){return window.event.srcElement
}else{return A.target
}};
Zapatec.Utils.stopEvent=function(A){A||(A=window.event);
if(A){if(Zapatec.is_ie){A.cancelBubble=true;
A.returnValue=false
}else{A.preventDefault();
A.stopPropagation()
}}return false
};
Zapatec.Utils.addEvent=function(A,C,B){if(A.attachEvent){A.attachEvent("on"+C,B)
}else{if(A.addEventListener){A.addEventListener(C,B,false)
}else{A["on"+C]=B
}}};
Zapatec.Utils.removeEvent=function(A,C,B){if(A.detachEvent){A.detachEvent("on"+C,B)
}else{if(A.removeEventListener){A.removeEventListener(C,B,false)
}else{A["on"+C]=null
}}};
Zapatec.Utils.createElement=function(D,C,A){var B=null;
if(window.self.document.createElementNS){B=window.self.document.createElementNS("http://www.w3.org/1999/xhtml",D)
}else{B=window.self.document.createElement(D)
}if(typeof C!="undefined"&&C!=null){C.appendChild(B)
}if(!A){if(Zapatec.is_ie){B.setAttribute("unselectable",true)
}if(Zapatec.is_gecko){B.style.setProperty("-moz-user-select","none","")
}}return B
};
Zapatec.Utils.writeCookie=function(C,E,D,F,B){E=escape(E);
var A=C+"="+E,G;
if(D){A+=";domain="+D
}if(F){A+=";path="+F
}if(B){G=new Date();
G.setTime(B*86400000+G.getTime());
A+=";expires="+G.toGMTString()
}document.cookie=A
};
Zapatec.Utils.getCookie=function(B){var E=B+"=";
var D=0;
while(D<document.cookie.length){var A=D+E.length;
if(document.cookie.substring(D,A)==E){var C=document.cookie.indexOf(";",A);
if(C==-1){C=document.cookie.length
}return unescape(document.cookie.substring(A,C))
}D=document.cookie.indexOf(" ",D)+1;
if(D==0){break
}}return null
};
Zapatec.Utils.makePref=function(C){function D(E){if(typeof E=="object"&&!E){return"null"
}else{if(typeof E=="number"||typeof E=="boolean"){return E
}else{if(typeof E=="string"){return'"'+E.replace(/\22/,"\\22")+'"'
}else{return null
}}}}var A="",B;
for(B in C){A+=(A?",'":"'")+B+"':"+D(C[B])
}return A
};
Zapatec.Utils.loadPref=function(txt){var obj=null;
try{eval("obj={"+txt+"}")
}catch(e){}return obj
};
Zapatec.Utils.mergeObjects=function(A,C){for(var B in C){A[B]=C[B]
}};
Zapatec.Utils.__wch_id=0;
Zapatec.Utils.createWCH=function(A){var C=null;
A=A||window.self.document.body;
if(Zapatec.is_ie&&!Zapatec.is_ie5){var B="filter:progid:DXImageTransform.Microsoft.alpha(style=0,opacity=0);";
var D="WCH"+(++Zapatec.Utils.__wch_id);
A.insertAdjacentHTML("beforeEnd",'<iframe id="'+D+'" scroll="no" frameborder="0" style="z-index:0;position:absolute;visibility:hidden;'+B+'border:0;top:10;left:100;width:0;height:0;" src="javascript:false;"></iframe>');
C=window.self.document.getElementById(D)
}return C
};
Zapatec.Utils.setupWCH_el=function(I,A,D){if(I){var J=Zapatec.Utils.getAbsolutePos(A),F=J.x,M=J.y,C=F+A.offsetWidth,L=M+A.offsetHeight;
if(D){var K=Zapatec.Utils.getAbsolutePos(D),H=K.x,E=K.y,G=H+D.offsetWidth,B=E+D.offsetHeight;
if(F>H){F=H
}if(M>E){M=E
}if(C<G){C=G
}if(L<B){L=B
}}Zapatec.Utils.setupWCH(I,F,M,C-F,L-M)
}};
Zapatec.Utils.setupWCH=function(E,A,F,B,D){if(E){var C=E.style;
(typeof A!="undefined")&&(C.left=A+"px");
(typeof F!="undefined")&&(C.top=F+"px");
(typeof B!="undefined")&&(C.width=B+"px");
(typeof D!="undefined")&&(C.height=D+"px");
C.visibility="inherit"
}};
Zapatec.Utils.hideWCH=function(A){if(A){A.style.visibility="hidden"
}};
Zapatec.Utils.getPageScrollY=function(){return window.pageYOffset||document.documentElement.scrollTop||(document.body?document.body.scrollTop:0)||0
};
Zapatec.ScrollWithWindow={};
Zapatec.ScrollWithWindow.list=[];
Zapatec.ScrollWithWindow.stickiness=0.25;
Zapatec.ScrollWithWindow.register=function(A){var C=parseInt(A.style.top)||0;
var B=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0;
C-=B;
if(C<0){C=0
}Zapatec.ScrollWithWindow.list[Zapatec.ScrollWithWindow.list.length]={node:A,origTop:C}
};
Zapatec.ScrollWithWindow.unregister=function(B){for(var A=0;
A<Zapatec.ScrollWithWindow.list.length;
A++){var C=Zapatec.ScrollWithWindow.list[A];
if(B==C.node){Zapatec.ScrollWithWindow.list.splice(A,1);
return 
}}};
Zapatec.ScrollWithWindow.handler=function(A){oldScrollY+=((A-oldScrollY)*this.stickiness);
if(Math.abs(oldScrollY-A)<=1){oldScrollY=A
}for(var C=0;
C<Zapatec.ScrollWithWindow.list.length;
C++){var D=Zapatec.ScrollWithWindow.list[C];
var B=D.node;
if(!D.origTop){D.origTop=Zapatec.Utils.getAbsolutePos(B).y;
B.style.position="absolute"
}B.style.top=D.origTop+parseInt(oldScrollY)+"px"
}};
var oldScrollY=Zapatec.Utils.getPageScrollY();
setInterval("var newScrollY = Zapatec.Utils.getPageScrollY(); if (newScrollY != oldScrollY) { Zapatec.ScrollWithWindow.handler(newScrollY); }",50);
Zapatec.Utils.destroy=function(A){if(A&&A.parentNode){A.parentNode.removeChild(A)
}};
Zapatec.Utils.newCenteredWindow=function(A,H,B,I,F){var D=0;
var G=0;
if(screen.width){D=(screen.width-B)/2
}if(screen.height){G=(screen.height-I)/2
}var C="height="+I+",width="+B+",top="+G+",left="+D+",scrollbars="+F+",resizable";
var E=window.open(A,H,C);
return E
};
Zapatec.Utils.getWindowSize=function(){var A=0;
var B=0;
if(document.compatMode&&document.compatMode=="CSS1Compat"){if(window.opera){A=document.body.clientWidth||0;
B=document.body.clientHeight||0
}else{A=document.documentElement.clientWidth||0;
B=document.documentElement.clientHeight||0
}}else{A=window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth||0;
B=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight||0
}return{width:A,height:B}
};
Zapatec.Utils.selectOption=function(sel,val,call_default){var a=sel.options,i,o;
for(i=a.length;
--i>=0;
){o=a[i];
o.selected=(o.val==val)
}sel.value=val;
if(call_default){if(typeof sel.onchange=="function"){sel.onchange()
}else{if(typeof sel.onchange=="string"){eval(sel.onchange)
}}}};
Zapatec.Utils.getNextSibling=function(C,A,B){C=C.nextSibling;
if(!A){return C
}A=A.toLowerCase();
if(B){B=B.toLowerCase()
}while(C){if(C.nodeType==1&&(C.tagName.toLowerCase()==A||(B&&C.tagName.toLowerCase()==B))){return C
}C=C.nextSibling
}return C
};
Zapatec.Utils.getFirstChild=function(C,A,B){if(!C){return null
}C=C.firstChild;
if(!C){return null
}if(!A){return C
}A=A.toLowerCase();
if(C.nodeType==1){if(C.tagName.toLowerCase()==A){return C
}else{if(B){B=B.toLowerCase();
if(C.tagName.toLowerCase()==B){return C
}}}}return Zapatec.Utils.getNextSibling(C,A,B)
};
Zapatec.Utils.getChildText=function(C){if(C==null){return""
}var B=[];
var A=C.firstChild;
while(A!=null){if(A.nodeType==3){B.push(A.data)
}A=A.nextSibling
}return B.join(" ")
};
Zapatec.Utils.insertAfter=function(B,A){if(B.nextSibling){B.parentNode.insertBefore(A,B.nextSibling)
}else{B.parentNode.appendChild(A)
}};
Zapatec.Utils._ids={};
Zapatec.Utils.generateID=function(A,B){if(typeof B=="undefined"){if(typeof this._ids[A]=="undefined"){this._ids[A]=0
}B=++this._ids[A]
}return"zapatec-"+A+"-"+B
};
Zapatec.Utils.addTooltip=function(B,A){return new Zapatec.Tooltip(B,A)
};
Zapatec.isLite=true;
Zapatec.Utils.checkActivation=function(){if(!Zapatec.isLite){return true
}var G=[];
add_product=function(J,I,K){G[J]={webdir:I,name:K,bActive:false}
};
add_product("calendar.js","prod1","Calendar");
add_product("menu.js","prod2","Menu");
add_product("tree.js","prod3","Tree");
add_product("form.js","forms","Forms");
add_product("effects.js","effects","Effects");
add_product("hoverer.js","effects","Effects - Hoverer");
add_product("slideshow.js","effects","Effects - Slidshow");
add_product("zpgrid.js","grid","Grid");
add_product("slider.js","slider","Slider");
add_product("zptabs.js","tabs","Tabs");
add_product("zptime.js","time","Time");
add_product("window.js","windows","Window");
var E,H,D;
var B=false;
var A=document.getElementsByTagName("script");
for(D=0;
D<A.length;
D++){if(/wizard.js/i.test(A[D].src)){return true
}H=A[D].src.split("/");
if(H.length==0){E=A[D]
}else{E=H[H.length-1]
}E=E.toLowerCase();
if(typeof G[E]!="undefined"){B=true;
G[E].bActive=true
}}if(!B){return true
}var F=document.getElementsByTagName("A");
for(D=0;
D<F.length;
D++){if(/(dev|www)\.zapatec\.com/i.test(F[D].href)){return true
}}var C="You are using the Free version of the Zapatec Software.\nWhile using the Free version, a link to www.zapatec.com in this page is required.";
for(D in G){if(G[D].bActive==true){C+="\nTo purchase the Zapatec "+G[D].name+" visit www.zapatec.com/website/main/products/"+G[D].webdir+"/"
}}return false
};
Zapatec.is_opera=/opera/i.test(navigator.userAgent);
Zapatec.is_ie=(/msie/i.test(navigator.userAgent)&&!Zapatec.is_opera);
Zapatec.is_ie5=(Zapatec.is_ie&&/msie 5\.0/i.test(navigator.userAgent));
Zapatec.is_mac_ie=(/msie.*mac/i.test(navigator.userAgent)&&!Zapatec.is_opera);
Zapatec.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);
Zapatec.is_konqueror=/Konqueror/i.test(navigator.userAgent);
Zapatec.is_gecko=/Gecko/i.test(navigator.userAgent);
if(!Function.prototype.call){Function.prototype.call=function(){var self=arguments[0];
self._this_func=this;
var args=new Array();
for(var i=1;
i<arguments.length;
i++){args[args.length]="arguments["+i+"]"
}var ret=eval("self._this_func("+args.join(",")+")");
self._this_func=null;
return ret
}
}if(!Array.prototype.pop){Array.prototype.pop=function(){var A;
if(this.length){A=this[this.length-1];
this.length-=1
}return A
}
}if(!Array.prototype.push){Array.prototype.push=function(){for(var A=0;
A<arguments.length;
A++){this[this.length]=arguments[A]
}return this.length
}
}if(!Array.prototype.shift){Array.prototype.shift=function(){var B;
if(this.length){B=this[0];
for(var A=0;
A<this.length-1;
A++){this[A]=this[A+1]
}this.length-=1
}return B
}
}if(!Array.prototype.unshift){Array.prototype.unshift=function(){if(arguments.length){var B,A=arguments.length;
for(B=this.length+A-1;
B>=A;
B--){this[B]=this[B-A]
}for(B=0;
B<A;
B++){this[B]=arguments[B]
}}return this.length
}
}if(!Array.prototype.splice){Array.prototype.splice=function(A,C){var D=[],E=[],B;
for(B=2;
B<arguments.length;
B++){D.push(arguments[B])
}for(B=A;
(B<A+C)&&(B<this.length);
B++){E.push(this[B])
}for(B=A+C;
B<this.length;
B++){this[B-C]=this[B]
}this.length-=E.length;
for(B=this.length+D.length-1;
B>=A+D.length;
B--){this[B]=this[B-D.length]
}for(B=0;
B<D.length;
B++){this[A+B]=D[B]
}return E
}
}Zapatec.Log=function(A){if(!A){return 
}var B=A.description;
if(A.severity){B=A.severity+":\n"+B
}};
Zapatec.Utils.Array={};
Zapatec.Utils.Array.insertBefore=function(B,F,E,A){var D=new Array();
for(var C in B){if(C==A){if(E){D[E]=F
}else{D.push(F)
}}D[C]=B[C]
}return D
};
Zapatec.Calendar=function(C,B,E,A){this.bShowHistoryEvent=false;
this.activeDiv=null;
this.currentDateEl=null;
this.getDateStatus=null;
this.getDateToolTip=null;
this.getDateText=null;
this.timeout=null;
this.onSelected=E||null;
this.onClose=A||null;
this.onFDOW=null;
this.dragging=false;
this.hidden=false;
this.minYear=1970;
this.maxYear=2050;
this.minMonth=0;
this.maxMonth=11;
this.dateFormat=Zapatec.Calendar.i18n("DEF_DATE_FORMAT");
this.ttDateFormat=Zapatec.Calendar.i18n("TT_DATE_FORMAT");
this.historyDateFormat="%B %d, %Y";
this.isPopup=true;
this.weekNumbers=true;
this.noGrab=false;
if(Zapatec.Calendar.prefs.fdow||(Zapatec.Calendar.prefs.fdow==0)){this.firstDayOfWeek=parseInt(Zapatec.Calendar.prefs.fdow,10)
}else{var D=0;
if(typeof C=="number"){D=C
}else{if(typeof Zapatec.Calendar._FD=="number"){D=Zapatec.Calendar._FD
}}this.firstDayOfWeek=D
}this.showsOtherMonths=false;
this.dateStr=B;
this.showsTime=false;
this.sortOrder="asc";
this.time24=true;
this.timeInterval=null;
this.yearStep=2;
this.hiliteToday=true;
this.multiple=null;
this.table=null;
this.element=null;
this.tbody=new Array();
this.firstdayname=null;
this.monthsCombo=null;
this.hilitedMonth=null;
this.activeMonth=null;
this.yearsCombo=null;
this.hilitedYear=null;
this.activeYear=null;
this.histCombo=null;
this.hilitedHist=null;
this.dateClicked=false;
this.numberMonths=1;
this.controlMonth=1;
this.vertical=false;
this.monthsInRow=1;
this.titles=new Array();
this.rowsOfDayNames=new Array();
this.helpButton=true;
this.disableFdowClick=false;
Zapatec.Calendar._initSDN()
};
Zapatec.Calendar._initSDN=function(){if(typeof Zapatec.Calendar._TT._SDN=="undefined"){if(typeof Zapatec.Calendar._TT._SDN_len=="undefined"){Zapatec.Calendar._TT._SDN_len=3
}var A=[];
for(var B=8;
B>0;
){A[--B]=Zapatec.Calendar._TT._DN[B].substr(0,Zapatec.Calendar._TT._SDN_len)
}Zapatec.Calendar._TT._SDN=A;
if(typeof Zapatec.Calendar._TT._SMN_len=="undefined"){Zapatec.Calendar._TT._SMN_len=3
}A=[];
for(var B=12;
B>0;
){A[--B]=Zapatec.Calendar._TT._MN[B].substr(0,Zapatec.Calendar._TT._SMN_len)
}Zapatec.Calendar._TT._SMN=A
}};
Zapatec.Calendar.i18n=function(C,A){var B="";
if(!A){if(Zapatec.Calendar._TT){B=Zapatec.Calendar._TT[C]
}if(!B&&Zapatec.Calendar._TT_en){B=Zapatec.Calendar._TT_en[C]
}}else{switch(A){case"dn":B=Zapatec.Calendar._TT._DN[C];
break;
case"sdn":B=Zapatec.Calendar._TT._SDN[C];
break;
case"mn":B=Zapatec.Calendar._TT._MN[C];
break;
case"smn":B=Zapatec.Calendar._TT._SMN[C];
break
}}if(!B){B=""+C
}return B
};
Zapatec.Calendar._C=null;
Zapatec.Calendar.prefs={fdow:null,history:"",sortOrder:"asc",hsize:9};
Zapatec.Calendar.savePrefs=function(){Zapatec.Utils.writeCookie("ZP_CAL",Zapatec.Utils.makePref(this.prefs),null,"/",30)
};
Zapatec.Calendar.loadPrefs=function(){var A=Zapatec.Utils.getCookie("ZP_CAL"),B;
if(A){B=Zapatec.Utils.loadPref(A);
if(B){Zapatec.Utils.mergeObjects(this.prefs,B)
}}};
Zapatec.Calendar._add_evs=function(A){var B=Zapatec.Calendar;
Zapatec.Utils.addEvent(A,"mousedown",B.dayMouseDown);
Zapatec.Utils.addEvent(A,"mouseout",B.dayMouseOut);
if(Zapatec.is_ie){Zapatec.Utils.addEvent(A,"dblclick",B.dayMouseDblClick)
}};
Zapatec.Calendar._del_evs=function(A){var B=this;
Zapatec.Utils.removeEvent(A,"mouseover",B.dayMouseOver);
Zapatec.Utils.removeEvent(A,"mousedown",B.dayMouseDown);
Zapatec.Utils.removeEvent(A,"mouseout",B.dayMouseOut);
if(Zapatec.is_ie){Zapatec.Utils.removeEvent(A,"dblclick",B.dayMouseDblClick)
}};
Zapatec.Calendar.findMonth=function(A){if(typeof A.month!="undefined"){return A
}else{if(A.parentNode&&typeof A.parentNode.month!="undefined"){return A.parentNode
}}return null
};
Zapatec.Calendar.findHist=function(A){if(typeof A.histDate!="undefined"){return A
}else{if(A.parentNode&&typeof A.parentNode.histDate!="undefined"){return A.parentNode
}}return null
};
Zapatec.Calendar.findYear=function(A){if(typeof A.year!="undefined"){return A
}else{if(A.parentNode&&typeof A.parentNode.year!="undefined"){return A.parentNode
}}return null
};
Zapatec.Calendar.showMonthsCombo=function(){var B=Zapatec.Calendar._C;
if(!B){return false
}var D=B.activeDiv;
var J=B.monthsCombo;
var F=B.date,K=B.date.getMonth(),C=B.date.getFullYear(),G=(C==B.minYear),I=(C==B.maxYear);
for(var H=J.firstChild;
H;
H=H.nextSibling){var E=H.month;
Zapatec.Utils.removeClass(H,"hilite");
Zapatec.Utils.removeClass(H,"active");
Zapatec.Utils.removeClass(H,"disabled");
H.disabled=false;
if((G&&E<B.minMonth)||(I&&E>B.maxMonth)){Zapatec.Utils.addClass(H,"disabled");
H.disabled=true
}if(E==K){Zapatec.Utils.addClass(B.activeMonth=H,"active")
}}var L=J.style;
L.display="none";
if(D.navtype<0){L.left=D.offsetLeft+"px"
}else{var A=J.offsetWidth;
if(typeof A=="undefined"){A=50
}L.left=(D.offsetLeft+D.offsetWidth-A)+"px"
}L.top=(D.offsetTop+D.offsetHeight)+"px";
B.updateWCH(J)
};
Zapatec.Calendar.showHistoryCombo=function(){var B=Zapatec.Calendar._C,H,F,D,C,G,I,E,A;
if(!B){return false
}G=B.histCombo;
while(G.firstChild){G.removeChild(G.lastChild)
}if(Zapatec.Calendar.prefs.history){H=Zapatec.Calendar.prefs.history.split(/,/);
D=0;
while(E=H[D++]){E=E.split(/\//);
F=Zapatec.Utils.createElement("div");
F.className=Zapatec.is_ie?"label-IEfix":"label";
F.histDate=new Date(parseInt(E[0],10),parseInt(E[1],10)-1,parseInt(E[2],10),E[3]?parseInt(E[3],10):0,E[4]?parseInt(E[4],10):0);
F.appendChild(window.document.createTextNode(F.histDate.print(B.historyDateFormat)));
G.appendChild(F);
if(F.histDate.dateEqualsTo(B.date)){Zapatec.Utils.addClass(F,"active")
}}}C=B.activeDiv;
I=G.style;
I.display="none";
I.left=Math.floor(C.offsetLeft+(C.offsetWidth-G.offsetWidth)/2)+"px";
I.top=(C.offsetTop+C.offsetHeight)+"px";
B.updateWCH(G);
B.bEventShowHistory=true
};
Zapatec.Calendar.showYearsCombo=function(D){var A=Zapatec.Calendar._C;
if(!A){return false
}var C=A.activeDiv;
var F=A.yearsCombo;
if(A.hilitedYear){Zapatec.Utils.removeClass(A.hilitedYear,"hilite")
}if(A.activeYear){Zapatec.Utils.removeClass(A.activeYear,"active")
}A.activeYear=null;
var B=A.date.getFullYear()+(D?1:-1);
var I=F.firstChild;
var H=false;
for(var E=12;
E>0;
--E){if(B>=A.minYear&&B<=A.maxYear){I.firstChild.data=B;
I.year=B;
I.style.display="none";
H=true
}else{I.style.display="none"
}I=I.nextSibling;
B+=D?A.yearStep:-A.yearStep
}if(H){var J=F.style;
J.display="none";
if(C.navtype<0){J.left=C.offsetLeft+"px"
}else{var G=F.offsetWidth;
if(typeof G=="undefined"){G=50
}J.left=(C.offsetLeft+C.offsetWidth-G)+"px"
}J.top=(C.offsetTop+C.offsetHeight)+"px"
}A.updateWCH(F)
};
Zapatec.Calendar.tableMouseUp=function(E){var H=Zapatec.Calendar._C;
if(!H){return false
}if(H.timeout){clearTimeout(H.timeout)
}var D=H.activeDiv;
if(!D){return false
}var G=Zapatec.Utils.getTargetElement(E);
if(typeof (D.navtype)=="undefined"){while(!G.calendar){G=G.parentNode
}}E||(E=window.event);
Zapatec.Utils.removeClass(D,"active");
if(G==D||G.parentNode==D){Zapatec.Calendar.cellClick(D,E)
}var C=Zapatec.Calendar.findMonth(G);
var A=null;
if(C){if(!C.disabled){A=new Date(H.date);
if(C.month!=A.getMonth()){A.setMonth(C.month);
H.setDate(A,true);
H.dateClicked=false;
H.callHandler()
}}}else{var B=Zapatec.Calendar.findYear(G);
if(B){A=new Date(H.date);
if(B.year!=A.getFullYear()){A.setFullYear(B.year);
H.setDate(A,true);
H.dateClicked=false;
H.callHandler()
}}else{var F=Zapatec.Calendar.findHist(G);
if(F&&!F.histDate.dateEqualsTo(H.date)){A=new Date(F.histDate);
H._init(H.firstDayOfWeek,H.date=A);
H.dateClicked=false;
H.callHandler();
H.updateHistory()
}}}Zapatec.Utils.removeEvent(window.document,"mouseup",Zapatec.Calendar.tableMouseUp);
Zapatec.Utils.removeEvent(window.document,"mouseover",Zapatec.Calendar.tableMouseOver);
Zapatec.Utils.removeEvent(window.document,"mousemove",Zapatec.Calendar.tableMouseOver);
H._hideCombos();
Zapatec.Calendar._C=null;
return Zapatec.Utils.stopEvent(E)
};
Zapatec.Calendar.tableMouseOver=function(U){var M=Zapatec.Calendar._C;
if(!M){return 
}var D=M.activeDiv;
var W=Zapatec.Utils.getTargetElement(U);
if(W==D||W.parentNode==D){Zapatec.Utils.addClass(D,"hilite active");
Zapatec.Utils.addClass(D.parentNode,"rowhilite")
}else{if(typeof D.navtype=="undefined"||(D.navtype!=50&&((D.navtype==0&&!M.histCombo)||Math.abs(D.navtype)>2))){Zapatec.Utils.removeClass(D,"active")
}Zapatec.Utils.removeClass(D,"hilite");
Zapatec.Utils.removeClass(D.parentNode,"rowhilite")
}U||(U=window.event);
if(D.navtype==50&&W!=D){var G=Zapatec.Utils.getAbsolutePos(D);
var J=D.offsetWidth;
var I=U.clientX;
var L;
var A=true;
if(I>G.x+J){L=I-G.x-J;
A=false
}else{L=G.x-I
}if(L<0){L=0
}var N=D._range;
var P=D._current;
var V=M.date;
var T=(V.getHours()>=12);
var B=D.firstChild.data;
var H=Math.floor(L/10)%N.length;
for(var S=N.length;
--S>=0;
){if(N[S]==P){break
}}while(H-->0){if(A){if(--S<0){S=N.length-1
}}else{if(++S>=N.length){S=0
}}}if(M.getDateStatus){var O=null;
var F=null;
var C=new Date(V);
if(D.className.indexOf("ampm",0)!=-1){O=V.getMinutes();
if(B!=N[S]){F=(N[S]=="pm")?((V.getHours()==0)?(12):(V.getHours()+12)):(V.getHours()-12)
}else{F=V.getHours()
}C.setHours(F)
}if(D.className.indexOf("hour",0)!=-1){O=V.getMinutes();
F=(!M.time24)?((T)?((N[S]!=12)?(parseInt(N[S],10)+12):(12)):((N[S]!=12)?(N[S]):(0))):(N[S]);
C.setHours(F)
}if(D.className.indexOf("minute",0)!=-1){F=V.getHours();
O=N[S];
C.setMinutes(O)
}}var Q=false;
if(M.getDateStatus){Q=M.getDateStatus(C,V.getFullYear(),V.getMonth(),V.getDate(),parseInt(F,10),parseInt(O,10))
}if(Q==false){if(!((!M.time24)&&(N[S]=="pm")&&(F>23))){D.firstChild.data=N[S]
}}M.onUpdateTime()
}var R=Zapatec.Calendar.findMonth(W);
if(R){if(!R.disabled){if(R.month!=M.date.getMonth()){if(M.hilitedMonth){Zapatec.Utils.removeClass(M.hilitedMonth,"hilite")
}Zapatec.Utils.addClass(R,"hilite");
M.hilitedMonth=R
}else{if(M.hilitedMonth){Zapatec.Utils.removeClass(M.hilitedMonth,"hilite")
}}}}else{if(M.hilitedMonth){Zapatec.Utils.removeClass(M.hilitedMonth,"hilite")
}var K=Zapatec.Calendar.findYear(W);
if(K){if(K.year!=M.date.getFullYear()){if(M.hilitedYear){Zapatec.Utils.removeClass(M.hilitedYear,"hilite")
}Zapatec.Utils.addClass(K,"hilite");
M.hilitedYear=K
}else{if(M.hilitedYear){Zapatec.Utils.removeClass(M.hilitedYear,"hilite")
}}}else{if(M.hilitedYear){Zapatec.Utils.removeClass(M.hilitedYear,"hilite")
}var E=Zapatec.Calendar.findHist(W);
if(E){if(!E.histDate.dateEqualsTo(M.date)){if(M.hilitedHist){Zapatec.Utils.removeClass(M.hilitedHist,"hilite")
}Zapatec.Utils.addClass(E,"hilite");
M.hilitedHist=E
}else{if(M.hilitedHist){Zapatec.Utils.removeClass(M.hilitedHist,"hilite")
}}}else{if(M.hilitedHist){Zapatec.Utils.removeClass(M.hilitedHist,"hilite")
}}}}return Zapatec.Utils.stopEvent(U)
};
Zapatec.Calendar.tableMouseDown=function(A){if(Zapatec.Utils.getTargetElement(A)==Zapatec.Utils.getElement(A)){return Zapatec.Utils.stopEvent(A)
}};
Zapatec.Calendar.calDragIt=function(D){D||(D=window.event);
var E=Zapatec.Calendar._C;
if(!(E&&E.dragging)){return false
}var G=D.clientX+window.document.body.scrollLeft;
var F=D.clientY+window.document.body.scrollTop;
E.hideShowCovered();
var C=E.element.style,A=G-E.xOffs,B=F-E.yOffs;
C.left=A+"px";
C.top=B+"px";
Zapatec.Utils.setupWCH(E.WCH,A,B);
return Zapatec.Utils.stopEvent(D)
};
Zapatec.Calendar.calDragEnd=function(A){var B=Zapatec.Calendar._C;
if(!B){return false
}B.dragging=false;
Zapatec.Utils.removeEvent(window.document,"mousemove",Zapatec.Calendar.calDragIt);
Zapatec.Utils.removeEvent(window.document,"mouseover",Zapatec.Calendar.calDragIt);
Zapatec.Utils.removeEvent(window.document,"mouseup",Zapatec.Calendar.calDragEnd);
Zapatec.Calendar.tableMouseUp(A);
B.hideShowCovered()
};
Zapatec.Calendar.dayMouseDown=function(C){var A=true;
var B=Zapatec.Utils.getElement(C);
if(B.disabled){return false
}var D=B.calendar;
while(!D){B=B.parentNode;
D=B.calendar
}D.bEventShowHistory=false;
D.activeDiv=B;
Zapatec.Calendar._C=D;
if(B.navtype!=300){if(B.navtype==50){if(!((D.timeInterval==null)||((D.timeInterval<60)&&(B.className.indexOf("hour",0)!=-1)))){A=false
}B._current=B.firstChild.data;
if(A){Zapatec.Utils.addEvent(window.document,"mousemove",Zapatec.Calendar.tableMouseOver)
}}else{if(((B.navtype==201)||(B.navtype==202))&&(D.timeInterval>30)&&(B.timePart.className.indexOf("minute",0)!=-1)){A=false
}if(A){Zapatec.Utils.addEvent(window.document,Zapatec.is_ie5?"mousemove":"mouseover",Zapatec.Calendar.tableMouseOver)
}}if(A){Zapatec.Utils.addClass(B,"hilite active")
}Zapatec.Utils.addEvent(window.document,"mouseup",Zapatec.Calendar.tableMouseUp)
}else{if(D.isPopup){D._dragStart(C)
}else{Zapatec.Calendar._C=null
}}if(B.navtype==-1||B.navtype==1){if(D.timeout){clearTimeout(D.timeout)
}D.timeout=setTimeout("Zapatec.Calendar.showMonthsCombo()",250)
}else{if(B.navtype==-2||B.navtype==2){if(D.timeout){clearTimeout(D.timeout)
}D.timeout=setTimeout((B.navtype>0)?"Zapatec.Calendar.showYearsCombo(true)":"Zapatec.Calendar.showYearsCombo(false)",250)
}else{if(B.navtype==0&&Zapatec.Calendar.prefs.history){if(D.timeout){clearTimeout(D.timeout)
}D.timeout=setTimeout("Zapatec.Calendar.showHistoryCombo()",250)
}else{D.timeout=null
}}}return Zapatec.Utils.stopEvent(C)
};
Zapatec.Calendar.dayMouseDblClick=function(A){Zapatec.Calendar.cellClick(Zapatec.Utils.getElement(A),A||window.event);
if(Zapatec.is_ie){window.document.selection.empty()
}};
Zapatec.Calendar.dayMouseOver=function(D){var C=Zapatec.Utils.getElement(D),A=C.caldate;
while(!C.calendar){C=C.parentNode;
A=C.caldate
}var E=C.calendar;
var B=C.timePart;
if(A){A=new Date(A[0],A[1],A[2]);
if(A.getDate()!=C.caldate[2]){A.setDate(C.caldate[2])
}}if(Zapatec.Utils.isRelated(C,D)||Zapatec.Calendar._C||C.disabled){return false
}if(C.ttip){if(C.ttip.substr(0,1)=="_"){C.ttip=A.print(C.calendar.ttDateFormat)+C.ttip.substr(1)
}C.calendar.showHint(C.ttip)
}if(C.navtype!=300){if(!((E.timeInterval==null)||(C.className.indexOf("ampm",0)!=-1)||((E.timeInterval<60)&&(C.className.indexOf("hour",0)!=-1)))&&(C.navtype==50)){return Zapatec.Utils.stopEvent(D)
}if(((C.navtype==201)||(C.navtype==202))&&(E.timeInterval>30)&&(B.className.indexOf("minute",0)!=-1)){return Zapatec.Utils.stopEvent(D)
}Zapatec.Utils.addClass(C,"hilite");
if(A){Zapatec.Utils.addClass(C.parentNode,"rowhilite")
}}return Zapatec.Utils.stopEvent(D)
};
Zapatec.Calendar.dayMouseOut=function(B){var A=Zapatec.Utils.getElement(B);
while(!A.calendar){A=A.parentNode;
caldate=A.caldate
}if(Zapatec.Utils.isRelated(A,B)||Zapatec.Calendar._C||A.disabled){return false
}Zapatec.Utils.removeClass(A,"hilite");
if(A.caldate){Zapatec.Utils.removeClass(A.parentNode,"rowhilite")
}if(A.calendar){A.calendar.showHint(Zapatec.Calendar.i18n(""))
}return Zapatec.Utils.stopEvent(B)
};
var samestate=1;
Zapatec.Calendar.cellClick=function(C,Y){var N=C.calendar;
var I=false;
var B=false;
var b=null;
if(Y!=undefined){try{if(Y.target.parentNode.rowIndex>1&&Y.target.cellIndex>=7){samestate=2
}}catch(F){if(Y.srcElement.parentNode.rowIndex>1&&Y.srcElement.cellIndex>=7){samestate=2
}}}while(!N){C=C.parentNode;
N=C.calendar
}if(typeof C.navtype=="undefined"){if(N.currentDateEl){Zapatec.Utils.removeClass(N.currentDateEl,"selected");
Zapatec.Utils.addClass(C,"selected");
I=(N.currentDateEl==C);
if(!I){N.currentDateEl=C
}}var D=new Date(C.caldate[0],C.caldate[1],C.caldate[2]);
if(D.getDate()!=C.caldate[2]){D.setDate(C.caldate[2])
}N.date.setDateOnly(D);
N.currentDate.setDateOnly(D);
b=N.date;
var K=!(N.dateClicked=!C.otherMonth);
if(!K&&N.multiple){N._toggleMultipleDate(new Date(b))
}B=true;
if(K){N._init(N.firstDayOfWeek,b)
}N.onSetTime()
}else{if(C.navtype==200){Zapatec.Utils.removeClass(C,"hilite");
N.callCloseHandler();
return 
}b=new Date(N.date);
if(C.navtype==0&&N.bEventShowHistory){b.setDateOnly(new Date())
}N.dateClicked=false;
var M=b.getFullYear();
var U=b.getMonth();
function L(g){var h=b.getDate();
var f=b.getMonthDays(g);
if(h>f){b.setDate(f)
}b.setMonth(g)
}switch(C.navtype){case 400:Zapatec.Utils.removeClass(C,"hilite");
var O=Zapatec.Calendar.i18n("ABOUT");
if(typeof O!="undefined"){O+=N.showsTime?Zapatec.Calendar.i18n("ABOUT_TIME"):""
}else{O='Help and about box text is not translated into this language.\nIf you know this language and you feel generous please update\nthe corresponding file in "lang" subdir to match calendar-en.js\nand send it back to <support@zapatec.com> to get it into the distribution  ;-)\n\nThank you!\nhttp://www.zapatec.com\n'
}return ;
case -21:if(M>N.minYear){b.setFullYear(M-1)
}break;
case -1:var Z=phpdate,E=Z.getDate(),T=Z.getFullYear(),c=Z.getMonth();
if((b>Z)){if((U>0)){if(M!=T){L(U-1)
}else{if(U!=c){L(U-1)
}}}else{if(M-->N.minYear){b.setFullYear(M);
L(11)
}}}break;
case 1:if(U<11){L(U+1)
}else{if(M<N.maxYear){b.setFullYear(M+1);
L(0)
}}break;
case 21:if(M<N.maxYear){b.setFullYear(M+1)
}break;
case 1001:N.setFirstDayOfWeek(C.fdow);
Zapatec.Calendar.prefs.fdow=N.firstDayOfWeek;
Zapatec.Calendar.savePrefs();
if(N.onFDOW){N.onFDOW(N.firstDayOfWeek)
}return ;
case 50:var b=N.currentDate;
if(C.className.indexOf("ampm",0)>=0){}else{if(!((N.timeInterval==null)||((N.timeInterval<60)&&(C.className.indexOf("hour",0)!=-1)))){break
}}var P=C._range;
var R=C.firstChild.data;
var W=(b.getHours()>=12);
for(var V=P.length;
--V>=0;
){if(P[V]==R){break
}}if(Y&&Y.shiftKey){if(--V<0){V=P.length-1
}}else{if(++V>=P.length){V=0
}}if(N.getDateStatus){var Q=null;
var H=null;
var A=new Date(b);
if(C.className.indexOf("ampm",0)!=-1){Q=b.getMinutes();
H=(P[V]=="pm")?((b.getHours()==12)?(b.getHours()):(b.getHours()+12)):(b.getHours()-12);
if(N.getDateStatus&&N.getDateStatus(A,b.getFullYear(),b.getMonth(),b.getDate(),parseInt(H,10),parseInt(Q,10))){var J;
if(P[V]=="pm"){J=-5
}else{J=5
}hours=H;
minutes=Q;
do{minutes+=J;
if(minutes>=60){minutes-=60;
++hours;
if(hours>=24){hours-=24
}A.setHours(hours)
}if(minutes<0){minutes+=60;
--hours;
if(hours<0){hours+=24
}A.setHours(hours)
}A.setMinutes(minutes);
if(!N.getDateStatus(A,b.getFullYear(),b.getMonth(),b.getDate(),parseInt(hours,10),parseInt(minutes,10))){H=hours;
Q=minutes;
if(H>12){V=1
}else{V=0
}N.date.setHours(H);
N.date.setMinutes(Q);
N.onSetTime()
}}while((H!=hours)||(Q!=minutes))
}A.setHours(H)
}if(C.className.indexOf("hour",0)!=-1){Q=b.getMinutes();
H=(!N.time24)?((W)?((P[V]!=12)?(parseInt(P[V],10)+12):(12)):((P[V]!=12)?(P[V]):(0))):(P[V]);
A.setHours(H)
}if(C.className.indexOf("minute",0)!=-1){H=b.getHours();
Q=P[V];
A.setMinutes(Q)
}}var S=false;
if(N.getDateStatus){S=N.getDateStatus(A,b.getFullYear(),b.getMonth(),b.getDate(),parseInt(H,10),parseInt(Q,10))
}if(!S){C.firstChild.data=P[V]
}N.onUpdateTime();
return ;
case 201:case 202:var X=C.timePart;
var b=N.currentDate;
if((X.className.indexOf("minute",0)!=-1)&&(N.timeInterval>30)){break
}var d=parseInt(X.firstChild.data,10);
var W=(b.getHours()>=12);
var P=X._range;
for(var V=P.length;
--V>=0;
){if(d==P[V]){d=V;
break
}}var G=X._step;
if(C.navtype==201){d=G*Math.floor(d/G);
d+=G;
if(d>=P.length){d=0
}}else{d=G*Math.ceil(d/G);
d-=G;
if(d<0){d=P.length-G
}}if(N.getDateStatus){var Q=null;
var H=null;
var A=new Date(b);
if(X.className=="hour"){Q=b.getMinutes();
H=(!N.time24)?((W)?((P[d]!=12)?(parseInt(P[d],10)+12):(12)):((P[d]!=12)?(P[d]):(0))):(P[d]);
A.setHours(H)
}if(X.className=="minute"){H=b.getHours();
Q=d;
A.setMinutes(P[d])
}}var S=false;
if(N.getDateStatus){S=N.getDateStatus(A,b.getFullYear(),b.getMonth(),b.getDate(),parseInt(H,10),parseInt(Q,10))
}if(!S){X.firstChild.data=P[d]
}N.onUpdateTime();
return ;
case 0:b=new Date();
if(N.getDateStatus&&((N.getDateStatus(b,b.getFullYear(),b.getMonth(),b.getDate())==true)||(N.getDateStatus(b,b.getFullYear(),b.getMonth(),b.getDate())=="disabled"))){return false
}break
}if(!b.equalsTo(N.date)){if((C.navtype>=-2&&C.navtype<=2)&&(C.navtype!=0)){N._init(N.firstDayOfWeek,b,true);
return 
}N.setDate(b);
B=!(C.navtype&&(C.navtype>=-2&&C.navtype<=2))
}}if(B){N.callHandler()
}if(I){Zapatec.Utils.removeClass(C,"hilite");
N.callCloseHandler()
}};
Zapatec.Calendar.prototype.create=function(J){var F=null;
if(!J){F=window.document.getElementsByTagName("body")[0];
this.isPopup=true;
this.WCH=Zapatec.Utils.createWCH()
}else{F=J;
this.isPopup=false
}this.currentDate=this.date=this.dateStr?new Date(this.dateStr):new Date();
var S=Zapatec.Utils.createElement("table");
this.table=S;
S.align="center";
S.cellSpacing=0;
S.cellPadding=0;
S.border=0;
S.calendar=this;
Zapatec.Utils.addEvent(S,"mousedown",Zapatec.Calendar.tableMouseDown);
var I=Zapatec.Utils.createElement("div");
this.element=I;
I.className="calendar";
I.id="modifcal";
if(Zapatec.is_opera){S.style.width=(this.monthsInRow*((this.weekNumbers)?(8):(7))*2+4.4*this.monthsInRow)+"em";
S.style.width=334+"px"
}if(this.isPopup){I.style.position="absolute";
I.style.display="none"
}I.appendChild(S);
var T=1;
var U=1;
var C=null;
var E=null;
var H=this;
var D=function(Z,Y,X){C=Zapatec.Utils.createElement("td",E);
Zapatec.Utils.addClass(E,"gap");
C.colSpan=Y;
C.className="title";
if(Math.abs(X)<=2){C.className+=" nav"
}Zapatec.Calendar._add_evs(C);
C.calendar=H;
C.navtype=X;
if(Z.substr(0,1)!="&"){C.appendChild(document.createTextNode(Z));
if(Z.indexOf("close")!=-1){C.innerHTML="";
C.className="close-cal"
}}else{U+=1;
if(T==1){if(Z.indexOf("2039")!=-1){C.className+=" prev";
T=0
}}if(U==5){if(Z.indexOf("203a")!=-1){C.className+=" next"
}}}return C
};
var V=((this.weekNumbers)?(8):(7))*this.monthsInRow-2;
var R=Zapatec.Utils.createElement("thead",S);
if(this.numberMonths==1){this.title=R
}E=Zapatec.Utils.createElement("tr",R);
if(this.helpButton){D(" ",1,400).ttip=Zapatec.Calendar.i18n("INFO")
}else{C=Zapatec.Utils.createElement("td",E);
C.colSpan=1;
C.className="button";
C.innerHTML="<p> </p>"
}this.title=D(" ",V,300);
this.title.className="title";
if(this.isPopup){this.title.ttip=Zapatec.Calendar.i18n("DRAG_TO_MOVE");
this.title.style.cursor="move";
a=D("close",1,200).ttip=Zapatec.Calendar.i18n("CLOSE")
}else{C=Zapatec.Utils.createElement("td",E);
C.colSpan=1;
C.className="title";
C.innerHTML="<p> </p>"
}if(this.params&&this.params.titleHtml){this.title.innerHTML=this.params.titleHtml
}E=Zapatec.Utils.createElement("tr",R);
var W=Math.floor(this.numberMonths/this.monthsInRow);
if(this.numberMonths%this.monthsInRow>0){++W
}for(var K=1;
K<=W;
++K){var R=Zapatec.Utils.createElement("thead",S);
if(Zapatec.is_opera){R.style.display="table-row-group"
}if(this.numberMonths!=1){E=Zapatec.Utils.createElement("tr",R);
var V=5;
this.weekNumbers&&++V;
this.titles[K]=new Array();
for(var L=1;
(L<=this.monthsInRow)&&((K-1)*this.monthsInRow+L<=this.numberMonths);
++L){this._nav_pm=D("&#x2039",1,-1);
this._nav_pm.ttip=Zapatec.Calendar.i18n("PREV_MONTH");
this.titles[K][L]=D("",V,300);
this.titles[K][L].className="title";
this._nav_nm=D("&#x203a;",1,1);
this._nav_nm.ttip=Zapatec.Calendar.i18n("NEXT_MONTH")
}}E=Zapatec.Utils.createElement("tr",R);
E.className="daynames";
for(L=1;
(L<=this.monthsInRow)&&((K-1)*this.monthsInRow+L<=this.numberMonths);
++L){if(this.weekNumbers){C=Zapatec.Utils.createElement("td",E);
C.className="name wn";
C.appendChild(window.document.createTextNode(Zapatec.Calendar.i18n("WK")));
if(L>1){Zapatec.Utils.addClass(C,"month-left-border")
}var Q=Zapatec.Calendar.i18n("WK");
if(Q==null){Q=""
}}for(var P=7;
P>0;
--P){C=Zapatec.Utils.createElement("td",E);
C.appendChild(window.document.createTextNode(""))
}}this.firstdayname=E.childNodes[this.weekNumbers?1:0];
this.rowsOfDayNames[K]=this.firstdayname;
this._displayWeekdays();
var B=Zapatec.Utils.createElement("tbody",S);
this.tbody[K]=B;
for(P=6;
P>0;
--P){E=Zapatec.Utils.createElement("tr",B);
for(L=1;
(L<=this.monthsInRow)&&((K-1)*this.monthsInRow+L<=this.numberMonths);
++L){if(this.weekNumbers){C=Zapatec.Utils.createElement("td",E);
C.appendChild(document.createTextNode(""))
}for(var M=7;
M>0;
--M){C=Zapatec.Utils.createElement("td",E);
C.appendChild(document.createTextNode(""));
C.calendar=this;
Zapatec.Calendar._add_evs(C)
}}}}var G=Zapatec.Utils.createElement("tfoot",S);
if(this.showsTime){E=Zapatec.Utils.createElement("tr",G);
E.className="time";
var A;
if(this.monthsInRow!=1){C=Zapatec.Utils.createElement("td",E);
A=C.colSpan=Math.ceil((((this.weekNumbers)?8:7)*(this.monthsInRow-1))/2);
C.className="timetext";
C.innerHTML=" "
}C=Zapatec.Utils.createElement("td",E);
C.className="timetext";
C.colSpan=this.weekNumbers?2:1;
C.innerHTML=Zapatec.Calendar.i18n("TIME")||" ";
(function(){function d(s,x,l,w){var y,r,u,n,m;
if(w){C=Zapatec.Utils.createElement("td",E);
C.colSpan=1;
if(H.showsTime!="seconds"){++C.colSpan
}C.className="parent-"+s;
y=Zapatec.Utils.createElement("table",C);
y.cellSpacing=y.cellPadding=0;
if(s=="hour"){y.align="right"
}y.className="calendar-time-scroller";
r=Zapatec.Utils.createElement("tbody",y);
u=Zapatec.Utils.createElement("tr",r);
n=Zapatec.Utils.createElement("tr",r)
}else{u=E
}m=Zapatec.Utils.createElement("td",u);
m.className=s;
m.appendChild(window.document.createTextNode(x));
m.calendar=H;
m.ttip=Zapatec.Calendar.i18n("TIME_PART");
m.navtype=50;
m._range=[];
if(!w){m._range=l
}else{m.rowSpan=2;
for(var q=l;
q<=w;
++q){var p;
if(q<10&&w>=10){p="0"+q
}else{p=""+q
}m._range[m._range.length]=p
}var o=Zapatec.Utils.createElement("td",u);
o.className="up";
o.navtype=201;
o.calendar=H;
o.timePart=m;
if(Zapatec.is_khtml){o.innerHTML=" "
}Zapatec.Calendar._add_evs(o);
var v=Zapatec.Utils.createElement("td",n);
v.className="down";
v.navtype=202;
v.calendar=H;
v.timePart=m;
if(Zapatec.is_khtml){v.innerHTML=" "
}Zapatec.Calendar._add_evs(v)
}Zapatec.Calendar._add_evs(m);
return m
}var h=H.currentDate.getHours();
var X=H.currentDate.getMinutes();
if(H.showsTime=="seconds"){var b=H.currentDate.getSeconds()
}var i=!H.time24;
var Y=(h>12);
if(i&&Y){h-=12
}var f=d("hour",h,i?1:0,i?12:23);
f._step=(H.timeInterval>30)?(H.timeInterval/60):1;
C=Zapatec.Utils.createElement("td",E);
C.innerHTML=":";
C.className="colon";
var c=d("minute",X,0,59);
c._step=((H.timeInterval)&&(H.timeInterval<60))?(H.timeInterval):5;
if(H.showsTime=="seconds"){C=Zapatec.Utils.createElement("td",E);
C.innerHTML=":";
C.className="colon";
var Z=d("minute",b,0,59);
Z._step=5
}var g=null;
if(i){g=d("ampm",Y?"pm":"am",["am","pm"]);
g.className+=" button"
}else{Zapatec.Utils.createElement("td",E).innerHTML=" "
}H.onSetTime=function(){var o=this.currentDate.getHours();
var p=this.currentDate.getMinutes();
if(this.showsTime=="seconds"){var n=H.currentDate.getSeconds()
}if(this.timeInterval){p+=this.timeInterval-((p-1+this.timeInterval)%this.timeInterval)-1
}while(p>=60){p-=60;
++o
}if(this.timeInterval>60){var l=this.timeInterval/60;
if(o%l!=0){o+=l-((o-1+l)%l)-1
}if(o>=24){o-=24
}}var q=new Date(this.currentDate);
if(this.getDateStatus&&this.getDateStatus(this.currentDate,this.currentDate.getFullYear(),this.currentDate.getMonth(),this.currentDate.getDate(),o,p)){hours=o;
minutes=p;
do{if(this.timeInterval){if(this.timeInterval<60){minutes+=this.timeInterval
}else{o+=this.timeInterval/60
}}else{minutes+=5
}if(minutes>=60){minutes-=60;
hours+=1
}if(hours>=24){hours-=24
}q.setMinutes(minutes);
q.setHours(hours);
if(!this.getDateStatus(q,this.currentDate.getFullYear(),this.currentDate.getMonth(),this.currentDate.getDate(),hours,minutes)){o=hours;
p=minutes
}}while((o!=hours)||(p!=minutes))
}this.currentDate.setMinutes(p);
this.currentDate.setHours(o);
var m=(o>=12);
if(m&&i&&o!=12){o-=12
}if(!m&&i&&o==0){o=12
}f.firstChild.data=(o<10)?("0"+o):o;
c.firstChild.data=(p<10)?("0"+p):p;
if(this.showsTime=="seconds"){Z.firstChild.data=(n<10)?("0"+n):n
}if(i){g.firstChild.data=m?"pm":"am"
}};
H.onUpdateTime=function(){var n=this.currentDate;
var o=parseInt(f.firstChild.data,10);
if(i){if(/pm/i.test(g.firstChild.data)&&o<12){o+=12
}else{if(/am/i.test(g.firstChild.data)&&o==12){o=0
}}}var p=n.getDate();
var l=n.getMonth();
var q=n.getFullYear();
n.setHours(o);
n.setMinutes(parseInt(c.firstChild.data,10));
if(this.showsTime=="seconds"){n.setSeconds(parseInt(Z.firstChild.data,10))
}n.setFullYear(q);
n.setMonth(l);
n.setDate(p);
this.dateClicked=false;
this.callHandler()
}
})();
if(this.monthsInRow!=1){C=Zapatec.Utils.createElement("td",E);
C.colSpan=((this.weekNumbers)?8:7)*(this.monthsInRow-1)-Math.ceil(A);
C.className="timetext";
C.innerHTML=" "
}}else{this.onSetTime=this.onUpdateTime=function(){}
}E=Zapatec.Utils.createElement("tr",G);
E.className="footrow";
C=D(Zapatec.Calendar.i18n(""),this.weekNumbers?(8*this.numberMonths):(7*this.numberMonths),300);
C.className="ttip";
if(this.isPopup){C.ttip=Zapatec.Calendar.i18n("DRAG_TO_MOVE");
C.style.cursor="move"
}this.tooltips=C;
I=this.monthsCombo=Zapatec.Utils.createElement("div",this.element);
I.className="combo";
for(P=0;
P<12;
++P){var O=Zapatec.Utils.createElement("div");
O.className=Zapatec.is_ie?"label-IEfix":"label";
O.month=P;
O.appendChild(window.document.createTextNode(Zapatec.Calendar.i18n(P,"smn")));
I.appendChild(O)
}I=this.yearsCombo=Zapatec.Utils.createElement("div",this.element);
I.className="combo";
for(P=12;
P>0;
--P){var N=Zapatec.Utils.createElement("div");
N.className=Zapatec.is_ie?"label-IEfix":"label";
N.appendChild(window.document.createTextNode(""));
I.appendChild(N)
}I=this.histCombo=Zapatec.Utils.createElement("div",this.element);
I.className="combo history";
this._init(this.firstDayOfWeek,this.date);
F.appendChild(this.element)
};
Zapatec.Calendar._keyEvent=function(D){if(!window.calendar){return false
}(Zapatec.is_ie)&&(D=window.event);
var E=window.calendar;
if(D.keyCode==9){E.callCloseHandler();
return 
}var B=(Zapatec.is_ie||D.type=="keypress");
var A=D.keyCode;
var C=new Date(E.date);
var F=new Date();
if(D.ctrlKey){switch(A){case 37:Zapatec.Utils.stopEvent(D);
break;
case 38:B&&Zapatec.Calendar.cellClick(E._nav_py);
break;
case 32:B&&E.callCloseHandler();
break;
case 39:B&&Zapatec.Calendar.cellClick(E._nav_nm);
break;
case 40:B&&Zapatec.Calendar.cellClick(E._nav_ny);
break;
default:return false
}}else{switch(A){case 32:B&&E.callCloseHandler();
break;
case 27:B&&E.callCloseHandler();
break;
case 37:if(B&&!E.multiple){C.setTime(C.getTime()-86400000);
E.setDate(C)
}break;
case 38:if(B&&!E.multiple){C.setTime(C.getTime()-7*86400000);
E.setDate(C)
}break;
case 39:if(B&&!E.multiple){C.setTime(C.getTime()+86400000);
E.setDate(C)
}break;
case 40:if(B&&!E.multiple){C.setTime(C.getTime()+7*86400000);
E.setDate(C)
}break;
case 13:if(B){if((C==F)||(C>F)){Zapatec.Utils.stopEvent(D);
Zapatec.Calendar.cellClick(E.currentDateEl)
}else{Zapatec.Utils.stopEvent(D);
Zapatec.Calendar.cellClick(E.currentDateEl)
}}break;
default:return false
}}return Zapatec.Utils.stopEvent(D)
};
Zapatec.Calendar.prototype._init=function(Q,w,N){var I=new Date(),s=I.getDate(),c=I.getFullYear(),n=I.getMonth();
if(this.getDateStatus&&!N){var Z=this.getDateStatus(w,w.getFullYear(),w.getMonth(),w.getDate());
var F=new Date(w);
while(((Z==true)||(Z=="disabled"))&&(F.getMonth()==w.getMonth())){w.setTime(w.getTime()+86400000);
var Z=this.getDateStatus(w,w.getFullYear(),w.getMonth(),w.getDate())
}if(F.getMonth()!=w.getMonth()){w=new Date(F);
while(((Z==true)||(Z=="disabled"))&&(F.getMonth()==w.getMonth())){w.setTime(w.getTime()-86400000);
var Z=this.getDateStatus(w,w.getFullYear(),w.getMonth(),w.getDate())
}}if(F.getMonth()!=w.getMonth()){N=true;
w=new Date(F)
}}var E=w.getFullYear();
var A=w.getMonth();
var y=Math.floor(this.numberMonths/this.monthsInRow);
var P;
var U,b,K;
if(!this.vertical){U=(this.controlMonth-1);
P=A-U
}else{b=((this.numberMonths-1)%this.monthsInRow)+1;
K=(this.controlMonth-1)%this.monthsInRow;
bottom=(K>=(b)?(b):(K));
U=(K)*(y-1)+Math.floor((this.controlMonth-1)/this.monthsInRow)+bottom;
P=A-U
}var M=E;
if(P<0){P+=12;
--M
}var V=P+this.numberMonths-1;
var T=M;
if(V>11){V-=12;
++T
}function W(i){Zapatec.Calendar._del_evs(i);
i.disabled=true;
i.className="button";
i.innerHTML="<p> </p>"
}function D(l,i){Zapatec.Calendar._add_evs(l);
l.disabled=false;
l.className="button nav";
l.innerHTML=i
}upperMonth=this.maxMonth+1;
upperYear=this.maxYear;
if(upperMonth>11){upperMonth-=12;
++upperYear
}bottomMonth=this.minMonth-1;
bottomYear=this.minYear;
if(bottomMonth<0){bottomMonth+=12;
--bottomYear
}maxDate1=new Date(T,V,w.getMonthDays(V),23,59,59,999);
maxDate2=new Date(upperYear,upperMonth,1,0,0,0,0);
minDate1=new Date(M,P,1,0,0,0,0);
minDate2=new Date(bottomYear,bottomMonth,w.getMonthDays(bottomMonth),23,59,59,999);
if(maxDate1.getTime()>maxDate2.getTime()){w.setTime(w.getTime()-(maxDate1.getTime()-maxDate2.getTime()))
}if(minDate1.getTime()<minDate2.getTime()){w.setTime(w.getTime()+(minDate2.getTime()-minDate1.getTime()))
}delete maxDate1;
delete maxDate2;
delete minDate1;
delete minDate2;
this.firstDayOfWeek=Q;
if(!N){this.currentDate=w
}this.date=w;
(this.date=new Date(this.date)).setDateOnly(w);
E=this.date.getFullYear();
A=this.date.getMonth();
var H=w.getMonth();
var G=this.date.getDate();
var g=w.getMonthDays();
var S=new Array();
var R=new Date();
if(this.numberMonths%this.monthsInRow>0){++y
}for(var q=1;
q<=y;
++q){S[q]=new Array();
for(var r=1;
(r<=this.monthsInRow)&&((q-1)*this.monthsInRow+r<=this.numberMonths);
++r){var f=new Date(w);
if(this.vertical){var x=w.getMonth()-U+((r-1)*(y-1)+(q-1)+((b<r)?(b):(r-1)))
}else{var x=w.getMonth()-U+(q-1)*this.monthsInRow+r-1
}if(x<0){f.setFullYear(f.getFullYear()-1);
x=12+x
}if(x>11){f.setFullYear(f.getFullYear()+1);
x=x-12
}f.setDate(1);
f.setMonth(x);
var o=(f.getDay()-this.firstDayOfWeek)%7;
if(o<0){o+=7
}f.setDate(-o);
f.setDate(f.getDate()+1);
S[q][r]=f
}}var B=Zapatec.Calendar.i18n(A,"smn");
var C=Zapatec.Calendar.i18n("WEEKEND");
var p=this.multiple?(this.datesCells={}):null;
var h=this.getDateText;
for(var q=1;
q<=y;
++q){var J=this.tbody[q].firstChild;
for(var u=7;
--u>0;
J=J.nextSibling){var X=J.firstChild;
var z=false;
for(var r=1;
(r<=this.monthsInRow)&&((q-1)*this.monthsInRow+r<=this.numberMonths);
++r){w=S[q][r];
if(this.weekNumbers){X.className=" day wn";
X.innerHTML=w.getWeekNumber();
if(r>1){Zapatec.Utils.addClass(X,"month-left-border")
}X=X.nextSibling
}J.className="daysrow";
var Y;
for(j=7;
X&&(Y=w.getDate())&&(j>0);
w.setDate(Y+1),((w.getDate()==Y)?(w.setHours(1)&&w.setDate(Y+1)):(false)),X=X.nextSibling,--j){var L=w.getDay(),d=w.getMonth(),m=w.getFullYear();
X.className=" day";
if((!this.weekNumbers)&&(j==7)&&(r!=1)){Zapatec.Utils.addClass(X,"month-left-border")
}if((j==1)&&(r!=this.monthsInRow)){Zapatec.Utils.addClass(X,"month-right-border");
X.width=15
}if(this.vertical){x=H-U+((r-1)*(y-1)+(q-1)+((b<r)?(b):(r-1)))
}else{x=H-U+((q-1)*this.monthsInRow+r-1)
}if(x<0){x=12+x
}if(x>11){x=x-12
}var v=!(X.otherMonth=!(d==x));
if(!v){if(this.showsOtherMonths){X.className+=" othermonth"
}else{X.innerHTML="<p> </p>";
X.disabled=true;
continue
}}else{z=true
}X.disabled=false;
X.innerHTML=h?h(w,m,d,Y):Y;
p&&(p[w.print("%Y%m%d")]=X);
if(this.getDateStatus){var Z=this.getDateStatus(w,m,d,Y);
if(this.getDateToolTip){var O=this.getDateToolTip(w,m,d,Y);
if(O){X.title=O
}}if(Z==true){X.className+=" disabled";
X.disabled=true
}else{if(/disabled/i.test(Z)){X.disabled=true
}X.className+=" "+Z
}}if(!X.disabled){X.caldate=[m,d,Y];
X.ttip="_";
if(!this.multiple&&v&&Y==this.currentDate.getDate()&&this.hiliteToday&&(d==this.currentDate.getMonth())&&(m==this.currentDate.getFullYear())){X.className+=" selected";
this.currentDateEl=X
}if(m==c&&d==n&&Y==s){X.className+=" today";
X.ttip+=Zapatec.Calendar.i18n("PART_TODAY")
}if((C!=null)&&(C.indexOf(L.toString())!=-1)){X.className+=X.otherMonth?" oweekend":" weekend"
}}}if(!(z||this.showsOtherMonths)){J.className="daysrow"
}}if((u==1)&&(q<y)){if(J.className=="emptyrow"){J=J.previousSibling
}X=J.firstChild;
while(X!=null){Zapatec.Utils.addClass(X,"month-bottom-border");
X=X.nextSibling
}}}}if(this.numberMonths==1){this.title.innerHTML=Zapatec.Calendar.i18n(A,"mn")+", "+E
}else{for(var q=1;
q<=y;
++q){for(var r=1;
(r<=this.monthsInRow)&&((q-1)*this.monthsInRow+r<=this.numberMonths);
++r){if(this.vertical){x=A-U+((r-1)*(y-1)+(q-1)+((b<r)?(b):(r-1)))
}else{x=A-U+(q-1)*this.monthsInRow+r-1
}validYear=E;
if(x<0){--validYear;
x=12+x
}if(x>11){++validYear;
x=x-12
}this.titles[q][r].innerHTML=Zapatec.Calendar.i18n(x,"mn")+", "+validYear
}}}this.onSetTime();
this._initMultipleDates();
this.updateWCH()
};
Zapatec.Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var B in this.multiple){var A=this.datesCells[B];
var C=this.multiple[B];
if(!C){continue
}if(A){A.className+=" selected"
}}}};
Zapatec.Calendar.prototype._toggleMultipleDate=function(B){if(this.multiple){var C=B.print("%Y%m%d");
var A=this.datesCells[C];
if(A){var D=this.multiple[C];
if(!D){Zapatec.Utils.addClass(A,"selected");
this.multiple[C]=B
}else{Zapatec.Utils.removeClass(A,"selected");
delete this.multiple[C]
}}}};
Zapatec.Calendar.prototype.setDateToolTipHandler=function(A){this.getDateToolTip=A
};
Zapatec.Calendar.prototype.setDate=function(B,D){if(!B){B=new Date()
}if(!B.equalsTo(this.date)){var C=B.getFullYear(),A=B.getMonth();
if(C==this.minYear&&A<this.minMonth){this.showHint("<div class='error'>"+Zapatec.Calendar.i18n("E_RANGE")+" ���</div>")
}else{if(C==this.maxYear&&A>this.maxMonth){this.showHint("<div class='error'>��� "+Zapatec.Calendar.i18n("E_RANGE")+"</div>")
}}this._init(this.firstDayOfWeek,B,D)
}};
Zapatec.Calendar.prototype.showHint=function(A){this.tooltips.innerHTML=A
};
Zapatec.Calendar.prototype.reinit=function(){this._init(this.firstDayOfWeek,this.date)
};
Zapatec.Calendar.prototype.refresh=function(){var B=this.isPopup?null:this.element.parentNode;
var A=parseInt(this.element.style.left);
var C=parseInt(this.element.style.top);
this.destroy();
this.dateStr=this.date;
this.create(B);
if(this.isPopup){this.showAt(A,C)
}else{this.show()
}};
Zapatec.Calendar.prototype.setFirstDayOfWeek=function(B){if(this.firstDayOfWeek!=B){this._init(B,this.date);
var C=Math.floor(this.numberMonths/this.monthsInRow);
if(this.numberMonths%this.monthsInRow>0){++C
}for(var A=1;
A<=C;
++A){this.firstdayname=this.rowsOfDayNames[A];
this._displayWeekdays()
}}};
Zapatec.Calendar.prototype.setDateStatusHandler=Zapatec.Calendar.prototype.setDisabledHandler=function(A){this.getDateStatus=A
};
Zapatec.Calendar.prototype.setRange=function(C,E){var B,D=Math.min(C,E),F=Math.max(C,E);
this.minYear=B=Math.floor(D);
this.minMonth=(B==D)?0:Math.ceil((D-B)*100-1);
this.maxYear=B=Math.floor(F);
this.maxMonth=(B==F)?11:Math.ceil((F-B)*100-1)
};
Zapatec.Calendar.prototype.setMultipleDates=function(A){if(!A||typeof A=="undefined"){return 
}this.multiple={};
for(var B=A.length;
--B>=0;
){var D=A[B];
var C=D.print("%Y%m%d");
this.multiple[C]=D
}};
Zapatec.Calendar.prototype.submitFlatDates=function(){if(typeof this.params.flatCallback=="function"){Zapatec.Utils.sortOrder=(this.sortOrder!="asc"&&this.sortOrder!="desc"&&this.sortOrder!="none")?"none":this.sortOrder;
if(this.multiple&&(Zapatec.Utils.sortOrder!="none")){var D=new Array();
for(var B in this.multiple){var A=this.multiple[B];
if(A){D[D.length]=A
}D.sort(Zapatec.Utils.compareDates)
}this.multiple={};
for(var B=0;
B<D.length;
B++){var E=D[B];
var C=E.print("%Y%m%d");
this.multiple[C]=E
}}this.params.flatCallback(this)
}};
Zapatec.Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat))
}};
Zapatec.Calendar.prototype.updateHistory=function(){var B,D,G,C,E,F="",A=Zapatec.Calendar.prefs.hsize-1;
if(Zapatec.Calendar.prefs.history){B=Zapatec.Calendar.prefs.history.split(/,/);
D=0;
while(D<A&&(C=B[D++])){E=C.split(/\//);
G=new Date(parseInt(E[0],10),parseInt(E[1],10)-1,parseInt(E[2],10),parseInt(E[3],10),parseInt(E[4],10));
if(!G.dateEqualsTo(this.date)){F+=","+C
}}}Zapatec.Calendar.prefs.history=this.date.print("%Y/%m/%d/%H/%M")+F;
Zapatec.Calendar.savePrefs()
};
Zapatec.Calendar.prototype.callCloseHandler=function(){if(this.dateClicked){this.updateHistory()
}if(this.onClose){this.onClose(this)
}this.hideShowCovered()
};
Zapatec.Calendar.prototype.destroy=function(){this.hide();
Zapatec.Utils.destroy(this.element);
Zapatec.Utils.destroy(this.WCH);
Zapatec.Calendar._C=null;
window.calendar=null
};
Zapatec.Calendar.prototype.reparent=function(B){var A=this.element;
A.parentNode.removeChild(A);
B.appendChild(A)
};
Zapatec.Calendar._checkCalendar=function(B){if(!window.calendar){return false
}var A=Zapatec.is_ie?Zapatec.Utils.getElement(B):Zapatec.Utils.getTargetElement(B);
for(;
A!=null&&A!=calendar.element;
A=A.parentNode){}if(A==null){window.calendar.callCloseHandler();
return Zapatec.Utils.stopEvent(B)
}};
Zapatec.Calendar.prototype.updateWCH=function(A){Zapatec.Utils.setupWCH_el(this.WCH,this.element,A)
};
Zapatec.Calendar.prototype.show=function(){var E=this.table.getElementsByTagName("tr");
for(var D=E.length;
D>0;
){var F=E[--D];
Zapatec.Utils.removeClass(F,"rowhilite");
var C=F.getElementsByTagName("td");
for(var B=C.length;
B>0;
){var A=C[--B];
Zapatec.Utils.removeClass(A,"hilite");
Zapatec.Utils.removeClass(A,"active")
}}this.element.style.display="block";
this.hidden=false;
if(this.isPopup){this.updateWCH();
window.calendar=this;
if(!this.noGrab){Zapatec.Utils.addEvent(window.document,"keydown",Zapatec.Calendar._keyEvent);
Zapatec.Utils.addEvent(window.document,"keypress",Zapatec.Calendar._keyEvent);
Zapatec.Utils.addEvent(window.document,"mousedown",Zapatec.Calendar._checkCalendar)
}}this.hideShowCovered()
};
Zapatec.Calendar.prototype.hide=function(){if(this.isPopup){Zapatec.Utils.removeEvent(window.document,"keydown",Zapatec.Calendar._keyEvent);
Zapatec.Utils.removeEvent(window.document,"keypress",Zapatec.Calendar._keyEvent);
Zapatec.Utils.removeEvent(window.document,"mousedown",Zapatec.Calendar._checkCalendar)
}this.element.style.display="none";
Zapatec.Utils.hideWCH(this.WCH);
this.hidden=true;
this.hideShowCovered()
};
Zapatec.Calendar.prototype.showAt=function(A,C){var B=this.element.style;
B.left=A+"px";
B.top=C+"px";
this.show()
};
Zapatec.Calendar.prototype.showAtElement=function(E,F){var B=this;
var H=Zapatec.Utils.getAbsolutePos(E);
if(!F||typeof F!="string"){this.showAt(H.x,H.y+E.offsetHeight);
return true
}this.element.style.display="block";
var A=B.element.offsetWidth;
var D=B.element.offsetHeight;
B.element.style.display="none";
var C=F.substr(0,1);
var G="l";
if(F.length>1){G=F.substr(1,1)
}switch(C){case"T":H.y-=D;
break;
case"B":H.y+=E.offsetHeight;
break;
case"C":H.y+=(E.offsetHeight-D)/2;
break;
case"t":H.y+=E.offsetHeight-D;
break;
case"b":break
}switch(G){case"L":H.x-=A;
break;
case"R":H.x+=E.offsetWidth;
break;
case"C":H.x+=(E.offsetWidth-A)/2;
break;
case"l":H.x+=E.offsetWidth-A;
break;
case"r":break
}H.width=A;
H.height=D+40;
B.monthsCombo.style.display="none";
Zapatec.Utils.fixBoxPosition(H);
B.showAt(H.x,H.y)
};
Zapatec.Calendar.prototype.setDateFormat=function(A){this.dateFormat=A
};
Zapatec.Calendar.prototype.setTtDateFormat=function(A){this.ttDateFormat=A
};
Zapatec.Calendar.prototype.parseDate=function(C,A){if(!C){return this.setDate(this.date)
}if(!A){A=this.dateFormat
}var B=Date.parseDate(C,A);
return this.setDate(B)
};
Zapatec.Calendar.prototype.hideShowCovered=function(){if(!Zapatec.is_ie5){return 
}var P=this;
function B(S){var R=S.style.visibility;
if(!R){if(window.document.defaultView&&typeof (window.document.defaultView.getComputedStyle)=="function"){if(!Zapatec.is_khtml){R=window.document.defaultView.getComputedStyle(S,"").getPropertyValue("visibility")
}else{R=""
}}else{if(S.currentStyle){R=S.currentStyle.visibility
}else{R=""
}}}return R
}var Q=["applet","iframe","select"];
var C=P.element;
var A=Zapatec.Utils.getAbsolutePos(C);
var F=A.x;
var D=C.offsetWidth+F;
var O=A.y;
var N=C.offsetHeight+O;
for(var H=Q.length;
H>0;
){var G=window.document.getElementsByTagName(Q[--H]);
var E=null;
for(var J=G.length;
J>0;
){E=G[--J];
A=Zapatec.Utils.getAbsolutePos(E);
var M=A.x;
var L=E.offsetWidth+M;
var K=A.y;
var I=E.offsetHeight+K;
if(P.hidden||(M>D)||(L<F)||(K>N)||(I<O)){if(!E.__msh_save_visibility){E.__msh_save_visibility=B(E)
}E.style.visibility=E.__msh_save_visibility
}else{if(!E.__msh_save_visibility){E.__msh_save_visibility=B(E)
}E.style.visibility="hidden"
}}}};
Zapatec.Calendar.prototype._displayWeekdays=function(){var B=this.firstDayOfWeek;
var A=this.firstdayname;
var D=Zapatec.Calendar.i18n("WEEKEND");
for(k=1;
(k<=this.monthsInRow)&&(A);
++k){for(var C=0;
C<7;
++C){A.className=" day name";
if((!this.weekNumbers)&&(C==0)&&(k!=1)){Zapatec.Utils.addClass(A,"month-left-border")
}if((C==6)&&(k!=this.monthsInRow)){Zapatec.Utils.addClass(A,"month-right-border");
A.width=15
}var E=(C+B)%7;
if((!this.disableFdowClick)&&((this.params&&this.params.fdowClick)||C)){if(Zapatec.Calendar.i18n("DAY_FIRST")!=null){A.ttip=Zapatec.Calendar.i18n("DAY_FIRST").replace("%s",Zapatec.Calendar.i18n(E,"dn"))
}A.navtype=100;
A.calendar=this;
A.fdow=E;
Zapatec.Calendar._add_evs(A)
}if((D!=null)&&(D.indexOf(E.toString())!=-1)){Zapatec.Utils.addClass(A,"weekend")
}A.innerHTML=Zapatec.Calendar.i18n((C+B)%7,"sdn");
A=A.nextSibling
}if(this.weekNumbers&&A){A=A.nextSibling
}}};
Zapatec.Utils.compareDates=function(B,A){if(Zapatec.Calendar.prefs.sortOrder=="asc"){return B-A
}else{return A-B
}};
Zapatec.Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";
this.yearsCombo.style.display="none";
this.histCombo.style.display="none";
this.updateWCH()
};
Zapatec.Calendar.prototype._dragStart=function(B){B||(B=window.event);
if(this.dragging){return 
}this.dragging=true;
var D=B.clientX+window.document.body.scrollLeft;
var C=B.clientY+window.document.body.scrollTop;
var A=this.element.style;
this.xOffs=D-parseInt(A.left);
this.yOffs=C-parseInt(A.top);
Zapatec.Utils.addEvent(window.document,"mousemove",Zapatec.Calendar.calDragIt);
Zapatec.Utils.addEvent(window.document,"mouseover",Zapatec.Calendar.calDragIt);
Zapatec.Utils.addEvent(window.document,"mouseup",Zapatec.Calendar.calDragEnd)
};
Date._MD=[31,28,31,30,31,30,31,31,30,31,30,31];
Date.SECOND=1000;
Date.MINUTE=60*Date.SECOND;
Date.HOUR=60*Date.MINUTE;
Date.DAY=24*Date.HOUR;
Date.WEEK=7*Date.DAY;
Date.prototype.getMonthDays=function(B){var A=this.getFullYear();
if(typeof B=="undefined"){B=this.getMonth()
}if(((0==(A%4))&&((0!=(A%100))||(0==(A%400))))&&B==1){return 29
}else{return Date._MD[B]
}};
Date.prototype.getDayOfYear=function(){var A=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);
var C=new Date(this.getFullYear(),0,0,0,0,0);
var B=A-C;
return Math.floor(B/Date.DAY)
};
Date.prototype.getWeekNumber=function(){var C=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);
var B=C.getDay();
C.setDate(C.getDate()-(B+6)%7+3);
var A=C.valueOf();
C.setMonth(0);
C.setDate(4);
return Math.round((A-C.valueOf())/(7*86400000))+1
};
Date.prototype.equalsTo=function(A){return((this.getFullYear()==A.getFullYear())&&(this.getMonth()==A.getMonth())&&(this.getDate()==A.getDate())&&(this.getHours()==A.getHours())&&(this.getMinutes()==A.getMinutes()))
};
Date.prototype.dateEqualsTo=function(A){return((this.getFullYear()==A.getFullYear())&&(this.getMonth()==A.getMonth())&&(this.getDate()==A.getDate()))
};
Date.prototype.setDateOnly=function(A){var B=new Date(A);
this.setDate(1);
this.setFullYear(B.getFullYear());
this.setMonth(B.getMonth());
this.setDate(B.getDate())
};
Date.prototype.print=function(I){var A=this.getMonth();
var H=this.getDate();
var J=this.getFullYear();
var L=this.getWeekNumber();
var M=this.getDay();
var Q={};
var N=this.getHours();
var B=(N>=12);
var F=(B)?(N-12):N;
var P=this.getDayOfYear();
if(F==0){F=12
}var C=this.getMinutes();
var G=this.getSeconds();
Q["%a"]=Zapatec.Calendar.i18n(M,"sdn");
Q["%A"]=Zapatec.Calendar.i18n(M,"dn");
Q["%b"]=Zapatec.Calendar.i18n(A,"smn");
Q["%B"]=Zapatec.Calendar.i18n(A,"mn");
Q["%C"]=1+Math.floor(J/100);
Q["%d"]=(H<10)?("0"+H):H;
Q["%e"]=H;
Q["%H"]=(N<10)?("0"+N):N;
Q["%I"]=(F<10)?("0"+F):F;
Q["%j"]=(P<100)?((P<10)?("00"+P):("0"+P)):P;
Q["%k"]=N?N:"0";
Q["%l"]=F;
Q["%m"]=(A<9)?("0"+(1+A)):(1+A);
Q["%M"]=(C<10)?("0"+C):C;
Q["%n"]="\n";
Q["%p"]=B?"PM":"AM";
Q["%P"]=B?"pm":"am";
Q["%s"]=Math.floor(this.getTime()/1000);
Q["%S"]=(G<10)?("0"+G):G;
Q["%t"]="\t";
Q["%U"]=Q["%W"]=Q["%V"]=(L<10)?("0"+L):L;
Q["%u"]=(M==0)?7:M;
Q["%w"]=M?M:"0";
Q["%y"]=(""+J).substr(2,2);
Q["%Y"]=J;
Q["%%"]="%";
var O=/%./g;
if(!Zapatec.is_ie5&&!Zapatec.is_khtml&&!Zapatec.is_mac_ie){return I.replace(O,function(R){return Q[R]||R
})
}var K=I.match(O);
for(var E=0;
E<K.length;
E++){var D=Q[K[E]];
if(D){O=new RegExp(K[E],"g");
I=I.replace(O,D)
}}return I
};
Date.parseDate=function(I,A){if(!I){return new Date()
}var J=0;
var B=-1;
var G=0;
var L=I.split(/\W+/);
var K=A.match(/%./g);
var F=0,E=0;
var M=0;
var D=0;
for(F=0;
F<L.length;
++F){if(!L[F]){continue
}switch(K[F]){case"%d":case"%e":G=parseInt(L[F],10);
break;
case"%m":B=parseInt(L[F],10)-1;
break;
case"%Y":case"%y":J=parseInt(L[F],10);
(J<100)&&(J+=(J>29)?1900:2000);
break;
case"%b":case"%B":for(E=0;
E<12;
++E){if(Zapatec.Calendar.i18n(E,"mn").substr(0,L[F].length).toLowerCase()==L[F].toLowerCase()){B=E;
break
}}break;
case"%H":case"%I":case"%k":case"%l":M=parseInt(L[F],10);
break;
case"%P":case"%p":if(/pm/i.test(L[F])&&M<12){M+=12
}if(/am/i.test(L[F])&&M==12){M=0
}break;
case"%M":D=parseInt(L[F],10);
break
}}var C=!isNaN(J)&&!isNaN(B)&&!isNaN(G)&&!isNaN(M)&&!isNaN(D);
if(!C){return null
}if(J!=0&&B!=-1&&G!=0){return new Date(J,B,G,M,D,0)
}J=0;
B=-1;
G=0;
for(F=0;
F<L.length;
++F){if(L[F].search(/[a-zA-Z]+/)!=-1){var N=-1;
for(E=0;
E<12;
++E){if(Zapatec.Calendar.i18n(E,"mn").substr(0,L[F].length).toLowerCase()==L[F].toLowerCase()){N=E;
break
}}if(N!=-1){if(B!=-1){G=B+1
}B=N
}}else{if(parseInt(L[F],10)<=12&&B==-1){B=L[F]-1
}else{if(parseInt(L[F],10)>31&&J==0){J=parseInt(L[F],10);
(J<100)&&(J+=(J>29)?1900:2000)
}else{if(G==0){G=L[F]
}}}}}if(J==0){var H=new Date();
J=H.getFullYear()
}if(B!=-1&&G!=0){return new Date(J,B,G,M,D,0)
}return null
};
Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;
Date.prototype.setFullYear=function(B){var A=new Date(this);
A.__msh_oldSetFullYear(B);
if(A.getMonth()!=this.getMonth()){this.setDate(28)
}this.__msh_oldSetFullYear(B)
};
Date.prototype.compareDatesOnly=function(E,D){var C=E.getYear();
var B=D.getYear();
var A=E.getMonth();
var H=D.getMonth();
var G=E.getDate();
var F=D.getDate();
if(C>B){return -1
}if(B>C){return 1
}if(A>H){return -1
}if(H>A){return 1
}if(G>F){return -1
}if(F>G){return 1
}return 0
};
window.calendar=null;
try{Zapatec.Calendar.loadPrefs()
}catch(e){}Zapatec.Setup=function(){};
Zapatec.Setup.test=true;
Zapatec.Calendar.setup=function(B){function E(J,K){if(typeof B[J]=="undefined"){B[J]=K
}}E("inputField",null);
E("displayArea",null);
E("button",null);
E("eventName","click");
E("ifFormat","%Y/%m/%d");
E("daFormat","%Y/%m/%d");
E("singleClick",true);
E("disableFunc",null);
E("dateStatusFunc",B.disableFunc);
E("dateText",null);
E("firstDay",null);
E("align","Br");
E("range",[1900,2999]);
E("weekNumbers",false);
E("flat",null);
E("flatCallback",null);
E("onSelect",null);
E("onClose",null);
E("onUpdate",null);
E("date",null);
E("showsTime",false);
E("sortOrder","asc");
E("timeFormat","24");
E("timeInterval",null);
E("electric",true);
E("step",2);
E("position",null);
E("cache",false);
E("showOthers",false);
E("multiple",null);
E("saveDate",null);
E("fdowClick",false);
E("titleHtml",null);
E("disableFdowChange",false);
if((B.numberMonths>12)||(B.numberMonths<1)){B.numberMonths=1
}else{E("numberMonths",1)
}if(B.numberMonths>1){B.showOthers=false
}B.numberMonths=parseInt(B.numberMonths,10);
if((B.controlMonth>B.numberMonths)||(B.controlMonth<1)){B.controlMonth=1
}else{E("controlMonth",samestate)
}B.controlMonth=parseInt(B.controlMonth,10);
E("vertical",false);
if(B.monthsInRow>B.numberMonths){B.monthsInRow=B.numberMonths
}E("monthsInRow",B.numberMonths);
B.monthsInRow=parseInt(B.monthsInRow,10);
if(B.multiple){B.singleClick=false
}var C=["inputField","displayArea","button"];
for(var D in C){if(typeof B[C[D]]=="string"){B[C[D]]=document.getElementById(B[C[D]])
}}if(!(B.flat||B.multiple||B.inputField||B.displayArea||B.button)){return false
}if(((B.timeInterval)&&((B.timeInterval!==Math.floor(B.timeInterval))||((60%B.timeInterval!==0)&&(B.timeInterval%60!==0))))||(B.timeInterval>360)){B.timeInterval=null
}if(B.date&&!Date.parse(B.date)){B.date=null
}if(B.saveDate){E("cookiePrefix",window.location.href+"--"+B.button.id);
var H=B.cookiePrefix;
var F=Zapatec.Utils.getCookie(H);
if(F!=null){document.getElementById(B.inputField.id).value=F
}}function G(K){var J=K.params;
var M=(K.dateClicked||J.electric);
if(M&&J.flat){if(typeof J.flatCallback=="function"){if(!J.multiple){J.flatCallback(K)
}}else{return false
}}if(M&&J.inputField){J.inputField.value=K.currentDate.print(J.ifFormat);
if(typeof J.inputField.onchange=="function"){J.inputField.onchange()
}}if(M&&J.displayArea){J.displayArea.innerHTML=K.currentDate.print(J.daFormat)
}if(M&&J.singleClick&&K.dateClicked){K.callCloseHandler()
}if(M&&typeof J.onUpdate=="function"){J.onUpdate(K)
}if(J.saveDate){var L=J.cookiePrefix;
Zapatec.Utils.writeCookie(L,J.inputField.value,null,"/",J.saveDate)
}}if(B.flat!=null){if(typeof B.flat=="string"){B.flat=document.getElementById(B.flat)
}if(!B.flat){return false
}var A=new Zapatec.Calendar(B.firstDay,B.date,B.onSelect||G);
B.disableFdowChange=null;
A.disableFdowClick=B.disableFdowChange;
A.showsOtherMonths=B.showOthers;
A.showsTime=B.showsTime;
A.time24=(B.timeFormat=="24");
A.timeInterval=B.timeInterval;
A.params=B;
A.weekNumbers=B.weekNumbers;
A.sortOrder=B.sortOrder.toLowerCase();
A.setRange(B.range[0],B.range[1]);
A.setDateStatusHandler(B.dateStatusFunc);
A.getDateText=B.dateText;
A.numberMonths=B.numberMonths;
A.controlMonth=B.controlMonth;
A.vertical=B.vertical;
A.yearStep=B.step;
A.monthsInRow=B.monthsInRow;
A.helpButton=!B.noHelp;
if(B.ifFormat){A.setDateFormat(B.ifFormat)
}if(B.inputField&&B.inputField.type=="text"&&typeof B.inputField.value=="string"){A.parseDate(B.inputField.value)
}if(B.multiple){A.setMultipleDates(B.multiple)
}A.create(B.flat);
A.show();
return A
}var I=B.button||B.displayArea||B.inputField;
I["on"+B.eventName]=function(){var J=B.inputField||B.displayArea;
var M=B.inputField?B.ifFormat:B.daFormat;
var O=false;
var N=window.calendar;
if(N&&!N.hidden){return false
}if(!(N&&B.cache)){window.calendar=N=new Zapatec.Calendar(B.firstDay,B.date,B.onSelect||G,B.onClose||function(P){if(B.cache){P.hide()
}else{P.destroy()
}});
N.disableFdowClick=B.disableFdowChange;
N.showsTime=B.showsTime;
N.time24=(B.timeFormat=="24");
N.timeInterval=B.timeInterval;
N.weekNumbers=B.weekNumbers;
N.numberMonths=B.numberMonths;
N.controlMonth=B.controlMonth;
N.vertical=B.vertical;
N.monthsInRow=B.monthsInRow;
N.historyDateFormat=B.ifFormat||B.daFormat;
N.helpButton=!B.noHelp;
O=true
}else{if(B.date){N.setDate(B.date)
}N.hide()
}if(B.multiple){N.setMultipleDates(B.multiple)
}N.showsOtherMonths=B.showOthers;
N.yearStep=B.step;
N.setRange(B.range[0],B.range[1]);
N.params=B;
N.setDateStatusHandler(B.dateStatusFunc);
N.getDateText=B.dateText;
N.setDateFormat(M);
if(O){N.create()
}if(J){var K;
if(J.value){K=J.value
}else{K=J.innerHTML
}if(K!=""){var L=Date.parseDate(J.value||J.innerHTML,M);
if(L!=null){N.setDate(L)
}}}if(!B.position){N.showAtElement(B.button||B.displayArea||B.inputField,B.align)
}else{N.showAt(B.position[0],B.position[1])
}return false
};
if(B.closeEventName){I["on"+B.closeEventName]=function(){if(window.calendar){window.calendar.callCloseHandler()
}}
}return A
};
Zapatec.Calendar._DN=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
Zapatec.Calendar._SDN=new Array("S","M","T","W","T","F","S","S");
Zapatec.Calendar._FD=0;
Zapatec.Calendar._MN=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
Zapatec.Calendar._SMN=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
Zapatec.Calendar._TT_en=Zapatec.Calendar._TT={};
Zapatec.Calendar._TT.INFO="About the calendar";
Zapatec.Calendar._TT.ABOUT="DHTML Date/Time Selector\n(c) zapatec.com 2002-2004\nFor latest version visit: http://www.zapatec.com/\n\n\nDate selection:\n- Use the \xab, \xbb buttons to select year\n- Use the "+String.fromCharCode(8249)+", "+String.fromCharCode(8250)+" buttons to select month\n- Hold mouse button on any of the above buttons for faster selection.";
Zapatec.Calendar._TT.ABOUT_TIME="\n\nTime selection:\n- Click on any of the time parts to increase it\n- or Shift-click to decrease it\n- or click and drag for faster selection.";
Zapatec.Calendar._TT.PREV_YEAR="Prev. year (hold for menu)";
Zapatec.Calendar._TT.PREV_MONTH="Prev. month (hold for menu)";
Zapatec.Calendar._TT.GO_TODAY="Go Today (hold for history)";
Zapatec.Calendar._TT.NEXT_MONTH="Next month (hold for menu)";
Zapatec.Calendar._TT.NEXT_YEAR="Next year (hold for menu)";
Zapatec.Calendar._TT.SEL_DATE="";
Zapatec.Calendar._TT.DRAG_TO_MOVE="Drag to move";
Zapatec.Calendar._TT.PART_TODAY=" (today)";
Zapatec.Calendar._TT.DAY_FIRST="Display %s first";
Zapatec.Calendar._TT.WEEKEND="0,6";
Zapatec.Calendar._TT.CLOSE="Close";
Zapatec.Calendar._TT.TODAY="Today";
Zapatec.Calendar._TT.TIME_PART="(Shift-)Click or drag to change value";
Zapatec.Calendar._TT.DEF_DATE_FORMAT="%Y-%m-%d";
Zapatec.Calendar._TT.TT_DATE_FORMAT="%a, %b %e";
Zapatec.Calendar._TT.WK="wk";
Zapatec.Calendar._TT.TIME="Time:";
Zapatec.Calendar._TT.E_RANGE="Outside the range";
if(Zapatec.Calendar._DN){Zapatec.Calendar._TT._DN=Zapatec.Calendar._DN
}if(Zapatec.Calendar._SDN){Zapatec.Calendar._TT._SDN=Zapatec.Calendar._SDN
}if(Zapatec.Calendar._SDN_len){Zapatec.Calendar._TT._SDN_len=Zapatec.Calendar._SDN_len
}if(Zapatec.Calendar._MN){Zapatec.Calendar._TT._MN=Zapatec.Calendar._MN
}if(Zapatec.Calendar._SMN){Zapatec.Calendar._TT._SMN=Zapatec.Calendar._SMN
}if(Zapatec.Calendar._SMN_len){Zapatec.Calendar._TT._SMN_len=Zapatec.Calendar._SMN_len
}Zapatec.Calendar._DN=Zapatec.Calendar._SDN=Zapatec.Calendar._SDN_len=Zapatec.Calendar._MN=Zapatec.Calendar._SMN=Zapatec.Calendar._SMN_len=null;
function makeTxt(C,A){var B=document.getElementById(C);
if(!ori[C]){ori[C]=B.innerHTML
}B.innerHTML=A
}function reTxt(B){var A=document.getElementById(B);
if(ori[B]){A.innerHTML=ori[B]
}}function showHidechildText(){var A=0;
for(var B=0;
B<(document.getElementsByName("children")).length;
B++){if(document.getElementsByName("children")[B].value!=0){A++
}}if(A==0){document.getElementById("titleSpan").style.display="none"
}else{document.getElementById("titleSpan").style.display="block"
}}function isInteger(B){var A;
for(A=0;
A<B.length;
A++){var C=B.charAt(A);
if(((C<"0")||(C>"9"))){return false
}}return true
}function stripCharsInBag(C,D){var B;
var A="";
for(B=0;
B<C.length;
B++){var E=C.charAt(B);
if(D.indexOf(E)==-1){A+=E
}}return A
}function daysInFebruary(A){return(((A%4==0)&&((!(A%100==0))||(A%400==0)))?29:28)
}function DaysArray(B){for(var A=1;
A<=B;
A++){this[A]=31;
if(A==4||A==6||A==9||A==11){this[A]=30
}if(A==2){this[A]=29
}}return this
}function isThisDate(J,D){var A=new Date();
var B=DaysArray(12);
var I=J.indexOf(dtCh);
var H=J.indexOf(dtCh,I+1);
var E=J.substring(0,I);
var G=J.substring(I+1,H);
var C=J.substring(H+1);
strYr=C;
if(E.charAt(0)=="0"&&E.length>1){E=E.substring(1)
}if(G.charAt(0)=="0"&&G.length>1){G=G.substring(1)
}for(var F=1;
F<=3;
F++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)
}}month=parseInt(G);
day=parseInt(E);
year=parseInt(strYr);
if(I==-1||H==-1){alert(dateFormat);
document.getElementById(D).value="dd/mm/yyyy";
return false
}if(G.length<1||month<1||month>12){if(isNaN(month)){alert(dateFormat);
document.getElementById(D).focus()
}else{alert("Please enter a valid month.");
document.getElementById(D).focus()
}return false
}if(E.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>B[month]){alert(validDate);
document.getElementById(D).focus();
return false
}if(C.length!=4||year==0||year<minYear||year>maxYear){alert(valid4Digit+" "+A.getYear()+".");
document.getElementById(D).focus();
return false
}if(J.indexOf(dtCh,H+1)!=-1||isInteger(stripCharsInBag(J,dtCh))==false){alert(validDate);
document.getElementById(D).focus();
return false
}return true
}function ValidateForm(B,A){if(isDate(B,A)==false){document.getElementById(A).focus();
document.getElementById(A).value="dd/mm/yyyy";
return false
}return true
}function validate(){var A=document.getElementById("cityName");
if(document.getElementById("cityName").value=="dotedLine"){alert("Please Select the Destination");
document.getElementById("cityName").focus();
return false
}document.getElementById("tableDiv").style.display="none";
if(validateCity()&&validateDates()&&validateRoomStrength()){document.getElementById("totalDiv").style.display="none";
writePersistentCookie("_hc",document.getElementById("cityName").value,"months",1);
document.SearchForm.action="http://hotels.makemytrip.co.in/makemytrip/searchHotelProgress.do?residentOfIndia=Y&method=searchHotels";
document.SearchForm.submit()
}else{return false
}}function getDateString(C){var A=new Array();
A[0]="Jan";
A[1]="Feb";
A[2]="Mar";
A[3]="Apr";
A[4]="May";
A[5]="Jun";
A[6]="Jul";
A[7]="Aug";
A[8]="Sep";
A[9]="Oct";
A[10]="Nov";
A[11]="Dec";
var D=C.split("/");
if(D[1]=="09"){D[1]="9"
}if(D[1]=="08"){D[1]="8"
}var B=D[0]+"-"+A[parseInt(D[1])-1]+"-"+D[2];
return B
}function validateDates(){var D=document.getElementById("arrDateOway").value;
var B=document.getElementById("HdeptDateOway").value;
if(D.length==0&&B.length==0){alert(enterDates);
return 
}if(D.length==0){alert(enterCheckIn);
return 
}if(B.length==0){alert(enterCheckOut);
return 
}if(!isThisDate(D,"arrDateOway")){return false
}if(!isThisDate(B,"HdeptDateOway")){return false
}var I=buildDate(D);
var G=buildDate(B);
var E=new Date();
var C=E.getTime();
var H=I.getTime();
var F=G.getTime();
var A=new Date().getTime();
if(H>F){alert(checkIn_CheckOut);
return false
}else{if(H==F){alert(same_check_in_out);
return false
}else{return true
}}}function LTrim(A){var C=0;
var B=A.length-1;
if(A==null){return(false)
}for(C=0;
C<A.length;
C++){if(A.substr(C,1)!=" "&&A.substr(C,1)!="\t"){break
}}if(C<=B){return(A.substr(C,(B+1)-C))
}else{return("")
}}function RTrim(A){var C=0;
var B=A.length-1;
if(A==null){return(false)
}for(B=A.length-1;
B>=0;
B--){if(A.substr(B,1)!=" "&&A.substr(B,1)!="\t"){break
}}if(C<=B){return(A.substr(C,(B+1)-C))
}else{return("")
}}function trim(A){return LTrim(RTrim(A))
}function validateCity(){var A=document.getElementsByName("cityCode");
var D="otherCityCode";
var C=document.getElementById("cityName");
for(var B=0;
B<A.length;
B++){var E=A[B].id;
if(E!=D){if(A[B].checked==true){return true
}}}if(C.selectedIndex>0&&document.getElementById(D).checked==true){return true
}alert(enterCity);
C.focus();
return false
}function buildDate(C){var A=parseInt(C.split("/")[0],10);
var D=parseInt(C.split("/")[1],10);
var E=parseInt(C.split("/")[2],10);
var B=new Date(E,(D-1),A,0,0,0,0);
return B
}function close(A){document.getElementById(A).style.display="none"
}function addListener(){document.getElementById("otherCity").onkeydown=getCityNames
}function disableOtherCity(){document.getElementById("cityName").selectedIndex=0
}function enableOtherCity(){document.getElementById("cityName").selectedIndex=0
}var maxRoomStrength=6;
function searchoptnfn(){document.getElementById("searchoptn").style.display=""
}function updateArray(C,B,A){roomDtls[C][B]=A.value
}var childAges=new Array(5);
for(var t=0;
t<5;
t++){var ageRec=new Array(5);
for(var a=0;
a<5;
a++){ageRec[a]=1
}childAges[t]=ageRec
}function updateAgeArray(C,B,A){childAges[C][B]=A.value
}function createRooms(){var E=document.getElementById("guestsTable");
deleteTableWithHeader(E);
var B=document.getElementById("childrenAgesTable");
deleteTable(B);
var F=document.getElementById("titleSpan");
var H=document.getElementById("rooms").value;
for(var D=0;
D<H;
D++){var G=E.insertRow(D+1);
G.valign="top";
var C=G.insertCell(0);
var A=G.insertCell(1);
C.className="bluetext";
A.className="bluetext";
C.innerHTML="<select name='adults' class='childSelect' onchange='validateRoomStrength(),updateArray("+D+",0,this)' style='width:40px'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option></select>";
A.innerHTML="<select name='children' class='childSelect' style='width:40px' onchange='validateRoomStrength(),showChildrenAges(),showHidechildText(),updateArray("+D+",1,this)'><option value='0' selected>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option></select>";
A.align="left";
C.align="left";
if(D>0){document.forms[1].adults[D].value=roomDtls[D][0];
document.forms[1].children[D].value=roomDtls[D][1]
}else{document.forms[1].adults.value=roomDtls[D][0];
document.forms[1].children.value=roomDtls[D][1]
}}createArrows();
showChildrenAges()
}function createArrows(){var E=document.getElementById("rooms").value;
var C=document.getElementById("arrowsTable");
deleteTable(C);
for(var B=0;
B<E;
B++){var D=C.insertRow(B);
D.valign="top";
var A=D.insertCell(0);
A.className="bluetext";
if(B==0){A.innerHTML=" <img src='http://www.makemytrip.co.in/makemytrip/images/arrow2.gif' height='0'><img src='http://www.makemytrip.co.in/makemytrip/images/arrow3.gif' width='25' height='3'/>Room"+(B+1)+":"
}else{A.innerHTML="<img src='http://www.makemytrip.co.in/makemytrip/images/arrow2.gif' height='16'><img src='http://www.makemytrip.co.in/makemytrip/images/arrow3.gif' width='18' height='3'/>Room"+(B+1)+":"
}}}function deleteTableWithHeader(B){for(var A=B.rows.length-1;
A>0;
A--){B.deleteRow(A)
}}function deleteTable(B){for(var A=B.rows.length-1;
A>=0;
A--){B.deleteRow(A)
}}function showChildrenAges(){var C=document.getElementById("childrenAgesTable");
deleteTable(C);
var K=document.getElementsByName("children");
var L=0;
for(var G=0;
G<K.length;
G++){if(K[G].value>0){L+=1
}}if(L>0){document.getElementById("titleSpan").style.display="block"
}else{document.getElementById("titleSpan").style.display="none"
}var C=document.getElementById("childrenAgesTable");
deleteTable(C);
var K=document.getElementsByName("children");
var L=0;
for(var G=0;
G<K.length;
G++){var D=K[G].value;
if(D>0){var N=C.insertRow(L++);
var M=N.insertCell(0);
var J=N.insertCell(1);
M.className="whiteText";
J.className="whiteText";
M.innerHTML="Room"+(G+1)+":";
var H="";
var A="";
H+="<table><tr>";
var F=0;
for(var E=1;
E<=D;
E++){A+="Child "+E+":   ";
H+="<td class='whiteText'>Child "+E+":<BR>";
var B="Room"+(G+1);
H+="<SELECT class='childSelect' name='"+B+"' id='Room"+G+"_"+E+"' onchange='updateAgeArray("+G+","+F+",this)'>";
for(var I=1;
I<=12;
I++){H+="<option value="+I+">"+I+"</option>"
}H+="</select>";
H+="</TD>";
F++
}H+="</tr></table>";
J.innerHTML=H;
var F=0;
for(var E=1;
E<=D;
E++){document.getElementById("Room"+G+"_"+E).value=childAges[G][F];
F++
}}}createArrows()
}function validateRoomStrength(){var F=document.getElementById("rooms").value;
var I=document.getElementsByName("adults");
var B=document.getElementsByName("children");
for(var H=0;
H<F;
H++){var D=parseInt(I[H].value);
var C=parseInt(B[H].value);
var G=D+C;
if(G>maxRoomStrength){alert("Please check that the total number of persons (including children) per room is:"+maxRoomStrength);
B[H].focus();
var A=document.getElementById("childrenAgesTable");
deleteTable(A);
return false
}B[H].length=maxRoomStrength-D;
for(var E=0;
E<=maxRoomStrength-D;
E++){B[H].options[E]=new Option(E,E,true,false)
}B[H].value=C;
I[H].length=maxRoomStrength-C;
for(var E=0;
E<maxRoomStrength-C;
E++){I[H].options[E]=new Option(E+1,E+1,true,false)
}I[H].value=D
}return true
}function close(A){document.getElementById(A).style.display="none"
}function showOtherCity(A){document.getElementById("otherCityCode").value=""
}function divclose1(A){var B;
B=document.getElementById(A);
B.style.display="none";
createArrows()
}function bodyOnLoad(){populatecities();
onewayfn()
}function changeTab(A){if(A=="flt"){document.getElementById("hotels_tab").style.display="none";
document.getElementById("flights_tab").style.display="block";
document.getElementById("FlightTabData").style.display="block";
document.getElementById("HotelTabData").style.display="none"
}else{if(A=="htl"){document.getElementById("hotels_tab").style.display="block";
document.getElementById("flights_tab").style.display="none";
document.getElementById("FlightTabData").style.display="none";
document.getElementById("HotelTabData").style.display="block";
if(document.getElementById("otherCityCode").value==""){}}}createArrows()
};