/*按比例生成缩略图*/
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;
      }
    }
  }
} 


// 浏览器版本判断
var Client = {
    Engine: {'name': 'unknown', 'version': ''},
    Features: {}
};
Client.Features.xhr = !!(window.XMLHttpRequest);
Client.Features.xpath = !!(document.evaluate);
if (window.opera) Client.Engine.name = 'opera';
else if (window.ActiveXObject) Client.Engine = {'name': 'ie', 'version': (Client.Features.xhr) ? 7 : 6};
else if (!navigator.taintEnabled) Client.Engine = {'name': 'webkit', 'version': (Client.Features.xpath) ? 420 : 419};
else if (document.getBoxObjectFor != null) Client.Engine.name = 'gecko';
Client.Engine[Client.Engine.name] = Client.Engine[Client.Engine.name + Client.Engine.version] = true;

<!-- // 获取单个对象
function $1(e){
    var pr=document.getElementById(e).getElementsByTagName("li");
    pr.onmouseover=function(){
        this.tmpClass=this.className;
        this.className+=" hover";
    }
    pr.onmouseout=function(){
        this.className=this.tmpClass;
    }
}
if(Client.Engine.ie6){
   // $1("Nav");
}

// 获取多个子对象
function $2(e){
    var pr=document.getElementById(e).getElementsByTagName("li");
    for(var i=0;i<pr.length;i++){
        pr[i].onmouseover=function(){
            this.tmpClass=this.className;
            this.className+=" hover";
        }
        pr[i].onmouseout=function(){
            this.className=this.tmpClass;
        }
    }
}
if(Client.Engine.ie6){
    //$2("Nav");
}

// 让所有标记支持hover
function $(){
    var obj=document.all;
    for(var i=0;i<obj.length;i++){
        obj[i].onmouseover=function(){
            this.tmpClass=this.className;
            this.className+=" hover";
        }
        obj[i].onmouseout=function(){
            this.className=this.tmpClass;
        }
    }
}
if(Client.Engine.ie6){
    //$();
}

window.onload=function(){
	if(Client.Engine.ie6){
   $2("Nav");
} }



function addfavorite()
{
 var title = document.title;
            var url = location.href;

            // FF
            if(window.sidebar != null)
            {
                try
                {
                    if(window.sidebar.addPanel != null)
                    {
                        window.sidebar.addPanel(title, url, "");
                        return;
                    }
                }
                catch(e)
                {
                }

                alert("请按Ctrl+D键收藏 !");
                return;
            }

            // IE
            if(window.external != null)
            {
                try
                {
                    window.external.addFavorite(url, title);
                    return;
                }
                catch(e){
                }

                try
                {
                    window.external.addToFavoritesBar(url, title, "slice");
                    return;
                }
                catch(e){
                }
            }

            alert("您的浏览器不支持此操作, 请使用浏览器的收藏夹进行添加 !");
            return;

}


