function populateState() {
	var browser = navigator.appName ;// != 'Microsoft Internet Explorer' )
	var obj = "" ;
	var obj2 = "" ;
	var obj3 = "";

	if( browser == 'Microsoft Internet Explorer'  ) {
		obj = document.getElementById("country");
		obj2 = document.getElementById('IndianStatesText');
		obj3=document.getElementById('IndianCitiesText');
	}else {
		obj = document.fabmallRegisterForm.country;
		obj2 = document.fabmallRegisterForm.IndianStatesText;
		obj3=document.fabmallRegisterForm.IndianCitiesText;
	}

	if (obj.options[obj.selectedIndex].value=='India') {
		obj2.disabled=false;
		obj3.disabled=false;
		obj2.options.length=0;
		obj2.options[0]=new Option("-------------Select-------------","", false, false);
		for (var i=0; i<indiaState.length; i++) {
			if (indiaState[i]=='Kerala') {
			obj2.options[i+1]=new Option(indiaState[i],indiaState[i],true, true);
			}else {
			obj2.options[i+1]=new Option(indiaState[i],indiaState[i],false, false);
			}
		}
	}else if (obj.options[obj.selectedIndex].value=='United States') {
		obj2.disabled=false;
		obj3.disabled=true;
		obj2.options.length=0;
		obj2.options[0]=new Option("-------------Select-------------","", true, false);
		for (var i=0; i<usState.length; i++) {
			obj2.options[i+1]=new Option(usState[i],usState[i],false, false);
		}
	}else {
		obj2.disabled=true;
		obj3.disabled=true;
	}
	return true;
}
function ValidateNum(input,event){
var keyCode = event.which ? event.which : event.keyCode;
if (parseInt(keyCode)==9) return true;
if (document.fabmallRegisterForm.userName.value.length==0) {
	if (parseInt(keyCode)>=97 && parseInt(keyCode)<=122){
		return true;
	}else {
	alert("UserName should being with a letter(a-z)");
	return false;
	}
}

if(parseInt(keyCode)>=48 && parseInt(keyCode)<=57){
		return true;
}
if ((parseInt(keyCode)>=97 && parseInt(keyCode)<=122) || (parseInt(keyCode)==95)){
		return true;
}
if(parseInt(keyCode)==46 || parseInt(keyCode)==8 || parseInt(keyCode)==39){
	return true;					
}
	return false;
}
function ValidatePhone(input,event){
var keyCode = event.which ? event.which : event.keyCode;
if (parseInt(keyCode)==9) return true;
if(parseInt(keyCode)>=48 && parseInt(keyCode)<=57){
		return true;
}
if(parseInt(keyCode)==46 || parseInt(keyCode)==8 || parseInt(keyCode)==39){
	return true;					
}
	return false;
}
function ValidatePin(input,event){
var keyCode = event.which ? event.which : event.keyCode;
if (parseInt(keyCode)==9) return true;
if(parseInt(keyCode)>=48 && parseInt(keyCode)<=57){
		return true;
}
if (parseInt(keyCode)>=97 && parseInt(keyCode)<=122){
		return true;
}
if (parseInt(keyCode)>=65 && parseInt(keyCode)<=90){
		return true;
}
if(parseInt(keyCode)==46 || parseInt(keyCode)==8 || parseInt(keyCode)==39){
	return true;					
}
	return false;
}

  function trySubmit(theForm){


	if(validateFormFields(theForm)){
	  if (!isNaN(theForm.userName.value.substring(0,1))) {
		  alert("UserName should being with a letter");
		  theForm.userName.focus();
		  return false;
	  }
	  theForm.firstName.value=theForm.firstName.value.stringTrim();
	  theForm.lastName.value=theForm.lastName.value.stringTrim();	
	   // check whether passwd match
	  if (theForm.passwd.value.length < 4 ) {
		  alert('The passwords should contain minimum of 4 letters');
		  theForm.passwd.focus();
		  return false;
	  }
      if (theForm.passwd.value != theForm.confirmPasswd.value) {
          alert('The passwords do not match.  Please try again.');
          theForm.passwd.focus();
          return false;
      }
	  var dd = theForm.DD ;
	  var mm = theForm.MM;
	  var yy = theForm.YY;

	  theForm.dateOfBirth.value=mm.options[mm.selectedIndex].value+"/"+dd.options[dd.selectedIndex].value+"/"+yy.options[yy.selectedIndex].value;


		
	  var obj1 = theForm.IndianCitiesText;
	  var obj2 = theForm.OtherCitiesText;
	 
	  if (obj1.selectedIndex>0&&obj2.value.length>0&&obj1.disabled==false) {
		  alert('You cannot enter a value for City Others when you have selected a City');
		 if (obj1.disabled==false) {
			obj1.focus();
		 }else {
			 obj2.focus();
		 }
		  return false;
	  }else if (obj1.selectedIndex==0&&obj2.value.length==0) {
		alert("Please select your city");
		if (obj1.disabled==false) {
			obj1.focus();
		 }else {
			 obj2.focus();
		 }
		return false;
	  }else if (obj1.disabled==true&&obj2.value.length==0) {
		  alert("Please enter your city");
		if (obj1.disabled==false) {
			obj1.focus();
		 }else {
			 obj2.focus();
		 }
		return false;
	  }
	  if (obj1.disabled==false&&obj1.selectedIndex>0) {
	  theForm.city.value=obj1.options[obj1.selectedIndex].value;
	  }else {
	  theForm.city.value=obj2.value;
	  }
	  obj1 = theForm.IndianStatesText;
	  obj2 = theForm.OtherStatesText;
	 
	  if (obj1.selectedIndex>0&&obj2.value.length>0&&obj1.disabled==false) {
		  alert('You cannot enter a value for State Others when you have selected a State');
		 if (obj1.disabled==false) {
			obj1.focus();
		 }else {
			 obj2.focus();
		 }
		  return false;
		 
	  }else if (obj1.selectedIndex==0&&obj2.value.length==0) {
		alert("Please select your state");
		if (obj1.disabled==false) {
			obj1.focus();
		 }else {
			 obj2.focus();
		 }
		return false;
	  }else if (obj1.disabled==true&&obj2.value.length==0) {
		  alert("Please enter your state");
		if (obj1.disabled==false) {
			obj1.focus();
		 }else {
			 obj2.focus();
		 }
		return false;
	  }
	  if (obj1.disabled==false&&obj1.selectedIndex>0) {
	  theForm.state.value=obj1.options[obj1.selectedIndex].value;
	  }else {
	  theForm.state.value=obj2.value;
	  }
	  var email = theForm.email.value;
      email = email.replace(/ /g, "");
      if (email == "" || emailCheck(email)) {
         // theForm.submit();
		 return true ;
      }else {
         return false;
      } 

    }else{ 
        return false;
    }
	
  }//trySubmit

  function populateArrayValues(regList, stateName) {
	if (stateName=='USStates') {
		usState=regList.split("#");
	}else if (stateName=='IndiaStates') {
		indiaState=regList.split("#");
	}
  }
