// function.js (c) 2004 IPRO 網際家數位科技 All Rights Reserved. 
//                 http://www.e-ipro.com  service@e-ipro.com.tw
//
// 軟體使用授權:
//
// 此程式僅授權 科雅科技(Goyatek Technology Inc.) 使用於該公司企業網站上，
// 未經網際家數位科技正式授權，請勿任意複製作為其它用途。
// 
//
//var big52gbUrl = "http://dns.goya.com.tw/__cf_b2g/http/dns.goya.com.tw/chi/?__cf_Free=true";
var big52gbUrl = "";

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var ns6=document.getElementById&&!document.all;
var ns4=document.layers;

// for 簡繁體轉換用 Begin
var G_url_startNum = 0;
if ( location.pathname.match(/__cf_b2g/i)!=null ){	G_url_startNum = 3;	}
// for 簡繁體轉換用 End

PageNames = new Array(
    "about",
    "news",
    "service",
    "hr",    
    "contact",
    "wip");

OutputNames = new Array(  
    "關於科雅",  
    "新聞動態", 
    "產品服務",     
    "人力資源", 
    "聯絡我們",
    "e-Service");  
    
PageNames_about = new Array(
    "index.php",    
    "vision.php",    
    "partnership.php",    
    "location.php",    
    "qa.php");

OutputNames_about = new Array(
    "公司簡介",
    "經營理念",
    "合作夥伴",
    "公司位置",
    "品質政策");

PageNames_news = new Array(
    "index.php",    
    "events.php");
OutputNames_news = new Array(
    "Hot News",
    "Hot Events");

// Service 第一層
PageNames_service = new Array(
    "/eng/service/index.php",  
    "/eng/service/design",  
    "/eng/service/ip",  
    "/eng/service/turnkey",
    "/eng/wip/index.php");
OutputNames_service = new Array(
    "Goyatek Service",  
    "Design Service",
    "IP Service",
    "Turnkey Service",
    "e-Service");

    
PageNames_hr = new Array(
    "index.php",    
    "employee.php",    
    "job.php",    
    "learning.php");
OutputNames_hr = new Array(
    "福利政策",
    "人力分析",    
    "人才招募",    
    "學習發展");
                
PageNames_contact = new Array(
    "index.php");
OutputNames_contact = new Array(
    "聯絡我們");
    
PageNames_wip = new Array(
		"/eng/wip/index.php"
	);
OutputNames_wip = new Array(
		"e-Service"
	);
//// Service 第二層 Design Service
PageNames_wip_wip = new Array(
    "/eng/wip/index.php",
    "/eng/wip/rep.php");
OutputNames_wip_wip = new Array(
    "Real Time WIP",
    "WAT & CP Report");  


/*定義下拉選單 linkset */
var linkset=new Array();
var MenuWidth = new Array(100,100,100,100,100,130);
for(var lv_0=0; lv_0 < 6; lv_0++) {
    var PageNamesArray="PageNames";
    var OutputNamesArray="OutputNames";
    PageNamesArray += "_" + PageNames[lv_0];
    OutputNamesArray += "_" + PageNames[lv_0];
    var PageNA = eval(PageNamesArray);
    var OutputNA = eval(OutputNamesArray);
    
    var tmpUrl='';
    for(var lv_1=0; lv_1 < PageNA.length; lv_1++) {
    	
        linkset[lv_0]+='<div ><img src="/chi/images/s_menu_bg1.gif" width='+MenuWidth[lv_0]+' height=1 id="a'+lv_0+'" name="a'+lv_0+'" ></div>';
        if (lv_0=='2' || lv_0 == '5'){	
    		//tmpUrl = PageNA[lv_1]+'?__cf_change=no' ;
    		tmpUrl = PageNA[lv_1];
	        if (lv_1==0 ){
	            linkset[lv_0] ='<div class="menuitems"><a href="'+tmpUrl+'" title="" >&nbsp;'+OutputNA[lv_1]+'&nbsp;</a></div>';
	        }else{
	            linkset[lv_0]+='<div class="menuitems"><a href="'+tmpUrl+'" title="" >&nbsp;'+OutputNA[lv_1]+'&nbsp;</a></div>';
	        }    		
    	}else{
	        if (lv_1==0 ){
	            linkset[lv_0] ='<div class="menuitems"><a href="/chi/'+PageNames[lv_0]+'/'+PageNA[lv_1]+'" title="" >&nbsp;'+OutputNA[lv_1]+'&nbsp;</a></div>';
	        }else{
	            linkset[lv_0]+='<div class="menuitems"><a href="/chi/'+PageNames[lv_0]+'/'+PageNA[lv_1]+'" title="" >&nbsp;'+OutputNA[lv_1]+'&nbsp;</a></div>';
	        }
    	}    	

    }
}


