/*Added By Rajesh for RFF01 Starts*/
var xmlHttp;
var xmlHttp1;
function keypress()
{
	//alert("in keypressevent");
	if(event.keyCode=='13')
	  alert("Enter button clicked");


}
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
        xmlHttp1 = new XMLHttpRequest();
    }
}

function doRequestUsingGETCountry(ctrl,ctrlValue) {
	var objChildDest = document.getElementById("state");
	if ((ctrl.value == null)|| (ctrl.value == ""))
	{
		removeOptions(objChildDest);
		var objOption=new Option(controls_state_default,"");
		objChildDest[objChildDest.length]=objOption;
		return;
	}
    createXMLHttpRequest();
    queryString =   "countryState.do?method=load" ;
    queryString = queryString + "&selcountry="+ctrlValue;
    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", queryString, true);
    xmlHttp.send(null);
}
/* 
 This Method is add by Anshul For Checking whether  user enter password is correct or not.
 */
function checkCurrentPassword() {
	
		
	var passwordVal = document.getElementById("password").value;
	var tempUserId = document.getElementById("tempUserId").value;
				
    createXMLHttpRequest();
    queryString =   "checkPassword.do?method=checkCurrentPassword";
    queryString =  queryString+ "&password="+passwordVal+"&userId="+tempUserId;
    xmlHttp1.onreadystatechange = passwordChange;
    xmlHttp1.open("GET", queryString, true);
    xmlHttp1.send();
}

function handleStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
          updateStates();
        }
    }
}

function passwordChange() {	
    if(xmlHttp1.readyState == 4) {
        if(xmlHttp1.status == 200) {
        	        	
        	/*var passwordXML = xmlHttp1.responseXML;
        	   	
        	 var states = passwordXML.getElementsByTagName("passwords");
        	  	 
        	 var items = states.getElementsByTagName("password");
       	
        	var response4 = xmlHttp1.responseText;
    	
       	     var value = items.getElementsByTagName("value").firstChild.nodeValue;*/
          
        }
    }
}

/*
 * Update States corresponding to the country
 * described in XML document.
 */
       
function updateStates() {
	 var stateXML = xmlHttp.responseXML;	
	 var states = stateXML.getElementsByTagName("states")[0];
     var items = states.getElementsByTagName("state");
	 for (var i = 0 ; i < items.length ; i++) {
	     var item = items[i];
	     var name = item.getElementsByTagName("name")[0].firstChild.nodeValue;
	     var value = item.getElementsByTagName("value")[0].firstChild.nodeValue;
		 var idx = document.getElementById('state').options.length;
		 document.getElementById('state').options.length= items.length+1;
	     document.getElementById('state').options[i+1] = new Option(name, value);
	 }
}

function submitLoginUser(flag)
{
	
	if(validateMandatory("userName","User Name","password","Password"))
	{
		if(flag){
			document.loginForm.action="loadLogin.do?method=adminLogin";
		}else{
			//document.loginForm.action="loadLogin.do?method=submitLoginUser&next=/en_US/contedu/sc-100/intro.jsp";
			document.loginForm.action="loadLogin.do?method=submitLoginUser";
		}

		document.loginForm.submit();
	}
}
function validateUser(path)
{

	if(validateMandatory("userName","User Name","password","Password"))
	{

			document.loginForm.action="loadLogin.do?method=submitLoginUser&next="+path;
			document.loginForm.submit();
	}
}

function submitForgotPassword()
{
	/*if((document.getElementById('userName').value=="") && (document.getElementById('emailAddress').value==""))
	{
		alert(forgotPassword_error_required_MSS_013);
		document.getElementById('userName').focus();
	}*/
	// Add By Anshul for forget password on 5 dec
	if((document.getElementById('userName').value==""))
	{
		alert(forgotPassword_error_required_MSS_013);
		document.getElementById('userName').focus();
	}
	/*  comment  By anshul for forget password 
	 * else if((isValidateEmail(document.getElementById('emailAddress'))) && (document.getElementById('emailAddress').value!=""))
	{
		alert(user_error_invalidEmail_MSS_006);
		document.getElementById('emailAddress').focus();
	}*/ 
	else
	{
		//document.forgotPasswordForm.action="loadForgotPassword.do?method=saveForgotPassword"; 
		//Added by naresh for password security purpose
		document.forgotPasswordForm.action="loadForgotPassword.do?method=checkSecurityQuestions";
		document.forgotPasswordForm.submit();
	}
}

function submitCheckQuestions()
{
		document.forgotPasswordForm.action="loadForgotPassword.do?method=submitQuestionsAnswers";
		document.forgotPasswordForm.submit();
	
}

function submitQuestionsAnswer()
{		document.forgotPasswordForm.action="loadForgotPassword.do?method=submitSecurityAnswer";		
		document.forgotPasswordForm.submit();

}

function resetForm(param, ctrlForm)
{
	if(param!="UPDATE")
	{
		if(confirm(login_confirm_reset_GLB_002))
		{

			if(param =='LOGIN')
			{
				document.loginForm.action="loadLogin.do?method=loadLogin";
				document.loginForm.submit();
			}

			else if(param=='FORGOTPASSWORD')
			{
				document.forgotPasswordForm.action="loadForgotPassword.do?method=loadForgotPassword";
				document.forgotPasswordForm.submit();
			}
			else if(param=='REGISTRATION')
			{
				document.userForm.action="loadUser.do?method=reload";
				document.userForm.submit();
			}else if(param=='ADMIN_LOGIN')
			{
				document.loginForm.action="admin.do?method=load";
				document.loginForm.submit();
			}else if(param =='SEARCH')
			{
				ctrlForm.action="searchUser.do?method=load";
				ctrlForm.submit();
			}
		}

	}
	else
	{
		if(confirm(login_confirm_reset_update_MSS_048))
		{
			 //Updated by Sanjoy on 08-Sep-2009 for RFF-03.Start
			 //document.userForm.reset();
			 //document.getElementById('iamaDesc').focus();
			 this.location.reload(true);
			 //Updated by Sanjoy on 08-Sep-2009 for RFF-03.End
		}
	}
}
// This function is used to set the mandatory check based upon title value 'Dr'
function changeTitle()
{
	var aluminiId = document.getElementById('aluminiId');
	var alumniLabelIdObj =  document.getElementById('alumniLabelId');
	var alumniBlankLabelIdObj =  document.getElementById('alumniBlankLabelId');
	var iamaValue = document.getElementById('iamaDesc').value;
	if(iamaValue == "VS")
	{
		//alumniLabelIdObj.style.display = "";
		document.getElementById('alumniOf').selectedIndex=0;
		aluminiId.style.display = "none";
		blankThirdId.style.display = "none";
		aluminiTextId.style.display = "none";
		aluminiOtherId.style.display = "none";
	}
	else if(iamaValue == "")
	{
		aluminiId.style.display = "";
		//Updated by sanjoy on 03-Sep-2009 for RFF-03.Starts
		//alumniLabelIdObj.style.display = "none";
		alumniLabelIdObj.style.display = "";
		//Updated by sanjoy on 03-Sep-2009 for RFF-03.Ends
		alumniBlankLabelIdObj.style.display = "";
	}
	else if(iamaValue != "" && iamaValue != "VS" && iamaValue != "FM")//Sanjoy 08-Sep-09
	{
		alumniLabelIdObj.style.display = "";
		alumniBlankLabelIdObj.style.display = "none";
		aluminiId.style.display = "";
		clinicId.style.display = "none";
	}
}

