
function validate_email(field,alerttxt)
{
var tlds = ".ac .ad .ae .af .ag .ai .al .am .an .ao .aq .ar .as .at .au .aw .ax .az .ba .bb .bd .be "
	tlds += ".bf .bg .bh .bi .bj .bm .bn .bo .br .bs .bt .bu .bv .bw .by .bz .ca .cc .cd .cf .cg .ch .ci .ck .cl .cm "
	tlds += ".cn .co .cr .cs .cu .cv .cx .cy .cz .dd .de .dj .dk .dm .do .dz .ec .ee .eg .eh .er .es .et .eu .fi .fj "
	tlds += ".fk .fm .fo .fr .ga .gb .gd .ge .gf .gg .gh .gi .gl .gm .gn .gp .gq .gr .gs .gt .gu .gw .gy .hk .hm "
	tlds += ".hn .hr .ht .hu .id .ie .il .im .in .io .iq .ir .is .it .je .jm .jo .jp .ke .kg .kh .ki .km .kn .kp .kr .kw .ky .kz "
	tlds += ".la .lb .lc .li .lk .lr .ls .lt .lu .lv .ly .ma .mc .md .mg .mh .mk .ml .mm .mn .mo .mp .mq .mr .ms .mt "
	tlds += ".mu .mv .mw .mx .my .mz .na .nc .ne .nf .ng .ni .nl .no .np .nr .nu .nz .om .pa .pe .pf .pg .ph "
	tlds += ".pk .pl .pm .pn .pr .ps .pt .pw .py .qa .re .ro .ru .rw .sa .sb .sc .sd .se .sg .sh .si .sj .sk .sl .sm "
	tlds += ".sn .so .sr .st .su .sv .sy .sz .tc .td .tf .tg .th .tj .tk .tl .tm .tn .to .tp .tr .tt .tv .tw .tz .ua .ug .uk "
	tlds += ".um .us .uy .uz .va .vc .ve .vg .vi .vn .vu .wf .ws .ye .yt .yu .za .zm .zr .zw .com .net .org "
	tlds += ".mil .gov .edu .nato .info .int .name .biz .museum .pro";
var myRegex = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$");
var endofString = document.frm.email.value.split('.');
var ending = endofString.length - 1;
var tld = endofString[ending];
	if (! document.frm.email.value.match(myRegex))
	{alert(alerttxt);
	 return false;
	}
	else if (tlds.search(tld) < 0)
	{
	alert('Invalid top level domain, please try again.');
	 return false;
	}
	else
	{return true;}
}


function validate_form()
{
 with (document)
 { 
  		if (frm.company.value == ""){
    			alert("Please Fill In Your Company Name");
    			frm.company.focus();
   				return 0;}
//		if (document.frm.address.value == "")
//			{alert("Please Fill In Your Address");
//			document.frm.address.focus();
//			return 0;}
//		if (document.frm.city.value == "")
//			{alert("Please Fill In Your City");
//			document.frm.city.focus();
//			return 0;}
//		if (document.frm.province.value == "")
//			{alert("Please Fill In Your Province");
//			document.frm.province.focus();
//			return 0;}
//		if (document.frm.country.value == "")
//			{alert("Please Select Your Country");
//			document.frm.country.focus();
//			return 0;}
 // 		else{
//  			if (frm.postal_code.value.length < 5)
// 				{alert("Invalid postal code.");
//    			frm.postal_code.focus();
//    			return 0;}
//			}
//		if (document.frm.phone.value == "")
//			{alert("Please Fill In Your Telephone Number");
//			document.frm.phone.focus();
//			return 0;}
//		if (document.frm.email.value == "")
//			{alert("Please enter your email address");
//			document.frm.email.focus();
//			return 0;}
// 		if (validate_email(frm.email,"Invalid e-mail address!")==false)
//  			{frm.email.focus();
//    		return false;}

document.getElementById('frm').submit()

 }
}