﻿//此脚本原创于www.1idc.cn by 放睛の天空 QQ:3882271
function trim() {
return this.replace(/\s+$|^\s+/g,"");
}
String.prototype.trim=trim;

function LoadFlash(url,wmode,width,Height)
{ 
document.write(
  '<object width="' + width +'" height="' + Height + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="movie" value="' + url + '"><param name="wmode" value="'+wmode+'"><param name="quality" value="autohigh"><param name="menu" value="false"><embed width="' + width +'" height="' + Height + '" src="' + url + '"  quality="autohigh" wmode="' + wmode + '" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>');   
}

function newpro(w,h,p,t,tc,bc,ps,ls,ts)
{
var pic_width=w; //图片宽度
var pic_height=h; //图片高度
var button_pos=p; //按扭位置 1左 2右 3上 4下
var stop_time=3000; //图片停留时间(1000为1秒钟)
var show_text=t; //是否显示文字标签 1显示 0不显示
var txtcolor=tc; //文字色
var bgcolor=bc; //背景色
//可编辑内容结束
var swf_height=show_text==1?pic_height+20:pic_height;
var pics=ps, links=ls, texts=ts;
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0" width="'+ pic_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="images/focus.swf">');
document.write('<param name="quality" value="high"><param name="wmode" value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">');
document.write('<embed src="images/focus.swf" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

var browser=navigator.appName  
var b_version=navigator.appVersion  
var version=b_version.split(";");  
var trim_Version=version[1].replace(/[ ]/g,"");  
if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0")  
{
  document.execCommand("BackgroundImageCache", false, true);
}

function searchSubmit()
{
if(document.getElementById("key").value.replace(/请输入产品型号关键字!/g,"").trim()=="")
    {
        document.getElementById("key").value="请输入产品型号关键字!";
		document.getElementById("key").select();
	}
	else
	{
        location.href="products.aspx?key="+escape(document.getElementById("key").value);
	}
}

function getAbsoluteoffsetLeft(incomingobj)
{   
  var obj = document.getElementById(incomingobj);   
  AbsoluteoffsetLeft = 0;   
  while(obj != null && obj.tagName != "BODY")   
  {   
    AbsoluteoffsetLeft += obj.offsetLeft;   
    obj = obj.offsetParent;   
  }   
  AbsoluteoffsetLeft += obj.offsetLeft + document.body.scrollLeft;   
  return AbsoluteoffsetLeft;   
  }   
    
function getAbsoluteoffsetTop(incomingobj)
{   
  var obj = document.getElementById(incomingobj);   
  AbsoluteoffsetTop = 0;   
  while(obj != null && obj.tagName != "BODY")   
  {   
    AbsoluteoffsetTop += obj.offsetTop;   
    obj = obj.offsetParent;   
  }   
  AbsoluteoffsetTop += obj.offsetTop + document.body.scrollTop;  
  return AbsoluteoffsetTop;   
}

var menuCrTimeout=new Array(10);
var menuRmTimeout=new Array(10);
var menuOutTimeout=new Array(10);

var v;
var MenuInfo=new Array(7);

function Addinner()
{
    for(var i=1;i<MenuInfo.length;i++)
    {
    var v="";
    for(var m=0;m<MenuInfo[i].toString().split(",").length;m++)
    {
      v+='<a href="'+MenuInfo[i].toString().split(",")[m].toString().split("@")[1]+'">'+MenuInfo[i].toString().split(",")[m].toString().split("@")[0]+'</a>';
    }
    document.getElementById("menutwo").innerHTML+='<div id="menu_'+i+'" class="menu_div1" style="left:'+getAbsoluteoffsetLeft("M"+i)+'px; top:'+(getAbsoluteoffsetTop("M"+i)+20)+'px; filter:alpha(opacity=0); opacity:0; visibility:hidden" onmouseover="OnMenu(\'M'+i+'\','+i+')" onmouseout="OutMenu(\'M'+i+'\','+i+')"><div class="menu_t"></div><div class="menu_div2" style="white-space:nowrap;">'+v+'</div></div>';
    }
}

function OnMenu(o,id)
{
  if(document.getElementById("menu_"+id).style.visibility=="hidden")
  {
    document.getElementById("menu_"+id).style.visibility="visible";
  }
  for(var i=0;i<10;i++)
  {
    if(document.getElementById("menu_"+i) && document.getElementById("menu_"+i).style.visibility!="hidden" && i!=parseInt(id))
    {
      window.clearTimeout(menuCrTimeout[i]);
      menuRmTimeout[i]=window.setTimeout("rmdiv('M"+i+"','"+i+"')",10);
    }
  }
  window.clearTimeout(menuRmTimeout[id]);
  window.clearTimeout(menuOutTimeout[id]);
  menuCrTimeout[id]=window.setTimeout("crdiv('"+o+"','"+id+"')",10);
}

function OutMenu(o,id)
{
  menuOutTimeout[id]=window.setTimeout("rmdiv('"+o+"','"+id+"')",1000);
}

function crdiv(o,id)
{
  if(parseInt(document.getElementById("menu_"+id).style.top)>getAbsoluteoffsetTop(o))
  {
    document.getElementById("menu_"+id).style.top=parseInt(document.getElementById("menu_"+id).style.top)-1+"px";
    if(document.getElementById("menu_"+id).style.filter)
    {
      document.getElementById("menu_"+id).style.filter="alpha(opacity="+(document.getElementById("menu_"+id).filters.alpha.opacity+5)+")";
    }
    else
    {
      document.getElementById("menu_"+id).style.opacity=parseFloat(document.getElementById("menu_"+id).style.opacity)+0.05;
    }
    menuCrTimeout[id]=window.setTimeout("crdiv('"+o+"','"+id+"')",10);
  }
  else
  {
    window.clearTimeout(menuCrTimeout[id]);
  }
}

function rmdiv(o,id)
{
  if(parseInt(document.getElementById("menu_"+id).style.top)<(getAbsoluteoffsetTop(o)+20))
  {
    document.getElementById("menu_"+id).style.top=parseInt(document.getElementById("menu_"+id).style.top)+1+"px";
    if(document.getElementById("menu_"+id).style.filter)
    {
      document.getElementById("menu_"+id).style.filter="alpha(opacity="+(document.getElementById("menu_"+id).filters.alpha.opacity-5)+")";
    }
    else
    {
      document.getElementById("menu_"+id).style.opacity=parseFloat(document.getElementById("menu_"+id).style.opacity)-0.05;
    }
    menuRmTimeout[id]=window.setTimeout("rmdiv('"+o+"','"+id+"')",10);
  }
  else
  {
    document.getElementById("menu_"+id).style.visibility="hidden";
    window.clearTimeout(menuRmTimeout[id]);
  }
}