
//Contents for home menu
var menu_Home=new Array()
menu_Home[0]='<a href="links.aspx">Links &amp;<br/>&nbsp;Downloads</a>'
menu_Home[1]='<a href="http://203.88.121.136/ftp/" target="_blank">FTP Login</a>'

//Contents for samples menu
var menu_Samples=new Array()
menu_Samples[0]='<a href="samples.aspx">Gallery</a>'
menu_Samples[1]='<a href="features.aspx">Featured <br/>&nbsp;Projects</a>'

var menu_Designers=new Array()
menu_Designers[0]='<a href="designers.aspx">If you are<br/>&nbsp;a Designer<br/>&nbsp;please click<br/>&nbsp;here to find<br/>&nbsp;out more.</a>'

var menu_EndUsers=new Array()
menu_EndUsers[0]='<a href="customers.aspx">If you are<br/>&nbsp;an End User<br/>&nbsp;please click<br/>&nbsp;here to find<br/>&nbsp;out more.</a>'

//Contents for Company menu
var menu_Company=new Array()
menu_Company[0]='<a href="aboutus.aspx">About Us</a>'
menu_Company[1]='<a href="employment.aspx">Employment</a>'
menu_Company[2]='<a href="education.aspx">Education</a>'
menu_Company[3]='<a href="contactus.aspx">Contact Us</a>'
menu_Company[4]='<a href="awards.aspx">Awards</a>'

//Contents for technical menu
var menu_Technical=new Array()
menu_Technical[0]='<a href="equipment.aspx">Our <br/>&nbsp;Equipment</a>'
menu_Technical[1]='<a href="designaids.aspx">Design <br/>&nbsp;Aids</a>'
menu_Technical[2]='<a href="knowledgebase.aspx">Knowledge <br/>&nbsp;Base</a>'
menu_Technical[3]='<a href="productionprocess.aspx">Production <br/>&nbsp;Process</a>'
menu_Technical[4]='<a href="expertarticles.aspx">Expert <br/>&nbsp;Articles</a>'
		
var menuwidth='660px' 
var menuHeaderColor='#777778'
var menubgcolor='#cfcfd1'
var menubgcolorover='#666667'
var disappeardelay=250
var hidemenu_onclick="no"

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function setMouseOverMenu(divID)
{
    var mitem=document.getElementById(divID)
    mitem.style.backgroundColor=menubgcolorover
    if(isOpera() || isFireFox())
    {
		mitem.style.height='auto'
    }
    var img="img"+divID.substr(2,divID.length-2)
    img=document.getElementById(img)
    img.style.backgroundColor=menubgcolorover
    if(img.innerHTML.replace(' ','').length>0)
        img.innerHTML='<img src="Images/menu_highlight_dark.JPG">'
}
function setMouseOutMenu(divID)
{
    document.getElementById(divID).style.backgroundColor=menuHeaderColor
    
    var img="img"+divID.substr(2,divID.length-2)
    img=document.getElementById(img)
    img.style.backgroundColor=menuHeaderColor
    if(img.innerHTML.replace(' ','').length>0)
        img.innerHTML='<img src=\"Images/menu_highlight.JPG\">'
}
function getobj(did)
{
    return document.getElementById(did)
}
function getDivWidth(divID)
{
    return document.getElementById(divID).offsetWidth
}

function getDivHeight(divID)
{
    return document.getElementById(divID).offsetHeight
}

function isBrowser(name)
{
  var ua=navigator.userAgent
  var isb=ua.toLowerCase().indexOf(name.toLowerCase())
  
  if(isb<0)
     return false
  return true
}
function isOpera()
{
  var ua=navigator.userAgent
  var isop=ua.toLowerCase().indexOf("opera")
  
  if(isop<0)
     return false
  return true
}
function isFireFox()
{
  return isBrowser("firefox")
  var ua=navigator.userAgent
  var isff=ua.toLowerCase().indexOf("firefox")
  
  if(isff<0)
     return false
  return true
}

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, menuwidth)
{
    if (ie4||ns6)
        dropmenuobj.style.left=dropmenuobj.style.top="-500px"
    if (menuwidth!="")
    {
        dropmenuobj.widthobj=dropmenuobj.style
        dropmenuobj.widthobj.width=menuwidth
        dropmenuobj.widthobj.height=(getDivHeight("ueberDiv")-getDivHeight('Header'))+'px'
    }
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
        obj.visibility=visible
    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=ie4 && !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=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
        var windowedge=ie4 && !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 populatemenu(what)
{
    if (ie4||ns6)
        dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth)
{
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()

    clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)

    var blah=document.getElementById("Upper")
    var blah2=document.getElementById("UpperCenterPanel")
    var blah3=document.getElementById("ueberDiv")
    var cnt=blah3.offsetLeft+blah2.offsetLeft
    
    if (ie4||ns6)
    {
        showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
        dropmenuobj.x=getposOffset(obj, "left")//dont know why -3. just works.
        
        if(isOpera())
        {
            dropmenuobj.x=dropmenuobj.x+5
        }
        else if(isFireFox())
        {
            if(cnt>550)
                dropmenuobj.style.paddingRight="2px"
            else
			    dropmenuobj.style.paddingRight="1px"
        }
        else
        {
			dropmenuobj.style.width=dropmenuobj.offsetWidth+2
        }
        
        dropmenuobj.style.left=dropmenuobj.x+"px"
        dropmenuobj.style.top=blah.offsetTop+"px"
    }

    return clickreturnvalue()
}

function clickreturnvalue()
{
    if (ie4||ns6) 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 (ie4&&!dropmenuobj.contains(e.toElement))
        delayhidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
        delayhidemenu()
}

function hidemenu(e)
{
    if (typeof dropmenuobj!="undefined")
    {
        if (ie4||ns6)
            dropmenuobj.style.visibility="hidden"
    }
}

function delayhidemenu()
{
    if (ie4||ns6)
        delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu()
{
    if (typeof delayhide!="undefined")
        clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
    document.onclick=hidemenu
