s02off=new Image(51,22)
s02off.src="i/off-02.gif"
s02on=new Image(51,22)
s02on.src="i/on-02.gif"
s04off=new Image(44,22)
s04off.src="i/off-04.gif"
s04on=new Image(44,22)
s04on.src="i/on-04.gif"
s06off=new Image(63,22)
s06off.src="i/off-06.gif"
s06on=new Image(63,22)
s06on.src="i/on-06.gif"
s12off=new Image(81,22)
s12off.src="i/off-12.gif"
s12on=new Image(81,22)
s12on.src="i/on-12.gif"
s14off=new Image(92,22)
s14off.src="i/off-14.gif"
s14on=new Image(92,22)
s14on.src="i/on-14.gif"
s16off=new Image(66,22)
s16off.src="i/off-16a.gif"
s16on=new Image(66,22)
s16on.src="i/on-16a.gif"
s18off=new Image(97,22)
s18off.src="i/off-18.gif"
s18on=new Image(97,22)
s18on.src="i/on-18.gif"
s20off=new Image(35,22)
s20off.src="i/off-20.gif"
s20on=new Image(35,22)
s20on.src="i/on-20.gif"


function flipper(ExistingImageName,NewImageName){
    if (document.images)
    document.images[ExistingImageName].src = eval(NewImageName+".src")
}


function FileSubmission(){
    win3 = window.open("http://www.tek-tronics.com/file-popup.shtml","","width=400,height=400,toolbar,scrollbars,")
    win3.moveTo(0,0)
}


function PlantTour(){
    win3 = window.open("tour.shtml","","width=500,height=375")
    win3.moveTo(0,0)
}


/* begin spam killer */


function CedarockKS(JC0,handler) {  /* "KS" = kill spam */
    var JC1 = "tek-tronics"         /* this is the "do" in "do.us" */
    var JC2 = "com"                 /* this is the "us" in "do.us" */
    if (handler=="mto") {           /* write mail to only */
        document.write("<A HREF=\"mai")
        document.write("lto:"+JC0+"@")
        document.write(JC1+"."+JC2+"\">")
    }
    if (handler=="add") {           /* write address only */
        document.write(JC0+"@")
        document.write(JC1+"."+JC2)
    }
    if (handler=="all") {           /* write mail to and address */
        document.write("<A HREF=\"mai")
        document.write("lto:"+JC0+"@")
        document.write(JC1+"."+JC2+"\">")
        document.write(JC0+"@")
        document.write(JC1+"."+JC2)
        document.write("</A>")
    }
    return true
}


/* end of spam killer */
/* start of CedarockValidate */


subon = new Image(130,25)
subon.src = "i/submitted2.gif"

/* DISABLE THE SUBMIT BUTTON AFTER FIRST CLICK */
function Localize(NewText){
    return NewText;
}
var ButtonText = Localize("Submitting...");
var submissions=0;
function Submitting(f){
    f.go.value=ButtonText;
    f.go.disabled=true;
    if (submissions==0)f.submit();
    submissions++;
    /* SHOW "STAND BY" IMAGE */
    flipper('sub1','subon')
    return true
}

/* start of CVgeneric */
function CVgeneric() {
    for(i=0; i<document.contact.elements.length; i++) {
        if ((document.contact.elements[i].type != "submit") && (document.contact.elements[i].type != "checkbox") && (document.contact.elements[i].type != "textarea")) {
            document.contact.elements[i].className = "fieldinquiry";
        }
    }
    if ((document.contact.email.value == "") && (document.contact.phone.value == "")) {
        alert("Would you like us to reply by phone or email?  Please provide at least one way for us to answer your request.  Thank you.");
        document.contact.email.className = "fieldinquiryerror";
        document.contact.phone.className = "fieldinquiryerror";
        document.contact.email.focus();
        return false;
    }
    if (document.contact.verifytext.value == "") {
        alert("Please complete the anti-spam test.");
        document.contact.verifytext.className = "fieldinquiryerror";
        document.contact.verifytext.focus();
        return false;
    }
    if (document.contact.email.value != "") {
        document.contact.emailtest.value = "valid";
        document.cookie = "CedarockValidate=valid";
    }
    return true
}
/* end of CVgeneric */
/* start of CedarockValidateFileSubmit */


function CedarockValidateFileSubmit() {

    /* VALIDATE REQUIRED FIELDS */
    if (document.filesubmit.client.value==""){
        alert("Please enter your company name.")
        return false
    }
    if (document.filesubmit.project.value==""){
        alert("Please enter your project's name.")
        return false
    }
    var emailStr=document.filesubmit.email.value

    /* VERIFY EMAIL ADDRESS IS VALID */
    var emailPat=/^(.+)@(.+)$/
    var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    var validChars="\[^\\s" + specialChars + "\]"
    var quotedUser="(\"[^\"]*\")"
    var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    var atom=validChars + '+'
    var word="(" + atom + "|" + quotedUser + ")"
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
    var matchArray=emailStr.match(emailPat)
    if (matchArray==null) {
        var JC1 = confirm("Email address seems incorrect (check @ and .'s). Submit anyway?")
        if (!JC1) {return false}
    }
    var user=matchArray[1]
    var domain=matchArray[2]
    if (user.match(userPat)==null) {
        var JC2 = confirm("Email address seems incorrect (username doesn't seem to be valid). Submit anyway?")
        if (!JC2) {return false}
    }
    var IPArray=domain.match(ipDomainPat)
    if (IPArray!=null) {
        for (var i=1;i<=4;i++) {
            if (IPArray[i]>255) {
                var JC3 = confirm("Email address seems incorrect (destination IP address is invalid). Submit anyway?")
                if (!JC3) {return false}
            }
        }
        return true
    }
    var domainArray=domain.match(domainPat)
    if (domainArray==null) {
        var JC4 = confirm("Email address seems incorrect (domain name doesn't seem to be valid). Submit anyway?")
        if (!JC4) {return false}
    }
    var atomPat=new RegExp(atom,"g")
    var domArr=domain.match(atomPat)
    var len=domArr.length
    if (domArr[domArr.length-1].length<2 || 
        domArr[domArr.length-1].length>4) {
        var JC5 = confirm("Email address seems incorrect (address must end in a two, three, or four letter domain). Submit anyway?")
        if (!JC5) {return false}
    }
    if (len<2) {
        var errStr="Email address seems incorrect (missing a complete hostname). Submit anyway?"
        var JC6 = confirm(errStr)
        if (!JC6) {return false}
    }
    document.filesubmit.emailtest.value = "valid"
    document.cookie = "CedarockValidate=valid"

    /* SHOW "STAND BY" IMAGE */
    flipper('sub1','subon')
    return true
}

/* end of CedarockValidate */
/* start of ThankYou */

function cookieVal(cookieName) {
thisCookie = document.cookie.split("; ")
for (i=0; i<thisCookie.length; i++){
	if (cookieName == thisCookie[i].split("=")[0]){
		return thisCookie[i].split("=")[1]
	}
}
return 0
}


function ThankYou() {
    if (cookieVal("CedarockValidate") == "valid") {document.write("Our server has emailed a copy of your request to you for your records, and we will reply&nbsp;soon.")}
    else {document.write("We will reply&nbsp;soon.")}
}

/* end of ThankYou */

