function createXmlHttp(){
	var xmlObj = false;
	try {
		// 在 Mozilla 中使用这种方式来创建 XMLHttpRequest 对象
		xmlObj=new XMLHttpRequest;
	}
	catch(e) {
		try {
			// 如果不成功，那么尝试在较新 IE 里的方式
			xmlObj=new ActiveXObject("MSXML2.XMLHTTP");
		}
		catch(e2) {
			try {
				// 失败则尝试使用较老版本 IE 里的方式 
				xmlObj=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e3) {
				xmlObj=false;
			}
		}
	}
	if (!xmlObj) {
		alert("XMLHttpRequest init Failed!");
	}
	return xmlObj;
}
function show(serverPage,objID){
	var objdiary = document.getElementById(objID);
	objdiary.innerHTML='<img src="./images/ajax-loader.gif" width="16" height="16" border="0" />Loding...';
	//serverPage +="?"+Math.random();
	ajaxFri = getAjax();   
	ajaxFri.open("GET", serverPage, true); 
	ajaxFri.onreadystatechange = function() { 
		if (ajaxFri.readyState == 4 && ajaxFri.status == 200) { 
			var text = ajaxFri.responseText; 
			if(text!=0){
				objdiary.innerHTML=text;
			}
		} 
	}; 
	ajaxFri.send(null); 
}
function parseJSON(json){
    try{
        if(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)){
            var j = eval('(' + json + ')');
            return j;
		}
	}catch(e){
    }
    throw new SyntaxError("parseJSON");
}
function trim(string) {
	var tmpchar, i, j, result;
	i = 0;
	tmpchar = string.charAt(i);
	while (tmpchar == ' ') {
		i++;
		tmpchar = string.charAt(i);
	}

	j = string.length - 1;
	tmpchar = string.charAt(j);
	while (tmpchar == ' ') {
		j --;
		tmpchar = string.charAt (j);
	}
	if ( i <= j)
		result = string.substring(i,j+1);
	else
		result = "";
	return result;
}
function onloadEvent(func){
    var oldLoad=window.onload;
    if(typeof window.onload!='function'){
        window.onload=func;
    }
    else{
        window.onload=function(){
        	oldLoad();
            func();
        };
    }
}
function replaceHtml(el, html) {
	var oldEl = typeof el === "string" ? document.getElementById(el) : el;
	/*@cc_on // Pure innerHTML is slightly faster in IE
		oldEl.innerHTML = html;
		return oldEl;
	@*/
	var newEl = oldEl.cloneNode(false);
	newEl.innerHTML = html;
	oldEl.parentNode.replaceChild(newEl, oldEl);
	/* Since we just removed the old element from the DOM, return a reference
	to the new element, which can be used to restore variable references. */
	return newEl;
};


var ua = navigator.userAgent.toLowerCase();
var binfo =
{
    ve : ua.match(/.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/)[1],
    ie : /msie/.test(ua) && !/opera/.test(ua),
    op : /opera/.test(ua),
    sa : /version.*safari/.test(ua),
    ch : /chrome/.test(ua),
    ff : /gecko/.test(ua) && !/webkit/.test(ua)
};
function notification(miniNav){
	var timer;
	var height = miniNav.clientHeight;
	var no = this;
    var preHeight = 28;    
    this.nObj = miniNav;
    this.nObj.style.cursor = 'pointer';
	this.up = function(){		
		if (height == 0){
			no.nObj.style.display = 'none';
			clearTimeout(timer);
			return;
		}
		height--;
		no.nObj.style.height = height + 'px';		
		timer = setTimeout(no.up, 40);
	};

}
var fb;
onloadEvent(function(){
	if(document.getElementById('miniNav') != undefined){
		var no = new notification(document.getElementById('miniNav'));
		no.nObj.onclick = no.up;
	}

	if (document.getElementById('floatbar') != undefined){
		fb = {
				floatBar: document.getElementById('floatbar'),
				de: document.documentElement || document.body,
				setFloatBar: function(){
						
					if(binfo.ie && binfo.ve < 7){
						fb.floatBar.className = 'alternative';
						fb.scrollBar();
					}else{
						fb.floatBar.className = 'static';
					}
					fb.floatBar.style.display = 'block';	
				},
				scrollBar: function(){ 
					var style_top = fb.de.scrollTop + fb.de.clientHeight - fb.floatBar.offsetHeight;
					fb.floatBar.style.top = style_top + 'px';	
					setTimeout('fb.scrollBar()',80);
				}
		};
		fb.setFloatBar();
	}
}); 

function closefloat(){fb.floatBar.style.display = 'none'}
