// slaico.js

<!--Begin Image Rotation -->



<!--End Image Rotation -->

<!-- Home BUTTON -->
var iName=""; 
var nav=navigator.appName.indexOf("Netscape");
var vers=parseInt(navigator.appVersion);

if ( (nav != -1 && vers >= 3) || (vers == 4) ) {
   default1 = new Image(); 
   default1.src = "images/home.gif";
   changed1 = new Image(); 
   changed1.src = "images/home_on.gif";
}
 
function Ichange(p) {
 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {    
   var pSrc=eval(p+ ".src");
   document[iName].src = pSrc;
 }
}

<!-- Health BUTTON -->
<!-- Hide from old browsers
 var iName=""; 
 var nav=navigator.appName.indexOf("Netscape"); 
 var vers=parseInt(navigator.appVersion);

 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {
  default2 = new Image(); 
  default2.src = "images/health.gif";
  changed2 = new Image(); 
  changed2.src = "images/health_on.gif";
 }

function Ichange(p) {
 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {    
	var pSrc=eval(p+ ".src");
	document[iName].src = pSrc;
 }
}
// end hiding -->

<!-- Life BUTTON -->
<!-- Hide from old browsers
 var iName=""; var nav=navigator.appName.indexOf("Netscape"); 
 var vers=parseInt(navigator.appVersion);
 
 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {
   default3 = new Image(); 
   default3.src = "images/life.gif";
   changed3 = new Image(); 
   changed3.src = "images/life_on.gif";
 }

function Ichange(p) {
  if ( (nav != -1 && vers >= 3) || (vers == 4) ) {    
	var pSrc=eval(p+ ".src");
	document[iName].src = pSrc;
  }
}

<!-- Annuities BUTTON -->
<!-- Hide from old browsers
 var iName=""; var nav=navigator.appName.indexOf("Netscape");
 var vers=parseInt(navigator.appVersion);

 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {
    default4 = new Image(); 
    default4.src = "images/annu.gif";
    changed4 = new Image(); 
    changed4.src = "images/annu_on.gif";
 }
 
function Ichange(p) {
  if ( (nav != -1 && vers >= 3) || (vers == 4) ) {    
	var pSrc=eval(p+ ".src");
	document[iName].src = pSrc;
  }
}
// end hiding -->

<!-- About BUTTON -->
<!-- Hide from old browsers
var iName=""; 
var nav=navigator.appName.indexOf("Netscape");
var vers=parseInt(navigator.appVersion);

if ( (nav != -1 && vers >= 3) || (vers == 4) ) {
  default5= new Image(); 
  default5.src = "images/about-stand-life.jpg";
  changed5 = new Image(); 
  changed5.src = "images/about_on_stand_life.jpg";
}

function Ichange(p) {
 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {    
	var pSrc=eval(p+ ".src");
	document[iName].src = pSrc;
 }
}
// end hiding -->

<!-- Contact BUTTON -->
<!-- Hide from old browsers
var iName=""; 
var nav=navigator.appName.indexOf("Netscape"); 
var vers=parseInt(navigator.appVersion);

if ( (nav != -1 && vers >= 3) || (vers == 4) ) {
  default6 = new Image(); 
  default6.src = "images/contact.gif";
  changed6 = new Image(); 
  changed6.src = "images/contact_on.gif";
}

function Ichange(p) {
 if ( (nav != -1 && vers >= 3) || (vers == 4) ) {    
	var pSrc=eval(p+ ".src");
	document[iName].src = pSrc;
 }
}
// end hiding -->

//************************************************************************ 
//* openWin
//* This function makes sure the user is using IE5.5 or higher before
//* opening the window.  If not, the user will get a not supported page.
//************************************************************************ 
function openWin(webPage) {
     var myBars = 'directories=no,location=no,copyhistory=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes,resizable=no,top=0,left=0';
     
     var myOptions = 'dependent=no, height=300, width=300 top=200 left=200';
     var myFeatures = myBars + ',' + myOptions;
     var newWin;
  
     newWin = window.open(webPage, null, myFeatures);
}


function openDoNotCallWin(webPage) 
{
     var myBars = 'resizable=yes,newwin=yes,location=no,directories=no,menubar=no,status=no,copyhistory=no,toolbar=no,scrollbars=yes,left=0,top=0';
     
//     var myOptions = 'dependent=no, height=300, width=300 top=200 left=200';
     var myFeatures = myBars;// + ',' + myOptions;
     var newWin;
  
     newWin = window.open(webPage, null, myFeatures);
}

