var disappeardelay=200  //menu disappear speed onMouseout (in miliseconds)
var appeardelay=100  //menu appear speed onMouseover (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=0 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
delayshowmenu()
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left="0"
dropmenuobj.style.top="29px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
clearhidemenu()
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function delayshowmenu(){
delayshow=setTimeout("dropmenuobj.style.visibility='visible'",appeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
if (typeof delayshow!="undefined")
clearTimeout(delayshow)
}

function loadChatWindow(url)
{
   window.open(url,'9823H','width=500,height=460');

}

        var domainroot="http://www.machsol.com"
         
        function Gsitesearch(curobj)
        {
            curobj.q.value="site:"+domainroot+" "+curobj.qfront.value;
            return true;
        }
    
        var TextBoxValue = "";
        
        function TextClear()
        {
            TextBoxValue = document.getElementById("q");
            
            if(TextBoxValue.value = "Search")
            {
               TextBoxValue.value = ""; 
            }
        }
            
        function OnLeaveTextBox()
        {
            TextBoxValue = document.getElementById("q").value;
            
            if(TextBoxValue.length == 0)
            {
                document.getElementById("q").value="Search";
            }
        } 
    
        function URLEncode (clearString) 
        { 
            var output = ''; 
            var x = 0; clearString = clearString.toString();
            var regex = /(^[a-zA-Z0-9_.]*)/; 
            
            while (x < clearString.length) 
            { 
                var match = regex.exec(clearString.substr(x));
                if (match != null && match.length > 1 && match[1] != '') 
                { 
                    output += match[1]; 
                    x+= match[1].length; 
                } 
                else 
                { 
                    if (clearString[x] == ' ') 
                    output += '+'; 
                    else 
                    { 
                        var charCode = clearString.charCodeAt(x); 
                        var hexVal = charCode.toString(16); 
                        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
                    } x++; 
                } 
            } 
            return output; 
        } 
        
        function submitenter(myfield, e) 
        { 
            var keycode; 
            
            if (window.event) 
            keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; 
            
            if (keycode == 13) 
            { 
                SearchSite(); return false;
            } 
            else 
            return true; 
        } 
        
        function SearchSite()
        { 
            document.location.href='http://www.machsol.com/Search.aspx?cx=012617035625498554265%3Aawnfn9hpdzw&cof=FORID%3A10&ie=UTF-8&q=' + URLEncode(document.getElementById('q').value) + '&sa=Search'; 
        }
    


