var defaultEmptyOK = false;

// m is an abbreviation for "missing"
var mPrefix = "You did not enter a value into the "
var mSuffix = " field. This is a required field. Please enter it now."

// s is an abbreviation for "string"
var sUSDistrict = "District"
var sUSOrigin = "Origin Place In Rajasthan"
var sUSHeightMin = "Minimum Height"
var sUSHeightMax = "Maximum Height"
var sUSAge = "Age"
var sUSDetails = "Details"
var szUSProfession = "Profession"
var sUSRelationship = "Relationship"
var sUSBrothers = "No Of Brothers"
var sUSSisters = "No Of Sisters"
var sUSLangR = "Language You Can Read"
var sUSLangW = "Language You Can Write"
var sUSLangS = "Language You Can Speak"
var sUSHoroscope = "Horoscope Match"
var sUSOfficeAdd = "Office Address"
var sUSHobbies = "Hobbies"
var sUSComplexion = "Complexion"
var sUSWeight = "Weight"
var sUSHeight = "Height"
var sUSEducation = "Education"
var sUSMangalic = "Mangalic"
var sUSGotra = "Gotra"
var sUSCulture = "Culture"
var sUSOccupation = "Occupation"
var sUSPhysical = " Physical Fitness" 
var sUSMstatus = " Marital Status"
var sContact = " Contact Requested"
var sUSGender = "Gender"
var sUSAuthor = "Author Name"
var sUSBriefNews = "Brief News"
var sUSCurrency = "Currency"
var sUSHeading = "Head Lines"
var sUSNews = "News"
var sUSCity = "City"
var sUSPincode = "Pin Code"
var sUSGender = "Gender"
var sUSState = "State"
var sUSCountry = "Country"
var sUSProfession = "Profession"
var sUSOccupation = "Occupation"
var sUSCulture = "Culture"
var sUSLastName = "Last Name"
var sUSComments = "Comments"
var sUSFirstName = "First Name"
var sUSEmailAdd = "Email Address"
var sUSUserName = "User Name"
var sUSPassword = "User Password"
var sUSPasswordRetype = "Retype User Password"
var sUSPassQuestion = "Password Reminder Question"
var sUSPassAnswer = "Password Reminder Answer"
var sUSContactNoCode = "Std Code Of your Area"
var sUSContactNoTel = "Telephone No "
var sUSContactNoRef = "Telephone No Reference"
var sUSPartner = "Partner Preference"
var sUSComments= "Comments"
var sUSUserName = "User Name"
var sUSName = "Name"
var sUSFirmName = "Firm Name"
var sUSFatherName = "Father Name"
var sUSCompanyName = "Company / Firm Name"
var sUSDesignation= "Designation In Company"
var sUSIncome = "Your Income"
var sUSAgeMin = "Minimum Age"
var sUSAgeMax = "Maximum Age"
var sUSGender = "Gender"
var sUSAddress = "Address"
var sWorldAddress = "Address"
var sCity = "City"
var sStateCode = "State Code"
var sWorldState = "State, Province, or Prefecture"
var sCountry = "Country"
var sZIPCode = "ZIP Code"
var sWorldPostalCode = "Postal Code"
var sPhone = "Phone Number"
var sFax = "Fax Number"
var sDateOfBirth = "Date of Birth"
var sExpirationDate = "Expiration Date"
var sEmail = "Email"
var sOtherInfo = "Other Information"
var sUSHear = "Hear About Us"
var sUSIncome = "Annual Income"

// p is an abbreviation for "prompt"
var pWebsite = "Website Name"
var pEntryPrompt = "Please enter "
var pSelectPrompt= "Please Select "
var pUSPhone = "You must enter std code and  phone number (like 022 3233423)."
var pEmail = "valid email address (like foo@bar.com)."
var pDay = "day number between 1 and 31."
var pMonth = "month number between 1 and 12."
var pYear = "2 or 4 digit year number."

