function imageOn(ImageName)
{
    document[ImageName].src="images/"+ImageName+"1.gif";  
}

function imageOff(ImageName)
{
    document[ImageName].src="images/"+ImageName+".gif";
}

function numberval(num)
{
   var i=0;
   for(i=0;i<num.length;i++)
   {
   if(num.charAt(i) < '0'|| num.charAt(i) > '9')
   return false;
   }
   return true;
}

function checkpassid(check)
{
    if(check.UID.value == "")
    {
        alert("Please enter your User Id.");
        check.UID.focus();
        check.UID.select();   
        return false;
    }
    if(check.Password.value == "")
    {
        alert("Please enter your password.");
        check.Password.focus();
        check.Password.select();   
        return false;
    }
return true;
}

function choosedate(datecheck)
{
    /*
    if(!numberval(window.document.FOS.ToAge.value))
    {
        alert("Please enter numbers in Age field, Alphabets not accepted.");
        window.document.FOS.ToAge.focus();
        window.document.FOS.ToAge.select();
        return false;
    }

    if(!numberval(window.document.FOS.FromAge.value))
    {
        alert("Please enter numbers in Age field, Alphabets not accepted.");
        window.document.FOS.FromAge.focus();
        window.document.FOS.FromAge.select();
        return false;
    }

    if(datecheck.FromAge.value < 18) 
    {
        alert("The age entered should be more than 18 yrs.");
        datecheck.FromAge.focus();
        datecheck.FromAge.select();   
        return false;
    }

    if(datecheck.ToAge.value < 18)
    {
        alert("The age entered should be more than 18 yrs.");
        datecheck.ToAge.focus();
        datecheck.ToAge.select();   
        return false;
    }

    if(datecheck.ToAge.value > 99)
    {
        alert("The age entered should not be more than 99 yrs.");
        datecheck.ToAge.focus();
        datecheck.ToAge.select();   
        return false;
    }*/
    /*
    if(parseInt(datecheck.FromAge.value) > parseInt(datecheck.ToAge.value))
    {
        alert("Age should always be in ascending order.");
        datecheck.FromAge.focus();
        return false;
    }
    */
    if(parseInt(datecheck.FromAge.selectedIndex) > parseInt(datecheck.ToAge.selectedIndex))
    {
        alert("Age should always be in ascending order.");
        datecheck.FromAge.focus();
        return false;
    }

return true;
}


function blackbook(check)
{
    if(check.UID.value == "")
    {
        alert("Please enter your User Id.");
        check.UID.focus();
        check.UID.select();   
        return false;
    }
    if(check.Password.value == "")
    {
        alert("Please enter your password.");
        check.Password.focus();
        check.Password.select();   
        return false;
    }
return true;
}

function send(check)
{
    if(check.Title.value == "")
    {
        alert("Please enter your Title.");
        check.Title.focus();
        check.Title.select();   
        return false;
    }
    if(check.Message.value == "")
    {
        alert("Please enter your Message.");
        check.Message.focus();
        check.Message.select();
        return false;
    }
    else
    {
        args = check.Message.value;
        args = args.toUpperCase()
        
        if ((args.indexOf("STUPID") > -1) || (args.indexOf("IDIOT") > -1) || (args.indexOf("RASCAL")> -1) || (args.indexOf("BASTARD")> -1) || (args.indexOf("FUCK")> -1) || (args.indexOf("FUCKING")> -1) || (args.indexOf("ASSOLE")> -1) || (args.indexOf("SEX")> -1) || (args.indexOf("SEXY")> -1) || (args.indexOf("AFFAIR")> -1) || (args.indexOf("BITCH")> -1)|| (args.indexOf("INTERCOURSE")> -1) || (args.indexOf("FUCKIN")> -1) || (args.indexOf("SEXUAL")> -1) || (args.indexOf("BLOODY")> -1) || (args.indexOf("BOOBS")> -1) || (args.indexOf("PUSSY")> -1) || (args.indexOf("MASTURBATION")> -1) || (args.indexOf("HARDCORE")> -1) || (args.indexOf("DICK")> -1) || (args.indexOf("XXX")> -1))
        {
            alert("Bad words exists in your message. Please remove and proceed.");
            check.Message.focus();
            check.Message.select();
            return false;
        }
    }
return true;
}


