
/// <summary>
/// Programmer: Tauseef
/// Name of Function: trim(theField)
/// Usage / Functionality: Removes the white spaces from left & right hand side.
/// </summary>
function trim(theField) {
	if(theField == "" || theField == null){
		return null;
	}
	inStr=theField.value;
	inStr=inStr.replace(' ', '');
	return inStr;
}

/// Programmer: Tauseef
/// <summary>
/// Name of Function: isValidDate(theField)
/// Usage / Functionality: Validates the date.
/// </summary>
function isValidDate(theField) {
	var inStr=theField.value;
	var pass1=inStr.indexOf('/',0);
	var pass2=inStr.indexOf('/',pass1 + 1);
	
	if (pass1 == -1 || pass2 == -1) {
		return false;
	}
	
	if (pass1 >= pass2) {
		return false;
	}
	
	strDay=inStr.substring(0,pass1);
	strMonth=inStr.substring(pass1 + 1,pass2);
	strYear=inStr.substring(pass2 + 1);

	if(isNaN(strDay) || isNaN(strMonth) || isNaN(strYear)) {
		return false;
	}
	
	var day = parseInt(strDay, 10);
	var month = parseInt(strMonth, 10);
	var year = parseInt(strYear, 10);
	var dt = new Date();

	if (strYear.length == 2) {
		if (year < dt.getYear()) {
			year += 2000;
			strYear = "20" + strYear;
		}
		else {
			year += 1900;
			strYear = "19" + strYear;
		}	
	}

	if (day < 1 || day > 31 || month < 1 || month > 12 || year > dt.getYear() || strYear.length != 4) {
		return false;
	}
	strDay = (strDay.length == 1) ? "0" + strDay : strDay;
	strMonth = (strMonth.length == 1) ? "0" + strMonth : strMonth;
	
	inStr = strDay + "/" +  strMonth + "/" + strYear;
	if (confirm("Is this " + inStr + " the date you meant to specify?")) {
		theField.value = inStr;
	}
	return true;
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: isFieldBlank(theField)
/// Usage / Functionality: Checks for the given field blank.
/// </summary>
function isFieldBlank(theField) {
	inStr=trim(theField);
	if(inStr=="" || inStr == null)
		return true;
	else
		return false;
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: isNumber(theField)
/// Usage / Functionality: Checks for given field as number.
/// </summary>
function isNumber(theField) {
	inputStr=theField.value;
	return !isNaN(inputStr);
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: isValidEmailAddress(theField)
/// Usage / Functionality: Checks for valid email address.
/// </summary>
function isValidEmailAddress(theField) {
	var val = theField.value;
	var pass1 = val.indexOf('@',0);
	var pass2 = val.indexOf('.',0);
	if (pass1 == -1 || pass2 == -1) {
		return false;
	}
	return true;
}

/// <summary>
/// Programmer: Sachin
/// Name of Function: ViewnEditMemRegister
/// Usage / Functionality: Validate the fields on MemRegister form.
/// </summary>
function ViewnEditMemRegister() {
	
	if(isFieldBlank(document.MemProfileEdit.txtMemberName)) {
		alert("Please specify your name.");
		document.MemProfileEdit.txtMemberName.value="";
		document.MemProfileEdit.txtMemberName.focus();
		return false;
	}
	
	if(isFieldBlank(document.MemProfileEdit.txtSchoolName)) {
		alert("Please specify the school name.");
		document.MemProfileEdit.txtSchoolName.value="";
		document.MemProfileEdit.txtSchoolName.focus();
		return false;
	}
	/*
	if(isFieldBlank(document.MemProfileEdit.txtMemberStreet1)) {
		alert("Please specify the street1 of Addtress.");
		document.MemProfileEdit.txtMemberStreet1.value="";
		document.MemProfileEdit.txtMemberStreet1.focus();
		return false;
	}
	if(isFieldBlank(document.MemProfileEdit.txtMemberStreet2)) {
		alert("Please specify the street2 of Address.");
		document.MemProfileEdit.txtMemberStreet2.value="";
		document.MemProfileEdit.txtMemberStreet2.focus();
		return false;
	}
	*/
	if(isFieldBlank(document.MemProfileEdit.txtSchoolCity)) {
		alert("Please specify the school city.");
		document.MemProfileEdit.txtSchoolCity.value="";
		document.MemProfileEdit.txtSchoolCity.focus();
		return false;
	}
	if(isFieldBlank(document.MemProfileEdit.txtSchoolState)) {
		alert("Please specify the school state.");
		document.MemProfileEdit.txtSchoolState.value="";
		document.MemProfileEdit.txtSchoolState.focus();
		return false;
	}
	if(isFieldBlank(document.MemProfileEdit.txtSchoolPincode)) {
		alert("Please specify the school pincode.");
		document.MemProfileEdit.txtSchoolPincode.value="";
		document.MemProfileEdit.txtSchoolPincode.focus();
		return false;
	}
	if(!isNumber(document.MemProfileEdit.txtSchoolPincode)) {
		alert("Please specify proper PinCode");
		document.MemProfileEdit.txtMemberPincode.value="";
		document.MemProfileEdit.txtMemberPincode.focus();
		return false;
	}
	if(document.MemProfileEdit.drpSchoolCountry.selectedIndex == 0) {
		alert("Please select School Country.");
		document.MemProfileEdit.drpSchoolCountry.focus();
		return false;
	}
	/*
	if(isFieldBlank(document.MemProfileEdit.txtMemberCountryCode)) {
		alert("Please specify the country code of phone.");
		document.MemProfileEdit.txtMemberCountryCode.value="";
		document.MemProfileEdit.txtMemberCountryCode.focus();
		return false;
	}
	if(!isNumber(document.MemProfileEdit.txtMemberCountryCode)) {
		alert("Please  specify proper Member Country Code");
		document.MemProfileEdit.txtMemberCountryCode.value="";
		document.MemProfileEdit.txtMemberCountryCode.focus();
		return false;
	}
	if(isFieldBlank(document.MemProfileEdit.txtMemberProvinceCode)) {
		alert("Please specify the province code of phone.");
		document.MemProfileEdit.txtMemberProvinceCode.value="";
		document.MemProfileEdit.txtMemberProvinceCode.focus();
		return false;
	}
	if(!isNumber(document.MemProfileEdit.txtMemberProvinceCode)) {
		alert("Please  specify proper Member Province Code");
		document.MemProfileEdit.txtMemberProvinceCode.value="";
		document.MemProfileEdit.txtMemberProvinceCode.focus();
		return false;
	}
	if(isFieldBlank(document.MemProfileEdit.txtMemberTelephone)) {
		alert("Please specify the telephone number of phone.");
		document.MemProfileEdit.txtMemberTelephone.value="";
		document.MemProfileEdit.txtMemberTelephone.focus();
		return false;
	}
	if(!isNumber(document.MemProfileEdit.txtMemberTelephone)) {
		alert("Please  specify proper Member Telephone number");
		document.MemProfileEdit.txtMemberTelephone.value="";
		document.MemProfileEdit.txtMemberTelephone.focus();
		return false;
	}
	if(!isNumber(document.MemProfileEdit.txtMemberExtnNumber)) {
		alert("Please  specify proper Extn number");
		document.MemProfileEdit.txtMemberExtnNumber.value="";
		document.MemProfileEdit.txtMemberExtnNumber.focus();
		return false;
	}
	*/
	if(isFieldBlank(document.MemProfileEdit.txtSchoolEmail)) {
		alert("Please specify the School Email address");
		document.MemProfileEdit.txtSchoolEmail.value="";
		document.MemProfileEdit.txtSchoolEmail.focus();
		return false;
	}
	if (!isValidEmailAddress(document.MemProfileEdit.txtSchoolEmail)) {
		alert("The email address entered is invalid.");
		document.MemProfileEdit.txtSchoolEmail.focus();
		return false;
	}

	if (document.MemProfileEdit.cbxHomeDetails.checked == true)	
	{
		
		if(isFieldBlank(document.MemProfileEdit.txtMemberStreet1)) {
			alert("Please specify the street1 of Addtress.");
			document.MemProfileEdit.txtMemberStreet1.value="";
			document.MemProfileEdit.txtMemberStreet1.focus();
			return false;
		}
		
		/* kuan
		
		if(isFieldBlank(document.MemProfileEdit.txtMemberStreet2)) {
			alert("Please specify the street2 of Address.");
			document.MemProfileEdit.txtMemberStreet2.value="";
			document.MemProfileEdit.txtMemberStreet2.focus();
			return false;
		}
		
		*/
		
		if(isFieldBlank(document.MemProfileEdit.txtMemberCity)) {
			alert("Please specify the city.");
			document.MemProfileEdit.txtMemberCity.value="";
			document.MemProfileEdit.txtMemberCity.focus();
			return false;
		}
		if(isFieldBlank(document.MemProfileEdit.txtMemberState)) {
			alert("Please specify the state.");
			document.MemProfileEdit.txtMemberState.value="";
			document.MemProfileEdit.txtMemberState.focus();
			return false;
		}
		if(isFieldBlank(document.MemProfileEdit.txtMemberPincode)) {
			alert("Please specify the pincode.");
			document.MemProfileEdit.txtMemberPincode.value="";
			document.MemProfileEdit.txtMemberPincode.focus();
			return false;
		}
		if(!isNumber(document.MemProfileEdit.txtMemberPincode)) {
			alert("Please  specify proper PinCode");
			document.MemProfileEdit.txtMemberPincode.value="";
			document.MemProfileEdit.txtMemberPincode.focus();
			return false;
		}
		if(document.MemProfileEdit.drpMemberCountry.selectedIndex == 0) {
			alert("Please select Country.");
			document.MemProfileEdit.drpMemberCountry.focus();
			return false;
		}
	}

	return true;
}

/// <summary>
/// Programmer: Prashant
/// Name of Function: checkMemRegister
/// Usage / Functionality: Validate the fields on MemRegister form.
/// </summary>
function checkMemRegister() {

	/*if(isFieldBlank(document.MemRegister.txtGameNumber)) {
		alert("Please specify the Game Serial Number.");
		document.MemRegister.txtGameNumber.value="";
		document.MemRegister.txtGameNumber.focus();
		return false;
	}*/
	
	if(isFieldBlank(document.MemRegister.txtMemberName)) {
		alert("Please specify your name.");
		document.MemRegister.txtMemberName.value="";
		document.MemRegister.txtMemberName.focus();
		return false;
	}

	
	if(document.MemRegister.txtUserName.disabled == false) {
	if(isFieldBlank(document.MemRegister.txtUserName)) {
		alert("Please specify the User Name.");
		document.MemRegister.txtUserName.value="";
		document.MemRegister.txtUserName.focus();
		return false;
	}
	}
	if((document.MemRegister.txtUserName.value.length < 4)) {
		alert("Please specify the Minimum 4 character User Name.");
		document.MemRegister.txtUserName.value="";
		document.MemRegister.txtUserName.focus();
		return false;
	}
	if(document.MemRegister.txtPassword)
	{
		if(isFieldBlank(document.MemRegister.txtPassword)) {
			alert("Please specify the Password.");
			document.MemRegister.txtPassword.value="";
			document.MemRegister.txtPassword.focus();
			return false;
		}
	}			
	if(document.MemRegister.txtReconfirmPassword)
	{
		if (document.MemRegister.txtPassword.value != document.MemRegister.txtReconfirmPassword.value) {
			alert("The passwords you have entered do not match. Please re-enter the passwords.");
			document.MemRegister.txtPassword.value = "";
			document.MemRegister.txtReconfirmPassword.value = "";
			document.MemRegister.txtPassword.focus();
			return false;
		}
	}
	if(isFieldBlank(document.MemRegister.txtSchoolName)) {
		alert("Please specify the School Name.");
		document.MemRegister.txtSchoolName.value="";
		document.MemRegister.txtSchoolName.focus();
		return false;
	}
	if (document.MemRegister.cbxHomeDetails.checked == false)
	{
	if(isFieldBlank(document.MemRegister.txtSchoolStreet1)) {
		alert("Please specify the street1 of Addtress.");
		document.MemRegister.txtSchoolStreet1.value="";
		document.MemRegister.txtSchoolStreet1.focus();
		return false;
	}
	}
	/*
	if(isFieldBlank(document.MemRegister.txtMemberStreet2)) {
		alert("Please specify the street2 of Address.");
		document.MemRegister.txtMemberStreet2.value="";
		document.MemRegister.txtMemberStreet2.focus();
		return false;
	}*/
	if(isFieldBlank(document.MemRegister.txtSchoolCity)) {
		alert("Please specify the School city.");
		document.MemRegister.txtSchoolCity.value="";
		document.MemRegister.txtSchoolCity.focus();
		return false;
	}
	if(isFieldBlank(document.MemRegister.txtSchoolState)) {
		alert("Please specify the school state.");
		document.MemRegister.txtSchoolState.value="";
		document.MemRegister.txtSchoolState.focus();
		return false;
	}
	if(isFieldBlank(document.MemRegister.txtSchoolPincode)) {
		alert("Please specify the pincode.");
		document.MemRegister.txtSchoolPincode.value="";
		document.MemRegister.txtSchoolPincode.focus();
		return false;
	}
	if(document.MemRegister.drpSchoolCountry.selectedIndex == 0) {
		alert("Please select School Country.");
		document.MemRegister.drpSchoolCountry.focus();
		return false;
	}
	/*
	if(!isNumber(document.MemRegister.txtMemberCountryCode) || isFieldBlank(document.MemRegister.txtMemberCountryCode)) {
		alert("Please specify the country code(numeric) of phone.");
		document.MemRegister.txtMemberCountryCode.value="";
		document.MemRegister.txtMemberCountryCode.focus();
		return false;
	}
	if(!isNumber(document.MemRegister.txtMemberProvinceCode) || isFieldBlank(document.MemRegister.txtMemberProvinceCode)) {
		alert("Please specify the province code(numeric) of phone.");
		document.MemRegister.txtMemberProvinceCode.value="";
		document.MemRegister.txtMemberProvinceCode.focus();
		return false;
	}
	if(!isNumber(document.MemRegister.txtMemberTelephone) || isFieldBlank(document.MemRegister.txtMemberTelephone)) {
		alert("Please specify the telephone number(numeric) of phone.");
		document.MemRegister.txtMemberTelephone.value="";
		document.MemRegister.txtMemberTelephone.focus();
		return false;
	}
	*/
	if (!isValidEmailAddress(document.MemRegister.txtSchoolEmail)) {
		alert("The email address entered is invalid.");
		document.MemRegister.txtSchoolEmail.focus();
		return false;
	}
	
	
	if (document.MemRegister.cbxHomeDetails.checked == true)
	{
		
			if(isFieldBlank(document.MemRegister.txtMemberStreet1)) {
				alert("Please specify the street1 of Addtress.");
				document.MemRegister.txtMemberStreet1.value="";
				document.MemRegister.txtMemberStreet1.focus();
				return false;
			}
			
			
			/* kuan
			if(isFieldBlank(document.MemRegister.txtMemberStreet2)) {
				alert("Please specify the street2 of Address.");
				document.MemRegister.txtMemberStreet2.value="";
				document.MemRegister.txtMemberStreet2.focus();
				return false;
			}
			
			*/
			
			
			if(isFieldBlank(document.MemRegister.txtMemberCity)) {
				alert("Please specify the city.");
				document.MemRegister.txtMemberCity.value="";
				document.MemRegister.txtMemberCity.focus();
				return false;
			}
			if(isFieldBlank(document.MemRegister.txtMemberState)) {
				alert("Please specify the state.");
				document.MemRegister.txtMemberState.value="";
				document.MemRegister.txtMemberState.focus();
				return false;
			}
			if(isFieldBlank(document.MemRegister.txtMemberPincode)) {
				alert("Please specify the pincode.");
				document.MemRegister.txtMemberPincode.value="";
				document.MemRegister.txtMemberPincode.focus();
				return false;
			}
			if(document.MemRegister.drpMemberCountry.selectedIndex == 0) {
				alert("Please select Country.");
				document.MemRegister.drpMemberCountry.focus();
				return false;
			}
	
	}
	
	return true;
}

/// <summary>
/// Programmer: Prashant
/// Name of Function: checkMemChangePassword
/// Usage / Functionality: Validate the fields on MemChangePassword form.
/// </summary>
		
function checkMemChangePassword() {

	if(isFieldBlank(document.MemChangePassword.txtOldPassword)) {
		alert("Please specify the old password.");
		document.MemChangePassword.txtOldPassword.value="";
		document.MemChangePassword.txtOldPassword.focus();
		return false;
	}
	if(isFieldBlank(document.MemChangePassword.txtNewPassword)) {
		alert("Please specify the New Password.");
		document.MemChangePassword.txtNewPassword.value="";
		document.MemChangePassword.txtNewPassword.focus();
		return false;
	}			
	if (document.MemChangePassword.txtNewPassword.value != document.MemChangePassword.txtConfPassword.value) {
		alert("The passwords you have entered do not match. Please re-enter the passwords.");
		document.MemChangePassword.txtNewPassword.value = "";
		document.MemChangePassword.txtConfPassword.value = "";
		document.MemChangePassword.txtNewPassword.focus();
		return false;
	}
		
	return true;
}

//*************<Summary>*********************
 //Programmer :Yuraj Vichare   05/10/2007
// Nmae of Fuction : CheckDealerRegistration
// usage /Functionality : Validate the fields on AddDealer form
function CheckDealerRegistration()
{
 if (isFieldBlank(document.AddDealer.txtDealerCompany))
 {	
  alert("Please specify the DealerCompany");
  document.AddDealer.txtDealerCompany.value="";
  document.AddDealer.txtDealerCompany.focus();
  return false;
 }

 
 if (isFieldBlank(document.AddDealer.cmbCountry))
 {	
  alert("Please Select the Country Name ");
  document.AddDealer.cmbCountry.value="";
  document.AddDealer.cmbCountry.focus();
  return false;
 }
 
 if (isFieldBlank (document.AddDealer.txtTelephone))
 {
 alert("Please specify the Telephone Number");
 document.AddDealer.txtTelephone.value="";
 document.AddDealer.txtTelephone.focus();
  return false;
 }
 /* sandeep B 12/12/2007 As per Dharmesh Mail
  if (isFieldBlank (document.AddDealer.txtExtnNumber))
 {
 alert("Please specify the Telephone Extn Number");
 document.AddDealer.txtExtnNumber.value="";
 document.AddDealer.txtExtnNumber.focus();
  return false;
 } 
 */
 
 
 if (isFieldBlank (document.AddDealer.txtEmail))
 {
  alert("Please specify the Email");
  document.AddDealer.txtEmail.value="";
  document.AddDealer.txtEmail.focus();
   return false;
 }
 if (!isValidEmailAddress (document.AddDealer.txtEmail))
 { 
   alert("Email format :- abc@example.com ");
  document.AddDealer.txtEmail.value="";
  document.AddDealer.txtEmail.focus();
      return false;
 }
  if (isFieldBlank(document.AddDealer.txtDisplayName))
 {	
  alert("Please specify the DisplayName");
  document.AddDealer.txtDisplayName.value="";
  document.AddDealer.txtDisplayName.focus();
  return false;
 }
 return true;
 }
//************************

/// <summary>
/// Programmer: Sachin
/// Name of Function: checkEIMemRegister
/// Usage / Functionality: Validate the fields on EIMemRegister form.
/// </summary>
		
function checkEIMemRegister() {

	
	if(document.EIMemRegister.txtEIUserName.disabled == false) {
	if(isFieldBlank(document.EIMemRegister.txtEIUserName)) {
		alert("Please specify the User Name.");
		document.EIMemRegister.txtEIUserName.value="";
		document.EIMemRegister.txtEIUserName.focus();
		return false;
	}
	}
	
	if((document.EIMemRegister.txtEIUserName.value.length < 4)) {
		alert("Please specify the Minimum 4 character User Name.");
		document.EIMemRegister.txtEIUserName.value="";
		document.EIMemRegister.txtEIUserName.focus();
		return false;
	}
	
	if(document.EIMemRegister.txtEIPassword)
	{
		if(isFieldBlank(document.EIMemRegister.txtEIPassword)) {
			alert("Please specify the Password.");
			document.EIMemRegister.txtEIPassword.value="";
			document.EIMemRegister.txtEIPassword.focus();
			return false;
		}
	}	
	
	if(document.EIMemRegister.txtEIConfirmPassword)
	{
		if(isFieldBlank(document.EIMemRegister.txtEIConfirmPassword)) {
			alert("Please specify the Reconfirm Password.");
			document.EIMemRegister.txtEIConfirmPassword.value="";
			document.EIMemRegister.txtEIConfirmPassword.focus();
			return false;
		}
	}
			
	if(document.EIMemRegister.txtEIConfirmPassword)
	{
		if (document.EIMemRegister.txtEIPassword.value != document.EIMemRegister.txtEIConfirmPassword.value) {
			alert("The passwords you have entered do not match. Please re-enter the passwords.");
			document.EIMemRegister.txtEIPassword.value = "";
			document.EIMemRegister.txtEIConfirmPassword.value = "";
			document.EIMemRegister.txtEIPassword.focus();
			return false;
		}
	}
	
	if(isFieldBlank(document.EIMemRegister.txtEIMemName)) {
		alert("Please specify your name.");
		document.EIMemRegister.txtEIMemName.value="";
		document.EIMemRegister.txtEIMemName.focus();
		return false;
	}
	if(isFieldBlank(document.EIMemRegister.txtEIStreet1)) {
		alert("Please specify the street1 of Addtress.");
		document.EIMemRegister.txtEIStreet1.value="";
		document.EIMemRegister.txtEIStreet1.focus();
		return false;
	}
	if(isFieldBlank(document.EIMemRegister.txtEIStreet2)) {
		alert("Please specify the street2 of Address.");
		document.EIMemRegister.txtEIStreet2.value="";
		document.EIMemRegister.txtEIStreet2.focus();
		return false;
	}
	if(isFieldBlank(document.EIMemRegister.txtEICity)) {
		alert("Please specify the city.");
		document.EIMemRegister.txtEICity.value="";
		document.EIMemRegister.txtEICity.focus();
		return false;
	}
	if(isFieldBlank(document.EIMemRegister.txtEIState)) {
		alert("Please specify the state.");
		document.EIMemRegister.txtEIState.value="";
		document.EIMemRegister.txtEIState.focus();
		return false;
	}
	
	if(!isNumber(document.EIMemRegister.txtEIZipCode)) {
		alert("Please  specify proper ZipCode");
		document.EIMemRegister.txtEIZipCode.value="";
		document.EIMemRegister.txtEIZipCode.focus();
		return false;
	}
	
	if(isFieldBlank(document.EIMemRegister.txtEIZipCode)) {
		alert("Please specify the pincode.");
		document.EIMemRegister.txtEIZipCode.value="";
		document.EIMemRegister.txtEIZipCode.focus();
		return false;
	}
	
	if(document.EIMemRegister.cmbEICountry.selectedIndex == 0) {
		alert("Please select Country.");
		document.EIMemRegister.cmbEICountry.focus();
		return false;
	}
	
	if(!isNumber(document.EIMemRegister.txtEIMemberCountryCode)) {
		alert("Please specify proper country code of phone.");
		document.EIMemRegister.txtEIMemberCountryCode.value="";
		document.EIMemRegister.txtEIMemberCountryCode.focus();
		return false;
	}
	
	if(isFieldBlank(document.EIMemRegister.txtEIMemberCountryCode)) {
		alert("Please specify the country code of phone.");
		document.EIMemRegister.txtEIMemberCountryCode.value="";
		document.EIMemRegister.txtEIMemberCountryCode.focus();
		return false;
	}
	
	if(!isNumber(document.EIMemRegister.txtEIMemberProvinceCode)) {
		alert("Please specify proper province code of phone.");
		document.EIMemRegister.txtEIMemberProvinceCode.value="";
		document.EIMemRegister.txtEIMemberProvinceCode.focus();
		return false;
	}
	if(isFieldBlank(document.EIMemRegister.txtEIMemberProvinceCode)) {
		alert("Please specify the province code of phone.");
		document.EIMemRegister.txtEIMemberProvinceCode.value="";
		document.EIMemRegister.txtEIMemberProvinceCode.focus();
		return false;
	}
	
	if(!isNumber(document.EIMemRegister.txtEIMemberTelephone)) {
		alert("Please specify proper telephone number of phone.");
		document.EIMemRegister.txtEIMemberTelephone.value="";
		document.EIMemRegister.txtEIMemberTelephone.focus();
		return false;
	}	
	
	if(isFieldBlank(document.EIMemRegister.txtEIMemberTelephone)) {
		alert("Please specify the telephone number of phone.");
		document.EIMemRegister.txtEIMemberTelephone.value="";
		document.EIMemRegister.txtEIMemberTelephone.focus();
		return false;
	}
	
	if(!isNumber(document.EIMemRegister.txtEIMemberExtnNumber)) {
		alert("Please specify proper Extn number");
		document.EIMemRegister.txtEIMemberExtnNumber.value="";
		document.EIMemRegister.txtEIMemberExtnNumber.focus();
		return false;
	}	
		
	if(isFieldBlank(document.EIMemRegister.txtEIEmail)) {
		alert("Please specify the Email address");
		document.EIMemRegister.txtEIEmail.value="";
		document.EIMemRegister.txtEIEmail.focus();
		return false;
	}	
	if(!isValidEmailAddress(document.EIMemRegister.txtEIEmail)) {
		alert("Please specify valid Email address");
		document.EIMemRegister.txtEIEmail.value="";
		document.EIMemRegister.txtEIEmail.focus();
		return false;
	}	
	
	
	return true;
}


/// <summary>
/// Programmer: Prashant
/// Name of Function: checkMemLogin
/// Usage / Functionality: Validate the fields on MemLogin form.
/// </summary>
		
function checkMemLogin() {

	if(isFieldBlank(document.MemLogin.txtUserName)) {
		alert("Please specify the User Name.");
		document.MemLogin.txtUserName.value="";
		document.MemLogin.txtUserName.focus();
		return false;
	}
	if(document.MemLogin.txtPassword)
	{
		if(isFieldBlank(document.MemLogin.txtPassword)) {
			alert("Please specify the Password.");
			document.MemLogin.txtPassword.value="";
			document.MemLogin.txtPassword.focus();
			return false;
		}
	}
	
	return true;
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: checkdwnloadgame
/// Usage / Functionality: Validate the fields on downloading game.
/// </summary>
function checkdwnloadgame() {

	//if ((isFieldBlank(document.dwnloadgame.txtKeyWord)) && (isFieldBlank(document.dwnloadgame.txtTitle))) 
	if (document.dwnloadgame.cbxTermsConditions.checked == true)
	{
		alert("Please accept Terms & Conditions before downloading game.");
		document.dwnloadgame.cbxTermsConditions.focus();
		return false;
	}
	
	return true;

}

/// <summary>
/// Programmer: Sachin
/// Name of Function: checkAdminEILogin
/// Usage / Functionality: Validate the fields on MemLogin form.
/// </summary>
		
function checkAdminEILogin() {

	if(isFieldBlank(document.AdminEILogin.txtEIUserName)) {
		alert("Please specify the User Name.");
		document.AdminEILogin.txtEIUserName.value="";
		document.AdminEILogin.txtEIUserName.focus();
		return false;
	}
	if(document.AdminEILogin.txtEIPassword)
	{
		if(isFieldBlank(document.AdminEILogin.txtEIPassword)) {
			alert("Please specify the Password.");
			document.AdminEILogin.txtEIPassword.value="";
			document.AdminEILogin.txtEIPassword.focus();
			return false;
		}
	}
	
	return true;
}



/// <summary>
/// Programmer: Tauseef
/// Name of Function: UploadGameValidate
/// Usage / Functionality: Validate the fields on Upload Game form.
/// </summary>
		
function UploadGameValidate() {

	if(isFieldBlank(document.UploadGame.txtGameName)) {
		alert("Please specify the Game Name.");
		document.UploadGame.txtGameName.value="";
		document.UploadGame.txtGameName.focus();
		return false;
	}

	if(document.UploadGame.drpAgeFrom.selectedIndex == 0) {
		alert("Please select Age from.");
		document.UploadGame.drpAgeFrom.focus();
		return false;
	}

	if(document.UploadGame.drpAgeTo.selectedIndex == 0) {
		alert("Please select Age To.");
		document.UploadGame.drpAgeTo.focus();
		return false;
	}

	if(isFieldBlank(document.UploadGame.txtGradeLevel)) {
		alert("Please specify the Grade Level.");
		document.UploadGame.txtGradeLevel.value="";
		document.UploadGame.txtGradeLevel.focus();
		return false;
	}

	if(isFieldBlank(document.UploadGame.browFile)) {
		alert("Please specify the Game File.");
		document.UploadGame.browFile.value="";
		document.UploadGame.browFile.focus();
		return false;
	}
	
	if (document.UploadGame.browFile.value.substring(document.UploadGame.browFile.value.length - 3).toUpperCase() != "JGM")	{
	
		alert("Please specify the Game File having extension of JGM.");
		document.UploadGame.browFile.value="";
		document.UploadGame.browFile.focus();
		return false;
	}
	
	
	return true;
}


/// <summary>
/// Programmer: Tauseef
/// Name of Function: SearchGameValidate
/// Usage / Functionality: Validate the fields on Search Game form.
/// </summary>
		
function SearchGameValidate() {

	if ((document.GameSearch.drpGradeLevel.selectedIndex == 0) && (document.GameSearch.drpGameNo.selectedIndex == 0) && (isFieldBlank(document.GameSearch.txtAbbreviatedCat)) && (isFieldBlank(document.GameSearch.txtFinalCat)) && (isFieldBlank(document.GameSearch.txtClues)) && (isFieldBlank(document.GameSearch.txtAnswers)) && (isFieldBlank(document.GameSearch.txtSource))) 
	{
		alert("Please select at least one criteria.");
		document.GameSearch.drpAgeFrom.focus();
		return false;
	}
	
	return true;
}


/// <summary>
/// Programmer: Tauseef
/// Name of Function: EIPublicGameValidate
/// Usage / Functionality: Validate the fields on EI Public Area form.
/// </summary>
function EIPublicGameValidate()		
{

	if (isFieldBlank(document.EIPublicArea.txtGameNo))
	{
		alert("Please select Game No.");
		document.EIPublicArea.txtGameNo.focus();
		return false;
	}
	
	return true;
}

/// <summary>
/// Programmer: Prashant
/// Name of Function: CheckEmailGenerator
/// Usage / Functionality: Validate the fields on Email Generator form.
/// </summary>

function CheckEmailGenerator() {
	
	if(isFieldBlank(document.EmailGenerator.txtSubject)) {
		alert("Please specify the Subject.");
		document.EmailGenerator.txtSubject.value="";
		document.EmailGenerator.txtSubject.focus();
		return false;
	}
	
	if(isFieldBlank(document.EmailGenerator.txtMessage)) {
		alert("Please specify the Message.");
		document.EmailGenerator.txtMessage.value="";
		document.EmailGenerator.txtMessage.focus();
		return false;
	}
	
	elm = document.EmailGenerator.elements;
	var flag = false;
	for(i=0;i<elm.length;i++) {
		if(elm[i].type=="checkbox") {
			if(elm[i].checked==true) {
				flag = true;
			}
		}
	}
	
	if(flag==false)
	{
		alert("Please select atleast one email address.");
		return false;
	}
	
	return true;
}




/// <summary>
/// Programmer: Tauseef
/// Name of Function: CheckUploadGame
/// Usage / Functionality: Validate the fields on Upload Game.
/// </summary>

function CheckUploadGame() {
	
	
	if(document.GameUpload.cmbsubjects.selectedIndex == 0) 
	{
		alert("Please select Subject.");
		document.GameUpload.cmbsubjects.focus();
		return false;
	}
	
	if(isFieldBlank(document.GameUpload.txtDescription)) {
		alert("Please specify the Description.");
		document.GameUpload.txtDescription.value="";
		document.GameUpload.txtDescription.focus();
		return false;
	}
	if(!isFieldBlank(document.GameUpload.txtDescription)) {
		var descLen =document.GameUpload.txtDescription.value.length;
		if(descLen >360)
		{
			var intExeChar= descLen-360;
			var strMsg = "You've exceeded the character limit by " + intExeChar.toString() ;
			alert(strMsg );
			document.GameUpload.txtDescription.focus();
			return false;
		}
		
		
	}

	elm = document.GameUpload.elements;
	var flag = false;
	for(i=0;i<elm.length;i++) {
		if(elm[i].type=="radio") {
			if(elm[i].checked==true) {
				flag = true;
			}
		}
	}
	
	if(flag==false)
	{
		alert("Please select atleast one Grade Level.");
		return false;
	}
	
	
/*	
	if(document.GameUpload.drpAgeFrom.selectedIndex == 0) {
		alert("Please select Age from.");
		document.GameUpload.drpAgeFrom.focus();
		return false;
	}
	
		
	
	if(document.GameUpload.drpAgeTo.selectedIndex == 0) {
		alert("Please select Age To.");
		document.GameUpload.drpAgeTo.focus();
		return false;
	}

	if(document.GameUpload.drpAgeTo.selectedIndex < document.GameUpload.drpAgeFrom.selectedIndex) {
		alert("Please select Age Level To greater than Age Level From.");
		document.GameUpload.drpAgeTo.focus();
		return false;
	}
*/

	/*
	if (document.GameUpload.cbxTermsConditions.checked == false){
	if(isFieldBlank(document.GameUpload.browGameFile)) {
		alert("Please specify the Game File.");
		document.GameUpload.browGameFile.value="";
		document.GameUpload.browGameFile.focus();
		return false;
	}
	*/
	
	if (document.GameUpload.browGameFile.value.substring(document.GameUpload.browGameFile.value.length - 3).toUpperCase() != "JGM")	{
	
		alert("Please specify the Game File having extension of JGM.");
		document.GameUpload.browGameFile.value="";
		document.GameUpload.browGameFile.focus();
		return false;
	}
	
	
	
	if (document.GameUpload.cbxTermsConditions.checked == false)
	{
		alert("Please accept Terms & Conditions.");
		document.GameUpload.cbxTermsConditions.focus();
		return false;
	}
	

	
	return true;
}

/// <summary>
/// Programmer: Sachin
/// Name of Function: EditUploadGame
/// Usage / Functionality: Validate the fields on Upload Game.
/// </summary>

function EditUploadGame() {
	
	if(document.GameEdit.drpGameSubject.selectedIndex == 0) {
		alert("Please select GameSubject");
		document.GameEdit.drpGameSubject.focus();
		return false;
	}

	/*
	if(document.GameEdit.drpAgeLevelFrom.selectedIndex == 0) {
		alert("Please select Age from.");
		document.GameEdit.drpAgeLevelFrom.focus();
		return false;
	}

	if(document.GameEdit.drpAgeLevelTo.selectedIndex == 0) {
		alert("Please select Age To.");
		document.GameEdit.drpAgeLevelTo.focus();
		return false;
	}

	if(document.GameEdit.drpAgeLevelTo.selectedIndex < document.GameEdit.drpAgeLevelFrom.selectedIndex) {
		alert("Please select Age Level To greater than Age Level From.");
		document.GameEdit.drpAgeLevelTo.focus();
		return false;
	}
	*/
	if(isFieldBlank(document.GameEdit.txtDescription)) {
		alert("Please specify the Description.");
		document.GameEdit.txtDescription.value="";
		document.GameEdit.txtDescription.focus();
		return false;
	}

	elm = document.GameEdit.elements;	
	var flag = false;
	for(i=0;i<elm.length;i++) {
		if(elm[i].type=="radio") {
			if(elm[i].checked==true) {
				flag = true;
			}
		}
	}
	
	if(flag==false)
	{
		alert("Please select atleast one Grade Level.");
		return false;
	}
	
	if(document.GameEdit.CheckBox1.checked  == false){
	document.GameEdit.browGameFile.disabled = true;	
	}
	
	if(document.GameEdit.CheckBox1.checked  == true){
	
	document.GameEdit.browGameFile.disabled = false;	
	/*
	if(isFieldBlank(document.all.PanelGame.browGameFile)) {
		alert("Please specify the Game File.");
	//	document.all.PanelGame.browGameFile.value="";
	//	document.all.PanelGame.browGameFile.focus();
		return false;
	}
	*/
	
	if (document.GameEdit.browGameFile.value.substring(document.GameEdit.browGameFile.value.length - 3).toUpperCase() != "JGM")	{
	
		alert("Please specify the Game File having extension of JGM.");
	//	document.all.PanelGame.browGameFile.value="";
	//	document.all.PanelGame.browGameFile.focus();
		return false;
	}
	}
	
	return true;
}


/// <summary>
/// Programmer: Tauseef
/// Name of Function: checkdwnloadgame
/// Usage / Functionality: Validate the fields on Upload Game.
/// </summary>
function checkSearchUpldgame() {

	if ((isFieldBlank(document.GameUpload.txtGameSearchKeyword)) && (isFieldBlank(document.GameUpload.txtGameSearchTitle))) 
	{
		alert("Please select at least one criteria.");
		document.GameUpload.txtGameSearchKeyword.focus();
		return false;
	}
	
	return true;

}

/// <summary>
/// Programmer: Prashant
/// Name of Function: ShiftFocusinEIMem(currentfield,nextfield)
/// Usage / Functionality: set the focus on nextfield if currentfield's maxlength reached.
/// </summary>
function ShiftFocusinEIMem(currentField,nextField)
{
	if (currentField.value.length == currentField.maxLength)
        document.EIMemRegister[nextField].focus();
}

/// <summary>
/// Programmer: Prashant
/// Name of Function: ShiftFocusinMem(currentfield,nextfield)
/// Usage / Functionality: set the focus on nextfield if currentfield's maxlength reached.
/// </summary>
function ShiftFocusinMem(currentField,nextField)
{
	if (currentField.value.length == currentField.maxLength)
        document.MemRegister[nextField].focus();
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: checktxtSubject
/// Usage / Functionality: Validates for blank subject.
/// </summary>
function checktxtSubject()
 {
	if(isFieldBlank(document.SubjectMaster.txtsubjects))
	{
	alert("Please specify the Subject.");
		document.SubjectMaster.txtsubjects.value="";
		document.SubjectMaster.txtsubjects.focus();
		return false;
	}
	 return true;
	
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: checktxtSubject
/// Usage / Functionality: Validates for blank sub-subject.
/// </summary>
function checktxtSubSubject()
 {
	if(document.SubSubjectMaster.cmbsubjects.selectedIndex == 0) {
		alert("Please select Subject.");
		document.SubSubjectMaster.cmbsubjects.focus();
		return false;
	}
		
	if(isFieldBlank(document.SubSubjectMaster.txtsubsubjects))
	{
	alert("Please specify the SubSubject.");
		
		document.SubSubjectMaster.txtsubsubjects.focus();
		return false;
	}
	 return true;
	
}


/// <summary>
/// Programmer: Tauseef
/// Name of Function: AllowDisallowControls
/// Usage / Functionality: Enables / disables controls.
/// </summary>
function AllowDisallowControls()
{
	//var value = !document.MemRegister.cbxHomeDetails.checked;
	var value = !document.MemRegister.cbxHomeDetails.checked;
	
	//document.MemRegister.txtMemberName.disabled = value;
	if(value){
	lblStric.style.visibility = "visible";
	
	//kuan added this:
	
	lblMemberst1A.style.visibility = "hidden";
	lblMemberstreet1.style.color = "gray";
	lblMemberStreet2.style.color = "gray";
	lblMemberCityA.style.visibility = "hidden";
	lblMemberCity.style.color = "gray";
	lblMemberStateA.style.visibility = "hidden";
	lblMemberState.style.color = "gray";
	lblMemberZipA.style.visibility = "hidden";
	lblMemberZip.style.color = "gray";
	lblMemberCountryA.style.visibility = "hidden";
	lblMemberCountry.style.color = "gray";
    
	
	//end kuan modified
	}
	else{
	lblStric.style.visibility = "hidden";
	
		//kuan added this:
	
	lblMemberst1A.style.visibility = "visible";
	lblMemberstreet1.style.color = "black";
	lblMemberStreet2.style.color = "black";
	lblMemberCityA.style.visibility = "visible";
	lblMemberCity.style.color = "black";
	lblMemberStateA.style.visibility = "visible";
	lblMemberState.style.color = "black";
	lblMemberZipA.style.visibility = "visible";
	lblMemberZip.style.color = "black";
	lblMemberCountryA.style.visibility = "visible";
	lblMemberCountry.style.color = "black";
	
    
	//end kuan modified

	
	}


	document.MemRegister.txtMemberStreet1.disabled = value;
	document.MemRegister.txtMemberStreet2.disabled = value;
	document.MemRegister.txtMemberCity.disabled = value;
	document.MemRegister.txtMemberState.disabled = value;
	document.MemRegister.txtMemberPincode.disabled = value;
	document.MemRegister.drpMemberCountry.disabled = value;


	/*
	if (value == true)
	{
		document.MemRegister.lblMemberName.text = "* " + document.MemRegister.lblMemberName.text;
	}
	else
	{
		document.MemRegister.lblMemberName.text = document.MemRegister.lblMemberName.text;
	}
	*/
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: GameEditAllowDisallowControls
/// Usage / Functionality: Enables / disables controls.
/// </summary>
function GameEditAllowDisallowControls()
{
	var value = !document.GameEdit.CheckBox1.checked;
	
	document.GameEdit.btnViewGame.disabled=value;
	document.GameEdit.btnDownloadGame.disabled=value;
	document.GameEdit.browGameFile.disabled=value;
	
	return true;
	
}
function GameEditAllowDisallowControlsOne()
{
	var value = !document.GameEdit.CheckBox1.checked;
	
	document.GameEdit.btnViewGame.disabled=value;
	//document.GameEdit.btnDownloadGame.disabled=value;
	document.GameEdit.browGameFile.disabled=value;
	
	return true;
	
}

/// <summary>
/// Programmer: Tauseef
/// Name of Function: EditProfileAllowDisallowControls
/// Usage / Functionality: Enables / disables controls.
/// </summary>
function EditProfileAllowDisallowControls()
{
	//var value = !document.MemRegister.cbxHomeDetails.checked;
	var value = !document.MemProfileEdit.cbxHomeDetails.checked;
	
	//document.MemProfileEdit.txtMemberName.disabled = value;
	document.MemProfileEdit.txtMemberStreet1.disabled = value;
	document.MemProfileEdit.txtMemberStreet2.disabled = value;
	document.MemProfileEdit.txtMemberCity.disabled = value;
	document.MemProfileEdit.txtMemberState.disabled = value;
	document.MemProfileEdit.txtMemberPincode.disabled = value;
	document.MemProfileEdit.drpMemberCountry.disabled = value;
	
	/*
	if (value == true)
	{
		document.MemRegister.lblMemberName.text = "* " + document.MemRegister.lblMemberName.text;
	}
	else
	{
		document.MemRegister.lblMemberName.text = document.MemRegister.lblMemberName.text;
	}
	*/
}



/// <summary>
/// Programmer: Tauseef
/// Name of Function: SearchGameValidate
/// Usage / Functionality: Validate the fields on Search Game form.
/// </summary>
		
function SearchGameGradeLevels() {

	if ((document.GameSearch.drpGradeLevelFrom.selectedIndex == 0) && (document.GameSearch.drpGradeLevelTo.selectedIndex > 0)) 
	{
		alert("Grade Level From can not be blank.");
		document.GameSearch.drpGradeLevelFrom.focus();
		return false;
	}
	
	if ((document.GameSearch.drpGradeLevelFrom.selectedIndex > 0) && (document.GameSearch.drpGradeLevelTo.selectedIndex > 0)) 
	{
		if (document.GameSearch.drpGradeLevelFrom.selectedIndex >= document.GameSearch.drpGradeLevelTo.selectedIndex)
		{
			alert("Grade Level To should be greater than Grade Level From.");
			document.GameSearch.drpGradeLevelFrom.focus();
			return false;
		}
	}
	
	return true;
}


	
