var values = new Array();
values[0] = "9:00";
values[1] = "9:30";
values[2] = "10:00";
values[3] = "10:30";
values[4] = "11:00";
values[5] = "11:30";
values[6] = "12:00";
values[7] = "12:30";
values[8] = "13:00";
values[9] = "13:30";
values[10] = "14:00";
values[11] = "14:30";
values[12] = "15:00";
values[13] = "15:30";
values[14] = "16:00";
values[15] = "16:30";
values[16] = "17:00";
values[17] = "17:30";
values[18] = "18:00";
values[19] = "18:30";
values[20] = "19:00";
values[21] = "19:30";
values[22] = "20:00";
values[23] = "20:30";
values[24] = "21:00";
values[25] = "21:30";
values[26] = "22:00";
values[27] = "22:30";
values[28] = "23:00";

/*var texts = new Array();
texts[0] = "01:00 AM (Moscow time 9:00)",
texts[1] = "01:30 AM (Moscow time 9:30)",
texts[2] = "02:00 AM (Moscow time 10:00)"
texts[3] = "02:30 AM (Moscow time 10:30)";
texts[4] = "03:00 AM (Moscow time 11:00)";
texts[5] = "03:30 AM (Moscow time 11:30)";
texts[6] = "04:00 AM (Moscow time 12:00)";
texts[7] = "04:30 AM (Moscow time 12:30)";
texts[8] = "05:00 AM (Moscow time 13:00)";
texts[9] = "05:30 AM (Moscow time 13:30)";
texts[10] = "06:00 AM (Moscow time 14:00)";
texts[11] = "06:30 AM (Moscow time 14:30)";
texts[12] = "07:00 AM (Moscow time 15:00)";
texts[13] = "07:30 AM (Moscow time 15:30)";
texts[14] = "08:00 AM (Moscow time 16:00)";
texts[15] = "08:30 AM (Moscow time 16:30)";
texts[16] = "09:00 AM (Moscow time 17:00)";
texts[17] = "09:30 AM (Moscow time 17:30)";
texts[18] = "10:00 AM (Moscow time 18:00)";
texts[19] = "10:30 AM (Moscow time 18:30)";
texts[20] = "11:00 AM (Moscow time 19:00)";
texts[21] = "11:30 AM (Moscow time 19:30)";
texts[22] = "12:00 PM (Moscow time 20:00)";
texts[23] = "12:30 PM (Moscow time 20:30)";
texts[24] = "01:00 PM (Moscow time 21:00)";
texts[25] = "01:30 PM (Moscow time 21:30)";
texts[26] = "02:00 PM (Moscow time 22:00)";
texts[27] = "02:30 PM (Moscow time 22:30)";
texts[28] = "03:00 PM (Moscow time 23:00)"; */

var texts = new Array();
texts[0] = "00:00 AM (Moscow time 9:00)",
texts[1] = "00:30 AM (Moscow time 9:30)",
texts[2] = "01:00 AM (Moscow time 10:00)"
texts[3] = "01:30 AM (Moscow time 10:30)";
texts[4] = "02:00 AM (Moscow time 11:00)";
texts[5] = "02:30 AM (Moscow time 11:30)";
texts[6] = "03:00 AM (Moscow time 12:00)";
texts[7] = "03:30 AM (Moscow time 12:30)";
texts[8] = "04:00 AM (Moscow time 13:00)";
texts[9] = "04:30 AM (Moscow time 13:30)";
texts[10] = "05:00 AM (Moscow time 14:00)";
texts[11] = "05:30 AM (Moscow time 14:30)";
texts[12] = "06:00 AM (Moscow time 15:00)";
texts[13] = "06:30 AM (Moscow time 15:30)";
texts[14] = "07:00 AM (Moscow time 16:00)";
texts[15] = "07:30 AM (Moscow time 16:30)";
texts[16] = "08:00 AM (Moscow time 17:00)";
texts[17] = "08:30 AM (Moscow time 17:30)";
texts[18] = "09:00 AM (Moscow time 18:00)";
texts[19] = "09:30 AM (Moscow time 18:30)";
texts[20] = "10:00 AM (Moscow time 19:00)";
texts[21] = "10:30 AM (Moscow time 19:30)";
texts[22] = "11:00 AM (Moscow time 20:00)";
texts[23] = "11:30 AM (Moscow time 20:30)";
texts[24] = "12:00 PM (Moscow time 21:00)";
texts[25] = "12:30 PM (Moscow time 21:30)";
texts[26] = "01:00 PM (Moscow time 22:00)";
texts[27] = "01:30 PM (Moscow time 22:30)";
texts[28] = "02:00 PM (Moscow time 23:00)";

