﻿  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("抱歉！您的浏览器不支持直接设为首页。请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为“true”，点击“加入收藏”后忽略安全提示，即可设置成功。");  
                          }
                          var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                          prefs.setCharPref('browser.startup.homepage',vrl);
                   }
           }
}

function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}

function setTab(layerId,num,allNum){
  for(var i=1;i<=allNum;i++){
    if(num==i){
       document.getElementById(layerId+i.toString()).className="hover";
       document.getElementById("con_"+layerId+"_"+i.toString()).style.display="";
    }else{
       document.getElementById(layerId+i.toString()).className="";
       document.getElementById("con_"+layerId+"_"+i.toString()).style.display="none";
    }
  }
}


var flag=false; 
function DrawImage(ImgD,width,height){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= width/height){ 
   if(image.width>width){
    ImgD.width=width; 
    ImgD.height=(image.height*width)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
  else{ 
   if(image.height>height){
    ImgD.height=height; 
    ImgD.width=(image.width*height)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
 }
}