// find index # in array
function ItemID(name,nameArray){	
  if( name==null || name=='' ) return(0);
  for(var i=0; i < nameArray.length; i++) {
    if( name == nameArray[i] ) return(i);
  }
  return(0);  
}  

// Display Menu Function
function showFuncMenu(){	
    document.write('<table width="708" border="0" cellspacing="0" cellpadding="0"><tr>');  
    document.write('<td width="80" height="20">&nbsp;</td>\n');

	document.write('<td width="100" class="menu" ><a href="/chi/about/"   onmouseover="showmenu(event,linkset[0],230,192);this.style.cursor=\'hand\';MM_swapImage(\'about\',\'\',\'/eng/images/menu_about_on.gif\',1);"  onmouseout="MM_swapImgRestore();delayhidemenu();this.style.cursor=\'auto\';" >關於科雅</a></td>\n');
	document.write('<td width="100" class="menu" ><a href="/chi/news/"    onMouseOver="showmenu(event,linkset[1],330,192);this.style.cursor=\'hand\';MM_swapImage(\'news\',\'\',\'/eng/images/menu_news_on.gif\',1);" onmouseout="MM_swapImgRestore();delayhidemenu();this.style.cursor=\'auto\';">新聞動態</a></td>\n');
    document.write('<td width="100" class="menu" ><a href="/eng/service/');
    document.write('" onMouseOver="showmenu(event,linkset[2],430,192);this.style.cursor=\'hand\';MM_swapImage(\'service\',\'\',\'/eng/images/menu_service_on.gif\',1);" onmouseout="MM_swapImgRestore();delayhidemenu();this.style.cursor=\'auto\';">產品服務</a></td>\n');
    document.write('<td width="100" class="menu" ><a href="/chi/hr/"      onMouseOver="showmenu(event,linkset[3],530,192);this.style.cursor=\'hand\';MM_swapImage(\'hr\',\'\',\'/eng/images/menu_hr_on.gif\',1);" onmouseout="MM_swapImgRestore();delayhidemenu();this.style.cursor=\'auto\';">人力資源</a></td>\n');
    document.write('<td width="100" class="menu" > <a href="/chi/contact/">聯絡我們 </a></td>\n');    
	document.write('<td class="menu" > <a href="/eng/wip/index.php">e-Service</a></td>\n');    
    document.write('</tr></table>');      
}


// 
function ShowLeftMenu(){
//中文版無
}

// Display CatPic Function
function ShowCatPic(){
   
   var arrayOfpath = location.pathname.split("/");

   var arrayOfpage = arrayOfpath[arrayOfpath.length-1].split(".");
   var pagename = arrayOfpath[arrayOfpath.length-1];
   var PageNamesArray="PageNames";
   
   /*for(var itemNum=arrayOfpath.length-2-G_url_startNum; itemNum >1 ; itemNum--){
        PageNamesArray += "_" + arrayOfpath[arrayOfpath.length-itemNum];
   }*/
   for(var itemNum=2 + G_url_startNum ; itemNum < arrayOfpath.length-1 ; itemNum++){
        PageNamesArray += "_" + arrayOfpath[itemNum];
   } 
   
   PageNA = eval(PageNamesArray);
   id = ItemID(pagename, PageNA);
   if ( pagename.substr(0,4) == 'job_'){	id = 2;	}
   if ( pagename.substr(0,7) == 'events_'){	id = 1;	}
   if ( pagename.substr(0,5) == 'news_'){	id = 0;	}
   
   var SectionName=arrayOfpath[2];
   var SubSectionName=arrayOfpath[3];
   
   
   if (SectionName=='service'){
   		if ( SubSectionName == 'ip'){
   			document.write('<img src="/chi/images/main_title_'+SectionName+'_1.gif" height="18">');
		}else if ( SubSectionName == 'turnkey'){
			document.write('<img src="/chi/images/main_title_'+SectionName+'_2.gif" height="18">');
		}else if ( SubSectionName == 'design'){
			document.write('<img src="/chi/images/main_title_'+SectionName+'_0.gif" height="18">');
		}else{
			document.write('<img src="/chi/images/main_title_'+SectionName+'.gif" height="18">');
		}	
   }else{
   		document.write('<img src="/chi/images/main_title_'+SectionName+'_'+id+'.gif" height="18">');
   }
}