function change(check)
{
    if(check.user.value == "")
    {
        alert("Please enter your User Id.");
        check.user.focus();
        check.user.select();   
        return false;
    }
    if(check.oldpass.value == "")
    {
        alert("Please enter your old password.");
        check.oldpass.focus();
        check.oldpass.select();   
        return false;
    }

    if(check.newpass.value == "")
    {
        alert("Please enter your new password.");
        check.newpass.focus();
        check.newpass.select();   
        return false;
    }

    var lengthnewpass= check.newpass.value.length;
    var i,a;
    a=check.newpass.value;
    for(i=0;i<lengthnewpass;i++)
    {
        if(a.charAt(i)==' ')
        {
            alert("no blank space is allowed in the password.");
            check.newpass.focus();
            check.newpass.select();   
            return false;
        }
    }

    if(check.conpass.value == "")
    {
        alert("Please enter the confirm password field.");
        check.conpass.focus();
        check.conpass.select();   
        return false;
    }

    if(FOS.newpass.value != FOS.conpass.value)
    {
        alert("Your new password is not equal to the confirm password.");
        check.conpass.focus();
        check.conpass.select();
        return false;
    }
return true;
}

function forgotpass(check)
{
    if(check.userid.value == "")
    {
        alert("Please enter your User Id.");
        check.userid.focus();
        check.userid.select();   
        return false;
    }
return true;
}

function blurnickname()
{
    document.FOS.NName.blur();
    //document.FOS.Age.focus();
}

function check(theForm)
{
  if(theForm.NName.value== "")
  {
      alert("Please enter your Nick Name.");
      theForm.NName.focus();
      theForm.NName.select();
      return false;
  } else
  {
    a = theForm.NName.value;
    for(i=0;i<a.length;i++)
        {
        if(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']' || a.charAt(i)=='!' || a.charAt(i)=='@' || a.charAt(i)=='#' || a.charAt(i)=='$' || a.charAt(i)=='%' || a.charAt(i)=='^' || a.charAt(i)=='&' || a.charAt(i)=='*' || a.charAt(i)=='"' || a.charAt(i)=='=' || a.charAt(i)==';' || a.charAt(i)==':' || a.charAt(i)=='<' || a.charAt(i)=='>' || a.charAt(i)=='?' || a.charAt(i)=='~' || a.charAt(i)=='`' || a.charAt(i)=='{' || a.charAt(i)=='}' || a.charAt(i)=='|' || a.charAt(i)=='.' || a.charAt(i)=='_' || a.charAt(i)=='\'' || a.charAt(i)=='\\') 
            {
            alert("Only alphabets and numbers are allowed in the Nick Name field.");
            theForm.NName.focus();
            theForm.NName.select();
            return false;
            }
        }
  }


  /*
  if(theForm.Age.value== "")        
  {
      alert("Please enter your age.");
      theForm.Age.focus();
      theForm.Age.select();
      return false;
  }
   else
   {
      a = theForm.Age.value;
      var i=0;
      for(i=0;i<a.length;i++)
      {
          if(a.charAt(i) < '0'|| a.charAt(i) > '9') 
          {
              if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
              {
              alert("Characters and special symbols are not allowed in the Age field.");
              theForm.Age.select();
              theForm.Age.focus();
              return false;
              }
          }
      }
   }

  if(theForm.Age.value< 18 || theForm.Age.value>99)        
  {
      alert("Your age should be more than 17 and less than 99.");
      theForm.Age.focus();
      theForm.Age.select();
      return false;
  }

  if(theForm.Age.value.indexOf('.')>0)
  {
      alert("Please enter your age in integers only.");
      theForm.Age.focus();
      theForm.Age.select();
      return false;
  }
  */
  if(theForm.Weight.value.indexOf("'")>0)
  {
    alert("An apostrophe is not allowed in the weight field.");
    theForm.Weight.focus();
    theForm.Weight.select();
    return false;
  }
  else
  {
  a = theForm.Weight.value;
  var i=0;
  for(i=0;i<a.length;i++)
  {
   if(a.charAt(i) < '0'|| a.charAt(i) > '9') 
   {
    if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
    {
     alert("Characters and special symbols are not allowed in the Weight field.");
     theForm.Weight.select();
     theForm.Weight.focus();
     return false;
    }
   }
   }
   }

  /*
  if(theForm.Hobbies.value== "")
  {
   alert("Please enter your hobbies.");
   theForm.Hobbies.focus();
   theForm.Hobbies.select();
   return false;
   }
   */
  if(theForm.Gist.value== "")
  {
   alert("Please describe yourself briefly.");
   theForm.Gist.focus();
   theForm.Gist.select();
   return false;
   }
  if(theForm.Description.value== "")        
  {
   alert("Please enter a description of yourself.");
   theForm.Description.focus();
   theForm.Description.select();
   return false;
   }

   if (parseInt(theForm.AgeFrom.selectedIndex)>parseInt(theForm.AgeTo.selectedIndex))
   {
    alert("Age should always be in ascending order")
    theForm.AgeFrom.focus();
    return false
   }

  if(theForm.Weight1.value.indexOf("'")>0)
  {
   alert("An apostrophe is not allowed in the weight field.");
   theForm.Weight1.focus();
   theForm.Weight1.select();
   return false;
  }
  else
  {
  a = theForm.Weight1.value;
  var i=0;
  for(i=0;i<a.length;i++)
  {
   if(a.charAt(i) < '0'|| a.charAt(i) > '9') 
   {
    if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
    {
     alert("Characters and special symbols are not allowed in the Weight field.");
     theForm.Weight1.select();
     theForm.Weight1.focus();
     return false;
    }
   }
   }
   }


/*if(theForm.UID.value == "")
{
    alert("Please enter your User Id.");
    theForm.UID.focus();
    theForm.UID.select();   
    return false;
} 
 if(theForm.Password.value == "")
  {
    alert("Please enter your password.");
    theForm.Password.focus();
    theForm.Password.select();   
    return false;
    }
if(theForm.ConfirmPassword.value == "")
  {
    alert("Please Enter the Confirm Password.");
    theForm.ConfirmPassword.focus();
    theForm.ConfirmPassword.select();
    return false;
    }

if((theForm.Password.value) != (theForm.ConfirmPassword.value))
{
alert("Your password field is not equal to the confirm password field.");
theForm.ConfirmPassword.focus();
theForm.ConfirmPassword.select();
return false;
}*/
return true;
}