var iEmail = "This field must be a valid email address (like foo@bar.com). Please reenter it now."
var iDay = "This field must be a day number between 1 and 31.  Please reenter it now."
var iMonth = "This field must be a month number between 1 and 12.  Please reenter it now."
var iYear = "This field must be  4 digit year number and your age should be atleat 18 years and maximum 80 years."
var iDatePrefix = "The Day, Month, and Year for "
var iDateSuffix = " do not form a valid date.  Please reenter them now."
var iUSFax = "Enter the fax no"


// Display data entry prompt string s in status bar.

function promptEntry (s)
{   window.status = pEntryPrompt + s
}
function promptSelect(s)
{   window.status = pSelectPrompt + s
}

// Notify user that required field theField is empty.
// String s describes expected contents of theField.value.
// Put focus in theField and return false.

function warnEmpty (theField, s)
{   theField.focus();
    alert(mPrefix + s + mSuffix);
    return false;
}
function warnField (theField, s)
{   theField.focus();
    alert(mPrefix + s + mSuffix);
    return false;
}

function invalidLength (theField, s)
{   theField.focus()
    alert("You did not enter atlest four characters into the " + s + " field. Please enter four charactes now.")
    return false
}
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
function isinvalidLength(s)
{   
//alert('isinvalidLength called');
 if (s.length < 4)
     return true;
}

function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;
//	if ((rtrim(ltrim(s))) == "") return true;
    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        //if (whitespace.indexOf(c) == -1) return false;
        if (c != " ") return false;
    }

    // All characters are whitespace.
    return true;
}

function checkField(theField,theSpecial, s, emptyOK)
{   
     if (theField.value == "23")
     {
       if (isWhitespace(theSpecial.value))
       return warnField (theField, s);
     }  
    else return true;
}
  
function checkString(theField, s, emptyOK)
{   
     if (isWhitespace(theField.value)) 
       return warnEmpty (theField, s);
    else return true;
}

function stateChecker(theField,s)
 {
 alert('stateChecker called');
    var checkedButton = ""
       for (var i in document.frmProfile.Gender)
        { alert('stateChecker called');
              if (document.frmProfile.Gender[i].checked=="true")
               {alert('loop');
                       // checkedButton=document.frmProfile.Gender[i].value
  //                      if(checkedButton
                  return true;
                }
                else
                {//alert('else');
                   //theField.focus();
    alert(mPrefix + s + mSuffix);
    //return false;
    }
                   
          }
 }


function checkGender(theField, s, emptyOK)
{   
alert('checkGender called');
if (document.frmProfile.Gender[0].checked)
 { 
     //theField.value = "F";
     return true;
 }
else
 {
    if (document.frmProfile.Gender[1].checked)
     {
       //    theField.value = "M";
           return true;
     }   
     else
       {
             return warnEmpty (theField, s);
       }
  }
}  
  //function for enabling the textbox if other option is selected from selectlist
  //renamed from showbox
 function enablebox(listobj,frmname,textobj,i)
{
// get value of selected option
var occuinteger
//occuinteger = listobj.selectedIndex;
//alert (occuinteger);
var occutext

 if (listobj.options[i].selected)    
     { //alert(i + ' selected');
        // occutext = listobj.options[i].value;
          //alert('Please enter value here');
         //document.frmname.textobj.focus(); 
         return true; 
         
      } 
   else return false;
}


function showbox(listobj,frmname,textobj,i,divid)
{
 // alert('sshowbox called');
// get value of selected option
var occuinteger
//occuinteger = listobj.selectedIndex;
//alert (occuinteger);
var occutext

 if (listobj.options[i].selected)    
     { //alert(i + ' selected');
        // occutext = listobj.options[i].value;
          //alert('Please enter value here');
         //document.frmname.textobj.focus();
          
         show(divid);
         return true; 
         
      } 
   else 

   {  
      hide(divid);
      
      return false;
   }
}
// this function is for restring the no of characters to be typed in text area box//use it as onKeyPress="if(textareavalue(this.value,'frmProfile','Hobbies')) this.blur(); else this.focus();"// max 500 characters can be entered.
function textareavalue(checkString,frmname,textobj)
{

   var test = frmname;
   var count = 0;
     var details = textobj;
  newString = "";    // REVISED/CORRECTED STRING
         // COUNTER FOR LOOPING THROUGH STRING

    // LOOP THROUGH STRING CHARACTER BY CHARACTER
    for (var i = 0; i < checkString.length; i++)
  {      
    
   
    ch = checkString.substring(i, i+1);
    newString += ch;
      // alert('checkstring =  ' + checkString.length);
       //alert( checkString.length);
      // alert(count);
    //checkString.length > 9 this is for 10 characters
    if(checkString.length > 495)
   // { 
      // alert(count);
       return true;
    //}
    else
     //document.test.details.focus();
     return false;
   }
  }  
