function validate()
{
	if (document.fomSignup.txtFirstNm.value=='') 
	{
	alert('please enter the first name!!!');
	document.fomSignup.txtFirstNm.focus();
	return false;
	}
	if (document.fomSignup.txtLastNm.value=='') 
	{
	alert('please enter the last name!!!');
	document.fomSignup.txtLastNm.focus();
	return false;
	}
	if (document.fomSignup.cboCity.selectedIndex==0)
	{
	alert('please choose the city!!!');
	document.fomSignup.cboCity.focus();
	return false;
	}
	if (document.fomSignup.cboProvince.selectedIndex==0)
	{
 	alert('please choose the province!!!');
	document.fomSignup.cboProvince.focus();
	return false;
	}
	if (document.fomSignup.txtEmail.value=='')
	{
	alert('please enter the Email!!!');
	document.fomSignup.txtEmail.focus();
	return false;
	}
	//if (validateEmail(document.fomSignup.txtEmail)==false)
	if (!isEmail(document.fomSignup.txtEmail.value)) 
	{
		alert("Please provide a valid Email address");
		document.fomSignup.txtEmail.focus();
		return false;
	}
	//sbSendMail("ksuriyaa@hotmail.com","ksuriyaa@yahoo.co.in","Sunwing.ca","Test Message");	
	
	/*if (document.fomSignup.optHtml.checked==false && document.fomSignup.optHtml.checked==false)
	{
	alert('please choose the email format!!!');
	document.fomSignup.optHtml.focus();
	return false;
	}*/
	
	if (document.fomSignup.optEnglish.checked==false && document.fomSignup.optFrench.checked==false)
	{
	alert('please choose the language preference!!!');
	document.fomSignup.optEnglish.focus();
	return false;
	}
	if (document.fomSignup.optLastMin.checked==false && document.fomSignup.optInAdvance.checked==false && document.fomSignup.optOther.checked==false )
	{
	alert('please choose an option!!!');
	document.fomSignup.optLastMin.focus();
	return false;
	}
	postall();
}

function doEnable()
{
	if (document.fomSignup.chkAccept.checked==true)
	{
	document.fomSignup.butok.disabled=false;
	}
	else
	{
	document.fomSignup.butok.disabled=true;
	}
}
function isEmail(str) 
{
			// are regular expressions supported?
			var supported = 0;
		
			if (window.RegExp) {
				var tempStr = "a";
				var tempReg = new RegExp(tempStr);
				if (tempReg.test(tempStr)) supported = 1;
			}
			if (!supported)
				return (str.indexOf(".") > 3) && (str.indexOf("@") > 0);
			var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			return (!r1.test(str) && r2.test(str));
}

function validateEmail(objfield)
{
	with (objfield)
	{
		apos=value.indexOf("@");
		adotpos=value.lastIndexOf(".");
		if (apos==-1 || adotpos==-1)
		{
		return false;
		}
		else
		{
		return true;
		}
	}
}
function postall()
{
	document.fomSignup.method='post';
	document.fomSignup.action='SaveSignUp.asp';
	document.fomSignup.submit();
}
