//var BROWSER = {};
//var USERAGENT = navigator.userAgent.toLowerCase();
//browserVersion({'ie':'msie','firefox':'','chrome':'','opera':'','safari':'','mozilla':'','webkit':'','maxthon':'','qq':'qqbrowser'});
//if(BROWSER.safari) {
//	BROWSER.firefox = true;
//}
//BROWSER.opera = BROWSER.opera ? opera.version() : 0;
//
//HTMLNODE = document.getElementsByTagName('head')[0].parentNode;
//if(BROWSER.ie) {
//	HTMLNODE.className = 'ie_all ie' + parseInt(BROWSER.ie);
//}
function AddFavorites(title, url){ 
if (document.all) 
window.external.AddFavorite(url, title); 
else if (window.sidebar) 
window.sidebar.addPanel(title, url, "") 
} 
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 htmlencode(str) {
	//str = str.replace(/&/g, "&amp;") ;
	str = str.replace(/"/g, "&quot;") ;
	str = str.replace(/</g, "&lt;") ;
	str = str.replace(/>/g, "&gt;") ;
	str = str.replace(/'/g, "&#146;") ;
	str = str.replace(/\ /g,"&nbsp;");
	str = str.replace(/\n/g,"<br>");
	//str = str.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");
	return str;
}

function htmldecode(str) {
	//str = str.replace(/&amp;/g,"&");
	str = str.replace(/&lt;/g,"<");
	str = str.replace(/&gt;/g,">");
	//str = str.replace("&#39;","'");
	str = str.replace(/&nbsp;/," ");
	str = str.replace(/&#39;/g,"'");
	str = str.replace(/&quot;/g,"\"");
	str = str.replace(/<br>/g,chr(13));
 	return str;
}

function AutoResizeImage(maxWidth,maxHeight,objImg){
	var img = new Image();
	img.src = objImg.src;
	var hRatio;
	var wRatio;
	var Ratio = 1;
	var w = img.width;
	var h = img.height;
	wRatio = maxWidth / w;
	hRatio = maxHeight / h;
	if (maxWidth ==0 && maxHeight==0){
		Ratio = 1;
	}else if (maxWidth==0){//
		if (hRatio<1) Ratio = hRatio;
	}else if (maxHeight==0){
		if (wRatio<1) Ratio = wRatio;
	}else if (wRatio<1 || hRatio<1){
		Ratio = (wRatio<=hRatio?wRatio:hRatio);
	}
	if (Ratio<1){
		w = w * Ratio;
		h = h * Ratio;
	}
	objImg.height = h;
	objImg.width = w;
}

$(document).ready(function(){
	$("#getroot").hover(
	   function () {
		 $(this).append("hover");
	   },
	   function () {
		 $(this).removeClass("hover");
	   }
	 ); 
	 $("#getroot").bind("click",function(){
		return false;	 
	});
})
