<!--

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

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_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

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_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 breadCrumbs(base, delStr, defp, cStyle, tStyle, dStyle, nl) {
    loc = window.location.toString();
    subs = loc.substr(loc.indexOf(base) + base.length + 1).split("/");
    document.write("&nbsp;<a href=\"" + getLoc(subs.length - 1) + defp + "\" class=\"" + cStyle + "\">Home</a>  " + "<span class=\"" + dStyle + "\">" + delStr + "</span> ");
    a = (loc.indexOf(defp) == -1) ? 1 : 2;
    for (i = 0; i < (subs.length - a); i++) {
        subs[i] = makeCaps(unescape(subs[i]));
        document.write("<a href=\"" + getLoc(subs.length - i - 2) + defp + "\" class=\"" + cStyle + "\">" + subs[i] + "</a>  " + "<span class=\"" + dStyle + "\">" + delStr + "</span> ");
    }
    if (nl == 1) {
        document.write("<br>");
    }
    document.write("<span class=\"" + tStyle + "\">" + document.title + "</span>");
}

function makeCaps(a) {
    g = a.split(" ");
    for (l = 0; l < g.length; l++) {
        g[l] = g[l].toUpperCase().slice(0, 1) + g[l].slice(1);
    }
    return g.join(" ");
}
 
function getLoc(c) {
    var d = "";
    if (c > 0) {
        for (k = 0; k < c; k++) {
            d = d + "../";
        }
    }
    return d;
}

function togLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// old ie
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// nn4
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}

  function checkforvalid_form(theForm)
{

var alertsay = ""; // define for long lines
// check to see if the field is blank
if (theForm.Contact.value == "")
{
alert("You must enter an Contact Name");
theForm.Contact.focus();
return (false);
}

if (theForm.Contact.value == "First Last")
{
alert("You must enter an Contact Name");
theForm.Contact.focus();
return (false);
}

// require at least 3 characters be entered
if (theForm.Contact.value.length < 3)
{
alert("Please enter at least 3 characters in the Name field.");
theForm.Contact.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789. ";
var checkStr = theForm.Contact.value;
var allValid = true;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only letters and numbers in the Name field.");
theForm.Contact.focus();
return (false);
}

// test if a space exists in Contact
var checkcont = " ";
var ContcheckStr = theForm.Contact.value;
var ContValid = false;
var ContSpace = false;
for (i = 0;  i < ContcheckStr.length;  i++)
{
ch = ContcheckStr.charAt(i);
for (j = 0;  j < checkcont.length;  j++)
{
if (ch == checkcont.charAt(j) && ch == " ")
ContSpace = true;
	  if (ContSpace)
		break;
	  if (j == checkcont.length)
		break;
	}
	// if both the @ and . were in the string
if (ContSpace)
{
		ContValid = true
		break;
	}
}
if (!ContValid)
{
alert("Your Contact name must include a first and last name.");
theForm.Contact.focus();
return (false);
}

// check if both e-mail fields are the same
if (theForm.email.value != theForm.email2.value)
{
	alert("Your e-mail addresses do not match, please verify them.");
	theForm.email2.focus();
	return (false);
}

// allow only 255 characters maximum in the comment field
if (theForm.Notes.value.length > 255)
{
alert("Please limit your comments to 255 characters.");
theForm.Notes.focus();
return (false);
}

// check if no drop down has been selected
if (theForm.Source.selectedIndex < 0)
{
alert("Please specify where you heard about us.");
theForm.Source.focus();
return (false);
}

// check if email field is blank
if (theForm.email.value == "")
{
alert("You must enter an e-mail address.");
theForm.email.focus();
return (false);
}

// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.email.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("Your e-mail address is invalid, please review.");
theForm.email.focus();
return (false);
}

// only allow numbers to be entered in phone1
var checkOK = "0123456789";
var checkStr = theForm.Phone1.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the Phone field.");
theForm.Phone1.focus();
return (false);
}

// only allow numbers to be entered in Fax
var checkOK = "0123456789";
var checkStr = theForm.Fax.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the Fax field.");
theForm.Fax.focus();
return (false);
}


// alert if the box is NOT checked
// if (!theForm.agreetoterms.checked)
// {
// alertsay = "You must Agree to the Terms and Conditions "
// alertsay = alertsay + "to use this web form.  If you wish to receive a quote "
// alertsay = alertsay + "but do not want to use this form, please call our sales "
// alertsay = alertsay + "line at 800.689.8898 or e-mail us at sales\@copia.com."
// alert(alertsay);
// theForm.agreetoterms.focus();
// return (false);
// }

return (true);
}
