function getResolution(){
	resolution800x600="<LINK REL='STYLESHEET' TYPE='text/css' HREF='../css/800x600.css'>";
	resolution1024x768="<LINK REL='STYLESHEET' TYPE='text/css' HREF='../css/1024x768.css'>";
	width  = window.screen.width;
	height = window.screen.height;
	if (width==800 && height==600)
	return resolution800x600;
	else if (width==1024 && height==768)
	return resolution1024x768;
	else return resolution1024x768;
}
function loadPage(){
	//setDateToday();
	if (document.regform.firstName.value==""){}
	else loadValues();

}

function selectItem(sel,val){
	c=0;
	find=0;
	while((c<sel.length)&&(find==0)){
		if(sel.options[c].value==val){
			sel.selectedIndex=c;
			sel.value=val;
			find=1;
		}
		c++;
	}
	return find;
}


function loadValues(){

	selectItem(document.regform.selectTitle,document.regform.title.value);
	selectItem(document.regform.selectGender,document.regform.gender.value);

	if (selectItem(document.regform.selectState,document.regform.state.value)==0){
		document.regform.otherState.value = document.regform.state.value;
	}
	else document.regform.otherState.value = "";

	selectItem(document.regform.selectCountry,document.regform.country.value);

	selectItem(document.regform.howcontactus,document.regform.contact.value);
	birth = document.regform.dateBirth.value;

	year = birth.substring(0,birth.indexOf('-'));
	temp = birth.substring((birth.indexOf('-')+1),birth.length);
	month = temp.substring(0,temp.indexOf('-'));
	temp = temp.substring((temp.indexOf('-')+1),temp.length);
	day = temp.substring(0,temp.length);
	selectItem(document.regform.selectDay,day);
	selectItem(document.regform.selectMonth,month);
	selectItem(document.regform.selectYear,year);


}

function setDateToday(){
	date = new Date();
	day = date.getDate();
	month = (date.getMonth()+1);
	if (month<10){
		month = "0" + month;
	}
	if (day<10){
		day = "0" + day;
	}

	year = date.getYear();
	selectItem(document.regform.selectDay,day);
	selectItem(document.regform.selectMonth,month);
	selectItem(document.regform.selectYear,year);
}

function selectContact(){
	items = document.regform.contactItems.value;
	var s ="<SELECT class=select name=howcontactus>";
	s+="<option selected value=''>-- Choose One --</option>";
	if (items == ''){
		s+="<OPTION value=Television>Television<OPTION ";
		s+="value=Radio>Radio<OPTION value=Magazine>Magazine<OPTION ";
		s+="value='Direct Mail'>Direct Mail (Brochure)<OPTION value=Email>Direct ";
		s+="E-Mail<OPTION value='Banner Ad'>Banner Ad<OPTION ";
		s+="value='Outdoor Billboard'>Outdoor Billboard</OPTION> <OPTION value=Other>Other (please describe)</OPTION>";
		s+="</SELECT>";
	}
	else{
		len = items.length;
		cont = 0;
		temp = '';
		while(cont < len){
			temp = items.substring(0,items.indexOf(';'));
			s+="<OPTION value='"+temp+"'>" + temp;
			items = items.substring(items.indexOf(';')+1,items.length);
			cont = cont + temp.length + 1;
		}
	}
	return s;
	//selContact.innerHTML=s;


}



function selectTitle(){
	var s ="<select class=select name=selectTitle>";
	s +="<option value='Mr' Selected>Mr</option>";
	s +="<option value='Mrs'>Mrs</option>";
	s +="<option value='Ms'>Ms</option>";
	s +="<option value='Dr'>Dr</option>";
	s +="<option value=' ' Selected> </option>";
	s +="</select>";
	return s;
}
function selectMonth(){
	var s ="<select class=formfield name=selectMonth tabindex=12>";
	s +="<option value='01' Selected>January</option>";
	s +="<option value='02'>February</option>";
	s +="<option value='03'>March</option>";
	s +="<option value='04'>April</option>";
	s +="<option value='05'>May</option>";
	s +="<option value='06'>June</option>";
	s +="<option value='07'>July</option>";
	s +="<option value='08'>August</option>";
	s +="<option value='09'>September</option>";
	s +="<option value='10'>October</option>";
	s +="<option value='11'>November</option>";
	s +="<option value='12'>December</option>";
	s +="</select>";
	return s;
}
function selectGender(){
	var s ="<select class=select name=selectGender>";
	s +="<option value='0' Selected>Male</option>";
	s +="<option value='1'>Female</option>";
	s +="</select>";
	return s;
}
function selectDay(){
	d = 31;//getLastDay();
	var s ="<select class=formfield name=selectDay tabindex=13>";
	s +="<option value=01 Selected>1</option>";
	for(i=2;i<=d;i++)
	if (i<10)
	s +="<option value=0"+i+">"+i+"</option>";
	else s +="<option value="+i+">"+i+"</option>";
	s += "</select>"
	return s;
}