//
// Validates the contact us form and then submits it
//
function submitContactUs(form, action) {
  document.contactUsForm.action.value = action;
  if (document.contactUsForm.name.value == '') {
      alert ("Please provide your name.");
      return false;
  } else if (!isValidEmail(document.contactUsForm.emailAddress)) {   
      alert ("Please provide your valid email address.");
      return false;
  }
  document.contactUsForm.submit();
  return true;
}

//
//Checks to see if a string is blank or not
//
function isBlank(element) {
var s = element.value;
s.replace(/^\s+/g, '').replace(/\s+$/g, '');

 if (s.length == 0) {
   return true;

 } else {
   return false;
  }
}

//
//Validates an email address
//
function isValidEmail(email) {
  if ((email.value.indexOf(' ')>=0) || (email.value.indexOf('@')<=0) || 
                 (email.value.indexOf('.')<=0) ||
                 (email.value.indexOf('.') +1 == email.value.length) ||
                 (email.value.indexOf('@')+1 == email.value.length )) 	{
		return false;
  }		
  return true;
}

//
//Sets the focus on the field of the error
//
function setFocus(fieldName) {
  fieldName.focus();
}

function displayContact() {

	if (document.contactUsForm.contactByPhone[0].checked == true) {
		contact1.style.display = "inline";
		contact2.style.display = "inline";
		contact3.style.display = "inline";
		contact4.style.display = "inline";
	} else if (document.contactUsForm.contactByPhone[1].checked == true) {
		contact1.style.display = "none";
		contact2.style.display = "none";
		contact3.style.display = "none";
		contact4.style.display = "none";
	}
}

function displayPolicy() {

	if (document.contactUsForm.grpPolicyHolderAnswer[0].checked == true) {
		row1.style.display = "inline";
	} else if (document.contactUsForm.grpPolicyHolderAnswer[1].checked == true) {
		row1.style.display = "none";
	}
}

/* SR 16246
 function displayANPolicy() {

	if (document.contactUsForm.grpANPolicyHolderAnswer[0].checked == true) {
		row2.style.display = "inline";
	} else if (document.contactUsForm.grpANPolicyHolderAnswer[1].checked == true) {
		row2.style.display = "none";
    }
} */

function isCustomerStatusChecked(form) {
var rad_select = "";
for (var loop = 0; loop < document.contactUsForm.grpPolicyHolderAnswer.length; loop++)
{
 if (document.contactUsForm.grpPolicyHolderAnswer[loop].checked == true)
 {
   rad_select = document.contactUsForm.grpPolicyHolderAnswer[loop].value;
 }
}

if (rad_select != "") {
  return true;
} else {
  return false;
}
}



function isContactByPhoneChecked(form) {
var rad_select = "";
for (var loop = 0; loop < document.contactUsForm.contactByPhone.length; loop++)
{
 if (document.contactUsForm.contactByPhone[loop].checked == true)
 {
   rad_select = document.contactUsForm.contactByPhone[loop].value;
 }
}

if (rad_select != "") {
  return true;
} else {
  return false;
}
}


function isPolicyHolderCheckedYes(form) {

for (var loop = 0; loop < document.contactUsForm.grpPolicyHolderAnswer.length; loop++)
{
 if (document.contactUsForm.grpPolicyHolderAnswer[loop].checked == true)
 {
   if (document.contactUsForm.grpPolicyHolderAnswer[loop].value == "yes") {
     return true;
   }
 }
}

}

/* SR 16246
function isANPolicyHolderCheckedYes(form) {

for (var loop = 0; loop < document.contactUsForm.grpANPolicyHolderAnswer.length; loop++)
{
 if (document.contactUsForm.grpANPolicyHolderAnswer[loop].checked == true)
 {
   if (document.contactUsForm.grpANPolicyHolderAnswer[loop].value == "yes") {
     return true;
   }
 }
}

} */



function isContactByPhoneCheckedYes(form) {

for (var loop = 0; loop < document.contactUsForm.contactByPhone.length; loop++)
{
 if (document.contactUsForm.contactByPhone[loop].checked == true)
 {
   if (document.contactUsForm.contactByPhone[loop].value == "yes") {
     return true;
   }
 }
}

}

function isContactByPhoneCheckedNo(form) {

for (var loop = 0; loop < document.contactUsForm.contactByPhone.length; loop++)
{
 if (document.contactUsForm.contactByPhone[loop].checked == true)
 {
   if (document.contactUsForm.contactByPhone[loop].value == "no") {
     return true;
   }
 }
}

}

