/*DaysSclipt
-------------------------------------------------------------------------------------------------*/
function keta2(d) { return (d < 10) ? ('0' + d) : d; }

function s_yy(name, plusd) {
	var today=new Date();
	today.setTime(today.getTime() + 24 * 60 * 60 * 1000 * plusd );
	var year  = today.getFullYear();
	var x = '<select name="' + name + '">';
	for(k= year; k <=year+3; k++){
		x +="<option value=" + k + ((k==year) ? " selected" : "") + ">" + k + "</option>";
	}
	x += "</select>";
	return x;
}

function s_mm(name, plusd) {
	var today=new Date();
	today.setTime(today.getTime() + 24 * 60 * 60 * 1000 * plusd );
	var month = today.getMonth();
	var y = '<select name="'+ name + '">';
	for(j= 1; j <=12; j++){
		y +="<option value=" + keta2(j) + ((j==month+1) ? " selected" : "") + ">" + j + "</option>";
	}
	y += "</select>";
	return y;
}

function s_dd(name, plusd) {
	var today=new Date();
	today.setTime(today.getTime() + 24 * 60 * 60 * 1000 * plusd );
	var day = today.getDate();
	var z = '<select name="' + name + '">';
	for(i = 1; i <= 31; i++){
		z += "<option value=" + keta2(i) + ((i==(day)) ? " selected" : "") + ">" + i + "</option>";
	}
	z += "</select>";
	return z;
}


/*FormSclipt
-------------------------------------------------------------------------------------------------*/

//function menuLink(linkLoc)
//{ if(linkLoc !="") { window.location.href=linkLoc;} }
//
//function myWin(_myLink){
//	if(_myLink!=""){
//		_myWin=window.open(_myLink,"newWin");
//		_myWin.focus()
//	}
//}


/*FormSclipt main
-------------------------------------------------------------------------------------------------*/


function changeoption(){
	var S1 = document.getElementById("S1");
	var S2 = document.getElementById("S2");
	var selectAry = eval("type" + S1.selectedIndex);
	
	var s2L=S2.options.length;
	for(k=0; k<s2L; k++){
		S2.options[0] = null;
	}

	for(i=0; i<selectAry.length; i++){
		S2.options[i] = new Option(selectAry[i]);
		S2.options[i].value = eval("type" + S1.selectedIndex + "_v[i]");
	}
	if(S1.selectedIndex == 0){ for(m=1; m<S2.options.length; m++){S2.options[1] = null;}}

}

function search_url() {
	var f = document.myFORM;
	var url = f.Smenu.options[ f.Smenu.selectedIndex ].value;
	var e = new Array('chkin_yy', 'chkin_mm', 'chkin_dd', 'chkout_yy', 'chkout_mm', 'chkout_dd', 'search:ninzu', 'rooms');
	for (var i in e) {
		url += '&' + e[i] + '=' + f.elements[e[i]].options[f.elements[e[i]].selectedIndex].value;
	}
      if (f.elements['search:area'].selectedIndex > 0) url += '&search=1';

	return url;
}