/* This function is used to submit the user registration form */
function submitUser(userMode)
{

	//var titleValue = document.getElementById('title').value;
	var iamaValue =  document.getElementById('iamaDesc').value;
	var schoolDropdown =  document.getElementById('schoolName').value;
	var schoolText =  document.getElementById('schoolNameOther').value;
	var clinicText =  document.getElementById('clinicNameOther').value;
	var alumniOfDropdown =  document.getElementById('alumniOf').value;
	var alumniOfText =  document.getElementById('alumniOfOther').value;
	var practiceObj = document.getElementById('practice');
	var residenceObj = document.getElementById('residence');
	var yesObj = document.getElementById('yesId');
	var noObj = document.getElementById('noId');
	var addressTwoObj= document.getElementById('studentAddressTwo');
	var graduation = document.getElementById('yearOfGraduation').value;
	var zipTwoObj=document.getElementById('zipTwo');
	var firstPhoneObj = document.getElementById('phoneNumberFirst');
	var secondPhoneObj = document.getElementById('phoneNumberSecond');
	var thirdPhoneObj = document.getElementById('phoneNumberThird');
	var phoneNumber = document.getElementById('phoneNumber');
	var phone = document.getElementById('phoneNumber').value;
	//added by deepti
	var periodicYesObj = document.getElementById('periodicNewsYesId');
	var periodicNoObj = document.getElementById('periodicNewsNoId');
	//upto here
	//added by naresh
	var securityQuestion1 = document.getElementById('securityQuestion1').value;
	var securityQuestion2 = document.getElementById('securityQuestion2').value;
	var securityAnswer1 = document.getElementById('securityAnswer1').value;
	var securityAnswer2 = document.getElementById('securityAnswer2').value;
	//upto here
	/*if((firstPhoneObj.value!="") || (secondPhoneObj.value!="") || (thirdPhoneObj.value!=""))
	{
		document.getElementById('phoneNumber').value = firstPhoneObj.value+"-"+secondPhoneObj.value+"-"+thirdPhoneObj.value;
		var phone = document.getElementById('phoneNumber').value;
	}*/
	var alumniObjField="";
	var alumniDisplayField ="";
	var alumniOfOtherObjField="";
	var alumniOfOtherDisplayField ="";
	var schoolNameObjField ="";
	var schoolNameDisplayField ="";
	var schoolNameOtherObjField = "";
	var schoolNameOtherDisplayField = "";
	//added by deepti
	var clinicNameOtherObjField = "";
	var clinicNameOtherDisplayField = "";
	var addressReferenceObj = "";
	var addressReferenceDisplayField ="";
	var specialOfferObj = "";
	var specialOfferDisplayField ="";
	var addressTwoObjField="";
	var addressTwoObjFieldDisplay="";
	var zipTwoObjField="";
	var zipTwoObjFieldDisplay="";
	var graduationObjField ="yearOfGraduation";				// Updated by Sanjoy on 03-Sep-2009 for RFF-03
	var graduationDisplayField ="Graduation Year (yyyy)";   // Updated by Sanjoy on 03-Sep-2009 for RFF-03
	var phoneObjField = "";
	var phoneDisplayField = "";
	var graduationObjLabel ="";
	var graduationDisplayLabel = "";
	//added by Deepti
	var periodicNewsObj = "";
	var periodicNewsDisplayField ="";
	var	securityQ1ObjField = "";
	var	securityQ1DisplayField = "";
	var	securityQ2ObjField = "";
	var	securityQ2DisplayField = "";
	var	securityA1ObjField = "";
	var	securityA1DisplayField = "";
	var	securityA2ObjField = "";
	var	securityA2DisplayField = "";
	//upto here
	
	if((practiceObj.checked==false) && (residenceObj.checked==false))
	{
		addressReferenceObj = "addressReference";
		addressReferenceDisplayField ="This address is a";
	}
	if((yesObj.checked==false) && (noObj.checked==false))
	{
		specialOfferObj = "specialOffer";
		specialOfferDisplayField ="Special Offers and Periodic News";
	}
	/*//Added by Deepti
	if((periodicYesObj.checked==false) && (periodicNoObj.checked==false))
	{
		periodicNewsObj = "periodicNews";
		periodicNewsDisplayField ="Special Offers and Periodic News";
	}*/
	//upto here

	if(alumniOfDropdown == 28)
	{
		alumniOfOtherObjField="alumniOfOther";
		alumniOfOtherDisplayField ="Alumni of...";
	}
	if((iamaValue != "VS") && (iamaValue != ""))
	{
		alumniObjField="alumniOf";
		alumniDisplayField ="Alumni of...";

	}
/*	if((iamaValue == "VS" || iamaValue == "FM") ) //Sanjoy  //commented on 28/12/2011 as Alumni of ... is a mandatory field
	{
		schoolNameObjField ="schoolName";
		schoolNameDisplayField ="School Name";
		//graduationObjField ="yearOfGraduation";	   // Commented By Sanjoy on 03-Sep-09 for RFF-03
	    //graduationDisplayField ="Graduation Year (yyyy)";  // Commented By Sanjoy on 03-Sep-09 for RFF-03
	} */
	// Added by Sanjoy on 03-Sep-2009 for RFF-03. Starts
	if(iamaValue == "OM" ||iamaValue == "OT"  )
	{
		alumniObjField="";
		alumniDisplayField ="";
		graduationObjField ="";
	    graduationDisplayField ="";
	}
	// Added by Sanjoy on 03-Sep-2009 for RFF-03. Ends
	if((iamaValue != "VS") && (iamaValue != "FM"))
	{
		clinicNameOtherObjField ="clinicNameOther";
		clinicNameOtherDisplayField ="Clinic Name";
		if(iamaValue == "OT")
		{
			clinicNameOtherObjField ="";
			clinicNameOtherDisplayField ="";	
		}	
		
	}
	if(schoolDropdown == 28)
	{
		schoolNameOtherObjField ="schoolNameOther";
		schoolNameOtherDisplayField ="School Name";
	}
	//added by Deepti
	if(schoolDropdown == 28 && (iamaValue != "VS")&& (iamaValue != "FM"))
	{
		document.getElementById('schoolNameOther').value = "t";
		schoolNameOtherObjField ="schoolNameOther";
		schoolNameOtherDisplayField ="School Name";
	}
	if(addressTwoObj.value!="")
	{
		addressTwoObjField="studentAddressTwo";
		addressTwoObjFieldDisplay="Address 2"

	}
	/*if((firstPhoneObj.value=="") && (secondPhoneObj.value=="") && (thirdPhoneObj.value==""))
	{
		document.getElementById('phoneNumber').value = "";
		phoneObjField = "phoneNumber";
		phoneDisplayField ="Phone";
	}*/
	if(phoneNumber.value=="" )
	{
		phoneObjField = "phoneNumber";
		phoneDisplayField ="Phone";
	}
	if(zipTwoObj.value!="")
	{
		zipTwoObjField = "zipTwo";
		zipTwoObjFieldDisplay="4 Digit Extension";
	}
	if(graduation!="")
	{
		//alert(graduation);
		graduationObjLabel ="yearOfGraduation";
	    graduationDisplayLabel ="Graduation Year (yyyy)";
	}
	if(securityQuestion1=="")
	{
		securityQ1ObjField = "securityQuestion1";
		securityQ1DisplayField = "Security Question - One";
	}
	if(securityQuestion2=="")
	{
		securityQ2ObjField = "securityQuestion2";
		securityQ2DisplayField = "Security Question - Two";
	}
	if(securityAnswer1=="")
	{
		securityA1ObjField = "securityAnswer1";
		securityA1DisplayField = "Security Answer - One";
	}
	if(securityAnswer2=="")
	{
		securityA2ObjField = "securityAnswer2";
		securityA2DisplayField = "Security Answer - Two";
	}
	
//	if(document.getElementById("mode").value=='O'){
if(userMode=='OLD_U'){
		//alert("Inside OLD USER  Section");
	
	if(validateMandatory("iamaDesc","I am a","firstName","First Name","lastName","Last Name","userName","User Name","password","Password","newpassword","New Password","newconfirmPassword","Confirm Password",clinicNameOtherObjField,clinicNameOtherDisplayField,schoolNameObjField,schoolNameDisplayField,schoolNameOtherObjField,schoolNameOtherDisplayField,"studentAddressOne","Address 1","city","City","country","Country","state","State","zipOne","Postal Code","dobMonth","Month of Birth (MM)","dobYear","Year of Birth (YYYY)",phoneObjField,phoneDisplayField,"emailAddress","E-mail Address","confirmEmail","Confirm E-mail",addressReferenceObj,addressReferenceDisplayField,graduationObjField,graduationDisplayField,alumniObjField,alumniDisplayField,alumniOfOtherObjField,alumniOfOtherDisplayField,periodicNewsObj,periodicNewsDisplayField,specialOfferObj,specialOfferDisplayField,securityQ1ObjField,securityQ1DisplayField,securityQ2ObjField,securityQ2DisplayField,securityA1ObjField,securityA1DisplayField,securityA2ObjField,securityA2DisplayField))
		{
	   	//if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum","userName","User Name","AlphaNum","password","Password","AlphaNum","newpassword","New Password","AlphaNum","newconfirmPassword","Confirm Password","AlphaNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",schoolNameOtherObjField,"School Name","clinic",graduationObjLabel,graduationDisplayLabel,"Num",alumniOfOtherObjField,"Alumni of...","SpecialChar"))
		//**if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",graduationObjLabel,graduationDisplayLabel,"Num",alumniOfOtherObjField,"Alumni of...","SpecialChar","password","Password","AlphaNum","newpassword","New Password","AlphaNum","newconfirmPassword","Confirm Password","AlphaNum"))
		if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum","userName","User Name","AlphaNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",graduationObjLabel,graduationDisplayLabel,"Num",alumniOfOtherObjField,"Alumni of...","SpecialChar","password","Password","AlphaNum","newpassword","New Password","AlphaNum","newconfirmPassword","Confirm Password","AlphaNum"))
			{
				var email = document.getElementById("emailAddress");
				var confirmEmail = document.getElementById("confirmEmail");
				var password =document.getElementById("password");
				var confirmPassword=document.getElementById("confirmPassword");
				
				// Add by VIJAY  on 22 NOn 2011  to send on Under Age Page. If user is 13year or less than
					
				if(restrictUser())
				{				
					document.userForm.action="underAgeError.do";
					
				}else
				{	
					 //checkCurrentPassword();
					//if(userMode=='OLD_U'){
						document.userForm.action="loadUser.do?method=upadteOldUser";
				  //}
				}
				document.userForm.submit();
			}
		}
 }
//if(document.getElementById("mode").value=='U'){
if(userMode=='EDIT'){
		//alert("Inside Update  Section");

	if(validateMandatory("iamaDesc","I am a","firstName","First Name","lastName","Last Name","userName","User Name",clinicNameOtherObjField,clinicNameOtherDisplayField,schoolNameObjField,schoolNameDisplayField,schoolNameOtherObjField,schoolNameOtherDisplayField,"studentAddressOne","Address 1","city","City","country","Country","state","State","zipOne","Postal Code","dobMonth","Month of Birth (MM)","dobYear","Year of Birth (YYYY)",phoneObjField,phoneDisplayField,"emailAddress","E-mail Address","confirmEmail","Confirm E-mail",addressReferenceObj,addressReferenceDisplayField,graduationObjField,graduationDisplayField,alumniObjField,alumniDisplayField,alumniOfOtherObjField,alumniOfOtherDisplayField,periodicNewsObj,periodicNewsDisplayField,specialOfferObj,specialOfferDisplayField,securityQ1ObjField,securityQ1DisplayField,securityQ2ObjField,securityQ2DisplayField,securityA1ObjField,securityA1DisplayField,securityA2ObjField,securityA2DisplayField))
		{
			/*alert(" i am in edit mode");
			alert(graduationObjField);
			alert(graduationDisplayLabel);*/
			//if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum","userName","User Name","AlphaNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",graduationObjLabel,graduationDisplayLabel,"Num"))
			if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",graduationObjLabel,graduationDisplayLabel,"Num",alumniOfOtherObjField,"Alumni of...","SpecialChar","password","Password","AlphaNum","newpassword","New Password","AlphaNum","newconfirmPassword","Confirm Password","AlphaNum"))
			{
				//alert(" i am in edit mode 1111");
				
				var email = document.getElementById("emailAddress");
				var confirmEmail = document.getElementById("confirmEmail");
				var password =document.getElementById("password");
				var confirmPassword=document.getElementById("confirmPassword");
				
				// Add by Anshul singhal on 22 NOn 2011  to send on Under Age Page. If user is 13year or less than
					
				if(restrictUser())
				{				
					document.userForm.action="underAgeError.do";
					
				}else
				{	
					/*if(userMode=='ADD'){  
						document.userForm.action="loadUser.do?method=saveUser";
					}else if(userMode=='EDIT'){
						document.userForm.action="loadUser.do?method=upadteUser";
				  } */
				  //checkCurrentPassword();
				  document.userForm.action="loadUser.do?method=upadteUser";
				}
				document.userForm.submit();
			}
		}
 }
// if(document.getElementById("mode").value=='A'){ 
if(userMode=='ADD'){
  // alert("Inside registrations");
		
	//start changes made anil rawat 05/09/2011 to remove day from dateofbirth field 
	//if(validateMandatory("iamaDesc","I am a","firstName","First Name","lastName","Last Name","userName","User Name","password","Password","confirmPassword","Confirm Password",clinicNameOtherObjField,clinicNameOtherDisplayField,schoolNameObjField,schoolNameDisplayField,schoolNameOtherObjField,schoolNameOtherDisplayField,"studentAddressOne","Address 1","city","City","country","Country","state","State","zipOne","Postal Code","dobMonth","Month of Birth (MM)","dobDay","Date of Birth (DD)","dobYear","Year of Birth (YYYY)",phoneObjField,phoneDisplayField,"emailAddress","E-mail Address","confirmEmail","Confirm E-mail",addressReferenceObj,addressReferenceDisplayField,graduationObjField,graduationDisplayField,alumniObjField,alumniDisplayField,alumniOfOtherObjField,alumniOfOtherDisplayField,periodicNewsObj,periodicNewsDisplayField,specialOfferObj,specialOfferDisplayField,securityQ1ObjField,securityQ1DisplayField,securityQ2ObjField,securityQ2DisplayField,securityA1ObjField,securityA1DisplayField,securityA2ObjField,securityA2DisplayField))
	if(validateMandatory("iamaDesc","I am a","firstName","First Name","lastName","Last Name","userName","User Name","password","Password","confirmPassword","Confirm Password",clinicNameOtherObjField,clinicNameOtherDisplayField,schoolNameObjField,schoolNameDisplayField,schoolNameOtherObjField,schoolNameOtherDisplayField,"studentAddressOne","Address 1","city","City","country","Country","state","State","zipOne","Postal Code","dobMonth","Month of Birth (MM)","dobYear","Year of Birth (YYYY)",phoneObjField,phoneDisplayField,"emailAddress","E-mail Address","confirmEmail","Confirm E-mail",addressReferenceObj,addressReferenceDisplayField,graduationObjField,graduationDisplayField,alumniObjField,alumniDisplayField,alumniOfOtherObjField,alumniOfOtherDisplayField,periodicNewsObj,periodicNewsDisplayField,specialOfferObj,specialOfferDisplayField,securityQ1ObjField,securityQ1DisplayField,securityQ2ObjField,securityQ2DisplayField,securityA1ObjField,securityA1DisplayField,securityA2ObjField,securityA2DisplayField))
	{
		//if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum","userName","User Name","AlphaNum","password","Password","AlphaNum","confirmPassword","Confirm Password","AlphaNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobDay","Date of Birth (DD)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",schoolNameOtherObjField,"School Name","clinic",graduationObjLabel,graduationDisplayLabel,"Num",alumniOfOtherObjField,"Alumni of...","SpecialChar"))
		if(validateInputFields("firstName","First Name","Char","lastName","Last Name","SpecialCharNum","userName","User Name","AlphaNum","password","Password","AlphaNum","confirmPassword","Confirm Password","AlphaNum",clinicNameOtherObjField,"Clinic Name","clinic","studentAddressOne","Address 1","CharWithNum",addressTwoObjField,addressTwoObjFieldDisplay,"CharWithNum","city","City","CityChar","zipOne","Postal Code","Num",zipTwoObjField,zipTwoObjFieldDisplay,"Num","dobMonth","Date of Birth (MM)","Num","dobYear","Date of Birth (YYYY)","Num","phoneNumber","Phone","Phone","emailAddress","E-mail Address","Email","confirmEmail","Confirm E-mail","Email",graduationObjLabel,graduationDisplayLabel,"Num"))
	//end changes made anil rawat 05/09/2011 to remove day from dateofbirth field 	
		{
			var email = document.getElementById("emailAddress");
			var confirmEmail = document.getElementById("confirmEmail");
			var password =document.getElementById("password");
			var confirmPassword=document.getElementById("confirmPassword");
			if(restrictUser())
			{				
				document.userForm.action="underAgeError.do";
				
			}
			else
			{				
				/*if(userMode=='ADD'){					
				document.userForm.action="loadUser.do?method=saveUser";
				}else if(userMode=='EDIT'){
				document.userForm.action="loadUser.do?method=upadteUser";
				}*/	
				document.userForm.action="loadUser.do?method=saveUser";
			}
			
			document.userForm.submit();
		}
	}
 }
}
var changeVal =0;
function getOtherSchoolName(param,changeParam)
{
	var objSchool= document.getElementById('schoolId');
	var objBlankFirst = document.getElementById('blankFirstId');
	var objBlankFirst1 = document.getElementById('blankFirstId1');
	var objClinicText = document.getElementById('clinicTextId');
	var objClinic = document.getElementById('clinicId');
	var objBlankSecond = document.getElementById('blankSecondId');
	//added by deepti
	var objClinic1 = document.getElementById('clinicId1');
	var objBlankSecond1 = document.getElementById('blankSecondId1');
	var mode = document.getElementById('mode').value;
	//added by Sanjoy on 02-Sep-2009 for RFF-03. Starts
	var objEducationInfo = document.getElementById('educationInfo');
	var objEducationInfoColumn = document.getElementById('educationInfoColId');
	var objDottedLineId = document.getElementById('dottedLineId');
	var objGraduationYear = document.getElementById('graduationYear');
	var objAluminiId = document.getElementById('aluminiId');
	var objAluminiOfId = document.getElementById('alumniOf');
	var objAlumniLabelId = document.getElementById('alumniSpanId');
	var objAlumniBlankLabelId = document.getElementById('alumniBlankLabelId');
	var objAlumniLabelMsgId  = document.getElementById('alumniLabelMsgId');
	var objBlankThirdId = document.getElementById('blankThirdId');
	var objBlankForthId = document.getElementById('blankForthId');
	
	var objAddressPracticeId = document.getElementById('addressPracticeId');//Sanjoy
	var objAddressSchoolId = document.getElementById('addressSchoolId'); //Sanjoy
	var objBlankThirdId = document.getElementById('blankThirdId'); //Sanjoy
	var objAluminiTextId = document.getElementById('aluminiTextId'); //Sanjoy
	var objBlankThirdId1 = document.getElementById('blankThirdId1'); //Sanjoy
	var objAluminiOtherId = document.getElementById('aluminiOtherId'); //Sanjoy
	
	//added by Sanjoy on 02-Sep-2009 for RFF-03. Ends
	if(param=='IAMA')
	{
		var graduationLabelIdObj =  document.getElementById('graduationLabelId');
		var paramValue = document.getElementById('iamaDesc').value;
		var graduationBlankLabelIdObj = document.getElementById('graduationBlankLabelId');
		if(paramValue=="VS" )
		{
			if(changeParam=="CHANGE")
			{
				document.getElementById('schoolName').value ="";
				// blank the value of clinic or school name
				document.getElementById('clinicNameOther').value = "";
			}

			objSchool.style.display = "";
			objBlankFirst.style.display = "";
			objBlankFirst1.style.display = "";
			graduationLabelIdObj.style.display = "";
			graduationBlankLabelIdObj.style.display = "none";

			// Not displaying clinic text
			objClinicText.style.display ="none";
			objClinic.style.display ="none";
			objBlankSecond.style.display ="none";
			//added by deepti
			objClinic1.style.display ="none";
			objBlankSecond1.style.display ="none";
			
			//Added by Sanjoy on 02-Sep-2009 for RFF-03. Starts
			objDottedLineId.style.display="";
			objEducationInfo.style.display="";
			objGraduationYear.style.display="";
			objAluminiId.style.display="";
			objAluminiOfId.style.display="";
			objAlumniLabelId.style.display="";
			objAlumniBlankLabelId.style.display="";
			objAlumniLabelMsgId.style.display="";
			objBlankThirdId.style.display="";
			objBlankForthId.style.display="";
			objAddressPracticeId.style.display="none"; //Sanjoy
			objAddressSchoolId.style.display=""; //Sanjoy
			//Added by Sanjoy on 02-Sep-2009 for RFF-03. Ends
		}
		else if(paramValue=="")
		{
			objSchool.style.display = "none";
			objBlankFirst.style.display = "none";
			objBlankFirst1.style.display = "none";
			objClinicText.style.display ="none";
			objClinic.style.display ="none";
			objBlankSecond.style.display ="none";
			//Commented by Sanjoy on 03-Sep-09 for RFF-03. Starts
			//graduationLabelIdObj.style.display = "none";
			//Commented by Sanjoy on 03-Sep-09 for RFF-03. Ends
			graduationBlankLabelIdObj.style.display = "";
			document.getElementById('schoolName').value ="";
			// blank the value of clinic or school name
			document.getElementById('schoolNameOther').value = "";
			//added by deepti
			document.getElementById('clinicNameOther').value = "";
			objClinic1.style.display ="";//objClinic1.style.display ="none"; //Sanjoy
			objBlankSecond1.style.display ="";//objBlankSecond1.style.display ="none"; //Sanjoy
			objAddressPracticeId.style.display=""; //Sanjoy
			objAddressSchoolId.style.display="none"; //Sanjoy
			
			//sanjoy
			objDottedLineId.style.display="";
			objEducationInfo.style.display="";
			objGraduationYear.style.display="";
			objAluminiId.style.display="";
			objAluminiOfId.style.display="";
			objAlumniLabelId.style.display="";
			objAlumniBlankLabelId.style.display="";
			objAlumniLabelMsgId.style.display="";
			objBlankThirdId.style.display="";
			objBlankForthId.style.display="";
			//sanjoy
		}
		else
		{
			objSchool.style.display = "none";
			objBlankFirst.style.display = "none";
			objBlankFirst1.style.display = "none";
			objClinicText.style.display ="none";
			objClinic.style.display ="none";
			objBlankSecond.style.display ="none";
			//Commented by Sanjoy on 03-Sep-09 for RFF-03.Starts
			//graduationLabelIdObj.style.display = "none";
			//Commented by Sanjoy on 03-Sep-09 for RFF-03.Ends
			graduationBlankLabelIdObj.style.display = "";
			if(changeParam=="CHANGE")
			{
				// check if clinic /school name value is changed
				if(changeVal==1)
				{
					document.getElementById('schoolNameOther').value = "";
					document.getElementById('clinicNameOther').value = "";
					changeVal =0;
				}
			}

			//added by deepti
			objClinic1.style.display ="";
			objBlankSecond1.style.display ="";
			//Added by Sanjoy on 02-Sep-2009 for RFF-03. Starts
			objDottedLineId.style.display="";
			objEducationInfo.style.display="";
			objGraduationYear.style.display="";
			objAluminiId.style.display="";
			objAluminiOfId.style.display="";
			objAlumniLabelId.style.display="";
			objAlumniBlankLabelId.style.display="";
			objAlumniLabelMsgId.style.display="";
			objBlankThirdId.style.display="";
			objBlankForthId.style.display="";
			
			objAddressPracticeId.style.display=""; //Sanjoy
			objAddressSchoolId.style.display="none"; //Sanjoy
			if(paramValue == "OM" )
			{
				document.getElementById('alumniOf').selectedIndex=0;
				objDottedLineId.style.display="none";
				objEducationInfo.style.display="none";
				objGraduationYear.style.display="none";
				objAluminiId.style.display="none";
				objAluminiOfId.style.display="none";
				objAlumniLabelId.style.display="none";
				objAlumniBlankLabelId.style.display="none";
				objAlumniLabelMsgId.style.display="none";
				objBlankThirdId.style.display="none";
				objBlankForthId.style.display="none";
				objBlankThirdId.style.display="none";
				objAluminiTextId.style.display="none"; 
				objBlankThirdId1.style.display="none"; 
				objAluminiOtherId.style.display="none";
				
			}
			if(paramValue == "OT")
			{
				document.getElementById('alumniOf').selectedIndex=0;
				objClinic1.style.display ="none";
				objBlankSecond1.style.display ="none"; 
				objDottedLineId.style.display="none";
				objEducationInfo.style.display="none";
				objGraduationYear.style.display="none";
				objAluminiId.style.display="none";
				objAluminiOfId.style.display="none";
				objAlumniLabelId.style.display="none";
				objAlumniBlankLabelId.style.display="none";
				objAlumniLabelMsgId.style.display="none";
				objBlankThirdId.style.display="none";
				objBlankForthId.style.display="none";
				objBlankThirdId.style.display="none";
				objAluminiTextId.style.display="none"; 
				objBlankThirdId1.style.display="none"; 
				objAluminiOtherId.style.display="none";
			}
			if(paramValue == "FM")  
			{
				objClinic1.style.display ="none";
				objBlankSecond1.style.display ="none"; 
				objSchool.style.display = "";
				objBlankFirst.style.display = "";
				objBlankFirst1.style.display = "";
				graduationLabelIdObj.style.display = "";
				graduationBlankLabelIdObj.style.display = "none";
				objAddressPracticeId.style.display="none"; //Sanjoy
				objAddressSchoolId.style.display=""; //Sanjoy
				if(changeParam=="NOTCHANGE")
				{
					//document.getElementById('schoolName').selectedIndex=0;
					objBlankFirst.style.display = "";
					objBlankFirst1.style.display = "";
					objClinicText.style.display = "";
					objClinic.style.display = "";
					objBlankSecond.style.display = "";
				}
				else
				{
					document.getElementById('schoolName').selectedIndex=0;
				}
			}	
			//Added by Sanjoy on 02-Sep-2009 for RFF-03. Ends
		}
	}
	if(param=='SCHOOL')
	{
		var schoolValue = document.getElementById('schoolName').value;
		if(schoolValue==28)
		{
			// convert value of variable if school name drop down is selected
			changeVal = 1;
			objClinicText.style.display ="";
			objClinic.style.display ="";
			objBlankSecond.style.display ="";
			//added by deepti
			objClinic1.style.display ="none";
			objBlankSecond1.style.display ="none";
			if(changeParam=="CHANGE")
			{
				document.getElementById('schoolNameOther').value = "";
				document.getElementById('clinicNameOther').value = "";
			}
		}
		else if((schoolValue!=28) && (document.getElementById('iamaDesc').value!="VS") && (document.getElementById('iamaDesc').value!="FM") && (document.getElementById('iamaDesc').value!=""))
		{
			objClinicText.style.display ="none";
			objClinic.style.display ="none";
			objBlankSecond.style.display ="none";
			//added by deepti
			objClinic1.style.display ="";
			objBlankSecond1.style.display ="";
		}
		else if((schoolValue!=28) && (document.getElementById('iamaDesc').value=="VS")|| (document.getElementById('iamaDesc').value=="FM"))
		{
			objClinicText.style.display ="none";
			objClinic.style.display ="none";
			objBlankSecond.style.display ="none";
		}
		else
		{
			objClinicText.style.display ="none";
			objClinic.style.display ="none";
			objBlankSecond.style.display ="none";
		}
		//Added by Sanjoy on 08-Sep-2009 for RFF-03. Start
		if (document.getElementById('iamaDesc').value == "OT")
		{
			objClinic1.style.display ="none";
			objBlankSecond1.style.display ="none"; 
		}
		//Added by Sanjoy on 08-Sep-2009 for RFF-03. Start
	}
}