function getLastDay(){
	theMonth = document.regform.selectMonth.value - 1;
	theYear = document.regform.selectYear.value;
	d = new Date(theYear,theMonth,1);
	mm = d.getMonth();
	lastDay = 1;
	for (i=1;i<32;i++){
		t = new Date(theYear,theMonth,i);
		month = t.getMonth();
		if (mm==month){
			lastDay = i;
		}
	}
	return lastDay;
}


function selectYear(){
	d = new Date();
	hasta = d.getFullYear() -18;
	//if (navigator.appName=='Netscape')
	//	hasta = parseInt(hasta)+1900;
	var s ="<select class=formfield name=selectYear tabindex=14>";
	s +="<option value="+hasta+" Selected>"+hasta+"</option>";
	for(i=(hasta-1);i>=1909;i--){
		s +="<option value="+i+">"+i+"</option>";
	}
	s += "</select>"
	return  s;
}
function selectState(){
	var s = "<SELECT class=loginfield name=selectState tabindex=10>";
	s += "<OPTION selected value='00'>Choose one...";
	s += "<OPTION value=NA>Outside US , Canada or Australia</OPTION>";
	s += "<OPTION value=AL>Alabama";
	s += "<OPTION value=AK>Alaska";
	s += "<OPTION value=AZ>Arizona";
	s += "<OPTION value=AR>Arkansas";
	s += "<OPTION value=CA>California";
	s += "<OPTION value=CO>Colorado";
	s += "<OPTION value=CT>Connecticut";
	s += "<OPTION value=DE>Delaware";
	//s += "<OPTION value=DC>District of Columbia";
	s += "<OPTION value=FL>Florida";
	s += "<OPTION value=GA>Georgia";
	s += "<OPTION value=HI>Hawaii";
	s += "<OPTION value=ID>Idaho";
	s += "<OPTION value=IL>Illinois";
	s += "<OPTION value=IN>Indiana";
	s += "<OPTION value=IA>Iowa";
	s += "<OPTION value=KS>Kansas";
	//s += "<OPTION value=KY>Kentucky";
	s += "<OPTION value=LA>Louisiana";
	s += "<OPTION value=ME>Maine";
	s += "<OPTION value=MD>Maryland";
	s += "<OPTION value=MA>Massachusetts";
	s += "<OPTION value=MI>Michigan";
	s += "<OPTION value=MN>Minnesota";
	s += "<OPTION value=MS>Mississippi";
	//s += "<OPTION value=MO>Missouri";
	s += "<OPTION value=MT>Montana";
	s += "<OPTION value=NE>Nebraska";
	s += "<OPTION value=NV>Nevada";
	s += "<OPTION value=NH>New Hampshire";
	s += "<OPTION value=NJ>New Jersey";
	s += "<OPTION value=NM>New Mexico";
	s += "<OPTION value=NY>New York";
	s += "<OPTION value=NC>North Carolina";
	s += "<OPTION value=ND>North Dakota";
	s += "<OPTION value=OH>Ohio";
	s += "<OPTION value=OK>Oklahoma";
	s += "<OPTION value=OR>Oregon";
	s += "<OPTION value=PA>Pennsylvania";
	s += "<OPTION value=RI>Rhode Island";
	s += "<OPTION value=SC>South Carolina";
	s += "<OPTION value=SD>South Dakota";
	s += "<OPTION value=TN>Tennessee";
	s += "<OPTION value=TX>Texas";
	s += "<OPTION value=UT>Utah";
	s += "<OPTION value=VT>Vermont";
	s += "<OPTION value=VA>Virginia";
	//s += "<OPTION value=WA>Washington";
	s += "<OPTION value=WV>West Virginia";
	s += "<OPTION value=WI>Wisconsin";
	s += "<OPTION value=WY>Wyoming";
	s += "<OPTION value=canada>--------CANADA--------";
	s += "<OPTION value=AB style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Alberta</OPTION>";
	s += "<OPTION value=BC style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>British Columbia</OPTION>";
	s += "<OPTION value=MB style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Manitoba</OPTION>";
	s += "<OPTION value=NB style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>New Brunswick</OPTION>";
	s += "<OPTION value=NF style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Newfoundland</OPTION>";
	s += "<OPTION value=NS style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Nova Scotia</OPTION>";
	s += "<OPTION value=NU style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Nunavut</OPTION>";
	s += "<OPTION value=NT style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>N.W.T.</OPTION> ";
	s += "<OPTION value=ON style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Ontario</OPTION>";
	s += "<OPTION value=PE style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Prince Edward Island</OPTION>";
	s += "<OPTION value=QC style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Quebec</OPTION>";
	s += "<OPTION value=SK style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Saskatchewan</OPTION>";
	s += "<OPTION value=YT style='COLOR: red; FONT-STYLE: italic; FONT-WEIGHT: bold'>Yukon</OPTION>";
	s += "<OPTION value=australia>--------AUSTRALIA-------";
	s += "<OPTION value='CT'>Australian Capital Territory</option>";
	s += "<OPTION value='NS'>New South Wales</option>";
	s += "<OPTION value='NT'>Northern Territory</option>";
	s += "<OPTION value='QL'>Queensland</option>";
	s += "<OPTION value='SA'>South Australia</option>";
	s += "<OPTION value='TS'>Tasmania</option>";
	s += "<OPTION value='VI'>Victoria</option>";
	s += "<OPTION value='WA'>Western Australia</option></SELECT>";
	return s;
}


