/***********************************************
* AnyLink Vertical Menu- c Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="books.asp">&#20154;&#36001;&#38321;&#35712;</a>'
menu1[1]='<a href="books2.asp">&#20154;&#26684;&#38321;&#35712;</a>'
menu1[2]='<a href="books3.asp">&#20154;&#25991;&#38321;&#35712;</a>'


//Contents for menu 2, and so on
var menu2=new Array()
//menu2[0]='<a href="mentor_hq.asp">&#21513;&#38534;&#22369;&#25991;&#21270;&#34903;&#32317;&#34892;</a>'
menu2[0]='<a href="mentor_ts.asp">&#21513;&#38534;&#22369;&#26178;&#20195;&#24291;&#22580;&#20998;&#34892;</a>'
menu2[1]='<a href="mentor_cv.asp">&#20843;&#25171;&#38728;The Curve &#20998;&#34892;</a>'
menu2[2]='<a href="mentor_pg.asp">&#27315;&#22478;&#30343;&#21518;&#28771;&#24291;&#22580;&#20998;&#34892;</a>'
menu2[3]='<a href="mentor_gardens.asp">&#21513;&#38534;&#22369;The Gardens &#20998;&#34892; </a>'

var menu3=new Array()
menu3[0]='<a href="../books.asp">&#20154;&#36001;&#38321;&#35712;</a>'
menu3[1]='<a href="../books2.asp">&#20154;&#26684;&#38321;&#35712;</a>'
menu3[2]='<a href="../books3.asp">&#20154;&#25991;&#38321;&#35712;</a>'


//Contents for menu 2, and so on
var menu4=new Array()
//menu2[0]='<a href="mentor_hq.asp">&#21513;&#38534;&#22369;&#25991;&#21270;&#34903;&#32317;&#34892;</a>'
menu4[0]='<a href="../mentor_ts.asp">&#21513;&#38534;&#22369;&#26178;&#20195;&#24291;&#22580;&#20998;&#34892;</a>'
menu4[1]='<a href="../mentor_cv.asp">&#20843;&#25171;&#38728;The Curve &#20998;&#34892;</a>'
menu4[2]='<a href="../mentor_pg.asp">&#27315;&#22478;&#30343;&#21518;&#28771;&#24291;&#22580;&#20998;&#34892;</a>'
menu2[3]='<a href="../mentor_gardens.asp">&#21513;&#38534;&#22369;The Gardens &#20998;&#34892; </a>'

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)

/////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: 160px" 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=-500
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-obj.offsetWidth < 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 menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
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.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"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)
}


urlAddress = "http://www.mentor.com.my"; 
var pageName = "¤j±N¤¤¤å¾\Åª"; 
function addToFavorites() 
// IE Favourites
{ 
if (window.external)
	 { window.external.AddFavorite(urlAddress,pageName) 
} 
// Mozilla Firefox Bookmark 
else if (window.sidebar) { 
window.sidebar.addPanel(pageName, urlAddress,""); 
}
else 
	{ alert("Sorry! Your browser doesn't support this function."); 
} 
}

function goBack(){
//author Dan Stewart
//purpose: differentiate between IE and Netscape to perform a back() function
if (navigator.appName != "Microsoft Internet Explorer"){
window.back();
}
else{
history.back();
} 
}

function swapImage(name,src) {
  if (document.images) {
    document.images[name].src = src;
  }
}


/***********************************************
* Random Content (from DIVs) script- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

if (document.getElementById)
document.documentElement.className = 'jsclass'; //hide content for DOM capable browsers


var randomcontentdisplay={
	divholders:new Object(),
	masterclass: "randomcontent",

	init:function(){
		if (!document.getElementById)
			return
		var alldivs=document.getElementsByTagName("div")
		var randomcontentsearch=new RegExp(this.masterclass+"\\s+(group\\d+)", "i") //check for CSS class="randomcontent groupX" (x=integer)
		for (var i=0; i<alldivs.length; i++){
			if (randomcontentsearch.test(alldivs[i].className)){
				if (typeof this.divholders[RegExp.$1]=="undefined") //if array to hold this group of divs doesn't exist yet
					this.divholders[RegExp.$1]=new Array() //create array first
					this.divholders[RegExp.$1].push(alldivs[i]) //add this div to the array
			}
		}
	this.showone()
	},

	showone:function(){
		for (group in this.divholders){ //loop thru each array within object
			var chosenOne=Math.floor(Math.random()*this.divholders[group].length) //randomly pick one entry from array
			this.divholders[group][chosenOne].style.display="block" //display content corresponding to the chosen entry
		}
	}
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") 
{	
	var totalTable = 8; //please change this value if total of category or table has changed.
	for (var x = 1; x <= totalTable; x++){ 
	temp = "table" + String(x);
		if(d == temp){
			document.getElementById(d).style.display = "block";
		}
		else{
			if(document.getElementById(temp) != null){
				document.getElementById(temp).style.display = "none";
			}
		} 
	}
}
else { document.getElementById(d).style.display = "none"; }

}
function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}
function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}