/**
* @ Title:			regn/reseller.js
* @ Version:		1.0
* @ Copyright:		Copyright (c) 2009
* @ Author:			Prashant Rai
* @ Company:		Avenues (I) Pvt. Limited.
* @ Description:	JavaScript file for new registration validations for reseller.
* @ Created:		23-Feb-2009
* @ Modified:		
*/

function reseller_field_validate(){

		if(document.resellerProgFrm.title.length > 1){
			if(document.resellerProgFrm.title.options.selectedIndex < 1){
				alert("Select Salutation");
				document.resellerProgFrm.title.focus();
				return false;
			}
		}
	

		if(!chkBlank(document.resellerProgFrm.fname, "First Name")) return false;
		if(!chkAlpha(document.resellerProgFrm.fname, "First Name")) return false;
		
		if(document.resellerProgFrm.mname.value != ''){
			if(!chkAlpha(document.resellerProgFrm.mname, "Middle Name")) return false;
		}
		
		if(!chkBlank(document.resellerProgFrm.lname, "Last Name")) return false;
		if(!chkAlpha(document.resellerProgFrm.lname, "Last Name")) return false;

		if(!chkBlank(document.resellerProgFrm.desgn, "Job Title")) return false;
		if(!chkBlank(document.resellerProgFrm.contEmail, "E-mail")) return false;
		if(!chkEmail(document.resellerProgFrm.contEmail, "E-mail")) return false;

		//Check for phone numbers
		if(!chkBlank(document.resellerProgFrm.phone1, "Direct Phone Country Code")) return false;
		if(!chkNaN(document.resellerProgFrm.phone1, "Direct Phone Country Code")) return false;
		if(!chkBlank(document.resellerProgFrm.phone2, "Direct Phone Area Code")) return false;
		if(!chkNaN(document.resellerProgFrm.phone2, "Direct Phone Area Code")) return false;
		if(!chkBlank(document.resellerProgFrm.phone3, "Direct Phone Number")) return false;
		if(!chkNaN(document.resellerProgFrm.phone3, "Direct Phone Number")) return false;

		//Check for phone numbers
		if(!chkBlank(document.resellerProgFrm.mobile_1, "Mobile Phone Country Code")) return false;
		if(!chkNaN(document.resellerProgFrm.mobile_1, "Mobile Phone Country Code")) return false;
		if(!chkBlank(document.resellerProgFrm.mobile_2, "Mobile Phone Number")) return false;
		if(!chkNaN(document.resellerProgFrm.mobile_2, "Mobile Phone Number")) return false;
		

		
		//Check for property details
		if(!chkBlank(document.resellerProgFrm.cmpName, "Company Name")) return false;
		if(!validateURL(document.resellerProgFrm.cmpURL, "Company URL")) return false;		

		if(!chkBlank(document.resellerProgFrm.cmpAddr, "Company Address")) return false;
		if(!chkBlank(document.resellerProgFrm.cmpCity, "City")) return false;

		if(!chkBlank(document.resellerProgFrm.cmpZip, "Zip Code")) return false;
		if(!chkNaN(document.resellerProgFrm.cmpZip, "Zip Code")) return false;
		
		if(document.resellerProgFrm.propcountry.length > 1){
			if(document.resellerProgFrm.propcountry.options.selectedIndex < 1){
				alert("Select Country");
				document.resellerProgFrm.propcountry.focus();
				return false;
			}
		}

		//Checks if state is populated on selection of country
		if(document.resellerProgFrm.propState.length > 1){
			if(document.resellerProgFrm.propState.options.selectedIndex < 1){
				alert("Select State");
				document.resellerProgFrm.propState.focus();
				return false;
			}
		}

		if(document.resellerProgFrm.source.length > 1){
			if(document.resellerProgFrm.source.options.selectedIndex < 1){
				alert("Please Select Source About How did you find out about ResAvenue Reseller Program?");
				document.resellerProgFrm.source.focus();
				return false;
			}
		}

		if(!chkBlank(document.resellerProgFrm.comment, "Comments")) return false;
	
	document.resellerProgFrm.country.value = document.resellerProgFrm.propcountry.options[document.resellerProgFrm.propcountry.selectedIndex].text;
	document.resellerProgFrm.state.value = document.resellerProgFrm.propState.options[document.resellerProgFrm.propState.selectedIndex].text;
	document.resellerProgFrm.actionPage.value = "/servlet/reseller.ResellerServ";

}

function listState(){	
	changeStateCombo(document.resellerProgFrm.propcountry, document.resellerProgFrm.propState);

}