function showFootMenu(){
   var arrayOfpath = location.pathname.split("/");
   var SectionName=arrayOfpath[1];
   
   document.write('<td class="footerlink" align=center>\n');
   for(var itemNum=0; itemNum < PageNames.length; itemNum++) {
    if( PageNames[itemNum]!='sitemap' ) {
       		if (itemNum!=0){document.write(' | \n'); }
      		tmpTarget="";
      		if (itemNum == 5)
      			document.write('<a href="/eng/' + PageNames[itemNum] + '/index.php" '+tmpTarget+' >'+OutputNames[itemNum] + '</a>');   
      		else
       			document.write('<a href="/chi/' + PageNames[itemNum] + '/" '+tmpTarget+' >'+OutputNames[itemNum] + '</a>');   
	}        
   }
   document.write('</td>\n');

}
  
// show Page flow structure
function ShowPageIndex(){

   var arrayOfpath = location.pathname.split("/");
   var arrayOfpage = arrayOfpath[arrayOfpath.length-1].split(".");
   var pagename = arrayOfpath[arrayOfpath.length-1];
   var urlstr="/"+arrayOfpath[1]+"/";
   var OutputNamesArray="OutputNames";
   var PageNamesArray="PageNames";

   document.write('<img src="/chi/images/icon_pageindex.gif" width="6" height="6" hspace="4" align="absmiddle"><a href="/chi/" class="pageindex">首頁</a>'); 

   for(var i=2; arrayOfpath[i] && i < arrayOfpath.length-1; i++) {

      document.write(' / ');
      urlstr += arrayOfpath[i] + "/" ;
      
      var PageNA = eval(PageNamesArray);
      var id=ItemID(arrayOfpath[i], PageNA);

      document.write('<a href="' + urlstr + '" class="pageindex">');
      document.write( eval(OutputNamesArray + '[' + id + ']' ) );
      document.write('</a>');

      OutputNamesArray += "_" + arrayOfpath[i];
      PageNamesArray += "_" + arrayOfpath[i];
   }
   
   if(G_url_startNum!=3){
	   PageNA = eval(PageNamesArray);
	   id = ItemID(pagename, PageNA);
	   
	   if ( pagename.substr(0,4) == 'job_'){ id = 2; }
	   if ( pagename.substr(0,7) == 'events_'){	id = 1;	}
	   if ( pagename.substr(0,5) == 'news_'){	id = 0;	}
	
	   if( PageNA.length> 1 ) {
	      document.write(' / <span class=pageindex>');
	      document.write( eval(OutputNamesArray + '[' + id + ']' )+'  ' );
	   }   
   }
   document.write('</span>  ');
}  

