var ie4=document.all;
var ns6=document.getElementById&&!document.all;
var ns4=document.layers;
var mac=navigator.userAgent.toLowerCase().indexOf("mac")!=-1;
var sR;

function findTop(obj)
{
var top = 0;
if (document.getElementById || document.all){
while (obj.offsetParent)
{
top += obj.offsetTop
obj = obj.offsetParent;
}}
else if (document.layers)
top += obj.y;
return top;}
function hl(obj,s)
{obj.bgColor=(s) ? '#ffff00': '#C9EEFE';}
function hli(d,i,state){
thbobj=ie4? document.all.thb : ns6? document.getElementById("thb") : ns4? document.thb : "";
thumbobj=ie4? document.all.thumb : ns6? document.getElementById("thumb") : ns4? document.thumb : "";
var sID = new String(i.src);
if(sID.indexOf("tb") != -1) {
	if(i.complete){
		thumbobj.src=i.src;
		if(state=="on") thbobj.thestyle.visibility="visible";
	}
}
if(state=="off") thbobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide";
d.id=(state=="on")? "mouseoverstyle" : "";
}
function h(obj,state){
obj.id=(state=="on")? "mouseoverstyle" : "";
}
function ShowMenu(row,which){
if (mac){return};
if (!document.all&&!document.getElementById&&!document.layers) return
if (sR)
	{hl(sR,false);}
hl(row,true);
sR=row;
cm();
menuobj=ie4? document.all.pm : ns6? document.getElementById("pm") : ns4? document.pm : ""
if (!menuState) {return};
if (!menuobj){return;}
var sa = which.split(",");
var w1;
var pc;
w1='<div class="mia" align="center" onClick=' + '\"' + 'location.href='+ '\'' + sa[0] + '\'\">  ' + sa[1] + '</div>'
for (var i=2; i < sa.length-1; i=i+3){
if (ns4){w1+='<div class="mi"><a href=' + sa[i] + '>' + sa[i+1] + '</a></div>'}
else{
	if (sa[i+2] != 'n') {pc = '<img id=\"tb'+i+'\" src=\"'+sa[i+2]+'\" width=\"10px\" hspace=\"4\" vspace=\"3\" border=\"0\" align=\"absmiddle\">'}
	else {pc = '<img id=\"tb'+i+'\" src=\"images/arrow.gif\" width=\"6\" height=\"8\" hspace=\"4\" vspace=\"3\" border=\"0\" align=\"absmiddle\">'}
	w1+='<div align="left" onmouseover="hli(this,tb' + i + ',\'on\')\" onmouseout="hli(this,tb' + i + ',\'off\')\" class="mi" onClick=' + '\"' + 'location.href='+ '\'' + sa[i] + '\'\">' + pc + sa[i+1] + '</div>'}
	//if (i>29) break;
	}
pc = '<img id=\"ar\" src=\"images/arrow.gif\" width=\"6\" height=\"8\" hspace=\"4\" vspace=\"3\" border=\"0\" align=\"absmiddle\">';
w1+='<div align="center" onmouseover="h(this,\'on\')\" onmouseout="h(this,\'off\')\" class="mib" onClick=' + '\"' + 'location.href='+ '\'' + sa[0] + '\'\">' + pc + pc + pc + 'see more...' + pc + pc + pc + '</div>';

menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
if (ie4||ns6) {
	menuobj.innerHTML=w1
	}
else {
	menuobj.document.write('<layer name=gui bgColor=#f5f0ca width=180 onmouseover="cm()" onmouseout="hidemenu()">'+w1+'</layer>');
	menuobj.document.close();
}
menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
objY=findTop(row)-22;
menuobj.thestyle.left=150+'px';
menuobj.thestyle.top=objY+'px';
//if (ns6) {return;}
menuobj.thestyle.visibility="visible";

tbobj=ie4? document.all.thb : ns6? document.getElementById("thb") : ns4? document.thb : "";
if (!tbobj){return;}
tbobj.thestyle=(ie4||ns6)? tbobj.style : tbobj
tbY=findTop(menuobj)-1;
tbobj.thestyle.left=(140 + menuobj.contentwidth) + 'px';
tbobj.thestyle.top=tbY+'px';
return false
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
function hidemenu(){
	if (window.menuobj){
		hl(sR,false);
		menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
	}
	if (window.tbobj){
		tbobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide";
	}
}
function dh(e){
	if (!menuobj){return;}
	if (ie4&&!menuobj.contains(e.toElement)) 
		hidemenu();
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget)) 
		hidemenu();
}
function DelayHideMenuA(){
if (ns4)
{return DelayHideMenu();}}
function ShowMenuA(e,which){
if (ns4)
{return ShowMenu(e,which);}}
function DelayHideMenu(){
if (mac){return};
if (ie4||ns6||ns4) delayhide=setTimeout("hidemenu()",500);}
function cm(){
	if (window.delayhide)
		{clearTimeout(delayhide)}
	}
if (ie4||ns6) document.onclick=hidemenu
function hlm(e,state){
		if (document.all)
			source_el=event.srcElement
		else if (document.getElementById)
			source_el=e.target
		
		if (source_el.className=="mi" || source_el.className=="mib"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
			}
		else{
			while(source_el.id!="pm"){
				source_el=document.getElementById? source_el.parentNode : source_el.parentElement
					if (source_el.className=="mi" || source_el.className=="mib"){
						source_el.id=(state=="on")? "mouseoverstyle" : ""
						}
			}
		}
}
function nkfa(){
	if(ns4)
		{return nkf();}
}
function nkf(){
	hl(sR,false);
	}
function nko(e){
	if (!document.all&&!document.getElementById&&!document.layers)
		return
	if (sR){hl(sR,false);}
		hidemenu();
		hl(e,true);
		sR=e;
		cm();
}

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}
function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 7;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function onoff(d){
if(menuState) {
	menuState = false;
	d.innerHTML="dynamic menu is off";
	SetCookie('menu', menuState, exp,"");}
else {
	menuState = true;
	d.innerHTML="dynamic menu is on";
	SetCookie('menu', menuState, exp,"");}
}
function popup(popname,popwidth,popheight) { apopup=window.open(popname,'jsppopup','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width='+(popwidth+20)+',height='+(popheight+30));}
