// JavaScript Document
function doZoom(size)
{
 $("#NewsDetails").css("font-size",size+"px");
}
/***********加入收藏***************/
function AddFavorite(sURL, sTitle)
{
    try
    {
       window.external.addFavorite(sURL, sTitle); 
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
/***********设为首页***************/
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 gourl(url,target)
{
	if(url!="")
	{
		if(target=="blank")
		{
		window.open(url);
		}else
		{
			location.href=url;
		}
	}
}
 function ResizeImages(w,h)
{
   var myimg,oldwidth,oldheight;
   var maxwidth=w;
   var maxheight=h
   var myimg = document.getElementById('imgContent');   //如果你定义的id不是article，请修改此处
     if(myimg.width > myimg.height)
     {
         if(myimg.width > maxwidth)
         {
            oldwidth = myimg.width;
            myimg.height = myimg.height * (maxwidth/oldwidth);
            myimg.width = maxwidth;
         }
     }else{
         if(myimg.height > maxheight)
         {
            oldheight = myimg.height;
            myimg.width = myimg.width * (maxheight/oldheight);
            myimg.height = maxheight;
         }
     }
}
 function submitForm(id,obj)
 {
	 $("#"+id).click(function(){$("#"+obj).submit();});
 }
function tabNav(id)
{
 $(".tab-nav li").each(function(i,dom){
								  if(id==i){
									  $(dom).removeClass();$(dom).addClass("tab_nav_hover");$("#tab-con"+id).fadeIn(0);
									  }else{
									  $(dom).removeClass();$(dom).addClass("tab_nav_a");$("#tab-con"+i).hide();
								      }
								  })
}
$(function(){
$("#addNav").click(function(){AddFavorite(document.location.href,document.title);});tabNav(0);submitForm("search_bnt","search_form");
});
