﻿/*按比例生成缩略图*/
function DrawImage(MyPic,W,H){
  var flag=false;
  var image=new Image();
  image.src=MyPic.src;
  if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= W/H){
      if(image.width>W){  
        MyPic.width=W;
        MyPic.height=(image.height*W)/image.width;
      }
	  else{
        MyPic.width=image.width;  
        MyPic.height=image.height;
      }
    }
    else{
      if(image.height>H){  
        MyPic.height=H;
        MyPic.width=(image.width*H)/image.height;     
      }
	  else{
        MyPic.width=image.width;  
        MyPic.height=image.height;
      }
    }
  }
} 

function correctPNG()  
{ 
for(var i=0; i<document.images.length; i++) 
{ 
  var img = document.images[i] 
  var imgName = img.src.toUpperCase() 
  if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
  { 
   var imgID = (img.id) ? "id='" + img.id + "' " : "" 
   var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
   var imgStyle = "display:inline-block;" + img.style.cssText  
   if (img.align == "left") imgStyle = "float:left;" + imgStyle 
   if (img.align == "right") imgStyle = "float:right;" + imgStyle 
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle   
   var strNewHTML = "<span " + imgID + imgClass + imgTitle 
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"  
   img.outerHTML = strNewHTML 
   i = i-1 
  } 
} 
} 
window.attachEvent("onload", correctPNG); 

//FLASH
function banner(Url,width,height,wmode,menuNum ){
document.write("<embed src="+ Url +" width="+ width +" height="+ height +" quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode="+ wmode +" "+"flashvars='menuNum="+menuNum+"'" + "/>")
}

function secBoard(n)
{
for(i=0;i<menu.childNodes.length;i++)
menu.childNodes[i].className="on1";
menu.childNodes[n].className="on2";
}

//产品展示
function setTab0dSyn(i,classnamebef,idbef,idall,tabtabbef)
{
var waitInterval;

var MouseDelayTime=100;//鼠标感应延迟300毫秒
//

      _gObj(idbef+i).onmouseout=function(aEvent)
      {     
           
        clearTimeout(waitInterval);
        }
       clearTimeout(waitInterval);
     
      var str="setTab0dSyn1("+i+",'"+classnamebef+"','"+idbef+"',"+idall+",'"+tabtabbef+"')";
     
                    //alert(str);
      waitInterval=setTimeout(str,MouseDelayTime);

}
function setTab0dSyn1(i,classnamebef,idbef,idall,tabtabbef)
{
//alert("aa");
changDivClass(idbef,idall,i,classnamebef)
selectTab0dSyn(tabtabbef,idall,i);
}
function selectTab0dSyn(div_id,allnum,now){
for(var i= 1; i<= allnum;i++)
{
if(i==now)
{
   _gObj(div_id+i).style.display="block";
}else
{
   _gObj(div_id+i).style.display="none";
}
}

//   document.getElementById("tabtabd1").style.display="block";
// document.getElementById("tabtabd2").style.display="none";

} 
function _gObj(id)
{
return document.getElementById(id);
}
function changDivClass(div_id,all,now,classnamebef)
{
for(var i= 1; i<= all;i++)
{
if(i==now)
{
_gObj(div_id+i).className = classnamebef+"_01";
}else
{
//_gObj(div_id+i).className = "dj4_"+i;
_gObj(div_id+i).className = classnamebef+"_"+i;
}
}
}
