﻿function addBookmark(title) {
                     var url=parent.location.href;
                     if (window.sidebar) { 
                            window.sidebar.addPanel(title, url,""); 
                     } else if( document.all ) {
                     window.external.AddFavorite( url, title);
                     } else if( window.opera && window.print ) {
                     return true;
                     }
       }
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 DrawImage(ImgD,intLargeImgWidth,intLargeImgHeight,intAltFlag)
{
	var image = new Image();
	image.src = ImgD.src;

	if (image.width > 0 && image.height > 0)
	{
		flag = true;
		if (image.width/image.height >= intLargeImgWidth/intLargeImgHeight)
		{
			if (image.width > intLargeImgWidth)
			{  
				ImgD.width = intLargeImgWidth;
				ImgD.height = (image.height * intLargeImgWidth)/image.width;
			} 
			else
			{
				ImgD.width = image.width;  
				ImgD.height = image.height;
			}

			if (intAlfFlag = 0 )
			{
				ImgD.alt = "实际大小：" + image.width + "×" + image.height + ",点击查看原始图";
			}
		}
		else
		{
			if (image.height > intLargeImgHeight)
			{  
				ImgD.height = intLargeImgHeight;
				ImgD.width = (image.width * intLargeImgHeight)/image.height;     
			}
			else
			{
				ImgD.width = image.width;  
				ImgD.height = image.height;
			}
			
			if (intAltFlag = 0 )
			{
				ImgD.alt = "实际大小：" + image.width + "×" + image.height+ ",点击查看原始图";
			}
		}
	}
   /*else{
    ImgD.src="";
    ImgD.alt=""
    }*/
} 

/**********************************************************************/
/* Description : 自适应显示图片
/***********************************************************************/
function DrawImage2(ImgD,intLargeImgWidth)
{
	var image = new Image();
	image.src = ImgD.src;

	if (image.width > intLargeImgWidth)
	{  
			ImgD.width = intLargeImgWidth;
	}

	ImgD.alt = "实际大小：" + image.width + "×" + image.height + ",点击查看原始图";

}
