var menuTimer =null;
var oct = 150;
num = 0;
function showmenu(obj1,obj2,state,location){ 
    var btn=document.getElementById(obj1);
    var obj=document.getElementById(obj2);
    var h=btn.offsetHeight;
    var w=btn.offsetWidth;
    var x=btn.offsetLeft;
    var y=btn.offsetTop;
    
    obj.onmouseover =function(){
        showmenu(obj1,obj2,'show',location);
    }
    obj.onmouseout =function(){
        showmenu(obj1,obj2,'hide',location);
    }
    
    while(btn=btn.offsetParent){y+=btn.offsetTop;x+=btn.offsetLeft;}
    
    var hh=obj.offsetHeight;
    var ww=obj.offsetWidth;
    var xx=obj.offsetLeft;//style.left;
    var yy=obj.offsetTop;//style.top;
    var obj2state=state.toLowerCase();
    var obj2location=location.toLowerCase();
    
    var showx,showy;

    if(obj2location=="left" || obj2location=="l" || obj2location=="top" || obj2location=="t" || obj2location=="u" || obj2location=="b" || obj2location=="r" || obj2location=="up" || obj2location=="right" || obj2location=="bottom"){
        if(obj2location=="left" || obj2location=="l"){showx=x-ww;showy=y;}
        if(obj2location=="top" || obj2location=="t" || obj2location=="u"){showx=x;showy=y-hh;}
        if(obj2location=="right" || obj2location=="r"){showx=x+w;showy=y;}
        if(obj2location=="bottom" || obj2location=="b"){showx=x;showy=y+h;}
    }else{ 
        showx=xx;showy=yy;
    }
    obj.style.left=-12+showx+"px";
    obj.style.top=showy+"px";
    if(state =="hide"){
        menuTimer =setTimeout("hiddenmenu('"+ obj2 +"')", 200);
    }else{
        clearTimeout(menuTimer);
        obj.style.visibility ="visible";
    }
}
function hiddenmenu(psObjId){
    document.getElementById(psObjId).style.visibility ="hidden";
}
function number() {
len = msg.length;
window.status = msg.substring(0, num+1);
num++;
if ( num >= len ) { num = 0 };
window.setTimeout("number();", oct );
} 
function BtWindow(theURL,winName,Wval,Hval)
 { //v2.0无滚动条
  var features;
  var featv;
  features="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=on, resizable=no,location=no, status=no," + "width="+ Wval + ",height=" + Hval;
  features=features + ",top=" +(window.screen.height-Hval)/2 +",left=" + (window.screen.width-Wval)/2+ "";//弹出屏幕居中
  featv=window.open(theURL,winName,features);
  featv.focus();
  }
function lShowTD(sid,obj)
{
var whichEl = document.getElementById(sid).style;
if (whichEl.display == "none")
{
	 obj.className='';
     whichEl.display = "";
}
else
{
	obj.className='set';
    whichEl.display = "none";
}
}
function DbShow(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
var newtext="<img src='images/arrow-r.gif' >"
document.all["Tcon" + sid].innerHTML = newtext;
doiframe("main","510");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
var newtext="<img src='images/arrow-l.gif' >"
document.all["Tcon" + sid].innerHTML = newtext;
}
}
function TbShow(sid,tid)
{
whichEl = eval("submenu" + sid);
switch(tid)
   {
   case 1:
     eval("submenu" + sid + ".style.display=\"\";");
     //var newtext="<img src='images/arrow-r.gif' >"
     //document.all["Tcon" + sid].innerHTML = newtext;
	  doiframe("main","510");
     break;
   case 2:
     eval("submenu" + sid + ".style.display=\"none\";");
     //var newtext="<img src='images/arrow-l.gif' >"
     //document.all["Tcon" + sid].innerHTML = newtext;
	 doiframe("main","670");
     break
   }
}
function doiframe(frname,wth) {    

   iframename = frname; 
   if (document.getElementById) pTar = document.getElementById(iframename);    
   else eval("pTar = " + iframename + ";");  
   pTar.width = wth; 
}
//=============================================================================
//产品选中
//=============================================================================
function SelProduct(FieldUrl,edt,bmsg)
{
	var _obj=document.getElementsByName("SelPtd");
	var intCounter,strValue;
	intCounter=0,strValue=0;
	
	for(i = 0 ; i < _obj.length ;  i++)   
	{   
		if(_obj[i].checked == true)   
		{   
			if(intCounter > 0)   
			{   
				strValue = strValue + ","  + _obj[i].value   
			}   
			else  
			{   
				strValue = _obj[i].value   
			}   
			intCounter = intCounter + 1    
		}
	}
	if (strValue!=0&&strValue!="")
	{
		var url="../x"+ edt +"/"+FieldUrl+".aspx?PtdID="+strValue;
		BtWindow(url,FieldUrl,800,500);
	}
	else
	{
		alert(bmsg);
		}
}
function pageName()
    {
        var a = location.href;
        var b = a.split("/");
        var c = b.slice(b.length-1, b.length);
        return c.slice(0, 1);
    }
function writetop(edt)
{
	switch(edt)
       {
        case "en":
	       document.write ("【<a href='javascript:history.back()' class='ptd'>BACK</a>】【<a href='#top' class='ptd'>▲TOP</a>】");
         break
        case "cn":
	       document.write ("【<a href='javascript:history.back()' class='ptd'>返回</a>】【<a href='#top' class='ptd'>▲置顶</a>】");
         break
        default:
	       document.write ("【<a href='javascript:history.back()' class='ptd'>BACK</a>】【<a href='#top' class='ptd'>▲TOP</a>】");
	   }
}
function SetHome(obj,vrl){
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
                        }  
                        catch (e)  { 
                                alert("Browser Refused");  
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}

function openvideo(Myplayer,vurl) //播短片
{ 
	Myplayer.URL=vurl; 
	Myplayer.controls.play();
}
function openInquiry(sb,edt) //播短片
{ 
  winpop('../x'+ edt +'/SendEmail.aspx?subject='+sb,'sender',600,350);
}
function opensr(valid,edt) //打开搜索
{ 
   var theURL='../x'+ edt +'/Search.aspx?SeriesID=&ClassID=&MyKeyField=TypeName&keyword='+document.getElementById(valid).value;
   window.open(theURL,'_self');
}
function PageTurn(TextID,PageName) //翻页
{ 
IndexID=document.getElementById(TextID).value;
if(IndexID >1){PageName=PageName+"_"+IndexID;}
window.open(PageName+'.html','_self');
}
/*********************************************
功能:    通用DIV切换函数
参数:    divID --当前DIV的ID号；divName  --要改变的这一组DIV的命名前缀；zDivCount --这一组DIV的个数-1 obj变化
css
.zdiv1{ background-image:url(BP01.gif);cursor:pointer;}
.zdiv2{ background-image:url(BP02.gif);cursor:pointer;}
*********************************************/
function ChangeDiv(divId,divName,zDivCount,obj) 
{ 
 for(i=0;i<=zDivCount;i++)
 {
     document.getElementById(divName+i).style.display="none"; 
	 document.getElementById("mr_"+i).style.display="none"; 
	 document.getElementById(obj+i).className = "box-hd zdiv1"
 }
 document.getElementById(divName+divId).style.display="block"; 
 document.getElementById("mr_"+divId).style.display="block"; 
 document.getElementById(obj+divId).className = "box-hd zdiv2"
}
