// ___________________________________________________________________________________
// CUSTOM-DESIGNED MENU
// This menu offers CSS rollover tabs and DIV-based menu, 100% flexible menu!
//
// written by Colelinux (http://xetech.org)
// Credits to:
// - Tom's detect absolute position script 
//   (http://www.dagblastit.com/dhtml/)
// ___________________________________________________________________________________


//Browser check
isIE = (document.all ? true : false);
isDOM = (document.getElementById ? true : false);
var tab;
var mnu;
var ptab; //p=previous, variable that handles previous expand state
var pmnu;
var isDelayHide = false;


// Tom's code to get position (Nice!)
function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
	iPos = 0;
	while (elt != null) {
		iPos += elt["offset" + which];
		elt = elt.offsetParent;
		}
	return iPos;
}

function expandMenu(menu) {
	tab = getElement( "tab_" + menu );
	mnu = getElement( "mnu_" + menu );
	
	clearHideDelay()
	collapseMenu()
	tab.style.backgroundPosition = "100% 0px"; //Move the background of the tab
	mnu.style.left = getAbsX( tab ) + "px"; //Set the left position of the menu
	mnu.style.top = (getAbsY( tab ) + tab.offsetHeight - 1 ) + "px"; //Set the top position of the menu
	mnu.style.visibility = 'visible'; //Make the menu visible
}

function hideMenu(menu) {
	ptab = getElement( "tab_" + menu );
	pmnu = getElement( "mnu_" + menu );
	isDelayHide = setTimeout( "collapseMenu()",150 );
}

function collapseMenu(){
	if ( (typeof ptab!="undefined") ||  (typeof pmnu!="undefined")){
		ptab.style.backgroundPosition = "0px 0px";
		pmnu.style.visibility = 'hidden';
	}
}

function clearHideDelay(){
	if ( typeof isDelayHide!="undefined" )
	clearTimeout(isDelayHide)
}

//Generate Menu
	document.writeln('<div id=mnu_about class="menu" onMouseOver="clearHideDelay()" onMouseOut=');
	document.writeln("hideMenu('about')>");
	document.writeln('<div class="menu_item"><a href="company.htm">Overview</a></div>');
	document.writeln('<div class="menu_item"><a href="profile.htm">Company Profile</a></div>');
	document.writeln('<div class="menu_item"><a href="milestone.htm">Milestone</a></div>');
	document.writeln('<div class="menu_item"><a href="guarantees.htm">Our Guarantees</a></div>');
	document.writeln('<div class="menu_item"><a href="servers.htm">Our Servers</a></div>');
	document.writeln('<div class="menu_item"><a href="network.htm">Our Network</a></div>');
	document.writeln('<div class="menu_item"><a href="testimonial.htm">Testimonials</a></div>');
	document.writeln('<div class="menu_item"><a href="legal.htm">Legal Information</a></div>');
	document.writeln('</div>');
	
	document.writeln('<div id=mnu_webhost class="menu" onMouseOver="clearHideDelay()" onMouseOut=');
	document.writeln("hideMenu('webhost')>");
	document.writeln('<div class="menu_item"><a href="malaysia-web-hosting.htm">Overview</a></div>');
	document.writeln('<div class="menu_item"><a href="malaysia-linux-hosting.htm">Linux Web Hosting</a></div>');
	document.writeln('<div class="menu_item"><a href="malaysia-windows-hosting.htm">Windows Web Hosting</a></div>');
	document.writeln('<div class="menu_item"><a href="testimonial.htm">Testimonials</a></div>');
	document.writeln('<div class="menu_item"><a href="order-web-hosting.htm">Order Web Hosting</a></div>');
	document.writeln('</div>');

	document.writeln('<div id=mnu_mailhost class="menu" onMouseOver="clearHideDelay()" onMouseOut=');
	document.writeln("hideMenu('mailhost')>");
	document.writeln('<div class="menu_item"><a href="malaysia-email-hosting.htm">Overview</a></div>');
	document.writeln('<div class="menu_item"><a href="email-hosting-packages.htm">Email Hosting Packages</a></div>');
	document.writeln('<div class="menu_item"><a href="order-email-hosting.htm">Order Email Hosting</a></div>');
	document.writeln('</div>');

	document.writeln('<div id=mnu_reseller class="menu" onMouseOver="clearHideDelay()" onMouseOut=');
	document.writeln("hideMenu('reseller')>");
	document.writeln('<div class="menu_item"><a href="malaysia-reseller-hosting.htm">Overview</a></div>');
	document.writeln('<div class="menu_item"><a href="linux-reseller-hosting.htm">Reseller Hosting</a></div>');
	document.writeln('<div class="menu_item"><a href="malaysia-reseller-program.htm">Reseller Program</a></div>');
	document.writeln('<div class="menu_item"><a href="order-reseller-hosting.htm">Order Reseller Hosting</a></div>');
	document.writeln('</div>');

	document.writeln('<div id=mnu_domain class="menu" onMouseOver="clearHideDelay()" onMouseOut=');
	document.writeln("hideMenu('domain')>");
	document.writeln('<div class="menu_item"><a href="domain-name-registration.htm">Overview</a></div>');
	document.writeln('<div class="menu_item"><a href="malaysia-tld-registration.htm">TLDomain</a></div>');
	document.writeln('<div class="menu_item"><a href="malaysia-mynic-registration.htm">MyNIC</a></div>');
	document.writeln('<div class="menu_item"><a href="order-domain.htm">Order Domain Name</a></div>');
	document.writeln('</div>');

	document.writeln('<div id=mnu_support class="menu" onMouseOver="clearHideDelay()" onMouseOut=');
	document.writeln("hideMenu('support')>");
	document.writeln('<div class="menu_item"><a href="customer-support.htm">Overview</a></div>');
	document.writeln('<div class="menu_item"><a href="web-hosting-faq.htm">FAQ</a></div>');
	document.writeln('<div class="menu_item"><a href="web-hosting-resources.htm">Resources</a></div>');
	document.writeln('<div class="menu_item"><a href="web-hosting-troubleshooter.htm">Troubleshooter</a></div>');
	document.writeln('<div class="menu_item"><a href="web-hosting-flash-tutorial.htm">Flash Tutorial</a></div>');
	document.writeln('<div class="menu_item"><a href="http://www.kkhost.info">Trouble Ticket</a></div>');
	document.writeln('<div class="menu_item"><a href="billing-system.htm">Billing System</a></div>');
	document.writeln('</div>');