// QQ:386196596

/*加入收藏夹*/ 
function addfavorite(title){ 
	var url = "http://"+window.location.host;
    try{ 
		window.external.addfavorite(url,title); 
     }catch (e){ 
       try{ 
           window.sidebar.addPanel(title, url, ""); 
       }catch (e){ 
            alert("加入收藏失败，请使用ctrl+d进行添加"); 
       } 
    } 
}

/* 设为首页 */
function setHome(obj){
	var vrl = window.location;
	try{
			obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	}
	catch(e){
		if(window.netscape) {
			try {
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch (e) {
					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',vrl);
		 }
	}
}



function cb(obj, isOver){
	if(obj.getAttribute("btnstatus")=="active")return;
	obj.src= isOver ? obj.src.replace(".gif","Over.gif") : obj.src.replace("Over.gif",".gif");
}


//part
function blank(obj,str){
	if(str=="")
	obj.value="";
	else
	obj.value=str;
}
function re(obj,str){
	obj.value=str;
}
function change(obj,path){
	obj.src=path;

}

/*======展开折叠菜单======*/
 function showMenu(obj){
	 var e = document.getElementById(obj);
	 if(e.style.display=="none"){
	 	e.style.display="block";
	 }else{
		 e.style.display="none";
	 }
 }

/*======导航下拉菜单=========*/
  function displaySubMenu(li) {
	  var subMenu = li.getElementsByTagName("ul")[0];
	  subMenu.style.display = "block";
  }
  function hideSubMenu(li) {
	  var subMenu = li.getElementsByTagName("ul")[0];
	  subMenu.style.display = "none";
  }



			
/*====reSizeImage 重绘图==========================================形*/
function  reSizeImage(ImgObj, reWidth, reHeight){
	reWidth = reWidth || 250; reHeight=reHeight || 200;
	var image=new  Image(); image.src=ImgObj.src;
	if(image.width>0 && image.height>0){
		if(image.width / image.height >=  reWidth / reHeight){
			if(image.width > reWidth){
				ImgObj.width  = reWidth;
				ImgObj.height = (image.height * reWidth) / image.width;
			}else{
				 ImgObj.width = image.width;
				 ImgObj.height= image.height;
			}
        }else{
			if(image.height > reHeight){
				ImgObj.height =reHeight;
				ImgObj.width  =(image.width*reHeight) / image.height;
				}else{
					ImgObj.width  =image.width;
					ImgObj.height =image.height;
			}
		}
	}
}