function checkupdate(theForm)
{
  if(theForm.Name.value== "")        
  {
   alert("Please enter your name.");
   theForm.Name.focus();
   theForm.Name.select();
   return false;
   }
 if(theForm.Address.value== "")        
  {
   alert("Please enter your address.");
   theForm.Address.focus();
   theForm.Address.select();
   return false;
   }
if(!numberval(window.document.FOS.Phone.value))
     {
      alert("Please enter numbers in Phone field, Alphabets not accepted.");
      window.document.FOS.Phone.focus();
      return false;
}
  if(theForm.email.value.indexOf("@") == -1)
   {
   alert("Please enter a valid email address.");
   theForm.email.focus();
   theForm.email.select();
   return false;
   }
  if(theForm.email.value.indexOf(".") == -1)
{
   alert("Please enter a valid email address.");
   theForm.email.focus();
   theForm.email.select(); 
  return false;
   }


  if(theForm.NName.value== "")
  {
   alert("Please enter your Nick Name.");
   theForm.NName.focus();
   theForm.NName.select();
   return false;
   }
  if(theForm.Age.value== "")        
  {
   alert("Please enter your age.");
   theForm.Age.focus();
   theForm.Age.select();
   return false;
   }
  if(theForm.Hobbies.value== "")        
  {
   alert("Please enter your description.");
   theForm.Hobbies.focus();
   theForm.Hobbies.select();
   return false;
   }

  if(theForm.Gist.value== "")
  {
   alert("Please enter brief description.");
   theForm.Gist.focus();
   theForm.Gist.select();
   return false;
   }
  if(theForm.Description.value== "")        
  {
   alert("Please enter your description.");
   theForm.Description.focus();
   theForm.Description.select();
   return false;
   }
return true
}

function rfoccupation()
{
    if (document.FOS.Occupation.selectedIndex!=21)
    {
        document.FOS.xoccupation.blur();
        document.FOS.Income.focus();
    }
}

function rfoccupation1()
{
    if (document.FOS.Occupation1.selectedIndex!=21)
    {
        document.FOS.xoccupation1.blur();
        document.FOS.Relationship1.focus();
    }
}

function rcoccupation()
{
    if (document.FOS.Occupation.selectedIndex!=21)
    {
        document.FOS.xoccupation.value=""
    }
}

function rcoccupation1()
{
    if (document.FOS.Occupation1.selectedIndex!=21)
    {
        document.FOS.xoccupation1.value=""
    }
}

function checkonoff()
{
    if (document.FOS.Alertstat.checked==false)
    {
        alert("Please check the dating alert service box.");
        document.FOS.Alertstat.focus();
    }
}

function changecountry()
{
    if (document.FOS.location.selectedIndex!=0)
    {
        document.FOS.xloc.value="";
        document.FOS.xloc.focus();
    }
    else
    {
        document.FOS.xloc.value="Vizag";
    }

    if (document.FOS.location1.selectedIndex!=0)
    {
        document.FOS.xloc1.value="";
        document.FOS.xloc1.focus();
    }
    else
    {
        document.FOS.xloc1.value="Vizag";
    }
}

function maxchar()
{
    ss = document.sent.Message.value
    if (ss.length>=250)
    {
        document.sent.Message.blur()
        alert("You cannot enter more than 250 characters.")
    }
}










