﻿function hilite(myid) {
	document.getElementById(myid).className = "hilite1";
}

function hilite_sub(myid) {
	document.getElementById(myid).className = "hilite2";
}

//  get url
var u = location.href.toLowerCase();
if (u.indexOf(".com") > -1) {
    var p = u.indexOf("taprite");
    if (p > -1) {   //  for vi-dev.com/taprite/
        p = u.indexOf("/", p + 1) + 1;
        u = u.substring(0, p);
    }
    else {          // for live site
        u = u.substring(0, u.indexOf(".com") + 5);
    }
}
if (u.indexOf(".31") > -1) {
    var p = u.indexOf(".31");
    p = u.indexOf("/", p + 1) + 1;
    u = u.substring(0, p);
}
else {              // for orion/taprite
    var p = u.indexOf("taprite");
    if (p > -1) {
        p = u.indexOf("/", p + 1) + 1;
        u = u.substring(0, p);
    }
}

function submitSearch() {
    for (i = 0; i < document.forms[0].elements.length; i++) {
        if (document.forms[0].elements[i].name == "topsearch") {
            location.href = u + "search.aspx?topsearch=" + document.forms[0].elements[i].value;
        }
    }

}

function checkEnter(e){ //e is event object passed from function invocation
    var characterCode //literal character code will be stored in this variable

    if(e && e.which){ //if which property of event object is supported (NN4)
    e = e
    characterCode = e.which //character code is contained in NN4's which property
    }
    else{
    e = event
    characterCode = e.keyCode //character code is contained in IE's keyCode property
    }

    if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
    submitSearch() //submit the form
    return false 
    }
    else{
    return true 
}

}