function showLangMenu(ishome){
  
  if (ishome==0 ){
  	document.write('<td width="103" height="16"><a href="/eng/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image9\',\'\',\'/chi/images/index_eng_over.gif\',1)"><img src="/chi/images/index_eng.gif" name="Image9" width="103" height="16" border="0"></a></td>\n');
	document.write('<td width="78" height="16"><a href="/gb/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image12\',\'\',\'/chi/images/index_chisover.gif\',1)"><img src="/chi/images/index_chis.gif" name="Image12" width="78" height="16" border="0"></a></td>\n');  	
	document.write('<td width="78" height="16"><a href="/jap/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image13\',\'\',\'/chi/images/index_japover.gif\',1)"><img src="/chi/images/index_jap.gif" name="Image13" width="78" height="16" border="0"></a></td>\n');  	
  }else{
    document.write('<td width="69" height="16"><a href="/eng/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image9\',\'\',\'/chi/images/main_engover.gif\',1)"><img src="/chi/images/main_eng.gif" name="Image9" width="69" height="16" border="0"></a></td>\n');
    document.write('<td width="69" height="16"><a href="/gb/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image12\',\'\',\'/chi/images/main_chisover.gif\',1)"><img src="/chi/images/main_chis.gif" name="Image12" width="69" height="16" border="0"></a></td>\n');
    document.write('<td width="69" height="16"><a href="/jap/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image13\',\'\',\'/chi/images/main_japover.gif\',1)"><img src="/chi/images/main_jap.gif" name="Image13" width="69" height="16" border="0"></a></td>\n');
  }
if (big52gbUrl!=""){
  if (G_url_startNum==0 ){
  	document.write('<td width="78" ><a href="'+big52gbUrl+'"	title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image13\',\'\',\'/chi/images/index_chisover.gif\',1)"><img src="/chi/images/index_chis.gif" name="Image13" width="78" height="16" border="0"></a></td>\n');
  }else{
	document.write('<td width="78" height="16"><a href="/chi/');
  	document.write('"  title="" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image11\',\'\',\'/chi/images/main_chiover.gif\',1)"><img src="/chi/images/main_chi.gif" name="Image11" width="78" height="16" border="0"></a></td>\n');  
  }
}  
  if (ishome==1 ){
  	if (G_url_startNum!=0 ){
  		document.write('<td width="60" ><a href="http://b2g.e-ipro.com.tw/__cf_b2g/http/goya.e-ipro.com.tw/chi/news/?__cf_Free=true" ');
  	}else{
  		document.write('<td width="69" ><a href="/chi/');
  	}
  	document.write('" 	  title="HOME" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image10\',\'\',\'/chi/images/main_homeover.gif\',1)"><img src="/chi/images/main_home.gif" name="Image10" width="69" height="16" border="0"></a></td>');
  }else{
  	document.write('<td width="50" valign="top" background="images/index_6.gif"><img src="images/index_6.gif" width="7" height="16"></td>');
  }
}

