 //add by vida 20080827
function populatedropdown()
{
	    var mlist = ['January','February','March','April','May','June','July','August','September','October','November','December'];
		var mlistvalue = ['01','02','03','04','05','06','07','08','09','10','11','12'];
		var dlist = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'];
		var dlistvalue = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'];
	var today = new Date();
	var thisyear = today.getFullYear();
	for (var d=0; d<31; d++)
	{
		//if (d<=8)
//		{
//		document.getElementById("m_arrival_d").options[d] = new Option(d+1, "0"+(d+1).toString());
//		document.getElementById("m_arrival_d").options[today.getDate()-1] = new Option(today.getDate(), "0"+today.getDate().toString(), true, true); 
//		}
//		else
//		{
//		document.getElementById("m_arrival_d").options[d] = new Option(d+1, (d+1).toString());
//		document.getElementById("m_arrival_d").options[today.getDate()-1] = new Option(today.getDate(), today.getDate(), true, true); 
//		}
		document.getElementById("m_arrival_d").options[0] = new Option(dlist[0], dlistvalue[0]);
		document.getElementById("m_arrival_d").options[d] = new Option(dlist[d], dlistvalue[d]);
		document.getElementById("m_arrival_d").options[today.getDate()-1] = new Option(dlist[today.getDate()-1], dlistvalue[today.getDate()-1], true, true);
	}
	for (var m=0; m<12; m++)	
	{
		document.getElementById("m_arrival_m").options[m] = new Option(mlist[m], mlistvalue[m]);
		document.getElementById("m_arrival_m").options[today.getMonth()] = new Option(mlist[today.getMonth()], mlistvalue[today.getMonth()], true, true);
	}	
	for (var y=0; y<20; y++)
	{
		document.getElementById("m_arrival_y").options[y] = new Option(thisyear, thisyear);
		thisyear+=1;
	}
	document.getElementById("m_arrival_y").options[0] = new Option(today.getFullYear(), today.getFullYear(), true, true); 
}

function otherreason()//add by vida
{
thereason = document.getElementById("var13_1").options[document.getElementById("var13_1").selectedIndex].value;
if (thereason=='other')
{
	document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business'>Business</option><option value='holiday'>Holiday</option><option value='family visit'>Family Visit</option><option value='event'>Event</option><option value='hen party'>Hen Party</option><option value='stag party'>Stag Party</option><option value='other' selected='selected'>Other</option></select><input name='var13' id='var13' type='text' class='input1 h1 w3' maxlength='94'/>";
}
else if (thereason=='business')
{
document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business' selected='selected'>Business</option><option value='holiday'>Holiday</option><option value='family visit'>Family Visit</option><option value='event'>Event</option><option value='hen party'>Hen Party</option><option value='stag party'>Stag Party</option><option value='other'>Other</option></select><input name='var13' id='var13' type='hidden' class='input1 h1 w3' maxlength='94' value='business'/>";
}
else if (thereason=='holiday')
{
document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business'>Business</option><option value='holiday' selected='selected'>Holiday</option><option value='family visit'>Family Visit</option><option value='event'>Event</option><option value='hen party'>Hen Party</option><option value='stag party'>Stag Party</option><option value='other'>Other</option></select><input name='var13' id='var13' type='hidden' class='input1 h1 w3' maxlength='94' value='holiday'/>";
}
else if (thereason=='family visit')
{
document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business'>Business</option><option value='holiday'>Holiday</option><option value='family visit' selected='selected'>Family Visit</option><option value='event'>Event</option><option value='hen party'>Hen Party</option><option value='stag party'>Stag Party</option><option value='other'>Other</option></select><input name='var13' id='var13' type='hidden' class='input1 h1 w3' maxlength='94' value='family visit'/>";
}
else if (thereason=='event')
{
document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business'>Business</option><option value='holiday'>Holiday</option><option value='family visit'>Family Visit</option><option value='event' selected='selected'>Event</option><option value='hen party'>Hen Party</option><option value='stag party'>Stag Party</option><option value='other'>Other</option></select><input name='var13' id='var13' type='hidden' class='input1 h1 w3' maxlength='94' value='event'/>";
}
else if (thereason=='hen party')
{
document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business'>Business</option><option value='holiday'>Holiday</option><option value='family visit'>Family Visit</option><option value='event'>Event</option><option value='hen party' selected='selected'>Hen Party</option><option value='stag party'>Stag Party</option><option value='other'>Other</option></select><input name='var13' id='var13' type='hidden' class='input1 h1 w3' maxlength='94' value='hen party'/>";
}
else if (thereason=='stag party')
{
document.getElementById("reasons").innerHTML = "Reason For Visit:&nbsp;</span><select name='var13_1' id='var13_1' class='jamp5 h5_vida' onchange='javascript:otherreason();'><option value='business'>Business</option><option value='holiday'>Holiday</option><option value='family visit'>Family Visit</option><option value='event'>Event</option><option value='hen party'>Hen Party</option><option value='stag party' selected='selected'>Stag Party</option><option value='other'>Other</option></select><input name='var13' id='var13' type='hidden' class='input1 h1 w3' maxlength='94' value='stag party'/>";
}
}

