// BW*Wizard-built JavaScript

var formSubmitted = "N";
var testpotentialsFirstName = "";
var testpotentialsLastName = "";
var testpotentialsEmail = "";
var testpotentialsPassword = "";
var testpotentialsHomePhone = "";
var testpotentialsCellPhone = "";
var testpotentialsHomeCity = "";
var testpotentialsHomeState = "";
var testpotentialsHomeZipCode = "";
var testpotentialsWorkPhone = "";
var testpotentialsEmployerName = "";
var testpotentialsEmployerIndustryId = "";
var testpotentialsWorkZipCode = "";
var testpotentialsVocationTitle = "";
var testpotentialsEmployeeCount = "";
var testpotentialsGenderId = "";
var testpotentialsRaceId = "";
var testpotentialsMaritalStatusId = "";
var testpotentialsDateOfBirth = "";
var testpotentialsIncomeId = "";
var testpotentialsEducationLevelId = "";
var testpotentialsEmploymentLevelId = "";
var helpWindow
var currentDate = new Date()
var currentYear = currentDate.getYear()
var maxYear = currentYear + 30;
var aolWarningDiplayed = "N";

function GoToButton_onClick_func(selIndex) {

   if (helpWindow) {

      helpWindow.close()
      helpWindow = null

   }

   isudTarget = isudSelectionTarget[selIndex]

   if ((isudTarget.substring(0,5) == "http:") 
     || (isudTarget.substring(0,6) == "https:")) {
     
      location.href = isudTarget

   }
   else {
      
      isudSel = isudSelectionSel[selIndex]
      document.MyProfileDetailsInsertForm2.actionInd.value = "TRANSFER"
      document.MyProfileDetailsInsertForm2.mappingTarget.value = isudSel;
      document.MyProfileDetailsInsertForm2.submit()

   }

}


function onKeyPress () {

   var keycode;

   if (window.event) keycode = window.event.keyCode;
   else if (e) keycode = e.which;
        else return true;

   if (keycode == 13) {
       Button_onClick(document.MyProfileDetailsInsertForm2.defaultButton.value);
       return false
   }

   return true

}

function BackButton_onClick_func() {

   window.status = ""

   if (helpWindow) {
     helpWindow.close()
     helpWindow = null
   }


   document.MyProfileDetailsInsertForm2.mappingTarget.value = "!CANCEL"; 
   document.MyProfileDetailsInsertForm2.actionInd.value = "TRANSFER"
   document.MyProfileDetailsInsertForm2.submit()

}

function CancelButton_onClick_func() {

   window.status = ""

   if (helpWindow) {
     helpWindow.close()
     helpWindow = null
   }


   document.MyProfileDetailsInsertForm2.mappingTarget.value = "!CANCEL"; 
   document.MyProfileDetailsInsertForm2.actionInd.value = "TRANSFER"
   document.MyProfileDetailsInsertForm2.submit()

}

function HomeButton_onClick_func() {

   window.status = ""

   if (helpWindow) {
     helpWindow.close()
     helpWindow = null
   }

   document.MyProfileDetailsInsertForm2.mappingTarget.value = "!HOME"; 
   document.MyProfileDetailsInsertForm2.actionInd.value = "TRANSFER"
   document.MyProfileDetailsInsertForm2.submit()

}

function HelpButton_onClick_func(helpField) {

   window.status = ""

   if (helpWindow) {
     helpWindow.close()
     helpWindow = null
   }

   if ((mouseX + 500) > screen.availWidth) {

      mouseX = screen.availWidth - 550
      mouseY = mouseY + 40

   }


   if ((mouseY + 600) > screen.availHeight) {

      mousey = screen.availWidth - 650

   }

   helpWindow = window.open(document.MyProfileDetailsInsertForm2.webContext.value+"MyProfileDetailsInsertHelp.htm?" + helpField,
     "MyProfileDetailsInsertHelp",
     "top="+mouseY+",left="+mouseX+",width=500,height=600,"
     + "dependent=yes,resizable=yes,scrollbars=yes")

   helpWindow.focus();

}


