function ViewImage(ifile,ix,iy,ititle) { 
var win;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;
win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
if (NS) {
sWidth = win.innerWidth;
sHeight = win.innerHeight;
} else {
sWidth = win.document.body.clientWidth;
sHeight = win.document.body.clientHeight;
}
if(sWidth!=ix || sHeight!=iy) {
win.close();
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
return;
}
win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("</head><body>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src="+ifile+"></div></body></html>");
win.document.close();
}



function MM_displayStatusMsg(msgStr) { 
  status=msgStr;
  document.MM_returnValue = true;
}

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) { //v3.0
  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); return x;
}

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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function popup(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=530');
self.name = "mainWin"; 
}

function fillDay(monthNum,dayNum,commandName){
			//clean
			if (eval("document.selectDays."+commandName+".options.length")>0)
				for (i=eval("document.selectDays."+commandName+".options.length");i>=0;i--)
					eval("document.selectDays."+commandName+".options[i]=null");	
			//fill
			for (i=1;i<=daysOfMonth[monthNum];i++)
				eval("document.selectDays."+commandName+".options[document.selectDays."+commandName+".options.length] = new Option('"+i+"','"+i+"');")
			//select
			eval("document.selectDays."+commandName+".options[dayNum-1].selected=true");	
		}
		function fillMonth(monthNum,commandName){
			//clean
			if (eval("document.selectDays."+commandName+".options.length")>0)
				for (i=eval("document.selectDays."+commandName+".options.length");i>=0;i--)
					eval("document.selectDays."+commandName+".options[i]=null");	
			//fill
			for (i=1;i<=12;i++)
				eval("document.selectDays."+commandName+".options[document.selectDays."+commandName+".options.length] = new Option('"+monthNames[i-1]+"','"+i+"');")
			//select
			eval("document.selectDays."+commandName+".options[monthNum].selected=true");
		}
		function fillYear(YearNum,commandName){
			//clean
			if (eval("document.selectDays."+commandName+".options.length")>0)
				for (i=eval("document.selectDays."+commandName+".options.length");i>=0;i--)
					eval("document.selectDays."+commandName+".options[i]=null");	
			//fill
			for (i=0;i<5;i++)
				eval("document.selectDays."+commandName+".options[document.selectDays."+commandName+".options.length] = new Option("+(nextDate1.getUTCFullYear()+i)+","+(nextDate1.getUTCFullYear()+i)+");")
			//select

			eval("document.selectDays."+commandName+".options[YearNum-currentDate.getUTCFullYear()].selected=true");
		}
		function addDays(cDate,numOfDays){
			
			var CurMonth = cDate.getMonth();
			var CurYear = cDate.getUTCFullYear();
			var days = daysOfMonth[CurMonth];
			var CurDay =cDate.getDate() + numOfDays;
			
			if (CurDay > days) {
				if (CurMonth == 11) {
					CurMonth = 0;
					CurYear = CurYear + 1;
				}
				else 
				CurMonth++;
				CurDay = CurDay - days;
			}
		return CurYear+','+CurMonth+','+CurDay;
		}
		function february(CurYear){
			if (((CurYear % 4)==0) && ((CurYear % 100)!=0) || ((CurYear %	400)==0)) {
				daysOfMonth[1] = 29;
			}
			else {
				daysOfMonth[1] = 28;
			}
		}
		function copyDates(){
			document.reservation.date_arrival.value=document.selectDays.d1.value+'/'+document.selectDays.m1.value+'/'+document.selectDays.y1.value;
			document.reservation.date_departure.value=document.selectDays.d2.value+'/'+document.selectDays.m2.value+'/'+document.selectDays.y2.value;
			//alert(document.reservation.date_arrival.value+'-'+document.reservation.date_departure.value);
		}
		function changeDate(){
			var tempDate1=new Date(document.selectDays.y1.value,document.selectDays.m1.value-1,document.selectDays.d1.value);
			var tempDate2=new Date(document.selectDays.y2.value,document.selectDays.m2.value-1,document.selectDays.d2.value);
			if (tempDate1-nextDate1<0){
				fillDay(nextDate1.getMonth(),nextDate1.getDate(),'d1');
				fillMonth(nextDate1.getMonth(),'m1');
				february(nextDate1.getUTCFullYear());
				fillYear(nextDate1.getUTCFullYear(),'y1');
				tempDate1=nextDate1;
			}
			if (tempDate1-tempDate2>=0){
				var tempNextDate=eval("new Date ("+addDays(tempDate1,1)+")");
				fillDay(tempNextDate.getMonth(),tempNextDate.getDate(),'d2');
				fillMonth(tempNextDate.getMonth(),'m2');
				february(tempNextDate.getUTCFullYear());
				fillYear(tempNextDate.getUTCFullYear(),'y2');
			}
			copyDates();
		}
		function changeMonth(controlName){
			var tempDate=eval("document.selectDays.d"+controlName.substr(1,1)+".value");
			var tempMonth=eval("document.selectDays."+controlName+".value-1");
			var tempYear=eval("document.selectDays.y"+controlName.substr(1,1)+".value");
			february(tempYear);
			fillDay(tempMonth,tempDate,'d'+controlName.substr(1,1));
			copyDates();
		}
		function changeYear(controlName){
			var tempYear=eval("document.selectDays."+controlName+".value");
			february(tempYear);
			if (eval("document.selectDays.m"+controlName.substr(1,1)+".value")==2){
				  changeMonth('m'+controlName.substr(1,1));
				}
			copyDates();				
		}
		//---------------------------------------------------------------------------------------------
				
		var monthNames =new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
		var daysOfMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
		var currentDate=new Date();
		var nextDate1=eval("new Date ("+addDays(currentDate,1)+")");
		var nextDate2=eval("new Date ("+addDays(currentDate,2)+")");
		
		//---------------------------------------------------------------------------------------------
		function init(){
			fillDay(nextDate1.getMonth(),nextDate1.getDate(),'d1');
			fillMonth(nextDate1.getMonth(),'m1');
			february(nextDate1.getUTCFullYear());
			fillYear(nextDate1.getUTCFullYear(),'y1');
			
			fillDay(nextDate2.getMonth(),nextDate2.getDate(),'d2');
			fillMonth(nextDate2.getMonth(),'m2');
			february(nextDate2.getUTCFullYear());
			fillYear(nextDate2.getUTCFullYear(),'y2');
		}		