function isAtLeastOneAreaOfInterestChecked(form) {

for (var loop = 0; loop < document.contactUsForm.multiBoxInfo.length; loop++)
{
 if (document.contactUsForm.multiBoxInfo[loop].checked == true)
 {
   return true;
 }
}

return false;
}

function isSubjectSelected(form) {
var subject_option_number = document.contactUsForm.selectedSubject.selectedIndex;
var subject_option_value = "";

if (subject_option_number != -1) {
    subject_option_value = document.contactUsForm.selectedSubject.options[subject_option_number].value; 
}

if (subject_option_value == '') {
  return false;
} else {
 return true;
 }
}

function isNumeric(s) {
      return s.match(/^\d+$/) ? s : false;
}

function verifyDoNotCallAdd(form) {
     if ((document.sendDoNotCallAddForm.phone0.value.length < 3) || 
         (document.sendDoNotCallAddForm.phone1.value.length < 3) || 
         (document.sendDoNotCallAddForm.phone2.value.length < 4)) {
         alert("Please enter your complete phone number.");
         return false;
     } else if (!isNumeric(document.sendDoNotCallAddForm.phone0.value) || !isNumeric(document.sendDoNotCallAddForm.phone1.value) || !isNumeric(document.sendDoNotCallAddForm.phone2.value)) { 
         alert("Phone number must contain all numeric values.");
         return false;
     }             
     document.sendDoNotCallAddForm.submit();
     return true;
}

function verifyEmailForm(form) {
  /*if (isPolicyHolderCheckedYes(form)) {
       if (document.contactUsForm.policyNumber.value == '') {
         alert("Please enter your policy number.");
         return false;
       }  
  }*/
  /*if (isANPolicyHolderCheckedYes(form)) {
       if (document.contactUsForm.anPolicyNumber.value == '') {
         alert("Please enter your policy number.");
         return false;
       }  
  }*/
 /* if (!isCustomerStatusChecked(form)) {
     alert("Please select a customer status.");
     return false;
  } else*/ 
  if (!isAtLeastOneAreaOfInterestChecked(form)) {
     alert("Please select at least one area of interest.");
     return false;  
  } else if (!isSubjectSelected(form)) {
     alert("Please select a subject.");
     return false;    
  } else if (document.contactUsForm.lastName.value == '') {
     alert("Please enter your last name.");
     return false;
  } else if (document.contactUsForm.firstName.value == '') {
     alert("Please enter your first name.");
     return false;
     
  } else if(!isBlank(document.contactUsForm.email)) {  
      if (!isValidEmail(document.contactUsForm.email)) {   
         alert ("Please provide your valid email address.");
         return false;
       }   
  } 

  
  if (!isContactByPhoneChecked(form)) {
     alert("Please select contact by phone preference.");
     return false;
  }

  if (isContactByPhoneCheckedNo(form)) { 
  	 if (isBlank(document.contactUsForm.email) && isBlank(document.contactUsForm.address1) && isBlank(document.contactUsForm.address2)) {
        alert("Please fill in your address or email.");
  	    return false; 
  	 }
  	 else if((!isBlank(document.contactUsForm.address1) || !isBlank(document.contactUsForm.address2)) && isBlank(document.contactUsForm.city)) {
        alert("Please fill in your city.");
        return false;
     }
     else if((!isBlank(document.contactUsForm.address1) || !isBlank(document.contactUsForm.address2) || !isBlank(document.contactUsForm.city)) && isBlank(document.contactUsForm.state)) {
        alert("Please fill in your state.");
        return false;
     }
  }
  
  if (isContactByPhoneCheckedYes(form)) {
     if ((document.contactUsForm.phone0.value.length < 3) || 
         (document.contactUsForm.phone1.value.length < 3) || 
         (document.contactUsForm.phone2.value.length < 4)) {
         alert("Please enter your complete phone number.");
         return false;
     } else if (!isNumeric(document.contactUsForm.phone0.value) || !isNumeric(document.contactUsForm.phone1.value) || !isNumeric(document.contactUsForm.phone2.value)) { 
         alert("Phone number must contain all numeric values.");
         return false;
     }     
  }

  document.contactUsForm.submit();
  return true;
}

function toggleDiv(divid){
	var dv = document.getElementById(divid);
	dv.style.display = (dv.style.display == 'none' ? 'block' : 'none');
}
