
var menuheight=new Array(50);//don't change
for(i=0;i<51;i++)menuheight[i]=new Array(3);//don't change
////////////////////////////////////////////////////////////////////////////////////////
//
//XP Style Menu(FiNAL V2002.10.14.1531)
//
//Improved by: swnet(swnet@263.net)
//Original by: Zhong Zhong
//
//Note: best work with MS IE4/5/6, also looks fine on Netscape/Mozilla but no 
//      visualized menu function.
//
//*THIS CODE IS UNDER GUN GPL LICENCE*
////////////////////////////////////Setting Section////////////////////////////////////
//
//set of which menu to show. In this example you have 4 menu, you can switch between "show" and "not show"
//if you want to add extra one, you should follow this order: "menuheight[n][1]=;"
//
//And, If you don't like error, please don't forgot to include "filter:alpha(Opacity=100)" in <DIV>menu(n) bar.
//
//
var onepage=1; //open one page at same time.1 is yes, 0 is no. default=1.
var speedmout=5; //menu show speed(default=30)
var speedmin=5; //menu hide speed(default=30)

menuheight[1][1]="not show";
menuheight[2][1]="not show";
menuheight[3][1]="not show";
menuheight[4][1]="not show";
menuheight[5][1]="not show";
menuheight[6][1]="not show";
menuheight[7][1]="not show";
menuheight[8][1]="not show";
menuheight[9][1]="not show";
menuheight[10][1]="not show";
menuheight[11][1]="not show";
menuheight[12][1]="not show";
menuheight[13][1]="not show";
menuheight[14][1]="not show";
menuheight[15][1]="not show";
menuheight[16][1]="not show";
menuheight[17][1]="not show";
menuheight[18][1]="not show";
menuheight[19][1]="not show";
menuheight[20][1]="not show";
menuheight[21][1]="not show";
////////////////////////!!!DO NOT CHANGE BELOW THIS LINE!!!!/////////////////////////////
//
var da=new Date();
var browser=new BrowserDetectLite();
var fstrun=1;
var op="";
var whichContinue="";
var whichOpen="";
var opp=0;

function menuShow(obj,maxh,obj2)
{

da=new Date();
if(fstrun==1){
 op="show";
 document.onmousemove=foo;
 //document.onmouseout=foo;
 document.onclick=foo;
 opp=maxh/speedmout;
 fstrun=0;
}else{
 if(op!="show") return false;
}

  if(obj.style.pixelHeight<maxh)
  {
    obj.style.pixelHeight+=opp;
	obj.filters.alpha.opacity+=opp;
	obj2.background="images/2.jpg";
	obj.style.display='block';
	myObj=obj;
	myMaxh=maxh;
	myObj2=obj2;
	bkt=setTimeout('menuShow(myObj,myMaxh,myObj2)','5');
  }else{
        fstrun=1;
        op="";
        clearTimeout(bkt);
        document.onmousemove=monmouseover;
        //document.onmouseout=monmouseout;
        document.onclick=monclick;
        return true;
  }

}
function menuHide(obj,maxh,obj2)
{
da=new Date();
if(fstrun==1){
 op="hide";
 document.onmousemove=foo;
 //document.onmouseout=foo;
 document.onclick=foo;
 opp=maxh/speedmin;
 fstrun=0;
}else{
 if(op!="hide") return false;
}
  if(obj.style.pixelHeight-opp*2>1)
  {
        obj.style.pixelHeight-=opp;
	obj.filters.alpha.opacity-=opp;
	obj2.background="images/1.jpg";
	myObj=obj;
	myMaxh=maxh;
	myObj2=obj2;
	bkt=setTimeout('menuHide(myObj,myMaxh,myObj2)','5');
  }else{
        obj.style.pixelHeight=0.5;
        obj.style.display='none';
        fstrun=1;
        op="";
        clearTimeout(bkt);  
        document.onclick=monclick;
        document.onmousemove=monmouseover;
        //document.onmouseout=monmouseout;
        if(whichContinue && onepage==1) whichContinue.click();
        return true;
  }
}
function menuChange(obj,maxh,obj2)
{
  if(obj.style.pixelHeight)
  {
    menuHide(obj,maxh,obj2);
	whichOpen='';       
  }
  else
    if(whichOpen)
	{
	  whichContinue=obj2;
          whichOpen.click();
	}
	else
	{
	  menuShow(obj,maxh,obj2);
	  if(onepage==1)whichOpen=obj2;
	  whichContinue='';
	}
}


document.onclick=monclick;

if(browser.isNS6up || browser.isIE4up){
document.onmousemove=monmouseover;
document.onmouseout=monmouseout;
}

function foo(){
return false;
}
var regex=new RegExp("menuTitle\d*","i");
var regex1=new RegExp("[0-9]*$","i");
var boo=0;

