//###############################################\\
//        Sure Seal JavaScript Library           \\
//           Written By Matt Torbin              \\
//        Copyright 2004 (c) PEI-Genesis         \\
//            All Rights Reserved.               \\
//###############################################\\


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function isName() {
    var input = document.ssForm.name.value;
    
    if (input == "") {
        alert("Please fill in the name field.");
        document.ssForm.name.focus();
        
        return false;
    }
    
    return true;
}


function isCompany() {
    var input = document.ssForm.company.value;
    
    if (input == "") {
        alert("Please fill in the company field.");
        document.ssForm.company.focus();
        
        return false;
    }
    
    return true;
}


function isAddress() {
    var input = document.ssForm.address.value;
    
    if (input == "") {
        alert("Please fill in the address field.");
        document.ssForm.address.focus();
        
        return false;
    }
    
    return true;
}


function isCity() {
    var input = document.ssForm.city.value;
    
    if (input == "") {
        alert("Please fill in the city field.");
        document.ssForm.city.focus();
        
        return false;
    }
    
    return true;
}


function isState() {
    var input = document.ssForm.state.value;
    
    if (input == "") {
        alert("Please fill in the state field.");
        document.ssForm.state.focus();
        
        return false;
    }
    
    return true;
}


function isZip() {
    var input = document.ssForm.zipCode.value;
    
    if (input == "") {
        alert("Please fill in the zip code field.");
        document.ssForm.zipCode.focus();
        
        return false;
    }
    
    return true;
}


function isCountry() {
    var input = document.ssForm.country.value;
    
    if (input == "") {
        alert("Please fill in the country field.");
        document.ssForm.country.focus();
        
        return false;
    }
    
    return true;
}


function isPhone() {
    var input = document.ssForm.phone.value;
    
    if (input == "") {
        alert("Please fill in the phone field.");
        document.ssForm.phone.focus();
        
        return false;
    }
    
    return true;
}


function isEmail() {
    var input = document.ssForm.email.value;
    var periodChar = input.length - 4;
	var extension = input.substring((periodChar + 1),input.length);
	
    if (input == "") {
        alert("Please enter your email address.");
        document.ssForm.email.focus();
        
        return false;
    }

    else if (input.indexOf("@") == -1) {
        alert("The email address that you entered is invalid.  Please check your entry and resubmit the form.");
        document.ssForm.email.focus();
        
        return false;
    }
    
    switch (extension) {
        case "com":
            return true;
    
        case "edu":
            return true;
        
        case "gov":
            return true;
        
        case "mil":
            return true;
        
        case "net":
            return true;
        
        case "org":
            return true;
        
        default:
            //alert("The extension of the email address that you enetered is either invalid or is not a type that we are accepting.  Currently we are only accepting email addresses with extension com, edu, gov, mil, net and org.  Please check your entry and resubmit the form.");
            //document.ssForm.email.focus();
            return true;
    }
}


function isApp() {
    var input = document.ssForm.application.value;
	
    if (input == "") {
        alert("Please fill in the application field.");
        document.ssForm.application.focus();
        
        return false;
    }
    
    return true;
}