// this function shows alert if values of two password field are not //same
function warnPassword (theField, s)
{   theField.focus();
    alert('You did not enter the value of ' + s + ' same as in Password   type Field. The Values of these two fields should be same.');
    return false;
}
// this function is for checking the values in the two password fields //whether these are same or not
function checkPassword (firstField,secondField,s)
{   
     if ((secondField.value) != (firstField.value)) 
       return warnPassword (secondField, s);
    else return true;
}// this function is for if the member cliks the reset button then the form with original values should be displayedfunction resetfunction()
{
window.location.href = self.location.href;
}


//this function returns true if the date entered is current date or the future date.

function currdate(daypass,monthpass,yrpass)
{
//here I am calculating the current day month and year from the system date
//Purpose is to chack the day and month and yera entered by the user with these values and allow
//him to enter rodays or more that these values for the date
var Today,curryr,currmonth,currday
Today = new Date();
curryr = Today.getYear();
//The value returned by getMonth is an integer between 0 and 11. 0 corresponds to January, 1 to February, and so on.
currmonth = eval(Today.getMonth() + 1) ;
//The value returned by getDate is an integer between 1 and 31.
currday = Today.getDate();
//alert('curryr = ' + curryr + 'currmonth = ' + currmonth + 'currday = ' +currday);
var pubday,pubmonth,pubyr

//removing the prefix zero if present
// use it to remove 0 if it is prefixed    s = s.chatAt(1);
//this is for the case if the no is prefixed with 0 then remove the 0 and then check the no range
//if((daypass=="01") || (daypass=="02") || (daypass=="03") || (daypass=="04") || (daypass=="05") || (daypass=="06") || (daypass=="07") || (daypass=="08") || (daypass=="09"))
///	
	// daypass = daypass.chatAt(1);
//	 
//if((monthpass=="01") || (monthpass=="02") || (monthpass=="03") || (monthpass=="04") || (monthpass=="05") || (monthpass=="06") || (monthpass=="07") || (monthpass=="08") || (monthpass=="09"))
	
//	 monthpass = monthpass.chatAt(1);
	 
	 	 
	 
daypass = daypass;
monthpass = monthpass;
yrpass = yrpass;
alert('daypass = ' + daypass + 'monthpass = ' + monthpass + 'yrpass = ' +yrpass);
if(yrpass >= curryr)
 return true; 
else
{   
  if(yrpass == curryr)
  {
     if(monthpass >= currmonth)
       { return true; }
      else
      {
      if(monthpass == currmonth)
        {
         if(daypass >= currday)
           { return true; }
         else
            { 
			 alert('currday please enter the current or future date');
			 return false;
		     }
         }  
       else 
        { 
		 alert('currday please enter the current or future date');
		return false;
        }
      alert('currday please enter the current or future date');
	  return false;
   }
    
alert('currday please enter the current or future date');
return false;       
}
alert('currday please enter the current or future date');
return false;
}
   //here end of function  	 
}
   

	 
//now comparing the day month and year and combining all should be equal to or greater than the current date

//currdate("16","8","1999");
//alert(currdate("18","8","2000"));

// this function is for showing the image in the same sized window as that of image.

function myimage(image,width,height)
 {
// alert('myimage called');
 var adjwidth,adjheight
 if(navigator.appName == 'Netscape')
  {
  adjwidth = width + 20;
  adjheight = height + 20;
  }
 else
  {
  adjwidth = width + 50;
  adjheight = height + 150;
  } 
  
  window.open(image,'memberimage','height = ' + height,'width = ' + width + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no');
 
 }
 