function monmouseover(){
if(event.srcElement.tagName!="TD" || boo==1) return false;
if(regex.test(event.srcElement.id)){
event.srcElement.className="menu_title2";
boo=1;
}
}
function monmouseout(){
if(event.srcElement.tagName!="TD") return false;
if(regex.test(event.srcElement.id)){
event.srcElement.className="menu_title";
boo=0;
}
}
function monclick(){
if(!browser.isIE4up) return true;
if(event.srcElement.tagName!="TD" || !regex.test(event.srcElement.id)){ 
if(event.srcElement.tagName!="A") return true;
}else{
b=event.srcElement.id.match(regex1);
codex="menuChange(menu" + b + "," + eval("menuheight[" + b + "][2]") + "," + event.srcElement.id+ ")";
eval(codex);
}
}

function init(){
if(!browser.isIE4up) return false;

var mccount=0;
var showornot;
reg=new RegExp("menu[0-9]{1,2}","i");
reg1=new RegExp("[0-9]*$","i");

for(i=0;i<document.all.length;i++){

if(reg.test(document.all[i].id)){

s=document.all[i].id.match(reg1);
k=eval("document.all.menu" + s + ".style.height").replace("px",""); //code to get the height
eval("menuheight[s][2]=k");

eval("showornot=menuheight[s][1]");

switch (showornot){
case "show":
if(++mccount>1 && onepage==1)alert("You do not supposed put on 2 active page while 'onepage' open. Check your setting or turn 'onepage' to '0'");
if(onepage==1)eval("whichOpen=menuTitle" + s);
document.all[i].filters.alpha.opacity=100;
document.all[i].style.overflow="hidden";
document.all[i].style.height=k;
document.all[i].style.display="block";
break;
case "not show":
document.all[i].filters.alpha.opacity=0;
document.all[i].style.height="0";
document.all[i].style.display="none";
break;
default: 
alert("Expect 'show' or 'not show' in setting section!");
}

}
}
}
init()
//End of my code.
//
//Browser detect by Chris Nott
//(NEEDED!DO NOT DEL.)
function BrowserDetectLite() {
	var ua = navigator.userAgent.toLowerCase(); 

	// browser name
	this.isGecko     = (ua.indexOf('gecko') != -1);
	this.isMozilla   = (this.isGecko && ua.indexOf("gecko/") + 14 == ua.length);
	this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
	this.isIE        = ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) ); 
	this.isOpera     = (ua.indexOf("opera") != -1); 
	this.isKonqueror = (ua.indexOf("konqueror") != -1); 
	this.isIcab      = (ua.indexOf("icab") != -1); 
	this.isAol       = (ua.indexOf("aol") != -1); 
	this.isWebtv     = (ua.indexOf("webtv") != -1); 
	
	// spoofing and compatible browsers
	this.isIECompatible = ( (ua.indexOf("msie") != -1) && !this.isIE);
	this.isNSCompatible = ( (ua.indexOf("mozilla") != -1) && !this.isNS && !this.isMozilla);
	
	// browser version
	this.versionMinor = parseFloat(navigator.appVersion); 
	
	// correct version number
	if (this.isNS && this.isGecko) {
		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
	}
	else if (this.isIE && this.versionMinor >= 4) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	}
	else if (this.isOpera) {
		if (ua.indexOf('opera/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
		}
		else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
		}
	}
	else if (this.isKonqueror) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
	}
	else if (this.isIcab) {
		if (ua.indexOf('icab/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
		}
		else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
		}
	}
	else if (this.isWebtv) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('webtv/') + 6 ) );
	}
	
	this.versionMajor = parseInt(this.versionMinor); 
	this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
	
	// dom support
   this.isDOM1 = (document.getElementById);
	this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

	// platform
	this.isWin   = (ua.indexOf('win') != -1);
	this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1) );
	this.isMac   = (ua.indexOf('mac') != -1);
	this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('linux') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
	
	// specific browser shortcuts
	this.isNS4x = (this.isNS && this.versionMajor == 4);
	this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
	this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
	this.isNS4up = (this.isNS && this.versionMinor >= 4);
	this.isNS6x = (this.isNS && this.versionMajor == 6);
	this.isNS6up = (this.isNS && this.versionMajor >= 6);
	
	this.isIE4x = (this.isIE && this.versionMajor == 4);
	this.isIE4up = (this.isIE && this.versionMajor >= 4);
	this.isIE5x = (this.isIE && this.versionMajor == 5);
	this.isIE55 = (this.isIE && this.versionMinor == 5.5);
	this.isIE5up = (this.isIE && this.versionMajor >= 5);
	this.isIE6x = (this.isIE && this.versionMajor == 6);
	this.isIE6up = (this.isIE && this.versionMajor >= 6);
	
	this.isIE4xMac = (this.isIE4x && this.isMac);
}