function showHeader() {	
  document.write('<meta name="Author" content="IPRO Digital Tech., http://www.e-ipro.com">\n');
  document.write('<meta name="keywords" content="">\n');
  document.write('<link href="/chi/js/goya.css" rel="stylesheet" type="text/css">');
  document.write('<link rel="stylesheet" href="/chi/js/popmenu.css">');
  
  document.write('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages(\'../images/index_chisover.gif\',\'../images/main_chiover.gif\',\'../images/main_homeover.gif\')">\n');
  document.write('<a name="top"></a>');
  document.write('<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,\'on\')" onMouseout="highlightmenu(event,\'off\');');
  document.write('dynamichide(event)"></div>');

  document.write('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n'); 
  document.write('<td height="16" valign="top"><table width="100%" height="16" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n'); 
  document.write('<td height="16" valign="top" background="../images/index_2.gif"><img src="../images/index_2.gif" width="3" height="16"></td>\n');
  document.write('<td width="28" height="16"><img src="../images/main_13.gif" width="28" height="16"></td>\n');
  
  showLangMenu(1);  
  
  document.write('<td width="50" valign="top" background="../images/index_6.gif"><img src="../images/index_6.gif" width="7" height="16"></td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n'); 
  document.write('<td height="66" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td width="314" height="66"><img src="../images/main_logo.gif" alt="Goyatek Technology Inc." width="314" height="66"></td>\n');
  document.write('<td>&nbsp;</td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n'); 
  document.write('<td height="6" valign="top" background="../images/main_01.gif"><img src="../images/main_01.gif" width="10" height="6"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n'); 
  document.write('<td height="82" valign="top" background="../images/main_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr>\n');
  document.write('<td width="139"><img src="../images/main_02.gif" width="139" height="82"></td>\n');
  document.write('<td width="294"><img src="../images/main_03.gif" width="294" height="82"></td>\n');
  document.write('<td width="434"><img src="../images/main_04.gif" width="434" height="82"></td>\n');
  document.write('<td>&nbsp;</td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n'); 
  document.write('<td height="23" valign="top" background="../images/index_28.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr>\n'); 
  document.write('<td width="168"><img src="../images/main_06.gif" width="168" height="23"></td>\n');
  document.write('<td height="23" background="../images/index_28.gif">\n');
  
  showFuncMenu();  
  
  document.write('</td></tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n'); 
  document.write('<td height="17" background="../images/index_32.gif"><img src="../images/index_32.gif" width="5" height="17"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n'); 
  document.write('<td valign="top">\n');
  document.write('<body onLoad="MM_preloadImages(\'../images/main_10.gif\',\'../images/main_2002news_over.gif\',\'../images/main_2001news_over.gif\')">\n');
  document.write('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  
  //ShowLeftMenu();
    
  document.write('<td valign="top"><br>\n');
  document.write('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td width="20">&nbsp;</td>\n');
  document.write('<td width="1" valign="top" background="../../images/main_point.gif"><img src="../../images/main_point.gif" width="1" height="3"></td>\n');
  document.write('<td valign="top">\n');
  
  document.write('<div align=right>\n');
  ShowPageIndex();
  document.write('&nbsp;&nbsp;</div>\n');
  
  document.write('<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td height="34" valign="top"><table width="132" border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr>\n');
  document.write('<td width="41"><div align="center"><img src="../images/index_arw.gif" width="19" height="18"></div></td>\n');                          

  document.write('<td width="91">\n');
  ShowCatPic();
  document.write('</td>\n');
  
  document.write('</tr>\n');
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td valign="top" >\n');
}



function showFooter() {
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('<td width="1" valign="top" background="/chi/images/main_point.gif"><img src="/chi/images/main_point.gif" width="1" height="3"></td>\n');
  document.write('<td width="20">&nbsp;</td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('<tr> \n');
  document.write('<td height="21" background="/chi/images/main_11.gif"> \n');
  
  document.write('<table width="500" border="0" align="center" cellpadding="0" cellspacing="0"> \n');
  document.write('<tr> \n');
  showFootMenu();
  document.write('</tr> \n');
  document.write('</table> \n');
  
  document.write('</td> \n');
  document.write('</tr> \n');
  document.write('<tr> \n'); 
  document.write('<td height="5" bgcolor="#274387"><div align="center" class="footer">Copyright &copy; 2004 Goyatek Technology Inc.All rights reserved.</div></td> \n');
  document.write('</tr> \n');
 document.write('</table> \n');
 document.write('</body> \n');
 document.write('</html> \n');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

//-popMenu------------------------------------------------------------------------------------------------

function showmenu(e,which,ppX,ppY){
    
    if (!document.all&&!document.getElementById&&!document.layers)
        return

    clearhidemenu()

    menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
    menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

    if (ie4||ns6)
        menuobj.innerHTML=which
    else{
        menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onMouseOver="clearhidemenu()" onMouseOut="hidemenu()">'+which+'</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
    
    if (ie4){
        menuobj.thestyle.left=ppX;
        menuobj.thestyle.top= ppY;
    }else if (ns6){
        menuobj.thestyle.left=ppX;
        menuobj.thestyle.top= ppY-6;
    }else{
        menuobj.thestyle.left=ppX;
        menuobj.thestyle.top= ppY-6;
    }

    menuobj.thestyle.visibility="visible";
    return false;
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
    while (b.parentNode)
        if ((b = b.parentNode) == a)
            return true;
    return false;
}

function hidemenu(){
    if (window.menuobj)
        menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
}

function dynamichide(e){
    if (ie4&&!menuobj.contains(e.toElement))
        hidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    hidemenu()
}

function delayhidemenu(){
    if (ie4||ns6||ns4)
        delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
    if (window.delayhide)
        clearTimeout(delayhide)
}

function highlightmenu(e,state){
    if (document.all)
        source_el=event.srcElement
    else if (document.getElementById)
        source_el=e.target
    if (source_el.className=="menuitems"){
        source_el.id=(state=="on")? "mouseoverstyle" : ""
    }else{
        while(source_el.id!="popmenu"){
            source_el=document.getElementById? source_el.parentNode : source_el.parentElement
            if (source_el.className=="menuitems"){
                source_el.id=(state=="on")? "mouseoverstyle" : ""
            }
        }
    }
}

if (ie4||ns6)
    document.onclick=hidemenu