function selectCountry(){
	var s =	"<SELECT class=loginfield name=selectCountry tabindex=6 onChange='selectCountryOnChange(this)'>";
	s+= "<OPTION selected value=NA>Select Country...";
	s+= "<OPTION value=AF>Afghanistan";
	s+= "<OPTION value=AX>Aland Islands";
	s+= "<OPTION value=AL>Albania";
	s+= "<OPTION value=DZ>Algeria";
	s+= "<OPTION value=AS>American Samoa";
	s+= "<OPTION value =AD>Andorra";
	s+= "<OPTION value=AO>Angola";
	s+= "<OPTION value=AI>Anguilla";
	s+= "<OPTION value=AQ>Antarctica";
	s+= "<OPTION value=AG>Antigua And Barbuda";
	s+= "<OPTION value=AR>Argentina";
	s+= "<OPTION value=AM>Armenia";
	s+= "<OPTION value=AW>Aruba";
	s+= "<OPTION value=AU>Australia";
	s+= "<OPTION value=AT>Austria";
	s+= "<OPTION value=AZ>Azerbaijan";
	s+= "<OPTION value=BS>Bahamas";
	s+= "<OPTION value=BH>Bahrain";
	s+= "<OPTION value=BD>Bangladesh";
	s+= "<OPTION value=BB>Barbados";
	s+= "<OPTION value=BY>Belarus";
	s+= "<OPTION value=BE>Belgium";
	s+= "<OPTION value=BZ>Belize";
	s+= "<OPTION value=BJ>Benin";
	s+= "<OPTION value=BM>Bermuda";
	s+= "<OPTION value=BT>Bhutan";
	s+= "<OPTION value=BO>Bolivia";
	s+= "<OPTION value=BA>Bosnia and Herzegovina";
	s+= "<OPTION value=BW>Botswana";
	s+= "<OPTION value=BV>Bouvet Island";
	s+= "<OPTION value=BR>Brazil";
	s+= "<OPTION value=IO>British Indian Ocean Territory";
	s+= "<OPTION value=BN>Brunei";
	s+= "<OPTION value=BG>Bulgaria";
	s+= "<OPTION value=BF>Burkina Faso";
	s+= "<OPTION value=BI>Burundi";
	s+= "<OPTION value=KH>Cambodia";
	s+= "<OPTION value=CM>Cameroon";
	s+= "<OPTION value=CA>Canada";
	s+= "<OPTION value=CV>Cape Verde";
	s+= "<OPTION value=KY>Cayman Islands";
	s+= "<OPTION value=CF>Central African Republic";
	s+= "<OPTION value=TD>Chad";
	s+= "<OPTION value=CL>Chile";
	s+= "<OPTION value=CN>China";
	s+= "<OPTION value=CX>Christmas Island";
	s+= "<OPTION value=CC>Cocos (Keeling) Islands";
	s+= "<OPTION value=CO>Colombia";
	s+= "<OPTION value=KM>Comoros";
	s+= "<OPTION value=CG>Congo";
	s+= "<OPTION value=CD>Congo, Democractic Republic of the";
	s+= "<OPTION value=CK>Cook Islands";
	s+= "<OPTION value=CR>Costa Rica";
	s+= "<OPTION value=CI>Cote D'Ivoire (Ivory Coast)";
	s+= "<OPTION value=HR>Croatia (Hrvatska)";
	s+= "<OPTION value=CU>Cuba";
	s+= "<OPTION value=CY>Cyprus";
	s+= "<OPTION value=CZ>Czech Republic";
	s+= "<OPTION value=DK>Denmark";
	s+= "<OPTION value=DJ>Djibouti";
	s+= "<OPTION value=DM>Dominica";
	s+= "<OPTION value=DO>Dominican Republic";
	s+= "<OPTION value=EC>Ecuador";
	s+= "<OPTION value=EG>Egypt";
	s+= "<OPTION value=SV>El Salvador";
	s+= "<OPTION value=GQ>Equatorial Guinea";
	s+= "<OPTION value=ER>Eritrea";
	s+= "<OPTION value=EE>Estonia";
	s+= "<OPTION value=ET>Ethiopia";
	s+= "<OPTION value=FK>Falkland Islands (Islas Malvinas)";
	s+= "<OPTION value=FO>Faroe Islands";
	s+= "<OPTION value=FJ>Fiji Islands";
	s+= "<OPTION value=FI>Finland";
	s+= "<OPTION value=FR>France";
	s+= "<OPTION value=GF>French Guiana";
	s+= "<OPTION value=PF>French Polynesia";
	s+= "<OPTION value=TF>French Southern Territories";
	s+= "<OPTION value=GA>Gabon";
	s+= "<OPTION value=GM>Gambia";
	s+= "<OPTION value=GE>Georgia";
	s+= "<OPTION value=DE>Germany";
	s+= "<OPTION value=GH>Ghana";
	s+= "<OPTION value=GI>Gibraltar";
	s+= "<OPTION value=GR>Greece";
	s+= "<OPTION value=GL>Greenland";
	s+= "<OPTION value=GD>Grenada";
	s+= "<OPTION value=GP>Guadeloupe";
	s+= "<OPTION value=GU>Guam";
	s+= "<OPTION value=GT>Guatemala";
	s+= "<OPTION value=GN>Guinea";
	s+= "<OPTION value=GW>Guinea-Bissau";
	s+= "<OPTION value=GY>Guyana";
	s+= "<OPTION value=HT>Haiti";
	s+= "<OPTION value=HM>Heard and McDonald Islands";
	s+= "<OPTION value=VA>Holy See (Vatican City State)";
	s+= "<OPTION value=HN>Honduras";
	s+= "<OPTION value=HK>Hong Kong";
	s+= "<OPTION value=HU>Hungary";
	s+= "<OPTION value=IS>Iceland";
	s+= "<OPTION value=IN>India";
	s+= "<OPTION value=ID>Indonesia";
	s+= "<OPTION value=IR>Iran";
	s+= "<OPTION value=IQ>Iraq";
	s+= "<OPTION value=IE>Ireland";
	s+= "<OPTION value=IL>Israel";
	s+= "<OPTION value=IT>Italy";
	s+= "<OPTION value=JM>Jamaica";
	s+= "<OPTION value=JP>Japan";
	s+= "<OPTION value=JO>Jordan";
	s+= "<OPTION value=KZ>Kazakhstan";
	s+= "<OPTION value=KE>Kenya";
	s+= "<OPTION value=KI>Kiribati";
	s+= "<OPTION value=KP>Korea, Democratic People's Republic of";
	s+= "<OPTION value=kr>Korea, Republic of";
	s+= "<OPTION value=KW>Kuwait";
	s+= "<OPTION value=KG>Kyrgyzstan";
	s+= "<OPTION value=LA>Laos";
	s+= "<OPTION value=LV>Latvia";
	s+= "<OPTION value=LB>Lebanon";
	s+= "<OPTION value=LS>Lesotho";
	s+= "<OPTION value=LR>Liberia";
	s+= "<OPTION value=LYLibya";
	s+= "<OPTION value=LI>Liechtenstein";
	s+= "<OPTION value=LT>Lithuania";
	s+= "<OPTION value=LU>Luxembourg";
	s+= "<OPTION value=MO>Macao";
	s+= "<OPTION value=MK>Macedonia";
	s+= "<OPTION value=MG>Madagascar";
	s+= "<OPTION value=MW>Malawi";
	s+= "<OPTION value=MY>Malaysia";
	s+= "<OPTION value=MV>Maldives";
	s+= "<OPTION value=ML>Mali";
	s+= "<OPTION value=MT>Malta";
	s+= "<OPTION value=MH>Marshall Islands";
	s+= "<OPTION value=MQ>Martinique";
	s+= "<OPTION value=MR>Mauritania";
	s+= "<OPTION value=MU>Mauritius";
	s+= "<OPTION value=YT>Mayotte";
	s+= "<OPTION value=MX>Mexico";
	s+= "<OPTION value=FM>Micronesia";
	s+= "<OPTION value=MD>Moldova";
	s+= "<OPTION value=MC>Monaco";
	s+= "<OPTION value=MN>Mongolia";
	s+= "<OPTION value=MS>Montserrat";
	s+= "<OPTION value=MA>Morocco";
	s+= "<OPTION value=MZ>Mozambique";
	s+= "<OPTION value=MMM>Myanmar";
	s+= "<OPTION value=NA>Namibia";
	s+= "<OPTION value=NR>Nauru";
	s+= "<OPTION value=NP>Nepal";
	s+= "<OPTION value=AN>Netherlands Antilles";
	s+= "<OPTION value=NL>Netherlands";
	s+= "<OPTION value=NC>New Caledonia";
	s+= "<OPTION value=NZ>New Zealand";
	s+= "<OPTION value=NI>Nicaragua";
	s+= "<OPTION value=NE>Niger";
	s+= "<OPTION value=NG>Nigeria";
	s+= "<OPTION value=NU>Niue";
	s+= "<OPTION value=NF>Norfolk Island";
	s+= "<OPTION value=MP>Northern Mariana Islands";
	s+= "<OPTION value=NO>Norway";
	s+= "<OPTION value=OM>Oman";
	s+= "<OPTION value=PK>Pakistan";
	s+= "<OPTION value=PW>Palau";
	s+= "<OPTION value=PS>Palestinian Territory, Occupied";
	s+= "<OPTION value=PA>Panama";
	s+= "<OPTION value=PG>Papua new Guinea";
	s+= "<OPTION value=PY>Paraguay";
	s+= "<OPTION value=PE>Peru";
	s+= "<OPTION value=PH>Philippines";
	s+= "<OPTION value=PN>Pitcairn Island";
	s+= "<OPTION value=PL>Poland";
	s+= "<OPTION value=PT>Portugal";
	s+= "<OPTION value=PR>Puerto Rico";
	s+= "<OPTION value=QA>Qatar";
	s+= "<OPTION value=RE>Reunion";
	s+= "<OPTION value=RO>Romania";
	s+= "<OPTION value=RU>Russia";
	s+= "<OPTION value=RW>Rwanda";
	s+= "<OPTION value=SH>Saint Helena";
	s+= "<OPTION value=KN>Saint Kitts And Nevis";
	s+= "<OPTION value=LC>Saint Lucia";
	s+= "<OPTION value=PM>Saint Pierre and Miquelon";
	s+= "<OPTION value=VC>Saint Vincent And The Grenadines";
	s+= "<OPTION value=WS>Samoa";
	s+= "<OPTION value=SM>San Marino";
	s+= "<OPTION value=ST>Sao Tome and Principe";
	s+= "<OPTION value=SA>Saudi Arabia";
	s+= "<OPTION value=SN>Senegal";
	s+= "<OPTION value=CS>Serbia and Montenegro";
	s+= "<OPTION value=SC>Seychelles";
	s+= "<OPTION value=SL>Sierra Leone";
	s+= "<OPTION value=SG>Singapore";
	s+= "<OPTION value=SK>Slovakia";
	s+= "<OPTION value=SI>Slovenia";
	s+= "<OPTION value=SB>Solomon Islands";
	s+= "<OPTION value=SO>Somalia";
	s+= "<OPTION value=ZA>South Africa";
	//	s+= "<OPTION value=GS>South Georgia And The South Sandwich Islands";
	s+= "<OPTION value=ES>Spain";
	s+= "<OPTION value=LK>Sri Lanka";
	s+= "<OPTION value=SD>Sudan";
	s+= "<OPTION value=SR>Suriname";
	s+= "<OPTION value=SJ>Svalbard And Jan Mayen Islands";
	s+= "<OPTION value=SZ>Swaziland";
	s+= "<OPTION value=SE>Sweden";
	s+= "<OPTION value=CH>Switzerland";
	s+= "<OPTION value=SY>Syria";
	s+= "<OPTION value=TW>Taiwan";
	s+= "<OPTION value=TJ>Tajikistan";
	s+= "<OPTION value=TZ>Tanzania";
	s+= "<OPTION value=TH>Thailand";
	s+= "<OPTION value=TL>Timor-Leste";
	s+= "<OPTION value=TG>Togo";
	s+= "<OPTION value=TK>Tokelau";
	s+= "<OPTION value=TO>Tonga";
	s+= "<OPTION value=TT>Trinidad And Tobago";
	s+= "<OPTION value=TN>Tunisia";
	s+= "<OPTION value=TR>Turkey";
	s+= "<OPTION value=TM>Turkmenistan";
	s+= "<OPTION value=TC>Turks And Caicos Islands";
	s+= "<OPTION value=TV>Tuvalu";
	s+= "<OPTION value=UG>Uganda";
	s+= "<OPTION value=UA>Ukraine";
	s+= "<OPTION value=AE>United Arab Emirates";
	s+= "<OPTION value=GB>United Kingdom";
	s+= "<OPTION value=US>United States";
	//	s+= "<OPTION value=UM>United States Minor Outlying Islands";
	s+= "<OPTION value=UY>Uruguay";
	s+= "<OPTION value=UZ>Uzbekistan";
	s+= "<OPTION value=VU>Vanuatu";
	s+= "<OPTION value=VE>Venezuela";
	s+= "<OPTION value=VN>Vietnam";
	s+= "<OPTION value=VG>Virgin Islands (British)";
	s+= "<OPTION value=VI>Virgin Islands (US)";
	s+= "<OPTION value=WF>Wallis And Futuna Islands";
	s+= "<OPTION value=EH>Western Sahara";
	s+= "<OPTION value=YE>Yemen";
	s+= "<OPTION value=ZM>Zambia";
	s+= "<OPTION value=ZW>Zimbabwe</OPTION></SELECT>";
	return s;
}


