/* styleChanges */
var pageURL = document.location.href;
var lang = document.documentElement.getAttribute('lang');	//documentElement refers to <html>

var styleString = '<style type="text\/css">';
styleString += '#navbox ul li#menu a,#navbox ul li#menu a:hover {float: right; display: block;}';
styleString += '#navbox ul li a,#navbox ul li .new,#navbox ul li .soon {padding-left: 3px; padding-right: 3px;}';
styleString += '#ersatzmenu {display: none;}';

if (pageURL.search(/fiber/)!=-1){							//make sure this reflects file name
 styleString += '#toothpick {display: block;}';
 styleString += '#mag,#met,#cer {display: none; margin-top: 0;}';
 styleString += '#toothpick,#mag,#met,#cer {height:';
 if (lang=='en')											//approximately in order of most frequented
  styleString += '29.0em;}';
 else if (lang=='fr')
  styleString += '27.4em;}';
 else if (lang=='de')
  styleString += '27.5em;}';
 else
  styleString += 'auto;}';
}
else if (pageURL.search(/products/)!=-1)
 styleString += 'table#EAS,table#fibers,#BottomBar {display:none;}<\/style>';	/* in products.css, are set to block: browsers without JS will display page; if JS is to happen, then sections should be at first hidden (avoid displaying before hiding and BottomBar briefly jumping); make sure that "table" be written before ID name, since they have it in products.css */

styleString += '<\/style>';
document.write(styleString);
/* end of styleChanges */

/* date */
var monthconv = new Array();
var lastmodifdate = new Date(document.lastModified); 		//get lastModified property, and make it into a Date object
var year = lastmodifdate.getFullYear();
var separ = " ";											//for case 'default' (avoiding two spaces in output)
switch (lang) {
 case 'de':
  monthconv[0]="Januar";
  monthconv[1]="Februar";
  monthconv[2]="M&#228;rz";
  monthconv[3]="April";
  monthconv[4]="Mai";
  monthconv[5]="Juni";
  monthconv[6]="Juli";
  monthconv[7]="August";
  monthconv[8]="September";
  monthconv[9]="Oktober";
  monthconv[10]="November";
  monthconv[11]="Dezember";
  break;
 case 'en':
  monthconv[0]="January";
  monthconv[1]="February";
  monthconv[2]="March";
  monthconv[3]="April";
  monthconv[4]="May";
  monthconv[5]="June";
  monthconv[6]="July";
  monthconv[7]="August";
  monthconv[8]="September";
  monthconv[9]="October";
  monthconv[10]="November";
  monthconv[11]="December";
  break;
 case 'es':
  monthconv[0]="Enero";
  monthconv[1]="Febrero";
  monthconv[2]="Marzo";
  monthconv[3]="Abril";
  monthconv[4]="Mayo";
  monthconv[5]="Junio";
  monthconv[6]="Julio";
  monthconv[7]="Agosto";
  monthconv[8]="Septiembre";
  monthconv[9]="Octubre";
  monthconv[10]="Noviembre";
  monthconv[11]="Diciembre";
  break;
 case 'fr':
  monthconv[0]="Janvier";
  monthconv[1]="F&#233;vrier";
  monthconv[2]="Mars";
  monthconv[3]="Avril";
  monthconv[4]="Mai";
  monthconv[5]="Juin";
  monthconv[6]="Juillet";
  monthconv[7]="Ao&#251;t";
  monthconv[8]="Septembre";
  monthconv[9]="Octobre";
  monthconv[10]="Novembre";
  monthconv[11]="D&#233;cembre";
  break;
 case 'pt':
  monthconv[0]="Janeiro";
  monthconv[1]="Fevereiro";
  monthconv[2]="Mar&#231;o";
  monthconv[3]="Abril";
  monthconv[4]="Maio";
  monthconv[5]="Junho";
  monthconv[6]="Julho";
  monthconv[7]="Agosto";
  monthconv[8]="Setembro";
  monthconv[9]="Outubro";
  monthconv[10]="Novembro";
  monthconv[11]="Dezembro";
  break;
 case 'ru':
  monthconv[0]="&#x042F;&#x043D;&#x0432;&#x0430;&#x0440;&#x044C;";
  monthconv[1]="&#x0424;&#x0435;&#x0432;&#x0440;&#x0430;&#x043B;&#x044C;";
  monthconv[2]="&#x041C;&#x0430;&#x0440;&#x0442;";
  monthconv[3]="&#x0410;&#x043F;&#x0440;&#x0435;&#x043B;&#x044C;";
  monthconv[4]="&#x041C;&#x0430;&#x0439;";
  monthconv[5]="&#x0418;&#x044E;&#x043D;&#x044C;";
  monthconv[6]="&#x0418;&#x044E;&#x043B;&#x044C;";
  monthconv[7]="&#x0410;&#x0432;&#x0433;&#x0443;&#x0441;&#x0442;";
  monthconv[8]="&#x0421;&#x0435;&#x043D;&#x0442;&#x044F;&#x0431;&#x0440;&#x044C;";
  monthconv[9]="&#x041E;&#x043A;&#x0442;&#x044F;&#x0431;&#x0440;&#x044C;";
  monthconv[10]="&#x041D;&#x043E;&#x044F;&#x0431;&#x0440;&#x044C;";
  monthconv[11]="&#x0414;&#x0435;&#x043A;&#x0430;&#x0431;&#x0440;&#x044C;";
  break;
 case 'zh':
  var monthzh = parseInt(lastmodifdate.getMonth())+1 + "&#x6708;";
  break;
 default:		//in the unlikely case one forgets to set the attribute or sets it incorrectly
  monthconv[lastmodifdate.getMonth()] = "";
  separ = "";
}

var month = monthconv[lastmodifdate.getMonth()];

if (lang=='zh')
 var copyrightText = "\u00A9 "+year+" "+monthzh+" MXT Inc.";
else
 var copyrightText = "\u00A9 "+month+separ+year+" MXT Inc.";
/* end of date */

/* NetscpacePageReload */
function MM_reloadPage(init)
{  //reloads the window if Nav4 resized, as a fix to a bug in Netscape; copied from the web
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);
/* end of NetscpacePageReload */

/* dropMenu */
var menuwidth='106px'; //default menu width
var menubgcolor='#a0bbff';  //menu bgcolor
var disappeardelay=100;  //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 showhidemenu(obj, e, visible, hidden, menuwidth){
  if (ie4||ns6)
   dropmenuobj.style.left=dropmenuobj.style.top=-500; //sets how far the left edge of an element is to the right/left of the left edge of the parent element
  if (menuwidth!=""){
   dropmenuobj.widthobj=dropmenuobj.style;
   dropmenuobj.widthobj.width=106; //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 windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
   dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
     edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight;
  }

 return edgeoffset;
}

function populatemenu(what){
  if (ie4||ns6)
   dropmenuobj.innerHTML=what.join(""); //The join() method is used to put all the elements of an array into a string.
}

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){
   showhidemenu(dropmenuobj.style, e, "visible", "hidden", menuwidth);
   dropmenuobj.x=getposOffset(obj, "left");
   dropmenuobj.y=getposOffset(obj, "top");
   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;
/* end of dropMenu */


/* info */
// displays str in window status area if JavaScript on; although must still write 'return true;' in attribute values, shortens tag length
function info(str){
 window.status=str;
}
/* end of info */