function Button_onClick(Command) {

   if (formSubmitted == "Y") {

      alert("Processing........, please wait")
      return

   }

   formSubmitted = "Y";

   if ((Command == "Select")
     && (document.MyProfileDetailsInsertForm2.allowSelect.value != "Y")) {
      return
   }

   if (Command == "Select") {
      SelectButton_onClick_func()
      return
   }

   if ((Command == "Update")
     && (document.MyProfileDetailsInsertForm2.allowUpdate.value != "Y")) {
      return
   }

   if ((Command == "Update")
     && (document.MyProfileDetailsInsertForm2.securityStatus.value == "M")
     && (document.MyProfileDetailsInsertForm2.dataAccessStatus.value == "M")) {
      UpdateButton_onClick_func()
      return
   }

   if ((Command == "Insert")
     && (document.MyProfileDetailsInsertForm2.allowInsert.value != "Y")) {
      return
   }

   if ((Command == "Insert")
     && (document.MyProfileDetailsInsertForm2.securityStatus.value == "M")
     && (document.MyProfileDetailsInsertForm2.dataAccessStatus.value == "M")) {
      InsertButton_onClick_func()
      return
   }

   if ((Command == "Delete")
     && (document.MyProfileDetailsInsertForm2.allowDelete.value != "Y")) {
      return
   }

   if ((Command == "Delete")
     && (document.MyProfileDetailsInsertForm2.securityStatus.value == "M")
     && (document.MyProfileDetailsInsertForm2.dataAccessStatus.value == "M")) {
      DeleteButton_onClick_func()
      return
   }

   if (Command == "BACK") {
      BackButton_onClick_func()
      return
   }

   if (Command == "CANCEL") {
      CancelButton_onClick_func()
      return
   }

   if (Command == "HOME") {
      HomeButton_onClick_func()
      return
   }
   formSubmitted = "N";

   if (Command == "HELP") {
      HelpButton_onClick_func()
      return
   }

   alert("Unsupported Option - " + Command)

}

function InsertButton_onClick_func() {

   //window.status = "Request being processed"


   document.MyProfileDetailsInsertForm2.actionInd.value = "Insert"
   
   var reg = new RegExp("@aol.com","i");
   if (reg.test(document.MyProfileDetailsInsertForm2.potentialsEmail.value) && 
       aolWarningDiplayed == "N") {
     alert("Due to AOL's aggressive spam filtering policy, you may not see emails from blarry.com in your inbox. If you sign up with Blarry House Research using an AOL email address, please remember to periodically check your spam folder in AOL for messages from blarry.com.")
     aolWarningDiplayed = "Y";
     formSubmitted = "N";
     return
   }     
   
   document.MyProfileDetailsInsertForm2.submit()

}


function SelectButton_onClick_func() {

   window.status = "Request being processed"

   document.MyProfileDetailsInsertForm2.actionInd.value = "Select"
   document.MyProfileDetailsInsertForm2.submit()

}



function UpdateButton_onClick_func() {

   window.status = "Request being processed"

   document.MyProfileDetailsInsertForm2.actionInd.value = "Update"
   document.MyProfileDetailsInsertForm2.submit()

}


function DeleteButton_onClick_func() {

   window.status = ""

   res = window.confirm("Are you sure you want to Delete this data?")
   if (res == true) {

      window.status = "Request being processed"
      document.MyProfileDetailsInsertForm2.actionInd.value = "Delete"
      document.MyProfileDetailsInsertForm2.submit()
   }

}



function local_opendoc() {

   window.status = ""

    focusNotSet = true;

    for (var i=0;i<document.MyProfileDetailsInsertForm2.elements.length;i++) {

       if (document.MyProfileDetailsInsertForm2.elements[i].type!="hidden") {

          eval(" part = document.MyProfileDetailsInsertForm2."+document.MyProfileDetailsInsertForm2.elements[i].name+"GUIState");
          //alert("Type - "+document.MyProfileDetailsInsertForm2.elements[i].type.substring(0,6))
          //alert("Part - " + part);
          //alert("Part name - " + part.name);
          //alert("Part value - " + part.value);

          if ((part)
            && (part.value == true)) {

             if (document.layers) {

                //Netscape 4 only
                document.MyProfileDetailsInsertForm2.elements[i].onfocus=document.MyProfileDetailsInsertForm2.elements[i].blur;

             }
             else {

                if (document.MyProfileDetailsInsertForm2.elements[i].type=="text") {

                   document.MyProfileDetailsInsertForm2.elements[i].readonly=true;
                   document.MyProfileDetailsInsertForm2.elements[i].disabled=true;

                }
                else {

                   document.MyProfileDetailsInsertForm2.elements[i].disabled=true;

                }

             }

          }
          else {

             if (focusNotSet) {

                if (document.MyProfileDetailsInsertForm2.elements[i].type=="text") {
                   document.MyProfileDetailsInsertForm2.elements[i].focus();
                   document.MyProfileDetailsInsertForm2.elements[i].select();
                }

                //document.MyProfileDetailsInsertForm2.elements[i].select();
                focusNotSet = false;

             }

          }

       }

    }
    
}


function local_closedoc() {

   if (helpWindow) {
     helpWindow.close()
     helpWindow = null
   }

}


 // end of BW*Wizard-built JavaScript


