function openpict(name) {
	pictwin=window.open(name, 'pictwin', 'statusbar=no, menubar=no, height=440, width=400. scrollbars=yes');
	pictwin.focus();
}



function daysInFebruary (year){
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function wrongdays(day, month, year){
	month++;
	return ((day>30 && (month==4 || month==6 || month==9 || month==11)) || (month==2 && day>daysInFebruary(year)))
}

function calcdays() {
 Now=new Date();
 var DateArriv = new Date(document.Form.arry.value, document.Form.arrm.selectedIndex, document.Form.arrd.value, 0, 0, 0, 0);
 var DateDep = new Date(document.Form.depy.value, document.Form.depm.selectedIndex, document.Form.depd.value, 0, 0, 0, 0);
 DDelta = Math.round( (DateDep - DateArriv) / 86400000 );
 if (DDelta <= 0 || DateArriv <= Now 
	 || wrongdays(document.Form.arrd.value, document.Form.arrm.selectedIndex, document.Form.arry.value) 
	 || wrongdays(document.Form.depd.value, document.Form.depm.selectedIndex, document.Form.depy.value)) { DDelta = "#"; }
 document.Form.nights.value = DDelta;
}

function InitDays() {
var novel1, novel2;
		novel1=1;
		novel2=1;
	X = new Date() ; X.setDate (X.getDate()+novel1) ;
	ev = X.getYear(); 
    if (!document.all) ev += 1900 ;
	ho = X.getMonth();
	nap = X.getDate();
	document.Form.arry.value=ev;
	document.Form.arrm.selectedIndex=ho;
	document.Form.arrd.value=nap;
	X.setDate (X.getDate()+novel2) ;
	ev = X.getYear();
    if (!document.all) ev += 1900 ;
	ho = X.getMonth();
	nap = X.getDate();
	document.Form.depy.value=ev;
	document.Form.depm.selectedIndex=ho;
	document.Form.depd.value=nap;
	calcdays();
}



function openreach(HID) {
	pictwin=window.open('../reachus.php?id='+HID, 'pictwin', 'statusbar=no, menubar=no, height=500, width=650, scrollbars=yes, resizable=yes');
	pictwin.focus();
}

function openreachde(HID) {
	pictwin=window.open('../reachus_de.php?id='+HID, 'pictwin', 'statusbar=no, menubar=no, height=500, width=650, scrollbars=yes, resizable=yes');
	pictwin.focus();
}
