function calPrice()
{	
	var indexValue = document.signup.acctype.value+document.signup.payterm.value;
	document.getElementById('tprice').innerHTML = accountTypeArray[indexValue];
	document.getElementById('price').value = accountTypeArray[indexValue];
}

function setCountyForSignUp(frmName, cmbState, cmbShire, province)
{
	 var intIndex;
	 var arrCounties = new Array();		  
	 arrCounties[''] = 'Choose a Counties';
	 arrCounties['Leinster'] = "Carlow,Dublin,Kildare,Kilkenny,Laois,Longford,Louth,Meath,Offaly,Westmeath,Wexford,Wicklow";
	 arrCounties['Munster'] = "Clare,Cork,Kerry,Limerick,Tipperary,Waterford";
	 arrCounties['Ulster'] = "Cavan,Donegal,Monaghan,Antrim,Armagh,Derry,Down,Fermanagh,Tyrone";
	 arrCounties['Connacht'] = "Galway,Leitrim,Mayo,Roscommon,Sligo";
	 strState = province;
	 eval("document."+frmName.name+"."+cmbShire+".options.length=1");
	 if(strState != "")
	 {
		 var arrCounty = arrCounties[strState].split(",");	 
		 eval("document."+frmName.name+"."+cmbShire+".options.length = "+arrCounty.length+"+1");
		 for(i=1;i <= arrCounty.length;i++)
	     {
	    	test=arrCounty[i-1];
	    	eval("document."+frmName.name+"."+cmbShire+".options["+i+"].value = '"+test+"'");
	    	eval("document."+frmName.name+"."+cmbShire+".options["+i+"].text = '"+test+"'");
	     }	
	 }
}


function FillBillingInfo(chkbox, f)
{
	if(chkbox)
	{
		f.bill_name.value=f.cont_bussiness.value;
		f.bill_fname.value=f.cont_fname.value;
		f.bill_lname.value=f.cont_lname.value;
		f.bill_addr1.value=f.cont_addr1.value;
		f.bill_addr2.value=f.cont_addr2.value;
		f.bill_city.value=f.cont_city.value;
		f.bill_province.value=f.cont_province.value;
		var province = f.bill_province.value;
		setCountyForSignUp(f,'bill_province', 'bill_shire',province);
		
		f.bill_shire.value=f.cont_shir.value;
		f.bill_zip.value=f.cont_zip.value;
		f.bill_tel.value=f.cont_tel.value;
	}
	else
	{
		f.bill_name.value="";
		f.bill_fname.value="";
		f.bill_lname.value="";
		f.bill_addr1.value="";
		f.bill_addr2.value="";
		f.bill_city.value="";
		f.bill_province.value="";
		f.bill_shire.value="";
		f.bill_zip.value="";
		f.bill_tel.value="";
	}
	
}

function Check_CC_Info()
{
	if(document.signup.cc_expirationMon.value == "0")
	{
		errMsg = "Please select the Month";
		alert(errMsg);
		document.signup.cc_expirationMon.focus();
		return false;
	}
	if(document.signup.cc_expirationYear.value == "Select Year")
	{
		errMsg = "Please select the Year";
		alert(errMsg);
		document.signup.cc_expirationYear.focus();
		return false;
	} 
	return true;
}

function check_form(form1)
{	
	var form1  = form1;
	
	if(eval('document.'+form1+'.username.value')=="")
	{
		alert("Please enter username");
		eval('document.'+form1+'.username.focus()');
		return false;
	}
	if(eval('document.'+form1+'.passwd.value')=="")
	{
		alert("Please enter password");
		eval('document.'+form1+'.passwd.focus()');
		return false;
	}
	return true;
}	

function chkDate(form)
{
	var reservationDate = eval('document.'+form+'.date.value');
	var todayDate = new Date();
	var date=todayDate.getDate();
	var month=1+(todayDate.getMonth());
	var year=todayDate.getFullYear();

var reservationDate_array=reservationDate.split("/");

	var dd = reservationDate_array[0];
	var mm = reservationDate_array[1];
	var yy = reservationDate_array[2];
	if(year > yy)
	{
		alert("Reservation date can not be less than Today's date");
		return false;
	}
	else if((year == yy) && (month > mm))
	{
		alert("Reservation date can not be less than Today's date");
		return false;
	}		
	else if((year == yy) && (month == mm) && (date > dd))
	{
		alert("Reservation date can not be less than Today's date");
		return false;
	}
	else
	{
		return true;
	}
	
}


function showPayInfo(paymethod)
{
	if (paymethod == '200') { // checque (cc info off)
		document.getElementById("ccinfo").style.display = "none";
	} else if (paymethod > 0 && paymethod < 10 ) { // credit card
		document.getElementById("ccinfo").style.display = "block";
	} else { // default (cc info off)
		document.getElementById("ccinfo").style.display = "none";
	}
	return true;
}