function getOtherAlumniOf(changeParam)
{
	var objAluminiText = document.getElementById('aluminiTextId');
	var objBlankThird = document.getElementById('blankThirdId');
	var objBlankThird1 = document.getElementById('blankThirdId1');
	var objAluminiOther = document.getElementById('aluminiOtherId');
	var alumniValue = document.getElementById('alumniOf').value;
	var mode = document.getElementById('mode').value;
	if(alumniValue==28)
	{
		if(changeParam=="CHANGE")
		{
			document.getElementById('alumniOfOther').value = "";
		}
		objAluminiText.style.display ="";
		objBlankThird.style.display ="";
		objBlankThird1.style.display ="";
		objAluminiOther.style.display ="";
	}
	else
	{
		objAluminiText.style.display ="none";
		objBlankThird.style.display ="none";
		objBlankThird1.style.display ="none";
		objAluminiOther.style.display ="none";
	}

}

function validateInputFields()
{

	var flag = true;
	var noofObjects = arguments.length;
	var errorMsg ="";
	
	for(var i = 0; i < noofObjects; i=i+3)
    {
		/*alert("argument i --"+arguments[i]);
		alert("argument i+2 --"+arguments[i+2]);*/
		
    	if((arguments[i]!="undefined") && (arguments[i]!=""))
      	{
	    	if(arguments[i+2]=="Char")
	    	{
	    		if(isCharacter(document.getElementById(arguments[i])))
	    		{
			        alert(user_error_apphaChar_MSS_036 +" in the "+arguments[i+1]+ " field.");
			        flag = false;
			        document.getElementById(arguments[i]).focus();
			        return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="CityChar")
	    	{
	    		if(isCityCharacter(document.getElementById(arguments[i])))
	    		{
			        alert(user_error_apphaCityChar_MSS_046 +" in the "+arguments[i+1]+ " field.");
			        flag = false;
			        document.getElementById(arguments[i]).focus();
			        return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="SpecialCharNum")
	    	{
	    		if(isCharNumWithSpecialChar(document.getElementById(arguments[i])))
	    		{
	    			alert(user_error_lastName_MSS_031 +" in the "+arguments[i+1]+ " field.");
	    			flag = false;
	    			document.getElementById(arguments[i]).focus();
	    			return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="SpecialChar")
	    	{
	    		if(isCharactersWithSomeSpecialChar(document.getElementById(arguments[i])))
	    		{
	    			alert(user_error_specialChar_MSS_037 +" in the "+arguments[i+1]+ " field.");
	    			flag = false;
	    			document.getElementById(arguments[i]).focus();
	    			return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="clinic")
	    	{
	    		if(isSpecialCharClinic(document.getElementById(arguments[i])))
	    		{
	    			alert(user_error_specialChar_MSS_050 +" in the "+arguments[i+1]+ " field.");
	    			flag = false;
	    			document.getElementById(arguments[i]).focus();
	    			return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="CharWithNum")
	    	{
	    		if(isCharactersWithNumberAndSpecialChar(document.getElementById(arguments[i])))
	    		{
			        alert(user_error_alphaNumSpecialChar_MSS_038 +" in the "+arguments[i+1]+ " field.");
			        flag = false;
			        document.getElementById(arguments[i]).focus();
			        return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="Num")
	    	{
	    		//alert(arguments[i]);
	    		if(isNumber(document.getElementById(arguments[i])))
	    		{
			        alert(user_error_num_MSS_039+ " in the "+arguments[i+1]+ " field.");
			        flag = false;
			        document.getElementById(arguments[i]).focus();
			        return flag;
	    		}
	    		if(arguments[i]=="zipOne")
	    		{
		    		if(isMinLength(document.getElementById(arguments[i]),5))
		    		{
	    				alert(user_error_zipCode_MSS_044);
		    			flag = false;
		    			document.getElementById(arguments[i]).focus();
				        return flag;
		    		}
	    		}
	    		if((arguments[i]=="yearOfGraduation") || (arguments[i]=="zipTwo"))
	    		{
	    			var currentDate = new Date();
					// Updated by sanjoy on 03-Sep-2009 for RFF-03. It was picking 109 as current year in Mozilla ( Starts)
					var currentYear =  currentDate.getYear();
					if(currentYear < 200)
						currentYear = 1900 + currentDate.getYear();
					// Updated by sanjoy on 03-Sep-2009 for RFF-03. It was picking 109 as current year in Mozilla ( Ends)
					var defaultYear = 1940;
		    		if(isMinLength(document.getElementById(arguments[i]),4))
		    		{
	    				alert(user_error_min4Digit_MSS_045+ " in the "+arguments[i+1]+ " field.");
		    			flag = false;
		    			document.getElementById(arguments[i]).focus();
				        return flag;
		    		}
		    		if(arguments[i]=="yearOfGraduation")
		    		{
		    			if(document.getElementById(arguments[i]).value<1940)
		    			{
		    				alert(user_error_graduationRange_MSS_047);
		    				flag = false;
		    				document.getElementById(arguments[i]).focus();
				        	return flag;
		    			}
		    			//alert("argument i-18"+arguments[i-18]);
		    			//Added by sanjoy on 04-Sep-2009.Starts
		    			/*if(document.getElementById('iamaDesc').value != "OT" && document.getElementById('iamaDesc').value != "OM")
		    			{*/
			    			if(document.getElementById(arguments[i]).value < document.getElementById("dobYear").value)
			    			{
			    				alert("Graduation Year should be more than Birth Year.");
			    				flag = false;
			    				document.getElementById(arguments[i]).focus();
					        	return flag;
			    			}
			    		//}
		    			//Added by sanjoy on 04-Sep-2009.Ends
		    		}
	    		}
	    		// Added by Sanjoy on 27-Aug-2009 for RFF-03. Starts
	    		// changes made by anil on 05/09/11
	    		//if((arguments[i]=="dobDay") ||(arguments[i]=="dobMonth") )
	    		if((arguments[i]=="dobMonth") )
	    		{
	    			if(isMinLength(document.getElementById(arguments[i]),2))
		    		{
	    				alert(user_error_min2Digit_MSS_052+ " in the "+arguments[i+1]+ " field.");
	    				flag = false;
		    			document.getElementById(arguments[i]).focus();
				        return flag;
		    		}
		    		// Start changes made by anil on 05/09/11 new condition added
		    		var DoBMonth=document.getElementById(arguments[i]).value;
    	              if(DoBMonth<1 || DoBMonth>12){
        	          	flag = false;
            	      	alert("Please enter the valid month(MM).");
                	  	document.getElementById(arguments[i]).focus();
                  	  	return flag;
                  	   }
                  	   
                  	// End changes made by anil on 05/09/11 new condition added
		    		
		    	}
	    		if((arguments[i]=="dobYear"))
	    		{
	    			var currentBirthDate = new Date();
					var currentBirthYear =  currentBirthDate.getYear();
					if(currentBirthYear < 200)
						currentBirthYear = 1900 + currentBirthDate.getYear();
					
	    			if(isMinLength(document.getElementById(arguments[i]),4))
		    		{
	    				alert(user_error_min4Digit_MSS_045+ " in the "+arguments[i+1]+ " field.");
	    				//alert(" in the "+arguments[i+1]+ " field.");
		    			flag = false;
		    			document.getElementById(arguments[i]).focus();
				        return flag;
		    		}
		    		if(arguments[i]=="dobYear")
		    		{
		    			if((document.getElementById(arguments[i]).value<1900) ||document.getElementById(arguments[i]).value > currentBirthYear )
		    			{
		    				alert(user_error_birthYear_MSS_051);
		    				flag = false;
		    				document.getElementById(arguments[i]).focus();
				        	return flag;
		    			}
		    		}
	    		}
	    		//changes made by anil on 05/09/11
	    		//if((arguments[i-6]=="dobMonth") && (arguments[i-3]=="dobDay") && (arguments[i]=="dobYear"))
	    		if((arguments[i-6]=="dobMonth") && (arguments[i]=="dobYear"))
	    		{
	    			var bMonth = document.getElementById(arguments[i-6]).value
	    			//changes made by anil rawat on 05/09/11
	    			//var bDay = document.getElementById(arguments[i-3]).value
	    			var bDay = "01";
	    			var bYear = document.getElementById(arguments[i]).value	    				    			
	    			var daymonthflag = checkValidDate(bMonth,bDay,bYear)
	    			if(daymonthflag=="dayFlag")
	    			{
	    				alert(user_error_validDay_MSS_054);
    					flag=false;
	    				document.getElementById(arguments[i-3]).focus()	;
	    				return flag;
	    			
	    			}
	    			else if (daymonthflag=="monthFlag")
	    			{
	    				alert(user_error_validMonth_MSS_053);
	    				flag=false;
	    				document.getElementById(arguments[i-6]).focus()	;
	    				return flag;
	    			}
	    			
	    		}
     		// Added by Sanjoy on 27-Aug-2009 for RFF-03. Ends
	    	}
	    	if(arguments[i+2]=="AlphaNum")
	    	{
	    	// Add By Vijay  to check whether the password filed is empty or Not on 1 Dec 2011
	    	
	    	/* 
               Add By Anshul on 28 Nov 2011 for password validation in Edit Profile Start
               */ 
             if(document.getElementById("mode").value=='U'){
            	 
            	 if(document.getElementById("password").value!=null && document.getElementById("password").value!=""){
            		 
		    		if((!isAlphaNumeric(document.getElementById("password"))) && (!isMinLength(document.getElementById("password"),8)))
		    		{
		    			 if((document.getElementById("newpassword")!=null && !isAlphaNumeric(document.getElementById("newpassword"))) && (!isMinLength(document.getElementById("newpassword"),8)))
		    			   {
		    				 if(document.getElementById("newconfirmPassword").value!=null && document.getElementById("newconfirmPassword").value!="")
		    				   {
		    					 if(document.getElementById("newpassword").value.toLowerCase()!=document.getElementById("newconfirmPassword").value.toLowerCase())
					    			{
								        alert(user_error_notMatchNewPassword_MSS_011);
								        flag = false;
								        document.getElementById('newconfirmPassword').focus();
								        return flag;
					    			}
		    					    /////  Start
		    					 		    	                	
		    	                	if(isAlphaNumeric(document.getElementById(arguments[i])))
		    	    	    		{
		    	    	    			if(arguments[i]!="newconfirmPassword")
		    	    	    			{
		    	    	    				alert(user_error_alphaNum_MSS_040+ " in the "+arguments[i+1]+ " field.");
		    	    			        	flag = false;
		    	    			        	document.getElementById(arguments[i]).focus();
		    	    			        	return flag;
		    	    	    			}
		    	    	    		}
		    	    	    		if(isMinLength(document.getElementById(arguments[i]),8))
		    	    	    		{
		    	    	    			if(arguments[i]!="newconfirmPassword")
		    	    	    			{
		    	    		    			alert(user_error_minLength_MSS_010+ " in the "+arguments[i+1]+ " field.");
		    	    		    			flag = false;
		    	    		    			document.getElementById(arguments[i]).focus();
		    	    				        return flag;
		    	    	    			}
		    	    	    		}
		    	    	    		
		    			    		if((!isAlphaNumeric(document.getElementById("newpassword"))) && (!isMinLength(document.getElementById("newpassword"),8)))
		    			    		{
		    			    			if(document.getElementById("newpassword").value.toLowerCase()!=document.getElementById("newconfirmPassword").value.toLowerCase())
		    			    			{
		    						        alert(user_error_notMatchPassword_MSS_011);
		    						        flag = false;
		    						        document.getElementById('newpassword').focus();
		    						        return flag;
		    			    			}
		    			    		}
		    			    		
		    			    		/* 
		    			             Add By Anshul on 28 Nov 2011 for password validation in Edit Profile End  
		    			             */ 
		    				    		//added by naresh 
		    				    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
		    				    		{
		    				    			if(document.getElementById("newpassword").value.toLowerCase()==document.getElementById("userName").value.toLowerCase())
		    				    			{
		    							        alert('The New Password and the username should not be same');
		    							        flag = false;
		    							        document.getElementById('newpassword').focus();
		    							        return flag;
		    				    			}
		    				    		}
		    				    		//added by naresh 
		    				    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
		    				    		{
		    				    			re = /[0-9]/;
		    				    			if(!re.test(document.getElementById("newpassword").value))
		    				    			{
		    							        alert('The New Password should contain atleast 1 number(0-9)');
		    							        flag = false;
		    							        document.getElementById('newpassword').focus();
		    							        return flag;
		    				    			}
		    				    		}
		    				    		//added by naresh 
		    				    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
		    				    		{
		    				    			re = /[A-Z]/;
		    				    				if(!re.test(document.getElementById("newpassword").value))
		    				    				{
		    							       	 	alert('The New Password should contain upper case (A-Z) characters');
		    							        	flag = false;
		    							        	document.getElementById('newpassword').focus();
		    							        	return flag;
		    				    				}
		    				    		}
		    				    		// Commented by vijay 12/3/2011
		/*    if(document.getElementById("password").value.toLowerCase()!=document.getElementById("checkPassword").value.toLowerCase())
    			{
			        alert("Please enter the correct current password.");
			        flag = false;
			        document.getElementById('password').focus();
			        return flag;
    			}*/
		    				    		//added by naresh 
		    				    		if((!isAlphaNumeric(document.getElementById("newconfirmPassword"))))
		    				    		{
		    				    			re = /[A-Z]/;
		    				    				if(!re.test(document.getElementById("newconfirmPassword").value))
		    				    				{
		    							       	 	alert('The Confirm  password should contain upper case (A-Z) characters');
		    							        	flag = false;
		    							        	document.getElementById('newconfirmPassword').focus();
		    							        	return flag;
		    				    				}
		    				    		}
		    				    		//added by naresh 
		    				    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
		    				    		{
		    				    			re = /[a-z]/;
		    				    				if(!re.test(document.getElementById("newpassword").value))
		    				    				{
		    							       	 	alert('The New Password should contain small case (a-z) characters');
		    							        	flag = false;
		    							        	document.getElementById('newpassword').focus();
		    							        	return flag;
		    				    				}
		    				    		}
		    		    	 
		    					 
		    					   /////////  End 
		    				   }else{
			    				    alert("Confirm Password field should not be blank");
							        flag = false;
							        document.getElementById('newconfirmPassword').focus();
							        return flag;
			    			   }
		    			   }else{
		    				    alert(" New Password field should not be Blank.");
						        flag = false;
						        document.getElementById('newpassword').focus();
						        return flag;
		    			   }
		    		}else{
		    			 alert("Password should contain 8 charcter or Should be isAlphaNumeric ");
		    			 flag = false;
					     document.getElementById('password').focus();
					     return flag;
		    		}
		    		
            	 }
            	  else if(document.getElementById("password").value==null || document.getElementById("password").value=="" && document.getElementById("newpassword").value==null || document.getElementById("newpassword").value=="" && document.getElementById("newconfirmPassword").value==null || document.getElementById("newconfirmPassword").value==""){
            	         flag = true;
					     return flag; 
            	   }
            	 else{
            		 if(document.getElementById("newpassword").value!=null || document.getElementById("newpassword").value!=""){
            			 alert("Current password field should not be blank ");
		    			 flag = false;
					     document.getElementById('password').focus();
					     return flag; 
            		 }
            		 if(document.getElementById("newconfirmPassword").value!=null || document.getElementById("newconfirmPassword").value!=""){
            			 alert("Please fill Current password field");
		    			 flag = false;
					     document.getElementById('password').focus();
					     return flag; 
            		 }
            	 }
	    	 }
	    	
	    	///////////////////////////////////////////////////////////////
	  //if(document.getElementById("mode").value=='A'){
             else if(document.getElementById("mode").value=='A'){
	    		if(isAlphaNumeric(document.getElementById(arguments[i])))
	    		{
	    			if(arguments[i]!="confirmPassword")
	    			{
	    				alert(user_error_alphaNum_MSS_040+ " in the "+arguments[i+1]+ " field.");
			        	flag = false;
			        	document.getElementById(arguments[i]).focus();
			        	return flag;
	    			}
	    		}
	    		// Testing purpose
	    		if(isMinLength(document.getElementById(arguments[i]),8))
	    		{
	    		
	    			if(arguments[i]!="confirmPassword")
	    			{
		    			alert(user_error_minLength_MSS_010+ " in the "+arguments[i+1]+ " field.");
		    			flag = false;
		    			document.getElementById(arguments[i]).focus();
				        return flag;
	    			}
	    		}

	    		if((!isAlphaNumeric(document.getElementById("password"))) && (!isMinLength(document.getElementById("password"),8)))
	    		{
	    			if(document.getElementById("password").value.toLowerCase()!=document.getElementById("confirmPassword").value.toLowerCase())
	    			{
				        alert(user_error_notMatchPassword_MSS_011);
				        flag = false;
				        document.getElementById('password').focus();
				        return flag;
	    			}
	    		}
	    		//added by naresh
	    		if((!isAlphaNumeric(document.getElementById("password"))))
	    		{
	    			if(document.getElementById("password").value.toLowerCase()==document.getElementById("userName").value.toLowerCase())
	    			{
				        alert('The password and the username should not be same');
				        flag = false;
				        document.getElementById('password').focus();
				        return flag;
	    			}
	    		}
	    		//added by naresh
	    		if((!isAlphaNumeric(document.getElementById("password"))))
	    		{
	    			re = /[0-9]/;
	    			if(!re.test(document.getElementById("password").value))
	    			{
				        alert('The password should contain atleast 1 number(0-9)');
				        flag = false;
				        document.getElementById('password').focus();
				        return flag;
	    			}
	    		}
	    		//added by naresh
	    		if((!isAlphaNumeric(document.getElementById("password"))))
	    		{
	    			re = /[A-Z]/;
	    			//if(document.getElementById=="A") // commented by anil
	    			//{ // commented by anil
	    				if(!re.test(document.getElementById("password").value))
	    				{
				       	 	alert('the password should contain upper case (A-Z) characters');
				        	flag = false;
				        	document.getElementById('password').focus();
				        	return flag;
	    				}
	    			//} // commented by anil
	    		}
	    		//added by naresh
	    		if((!isAlphaNumeric(document.getElementById("password"))))
	    		{
	    			re = /[a-z]/;
	    			//if(document.getElementById=="A") // commented by anil
	    			//{ // commented by anil
	    				if(!re.test(document.getElementById("password").value))
	    				{
				       	 	alert('the password should contain small case (a-z) characters');
				        	flag = false;
				        	document.getElementById('password').focus();
				        	return flag;
	    				}
	    			//} // commented by anil
	    		}
          }// End bloclk Of Mode =A
        
        // If MODE =O
        
         //if(document.getElementById("mode").value=='O'){
             else if(document.getElementById("mode").value=='O'){
         //alert("Inside mode O ");
         // alert("Check password vlaue "+document.getElementById("checkPassword").value.toLowerCase());
    	   
    	   if((!isAlphaNumeric(document.getElementById("newpassword"))) && (!isMinLength(document.getElementById("newpassword"),8)))
    		{
    			if(document.getElementById("newpassword").value.toLowerCase()!=document.getElementById("newconfirmPassword").value.toLowerCase())
    			{
			        alert(user_error_notMatchPassword_MSS_011);
			        flag = false;
			        document.getElementById('newpassword').focus();
			        return flag;
    			}
    		}
    		
    		//ADD BY VIJAY TO check whether user has correct confirmed password.
    		
    		
		   
    		/*	if(document.getElementById("password").value.toLowerCase()!=document.getElementById("checkPassword").value.toLowerCase())
    			{
			        alert("Please enter the correct current password.");
			        flag = false;
			        document.getElementById('password').focus();
			        return flag;
    			}
    		*/
    		
    		// END
    		
    	
    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
    		{
    			re = /[a-z]/;
    				if(!re.test(document.getElementById("newpassword").value))
    				{
			       	 	alert('the new password should contain small case (a-z) characters');
			        	flag = false;
			        	document.getElementById('newpassword').focus();
			        	return flag;
    				}
    		}
    		
	    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
	    		{
	    			re = /[A-Z]/;
	    				if(!re.test(document.getElementById("newpassword").value))
	    				{
				       	 	alert('the new password should contain upper case (A-Z) characters');
				        	flag = false;
				        	document.getElementById('newpassword').focus();
				        	return flag;
	    				}
	    		}
	    		
	    		
	    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
	    		{
	    			re = /[0-9]/;
	    			if(!re.test(document.getElementById("newpassword").value))
	    			{
				        alert('The new password should contain atleast 1 number(0-9)');
				        flag = false;
				        document.getElementById('newpassword').focus();
				        return flag;
	    			}
	    		}
	    		if((!isAlphaNumeric(document.getElementById("newpassword"))))
		    		{
		    			if(document.getElementById("newpassword").value.toLowerCase()==document.getElementById("userName").value.toLowerCase())
		    			{
					        alert('The new password and the username should not be same');
					        flag = false;
					        document.getElementById('newpassword').focus();
					        return flag;
		    			}
		    		}
		    //==========================================================This is  change		
	    		if(isMinLength(document.getElementById(arguments[i]),8))
  	    		{
  	    			if(arguments[i]=="newconfirmPassword")
  	    			{
  		    			alert(user_error_minLength_MSS_010+ " in the "+arguments[i+1]+ " field.");
  		    			flag = false;
  		    			document.getElementById(arguments[i]).focus();
  				        return flag;
  	    			}
  	    		}
	    		if(isMinLength(document.getElementById(arguments[i]),8))
 	    		{
 	    			if(arguments[i]=="newpassword")
 	    			{
 		    			alert(user_error_minLength_MSS_010+ " in the "+arguments[i+1]+ " field.");
 		    			flag = false;
 		    			document.getElementById(arguments[i]).focus();
 				        return flag;
 	    			}
 	    		}
	    		//==============================================================================
	    		if(isAlphaNumeric(document.getElementById(arguments[i])))
 	    		{
 	    			if(arguments[i]!="newpassword")
 	    			{
 	    				alert(user_error_alphaNum_MSS_040+ " in the "+arguments[i+1]+ " field.");
 			        	flag = false;
 			        	document.getElementById(arguments[i]).focus();
 			        	return flag;
 	    			}
 	    		}
	    		if(isAlphaNumeric(document.getElementById(arguments[i])))
 	    		{
 	    			if(arguments[i]!="newconfirmPassword")
 	    			{
 	    				alert(user_error_alphaNum_MSS_040+ " in the "+arguments[i+1]+ " field.");
 			        	flag = false;
 			        	document.getElementById(arguments[i]).focus();
 			        	return flag;
 	    			}
 	    		}
       }else {//new block added on 28/12/2011
    	   if(isAlphaNumeric(document.getElementById(arguments[i])))
   		{
   			if(arguments[i]!="confirmPassword")
   			{
   				alert(user_error_alphaNum_MSS_040+ " in the "+arguments[i+1]+ " field.");
		        	flag = false;
		        	document.getElementById(arguments[i]).focus();
		        	return flag;
   			}
   		}
   		// Testing purpose
   		if(isMinLength(document.getElementById(arguments[i]),8))
   		{
   		 
   			if(arguments[i]!="confirmPassword")
   			{
	    			alert(user_error_minLength_MSS_010+ " in the "+arguments[i+1]+ " field.");
	    			flag = false;
	    			document.getElementById(arguments[i]).focus();
			        return flag;
   			}
   		}

   		if((!isAlphaNumeric(document.getElementById("password"))) && (!isMinLength(document.getElementById("password"),8)))
   		{
   			if(document.getElementById("password").value.toLowerCase()!=document.getElementById("confirmPassword").value.toLowerCase())
   			{
			        alert(user_error_notMatchPassword_MSS_011);
			        flag = false;
			        document.getElementById('password').focus();
			        return flag;
   			}
   		}
   		//added by naresh
   		if((!isAlphaNumeric(document.getElementById("password"))))
   		{
   			if(document.getElementById("password").value.toLowerCase()==document.getElementById("userName").value.toLowerCase())
   			{
			        alert('The password and the username should not be same');
			        flag = false;
			        document.getElementById('password').focus();
			        return flag;
   			}
   		}
   		//added by naresh
   		if((!isAlphaNumeric(document.getElementById("password"))))
   		{
   			re = /[0-9]/;
   			if(!re.test(document.getElementById("password").value))
   			{
			        alert('The password should contain atleast 1 number(0-9)');
			        flag = false;
			        document.getElementById('password').focus();
			        return flag;
   			}
   		}
   		
   		if((!isAlphaNumeric(document.getElementById("password"))))
   		{
   			re = /[A-Z]/;   			
   				if(!re.test(document.getElementById("password").value))
   				{
			       	 	alert('the password should contain upper case (A-Z) characters');
			        	flag = false;
			        	document.getElementById('password').focus();
			        	return flag;
   				}
   			
   		}
   		
   		if((!isAlphaNumeric(document.getElementById("password"))))
   		{
   			re = /[a-z]/;   		
   				if(!re.test(document.getElementById("password").value))
   				{
			       	 	alert('the password should contain small case (a-z) characters');
			        	flag = false;
			        	document.getElementById('password').focus();
			        	return flag;
   				}
   		
   		}
    	   
       }//end of else block
        
	  }//End Alpha Num Block
	    	
	    	if(arguments[i+2]=="Phone")
	    	{
	    		if(isValidPhone(document.getElementById(arguments[i])))
	    		{
			        alert(user_error_invalidPhone_MSS_041);
			        flag = false;
			        document.getElementById('phoneNumber').focus();
			        return flag;
	    		}
	    	}
	    	if(arguments[i+2]=="Email")
	    	{
    			if(isValidateEmail(document.getElementById(arguments[i])))
	    		{
	    			if(arguments[i]!="confirmEmail")
	    			{
	    				alert(user_error_invalidEmail_MSS_006);
			        	flag = false;
			        	document.getElementById(arguments[i]).focus();
			        	return flag;
	    			}
	    		}
	    		else if(!isValidateEmail(document.getElementById("emailAddress")))
	    		{
	    			if(document.getElementById("emailAddress").value.toLowerCase()!=document.getElementById("confirmEmail").value.toLowerCase())
	    			{
			        	alert(user_error_notMatchEmail_MSS_008);
			       	 	flag = false;
			       	 	document.getElementById('emailAddress').focus();
			        	return flag;
	    			}
	    		}
	    	}
      	}
    }
    return flag;
}
// Check the input string have only numbers.
function isValidPhone(inputString)
{
	var reChar=/^[0-9]{10}$/
    if(!reChar.test(inputString.value))
	{
		 return true;
	}
	return false;

}

//Added By Naman Gupta for call the reset password page.
function submitGeneratePassword(){
document.forgotPasswordForm.action="loadForgotPassword.do?method=resetPassword";
document.forgotPasswordForm.submit();
}

