// PRE-LOAD IMAGES AND SET UP SWAPPING //

if (document.images)  {

// ON IMAGES //
homeON = new Image(42,89);
homeON.src = "img/nav_home_on.gif";
ourcompanyON = new Image(42,112);
ourcompanyON.src = "img/nav_ourcompany_on.gif";
productsON = new Image(42,90);
productsON.src = "img/nav_products_on.gif";
industrysolutionsON = new Image(42,136);
industrysolutionsON.src = "img/nav_industrysolutions_on.gif";
customersupportON = new Image(42,135);
customersupportON.src = "img/nav_customersupport_on.gif";
customersON = new Image(42,98);
customersON.src = "img/nav_customers_on.gif";
contactusON = new Image(42,105);
contactusON.src = "img/nav_contactus_on.gif";

// OFF IMAGES //
homeOFF = new Image(42,89);
homeOFF.src = "img/nav_home_off.gif";
ourcompanyOFF = new Image(42,112);
ourcompanyOFF.src = "img/nav_ourcompany_off.gif";
productsOFF = new Image(42,90);
productsOFF.src = "img/nav_products_off.gif";
industrysolutionsOFF = new Image(42,136);
industrysolutionsOFF.src = "img/nav_industrysolutions_off.gif";
customersupportOFF = new Image(42,135);
customersupportOFF.src = "img/nav_customersupport_off.gif";
customersOFF = new Image(42,98);
customersOFF.src = "img/nav_customers_off.gif";
contactusOFF = new Image(42,105);
contactusOFF.src = "img/nav_contactus_off.gif";
}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}


//AUTO CENTERING POPUP WINDOW THINGY
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/4;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}




// DROPDOWN MENU...

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for time servers menu
var menu1=new Array()
menu1[0]='<a href="time-server.htm">Full-Featured GPS Time Server: Tempus LX</a>'
menu1[1]='<a href="network-time-server.htm">Full-Featured CDMA Time Server: Tempus LX</a>'
menu1[2]='<a href="gps-time-server.htm">Basic GPS Time Server: Unison</a>'
menu1[3]='<a href="ntp-server.htm">Basic CDMA Time Server: Unison</a>'
menu1[4]='<a href="ptp-ieee-1588-grandmaster.htm">PTP/IEEE-1588 Grandmaster</a>'

//Contents for frequency standards menu
var menu2=new Array()
menu2[0]='<a href="gps-frequency-standard.htm">High-Performance GPS Frequency Reference: Meridian</a>'
menu2[1]='<a href="frequency-standard-gps.htm">GPS Frequency Reference: Tycho</a>'
menu2[2]='<a href="frequency-standard-rackmount.htm">CDMA Frequency Reference: Tycho</a>'
menu2[3]='<a href="frequency-standard-rtm3204.htm">GPS Timing Module: RTM3204</a>'

//Contents for distribution menu
var menu3=new Array()
menu3[0]='<a href="timecode-distribution-chassis.htm">Time Code Distribution Chassis: TDC3303</a>'
menu3[1]='<a href="frequency-distribution-chassis-light.htm">Frequency Distribution Chassis: FDC3300</a>'
menu3[2]='<a href="frequency-distribution-chassis.htm">High-Performance Frequency Distribution Chassis: FDC3302</a>'
menu3[3]='<a href="pulse-distribution-chassis.htm">Pulse Distribution Chassis: PDC3301</a>'
menu3[4]='<a href="t1-clock-distribution.htm">T1 Clock Distribution Chassis: TEL3304</a>'
menu3[5]='<a href="e1-clock-distribution.htm">E1 Clock Distribution Chassis: TEL3305</a>'

//Contents for more products menu
var menu4=new Array()
menu4[0]='<a href="gps-amplifier.htm">GPS Preamplifier: Glna2</a>'
menu4[1]='<a href="fiber-optic-link.htm">Fiber Optic Link: AFL3430</a>'
menu4[2]='<a href="antennas.htm">Antennas and Options</a>'
menu4[3]='<a href="displays.htm">Digital Wall Clock</a>'
menu4[4]='<a href="network-time-source.htm">Praecis Ct Computer Time Source</a>'
menu4[5]='<a href="frequency-standard-lowcost.htm">Praecis Cf Frequency Reference</a>'
menu4[6]='<a href="time-receiver.htm">Praecis Ce Timing Engine</a>'
menu4[7]='<a href="cdma-amplifier.htm">CDMA Preamplifier: Clna</a>'

var menuwidth='165px' //default menu width
var menubgcolor="#D0E2F3"  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

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 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
}
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)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
// dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.x=188
// dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.y=getposOffset(obj, "top")-19
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"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


