function setHomePagee()
{ 
    if(document.all)//ie
    {
        document.body.style.behavior='url(#default#homepage)'; 
        document.body.setHomePage('http://www.sinchao.com/');   
    }
    else//firefox
    {
        if(window.netscape)
        { 
            try 
            {   
                window.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
            }   
            catch (e) 
            {          
                window.alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'"); 
            }
        } 
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage','http://www.sinchao.com/');
    }
    return false;
}

function setBookmarkit(){
	try{
	if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))//firefox
		{ 
		window.sidebar.addPanel('新潮网','http://www.sinchao.com','新潮网'); 
		} 
	else
		{ 
		window.external.AddFavorite('http://www.sinchao.com','新潮网'); //ie
		} 
	}catch(e){}
	return false;
}

/*JavaScript实现网页图片等比例缩放*/
function ReImgSize()
{
//    window.alert(1);
    for (i = 0; i < document.images.length; i++)
    {
        if (document.all)
        {
            if (document.images[i].width > 500)
            {                
                DrawImage(document.images[i], 500, 9999);                
                document.images[i].outerHTML = '<a href="' + document.images[i].src + '" target = "_blank" title ="在新窗口打开图片" > ' + document.images[i].outerHTML + '</a>';
            }
        }
        else
        {
            if (document.images[i].width > 400)
            {
                DrawImage(document.images[i], 400, 9999);   
                document.images[i].title = "在新窗口打开图片";
		        document.images[i].style.cursor = "pointer";
		        document.images[i].onclick = function(e)
                {
                    window.open(this.src)
                }
            }
        }
    }
}

/*JavaScript实现网页图片等比例缩放*/
function DrawImage(ImgD, FitWidth, FitHeight)
{
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0)
    {
        if (image.width / image.height >= FitWidth / FitHeight)
        {
            if (image.width > FitWidth)
            {
                ImgD.width = FitWidth;
                ImgD.height = (image.height * FitWidth) / image.width;
            }
            else
            {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
        else
        {
            if (image.height > FitHeight)
            {
                ImgD.height = FitHeight;
                ImgD.width = (image.width * FitHeight) / image.height;
            }
            else
            {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}

function setImagesSize(parentId, maxWidth)
{
    var shitImages = document.getElementById(parentId).getElementsByTagName("img");
    for(var ii=0; ii<shitImages.length; ii++)
        if(shitImages[ii].width>maxWidth)
            shitImages[ii].width=maxWidth;
}