function CopyTelToEveningTel()
{
	document.getElementById("var14").value = document.getElementById("var4").value;
}

function validate_form(thisform)
{
firstname=document.getElementById("var1").value;
surname = document.getElementById("var2").value;
dtelephone = document.getElementById("var4").value;
etelephone = document.getElementById("var14").value;
email=document.getElementById("email1").value;
emailconfirm=document.getElementById("var3").value;
reason=document.getElementById("var13").value;
//alert(reason.length);
vipmail=document.getElementById("var10").value;
var isNum = new RegExp("^[0-9]+$");
if (firstname == ''||firstname ==null)
 {
	alert("please enter your firstname");
	return false;
  }  
else if (surname ==''||surname == null)
{
	alert("please enter your surname");
	return false;
}
else if (email == ''||email == null)
{
    alert("please enter your email");
	return false;
}
else if (emailconfirm == ''||emailconfirm == null)
{
    alert("please enter your confirm email");
	return false;
}
else if (dtelephone == ''||dtelephone==null)
{
	alert("please enter your daytime telephone");
	return false;
}
//else if (etelephone == ''||etelephone==null)
//{
//	alert("please enter your evening telephone");
//	return false;
//}
else if (reason == ''||reason == null||reason.length==0)
{
	alert("please enter your other reason");
	return false;
}
else if (vipmail==''||vipmail == null||vipmail.length==0)
{
	alert("please choose if you would like to receive free vip email updates");
	return false;
}
else
{
	if (email!=''&&email!=null&&email.length!=0)
	{
		ind = email.indexOf('@', 0);
		if (ind==-1 || ind==0 || ind==(email.length-1))
		 {
			alert("please enter the correct format email");			
			return false;
		 }
	}
	if (emailconfirm!=''&&emailconfirm!=null&&emailconfirm.length!=0)
	{
	//alert(emailconfirm);
		indx = emailconfirm.indexOf('@', 0);
		if (indx==-1 || indx==0 || indx==(emailconfirm.length-1))
		 {
			alert("please enter the correct format confirm email");
			return false;
		 }
	}
	if ((email!=''&&email!=null&&email.length!=0)&&(emailconfirm!=''&&emailconfirm!=null&&emailconfirm.length!=0)&&(emailconfirm!=email))
	{
			alert("two emails are different");
			return false;
	}
	//if (document.getElementById("var4").value!=''&&document.getElementById("var4").value!=null&&document.getElementById("var4").value.length!=0)
//	{
		if (!document.getElementById("var4").value.match(isNum)){
		alert("Please enter numbers only for the daytime telephone number");
		document.getElementById("var4").focus();
		return false;
	    }		
	//}
//	if (document.getElementById("var14").value!=''&&document.getElementById("var14").value!=null&&document.getElementById("var14").value.length!=0)
//	{
		if (!document.getElementById("var14").value.match(isNum)){
		alert("Please enter numbers only for the evening telephone number");
		document.getElementById("var14").focus();
		return false;
	    }		
	//}
	else
	{
		document.getElementById('form2').submit();
		return true;
	}
}
}

function generateTimestamponVar11() {
  document.getElementById("var11").value = Math.round(new Date().getTime()/1000.0);  
}

function changeVar8()
{
var y, m, d;
y = (document.getElementById("m_arrival_y").options[document.getElementById("m_arrival_y").selectedIndex].value).toString();
m = (document.getElementById("m_arrival_m").options[document.getElementById("m_arrival_m").selectedIndex].value).toString();
d = (document.getElementById("m_arrival_d").options[document.getElementById("m_arrival_d").selectedIndex].value).toString();
document.getElementById("var8").value= y + "-" + m + "-" + d;
}



