// JavaScript Document

var corp = new Array();
corp[0]=['Overview','corp1.html'];
corp[1]=['Our Philosophy','corp4.html'];
corp[2]=['Our Business Ethics','corp5.html'];
corp[3]=['Management Board','corp2.html'];
corp[4]=['Shareholders / Investors Login','shareholders.html'];
corp[5]=['News','news.html'];

var products = new Array();
products[0]=['Our Range of Products','products1.html'];
products[1]=['New Products','products7.html'];
products[2]=['Customized Products','customized_products.html'];
products[3]=['Datasheets','products3.html'];
products[4]=['Symbols and Terms','products4.html'];
products[5]=['Renamed Part Numbers','products5.html'];
products[6]=['Typical Applications','products8.html'];
products[7]=['Technical Information','products6.html'];

var contact = new Array();
contact[0]=['Manufacturing Facilities','contact.html'];
contact[1]=['Enquiries','contact1.html'];
contact[2]=['Feedback','contact3.html'];

var news = new Array();
//news[0]=['Events','events.php'];
//news[1]=['Media','media.php'];
//news[0]=['Events','http://www.powersem.asia/events.php'];
news[0]=['New Products','products7.html'];
news[1]=['Events','events.html'];
news[2]=['Media','media.html'];
news[3]=['Bodo\'s Power','bodos.html'];

var buy = new Array();
buy[0]=['Stocking Distributors & Representatives','online.html'];
buy[1]=['Buy Samples Online','online1.html'];
//buy[2]=['Buy The Original','online2.html'];


document.write('<div id="div0" class="menu">');
for(i=0; i<corp.length; i++)
{document.write('<a href="'+corp[i][1]+'">'+corp[i][0]+'</a>')}
document.write('</div>');

document.write('<div id="div1" class="menu">');
for(i=0; i<products.length; i++)
{document.write('<a href="'+products[i][1]+'">'+products[i][0]+'</a>')}
document.write('</div>');


document.write('<div id="div2" class="menu">');
for(i=0; i<contact.length; i++)
{document.write('<a href="'+contact[i][1]+'">'+contact[i][0]+'</a>')}
document.write('</div>');

document.write('<div id="div3" class="menu">');
for(i=0; i<news.length; i++)
{document.write('<a href="'+news[i][1]+'">'+news[i][0]+'</a>')}
document.write('</div>');

document.write('<div id="div4" class="menu">');
for(i=0; i<buy.length; i++)
{document.write('<a href="'+buy[i][1]+'">'+buy[i][0]+'</a>')}
document.write('</div>');


// optional function

function checkit(divobj)
{  if(divobj.hasChildNodes())
	{	for(i=0; i<divobj.childNodes.length; i++)
		{ 	if(divobj.childNodes[i].href.indexOf("#")==-1)
			{ }
			else{divobj.childNodes[i].className="current";}
		}
	}
}

var ie4=document.all;
var dom=document.getElementById &&! ie4;
var ns4 = document.layers;
var opera = navigator.userAgent.indexOf('opera') != -1

var menuobj = null;

function iecompat()
{ return (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body; }

function gety(what)
{ var objtop = what.offsetTop;
  var objp = what.offsetParent;
  
  while(objp)
  { objtop = objtop+objp.offsetTop;
    objp = objp.offsetParent;
  }
  return objtop;

}

function gettoppos(what, offsettype)
{ var topy = gety(what);
  var winheight = (!opera)? iecompat().scrollTop+iecompat().clientHeight : window.pageYOffset+window.innerHeight;
  var maxheight = topy+menuobj.offsetHeight;
  
  if(winheight < maxheight)
  { var objy = (topy+what.offsetHeight)-(menuobj.offsetHeight);
 }
  else{objy = topy+what.offsetHeight;}
  return objy;
}

function getx(what)
{ var objleft = what.offsetLeft;
  var objp = what.offsetParent;
  while(objp)
  { objleft = objleft+objp.offsetLeft;
    objp = objp.offsetParent;
  }
	return objleft;	
}

function getleftpos(what, offsettype)
{ var leftx = getx(what);
  var winwidth = (!opera)? iecompat().scrollLeft+iecompat().clientWidth : window.pageXOffset+window.innerWidth;
  var maxwidth = leftx+menuobj.offsetWidth;
  
  if(winwidth < maxwidth)
  { var objx = winwidth - menuobj.offsetWidth}
  else
  {objx = leftx;}
  return objx;
  }


function dropmenu(obj,e)
{  if(window.event) window.event.cancelBubble=true;
   else if(e.stopPropagation) e.stopPropagation();
   
   if(menuobj != null)
   {hidemenu();}
   
   menuobj = document.getElementById(obj.rel)
   cleardelay()
   
   if(ie4 || dom)
   {menuobj.style.visibility="visible";
    menuobj.style.top = gettoppos(obj,"top")+"px"; 
	menuobj.style.left = getleftpos(obj,"left")+"px"; 
	}
	
	if(ns4)
   {menuobj.visibility="visible";
    menuobj.clip.top = gettoppos(obj,"top")+"px"; 
	menuobj.clip.left = getleftpos(obj,"left")+"px"; 
	}
	
	if(opera)
   {menuobj.style.visibility="visible";
    menuobj.style.pixelTop = gettoppos(obj,"top")+"px"; 
	menuobj.style.pixelLeft = getleftpos(obj,"left")+"px"; 
	}
   
   menuobj.onmouseover=function()
   {cleardelay();
    prev = obj.className;
   	obj.className = "current"; 
	}
	
   menuobj.onmouseout=function()
   {delayhide();
   obj.className = prev ;}


}

function delayhide()
{stopit = setTimeout('hidemenu()',200);}

function hidemenu()
{menuobj.style.visibility="hidden";}

function cleardelay()
{ if(typeof stopit != "undefined")
	clearTimeout(stopit);
}


/////////////////////////////////////////////////////////////////////////////

function newwin(url,name)
{
	var win = window.open(url,name,'width=325,height=275,top=350,left=250,screenX=250,screenY=350');
	win.focus();
}
/////////////////////////////////////////////////////////////////////////////
