﻿<!--
function validateAdvertEntry(form, AdvertType_error, AdvertType_tip, Name_error, Name_tip, Email_error, Email_tip, Phone_error, Phone_tip, ContactMethodID_error, ContactMethodID_tip, CountyID_error, CountyID_tip, Password_error, Password_tip, Password1_error, Password1_tip)
{
  var retVal = true;
  var strError = "";
  if (form.ctl00_ContentPlaceHolderBody_ddlAdvertTypeID)
  {
      if (form.ctl00_ContentPlaceHolderBody_ddlAdvertTypeID.selectedIndex == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_lblAdvertTypeID_tip'), AdvertType_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_c3').className = "form3CTipError3";
        strError = "<li>" + AdvertType_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_lblAdvertTypeID_tip'), AdvertType_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ddlAdvertTypeID_c3').className = "form3CTipContent3";
      }
  }
  
  // Contact Details
  
  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName)
  {
      if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName.value.length == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblName_tip'), Name_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_c3').className = "form3CTipError3";
        strError = "<li>" + Name_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblName_tip'), Name_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtName_c3').className = "form3CTipContent3";
      }
  }
  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail)
  {
    if(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail').value.length != 0)
      { 
        if(!echeck(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail').value))
        {
            changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblEmail_tip'), Email_error );
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_tip').className = "form3CError";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_row').className = "form3CRowError";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_arrow').className = "form3CTipArrowError";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c1').className = "form3CTipError1";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c2').className = "form3CTipError2";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c3').className = "form3CTipError3";
            strError = "<li>" + Email_error + "</li>";
            retVal = false;
        }
        else
        {
            changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblEmail_tip'), Email_tip );
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_tip').className = "form3CTip";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_row').className = "form3CRowNormal";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_arrow').className = "form3CTipArrow";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c1').className = "form3CTipContent1";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c2').className = "form3CTipContent2";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c3').className = "form3CTipContent3";
        }
      }
      else
      {
            changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblEmail_tip'), Email_error );
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_tip').className = "form3CError";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_row').className = "form3CRowError";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_arrow').className = "form3CTipArrowError";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c1').className = "form3CTipError1";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c2').className = "form3CTipError2";
            document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtEmail_c3').className = "form3CTipError3";
            strError = "<li>" + Email_error + "</li>";
            retVal = false;
      }
  }
  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone)
  {
      if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone.value.length == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblPhone_tip'), Phone_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_c3').className = "form3CTipError3";
        strError = "<li>" + Phone_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblPhone_tip'), Phone_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPhone_c3').className = "form3CTipContent3";
      }
  }
  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID)
  {
      if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID.selectedIndex == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblContactMethodID_tip'), ContactMethodID_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_c3').className = "form3CTipError3";
        strError = "<li>" + ContactMethodID_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblContactMethodID_tip'), ContactMethodID_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlContactMethodID_c3').className = "form3CTipContent3";
      }
  }
  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID)
  {
      if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID.selectedIndex == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblCountyID_tip'), CountyID_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_c3').className = "form3CTipError3";
        strError = "<li>" + CountyID_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblCountyID_tip'), CountyID_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_ddlCountyID_c3').className = "form3CTipContent3";
      }
  }

  var errorPanel = document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_pnlNewPassword');

  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword)
  {
      if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword.value.length == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblPassword_tip'), Password_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_c3').className = "form3CTipError3";
        strError = "<li>" + Password_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblPassword_tip'), Password_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword_c3').className = "form3CTipContent3";
      }
  }
  if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1 && errorPanel.style.display == 'block')
  {
      if (form.ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1.value.length == 0)
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblPassword1_tip'), Password1_error );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_tip').className = "form3CError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_row').className = "form3CRowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_arrow').className = "form3CTipArrowError";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_c1').className = "form3CTipError1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_c2').className = "form3CTipError2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_c3').className = "form3CTipError3";
        strError = "<li>" + Password1_error + "</li>";
        retVal = false;
      }
      else
      {
        changeText(document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_lblPassword1_tip'), Password1_tip );
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_tip').className = "form3CTip";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_row').className = "form3CRowNormal";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_arrow').className = "form3CTipArrow";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_c1').className = "form3CTipContent1";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_c2').className = "form3CTipContent2";
        document.getElementById('ctl00_ContentPlaceHolderBody_ucNewContactDetailsEntry_txtPassword1_c3').className = "form3CTipContent3";
      }
  }
  
  if (strError != "")
  {
    changeInnerHTML(document.getElementById('ctl00_ContentPlaceHolderBody_lblErrorMessages'), "<ul>" + strError + "</ul>");
    document.getElementById('ctl00_ContentPlaceHolderBody_pnlError').style.display = 'block';
  }
  if (!retVal)
  {
    scroll(0,0);
  }
  return retVal;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}

function changeInnerHTML(obj, meText)
{
        obj.innerHTML = meText;
}

function changeText(obj, meText)
{
    if (obj.innerText) 
    { // IE;
        obj.innerText = meText;
    }
    else
    {
        if (obj.textContent)
        {
            obj.textContent = meText;
        }
        else
        {
            //alert("Error: This application does not support your browser. Try again using IE or Firefox.");
        }
    }
}

function echeck(str) 
{
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  if (str.indexOf(at,(lat+1))!=-1)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  if (str.indexOf(dot,(lat+2))==-1)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  if (str.indexOf(" ")!=-1)
  {
      //alert("Invalid E-mail ID")
      return false
  }
  return true
}
//-->
