//------------------------------------------------------------------------------
function hideLayer(layerName, checkboxName) {
    document.getElementById(layerName).style.display = "none";
    document.getElementById(checkboxName).checked = false;
    clearShipToInfo(); //clear the ShipTo info when the user closes the fieldset
}

//------------------------------------------------------------------------------
function showHideLayer(layerName, checkboxName) {
    if(document.getElementById(layerName).style.display == "none"){
        document.getElementById(layerName).style.display = "block";
        document.getElementById(checkboxName).checked = true;
    }else{
         
        document.getElementById(layerName).style.display = "none";
        document.getElementById(checkboxName).checked = false;
        clearShipToInfo(); //clear the ShipTo info when the user closes the fieldset
        
    }
}


//------------------------------------------------------------------------------
function verifyPersonalInfoFields(){
    var alertMessage = "Please fill in the fields marked below";
    var bkgColor= "#990000";

    //BillTo Info
    if(document.getElementById('strFirstName').value == ''){
        document.getElementById('strFirstName').style.backgroundColor = bkgColor;
        return false;
    }
    if(document.getElementById('strLastName').value == ''){
        document.getElementById('strLastName').style.backgroundColor = bkgColor;
        return false;

    }

    var genderRadios = document.getElementById('strGender');
    for (var i=0; i <genderRadios.length; i++) {
        if (genderRadios[i].checked) {
            return true;
            
        }else{
            alert();
            document.getElementById('strGender').style.backgroundColor = bkgColor;
            return false;
        }
    }
     
    if(document.getElementById('strHandedness').value == ''){
        document.getElementById('strHandedness').style.backgroundColor = bkgColor;
        return false;
    }
    if(document.getElementById('strGMT').value == ''){
        document.getElementById('strGMT').style.backgroundColor = bkgColor;
        return false;
    }
    if(document.getElementById('numDay').value == ''){
        document.getElementById('numDay').style.backgroundColor = bkgColor;
        return false;
    }
    if(document.getElementById('numMonth').value == ''){
        document.getElementById('numMonth').style.backgroundColor = bkgColor;
        return false;
    }
    if(document.getElementById('numYear').value == ''){
        document.getElementById('numYear').style.backgroundColor = bkgColor;
        return false;
    }
    if(document.getElementById('strCity').value == ''){
        document.getElementById('strCity').style.backgroundColor = bkgColor;
        return false;
    }
   if(document.getElementById('strFavoriteColor').value == ''){
       document.getElementById('strFavoriteColor').style.backgroundColor = bkgColor;
       return false;
    }

    return true;
}


//------------------------------------------------------------------------------
function isValidEmail(strEmail){
   var regExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(regExp.test(strEmail) == false) {
      return false;
   }else{
       return true;

   }
}

//------------------------------------------------------------------------------
function isValidZip(strZipCode){
   var regExp = /(^\d{5}$)|(^\d{5}-\d{4}$)/ //checks for 5 OR 9 digits zipcodes
   if(regExp.test(strZipCode) == false) {
      return false;
   }else{
       return true;
   }
}


//Rollover Functions
//------------------------------------------------------------------------------
function imageOn(id, image){
 document.getElementById(id).src = image;
}

function imageOff(id, image){
 document.getElementById(id).src = image;
}

//Rollover Functions
//------------------------------------------------------------------------------
function smileyRedirect(firstName, lastName){
    gender = documents.getElementByID('strGender');
    birthYear = documents.getElementByID('strBirthYear');
    destURL = 'http%3A%2F%2Fwww.dailyhoroscopes.com%2Freadings%2Fpsychic%2Dsmiley%2DResult.php';
    placementID = 'dailyhoroscopes';
    redirectURL = 'http://ian.smileymedia.com/r2/?placementID=' + placementID + '&email=&fname=' + firstName + '&lname=' + lastName + '&gender=' + gender + '&dob=' + birthYear + '&addr=&addr2=&city=&state=&zip=&hphone=&mphone=&country=&pubSubID=&destURL=' + destURL;
    window.location = redirectURL;
}








