/*==========================================================================# 
# * Function for adding a Filter to an Input Field                          # 
# * @param  : [filterType  ] Type of filter 0=>Alpha, 1=>Num, 2=>AlphaNum   # 
# * @param  : [evt         ] The Event Object                               # 
# * @param  : [allowDecimal] To allow Decimal Point set this to true        # 
# * @param  : [allowCustom ] Custom Characters that are to be allowed       # 
#==========================================================================*/
function filterInput(filterType, evt, allowDecimal, allowCustom) {
    //X.x;
    var keyCode, Char, inputField, filter = ''; 
    var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ., '; 
    var num   = '0123456789'; 
    // Get the Key Code of the Key pressed if possible else - allow 
    if(window.event){ 
        keyCode = window.event.keyCode; 
        evt = window.event; 
    }else if (evt)keyCode = evt.which; 
    else return true; 
    // Setup the allowed Character Set 
    if(filterType == 0) filter = alpha; 
    else if(filterType == 1) filter = num; 
    else if(filterType == 2) filter = alpha + num; 
    if(allowCustom)filter += allowCustom; 
    if(filter == '')return true; 
    // Get the Element that triggered the Event 
    inputField = evt.srcElement ? evt.srcElement : evt.target || evt.currentTarget; 
    // If the Key Pressed is a CTRL key like Esc, Enter etc - allow 
    if((keyCode==null) || (keyCode==0) || (keyCode==8) || (keyCode==9) || (keyCode==13) || (keyCode==27) )return true; 
    // Get the Pressed Character 
    Char = String.fromCharCode(keyCode); 
    // If the Character is a number - allow 
    if((filter.indexOf(Char) > -1)) return true; 
    // Else if Decimal Point is allowed and the Character is '.' - allow 
    else if(filterType == 1 && allowDecimal && (Char == '.') && inputField.value.indexOf('.') == -1)return true; 
    else return false;
}

function CheckSession() {
    //function CheckSession(testVal) {
    //document.f1.t1.value = "Name";
    //if (testVal == 'True') 
    alert("You must be logged in in order to use the VRM facility, using this facility enables better matching of parts.");
}
//PBY Code below changes the status bar text, only works for I.E.
var statusmsg = ""

function hidestatus() {
    window.status = statusmsg
    return true
}
//PBY Code above changes the status bar text, only works for I.E.



////PBY New for Javascript Menu
//var menuids = new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
//var submenuoffset = -2 //Offset of submenus from main menu. Default is -2 pixels.

//function createcssmenu() {
//    for (var i = 0; i < menuids.length; i++) {
//        var ultags = document.getElementById(menuids[i]).getElementsByTagName("ul")
//        for (var t = 0; t < ultags.length; t++) {
//            var spanref = document.createElement("span")
//            spanref.className = "arrowdiv"
//            spanref.innerHTML = "&nbsp;&nbsp;"
//            ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
//            ultags[t].parentNode.onmouseover = function() {
//                this.getElementsByTagName("ul")[0].style.left = this.parentNode.offsetWidth + submenuoffset + "px"
//                this.getElementsByTagName("ul")[0].style.display = "block"
//            }
//            ultags[t].parentNode.onmouseout = function() {
//                this.getElementsByTagName("ul")[0].style.display = "none"
//            }
//        }
//    }
//}


//if (window.addEventListener)
//    window.addEventListener("load", createcssmenu, false)
//else if (window.attachEvent)
//    window.attachEvent("onload", createcssmenu)
////PBY New for Javascript Menu    