function setDateOn()
{
	var DATE=new Date();
	document.forms['FORM'].day.selectedIndex=DATE.getDate()-1;
	var x=DATE.getMonth();
	document.forms['FORM'].month.selectedIndex=x;
	var y=DATE.getYear();
	if(y<2000) {
		y=y+1900;
	}
	document.forms['FORM'].year.selectedIndex=(y-2005);
//	alert("Hello " + y);
	setOption(DATE);

}
function checkDate()
{
	var day = document.forms.FORM.day.selectedIndex+1;
	var month = document.forms.FORM.month.selectedIndex+1;
	var year = document.forms.FORM.year.selectedIndex+2005; //старт с 2005 года
	if((month==2)||(month==4)||(month==6)||(month==9)||(month==11))
	{
		var x=(month==2)?((year%4)?28:29):30;
		if(day>x)
		{
			alert("Sorry, your date is incorrect.");
			setDateOn();
		}
		else
		{
			//var d = new Date(Date.parse(month+"-"+day+"-"+year));
			var d = new Date(year, month-1, day);
			setOption(d);
		}
	}
	else
	{
		//var d = new Date(Date.parse(month+"-"+day+"-"+year));
		var d = new Date(year, month-1, day);
		setOption(d);
	}
}

function setOption(dd)
{
	var d = new Date(Date.parse(dd));
	var week = d.getDay();
	document.forms['FORM'].timefrom.options.length = 0;
	document.forms['FORM'].timeto.options.length = 0;

	if ((week != 0) && (week != 6))
	{
		for(var i = 0; i < values.length; i++)
		{
			document.forms['FORM'].timefrom.options.length = i+1;
			document.forms['FORM'].timefrom.options[i].value = values[i];
			document.forms['FORM'].timefrom.options[i].text = texts[i];

			document.forms['FORM'].timeto.options.length = i+1;
			document.forms['FORM'].timeto.options[i].value = values[i];
			document.forms['FORM'].timeto.options[i].text = texts[i];
		}
	}
	else
	{
		for(var i = 3; i < values.length-2; i++)
		{
			document.forms['FORM'].timefrom.options.length = i-2;
			document.forms['FORM'].timefrom.options[i-3].value = values[i];
			document.forms['FORM'].timefrom.options[i-3].text = texts[i];

			document.forms['FORM'].timeto.options.length = i-2;
			document.forms['FORM'].timeto.options[i-3].value = values[i];
			document.forms['FORM'].timeto.options[i-3].text = texts[i];
		}
	}


}

function check()
{

    if (document.forms.FORM.clientname.value=="")
	 {
 			alert('Please, enter your First Name!');
 		   document.forms.FORM.clientname.focus();
			return false;
	 };
    if (document.forms.FORM.clientsurname.value=="")
	 {
 			alert('Please, enter your Last Name!');
 		   document.forms.FORM.clientsurname.focus();
			return false;
	 };

	if (document.forms.FORM.email.value == "")
	{
		alert("You did not enter E-mail address!");
		document.forms.FORM.email.focus();
		return false;
	}
	else
	{
		var r_email = new RegExp("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$","ig");
		var arr = r_email.exec(document.forms.FORM.email.value);
		if(arr==null)
		{
			window.alert("E-mail address is incorrect");
			document.forms.FORM.email.focus();
			return false;
		}
	}

	if (document.forms.FORM.country.value == "")
	{
		alert("You did not enter your Country code!");
		document.forms.FORM.country.focus();
		return false;
	}

	if (document.forms.FORM.city.value == "")
	{
		alert("You did not enter your City/State code!");
		document.forms.FORM.city.focus();
		return false;
	}

	if (document.forms.FORM.phone.value == "")
	{
		alert("You did not enter your Phone code!");
		document.forms.FORM.phone.focus();
		return false;
	}

    if ((document.forms.FORM.girlid.value== "")) // &&  (document.forms.FORM.hm1.value=='yes'))
	{
		alert("You did not enter Profile ID!");
		document.forms.FORM.girlid.focus();
		return false;
	 }

    if (document.forms.FORM.ladyname.value== "")
	{
		alert("You did not enter Lady's Name!");
		document.forms.FORM.ladyname.focus();
		return false;
	 }

		if (document.forms.FORM.timefrom.selectedIndex > document.forms.FORM.timeto.selectedIndex)
		{
			alert("You entered the wrong time range!");
			return false;
		}

	return true;
}