//////////////


function checkField(field, whatis, onlyNumber) {
	if(field.value == "") 	{
		alert("Please insert a valid " + whatis);
		field.focus();
		return false;
	}
	else if (onlyNumber==true && !isFinite(field.value))	 	{
		alert(whatis+" numeric characters only");
		field.focus();
		return false;
	}
	else return true;
}

function checkAndSubmit()	{
	var p1=false;

	//----------------------------PERSONAL INFORMATION--------------------------
	//TITLE
	//document.regform.title.value = document.regform.selectTitle.options[document.regform.selectTitle.selectedIndex].value
	title = -1;
	for (i=document.regform.title.length-1; i > -1; i--) {
		if (document.regform.title[i].checked) {
			title = i;
			//Gender
			document.regform.gender.value = i;
		}
	}

	if (title == -1) {
		alert("Please select a valid Title");
		return false;
	}

	//FIRST NAME
	if (checkField(document.regform.firstName,'First Name',false)==false) return;
	//LASTNAME
	if (checkField(document.regform.lastName,'Last Name',false)==false) return;
	//TITLE
	//document.regform.title.value = document.regform.selectTitle.options[document.regform.selectTitle.selectedIndex].value
	//ADDRESS
	if (checkField(document.regform.address1,'Address 1',false)==false) return;
	//CITY
	if (checkField(document.regform.city,'City',false)==false) return;
	//COUNTRY
	country = document.regform.selectCountry.options[document.regform.selectCountry.selectedIndex].value
	if(country=='NA'){
		alert('Please choose a valid Country!');
		document.regform.selectCountry.focus();
		return;
	}

	if(country=='US')
	if (checkField(document.regform.zipCode,'Zip Code',false)==false) return;
	document.regform.country.value= country;

	//STATE
	state = document.regform.selectState.options[document.regform.selectState.selectedIndex].value
	if(country=='US'){
		if(state=='00'){
			alert('The STATE is required for United States, choose one!');
			document.regform.selectState.focus();
			return;
		}
		document.regform.state.value=state;
	}
	else if(country=='CA'){
		if(state=='00'){
			alert('The PROVINCE is required for Canada, choose one!');
			document.regform.selectState.focus();
			return;
		}
		document.regform.state.value=state;
	} else if(country=='AU'){
		if(state=='00'){
			alert('The PROVINCE is required for Australia, choose one!');
			document.regform.selectState.focus();
			return;
		}
		document.regform.state.value=state;

	}else if(state=='international'){
		document.regform.state.value=document.regform.otherState.value;
	} else if(country != 'US' || country != 'CA' || country != 'AU'){
		if(document.regform.otherState.value == ""){
			alert('The STATE / PROVINCE is required!');
			document.regform.otherState.focus();
			return;
		} else {
			document.regform.state.value=document.regform.otherState.value;
		}

	} else document.regform.state.value=state;


	//GENDER
	//document.regform.gender.value = document.regform.selectGender.options[document.regform.selectGender.selectedIndex].value
	//DATE OF BIRTH
	document.regform.dateBirth.value = document.regform.selectYear.options[document.regform.selectYear.selectedIndex].value+"-"+document.regform.selectMonth.options[document.regform.selectMonth.selectedIndex].value +"-"+ document.regform.selectDay.options[document.regform.selectDay.selectedIndex].value;


	//--------------------------------SECURITY INFORMATION-----------------
	//PASSWORD
	if (checkField(document.regform.newpassword,'Password',false)==false) return;
	if (checkField(document.regform.newpassword2,'Re-Type Password',false)==false) return;
	if (checkField(document.regform.passwordHint,'Password Hint',false)==false) return;
	if (document.regform.securityQuestion.value == '0') {
		alert("Please select a valid Security Question");
		document.regform.securityQuestion.focus();
		return;
	}
	if (checkField(document.regform.securityAnswer,'Security Answer',false)==false) return;
	if (document.regform.newpassword2.value != document.regform.newpassword.value){
		alert('Passwords are diferents');
		return;
	}



	//----------------------------CONTACT INFORMATION--------------------------
	//DAY PHONE


	if (document.regform.dayPhone.value==""){
		alert("Please enter a valid day phone");
		document.regform.dayPhone.focus();
		return;
	}

	//NIGHT PHONE
	//if (document.regform.nightPhone.value == ""){
	//alert("Please enter a valid night phone");
	//document.regform.nightPhone.focus();
	//return;
	//}

	//EMAIL
	if (document.regform.email.value=="" || document.regform.email.value.indexOf("@")<1)	{
		alert('Please enter a valid email');
		document.regform.email.focus();
		return;
	}

	//SECOND EMAIL
	/*if (document.regform.secondEmail.value!="" && document.regform.secondEmail.value.indexOf("@")<1)	{
	alert('Please enter a valid email(other)');
	document.regform.secondEmail.focus();
	return;
	}*/
	//KEEP ME UPDATE
	if (document.regform.send.checked){
		document.regform.marketingInfo.value = 1;
	}
	else document.regform.marketingInfo.value = 0;


//----------------------------------Points of Interest--------------------

	//points = -1;
	//for (i=document.regform.systemPreferences.length-1; i > -1; i--) {
		//if (document.regform.systemPreferences[i].checked) {
		//	points = i;
		//}
	//}

	//if(points == -1){
	//	alert("You must select one or more Points of interest");
	//	return false;
	//}


	//----------------------------------COMMENTS--------------------

	//if(document.regform.yourcomments.value != ""){
	//var clientComments = "Client Comments: "+document.regform.yourcomments.value+" || ";
	//} else {
	//var clientComments;
	//}

	//if(document.regform.promocode.value != ""){
	//var promoCode = "Promo Code: "+document.regform.promocode.value+" || ";
	//} else {
	//var promoCode;
	//}

	//exactsource = document.regform.exactsource.value
	//if (exactsource==""){
	//alert('Please enter source');
	//document.regform.exactsource.focus();
	//return;
	//}

	//document.regform.comments.value = clientComments+" Source:"+document.regform.exactsource.value+promoCode;

	//----------------------------------REFERRAL INFORMATION--------------------
	/*index = document.regform.howcontactus.selectedIndex;
	hw = document.regform.howcontactus.options[index].value;
	if (index == 0){
	alert("'How did you hear about us?' is a required field");
	document.regform.howcontactus.focus();
	return false;
	}
	else document.regform.contact.value=hw;
	*/

	//Source Type
	typesource = -1;
	var exactsource = "NA";
	for (i=document.regform.how.length-1; i > -1; i--) {
		if (document.regform.how[i].checked) {
			typesource = i;

			switch(typesource){

				case 5:
				if(document.regform.othermagazine.value == "" || document.regform.othermagazine.value == "Please Specify"){
					alert('Please Specify Magazine Name');
					document.regform.othermagazine.focus();
					return;
				} else {
					exactsource = "Other Magazine Name is "+document.regform.othermagazine.value;
				}
				break;
				case 8:
				if(document.regform.otheronline.value == "" || document.regform.otheronline.value == "Please Specify"){
					alert('Please Specify Other Online');
					document.regform.otheronline.focus();
					return;
				} else {
					exactsource = "Other Online is "+document.regform.otheronline.value;
				}
				break;
				case 9:
				if(document.regform.friendaccount.value == "" || document.regform.friendaccount.value == "Account #"){
					alert('Please Specify your Friend Account');
					document.regform.friendaccount.focus();
					return;
				} else {
					exactsource = "Friend Account is "+document.regform.friendaccount.value;
				}
				break;
				case 10:
				if(document.regform.googlekeyword.value == "" || document.regform.googlekeyword.value == "Specify Keyword"){
					alert('Please Specify Google Keyword');
					document.regform.googlekeyword.focus();
					return;
				} else {
					exactsource = "Google Keyword is "+document.regform.googlekeyword.value;
				}
				break;
				case 11:
				if(document.regform.yahookeyword.value == "" || document.regform.yahookeyword.value == "Specify Keyword"){
					alert('Please Specify Yahoo Keyword');
					document.regform.yahookeyword.focus();
					return;
				} else {
					exactsource = "Yahoo Keyword is "+document.regform.yahookeyword.value;
				}
				break;
				case 12:
				if(document.regform.msnkeyword.value == "" || document.regform.msnkeyword.value == "Specify Keyword"){
					alert('Please Specify MSN Keyword');
					document.regform.msnkeyword.focus();
					return;
				} else {
					exactsource = "MSN Keyword is "+document.regform.msnkeyword.value;
				}
				break;
				case 13:
				if(document.regform.foxkeyword.value == "" || document.regform.foxkeyword.value == "Specify Keyword"){
					alert('Please Specify Fox Keyword');
					document.regform.foxkeyword.focus();
					return;
				} else {
					exactsource = "Fox Keyword is "+document.regform.foxkeyword.value;
				}
				break;
				case 14:
				if(document.regform.other.value == "" || document.regform.other.value == "Please Specify"){
					alert('Please Specify this other source');
					document.regform.other.focus();
					return;
				} else {
					exactsource = "Other Source is "+document.regform.other.value;
				}
				break;
			}
		}
	}

	if (typesource == -1) {
		alert("You must check the source type");
		return false;
	}

	var hw="";
	j=document.regform.how.length;
	for (i=0; i<j; i++){
		if(document.regform.how[i].checked){
			var hw = document.regform.how[i].value
			document.regform.contact.value = hw;
		}
	}

	if(exactsource != "NA"){
		document.regform.comments.value = exactsource;
	}

	//--------------------------------- ACCEPT TERMS AND CONDITIONS ----------------------------
	if (document.regform.accept.checked == false) {
		alert("You must accept the terms and conditions");
		document.regform.accept.focus();
		return false;
	}

	document.regform.submit();
}
function moveToNext(text,nextText,characters){
	valor = text.value;
	total = valor.length;

	if(total>=characters){
		eval(nextText+".focus()");
	}
}
