//$(document).ready(function(){
//	var reval  = "";
//	reval += "<div class=\"call-board\">";
//	reval += "<span class=\"red\"><strong>通告</strong>：</span>三态电子商务物流部定于2008年2月6号至9号放假，届时将暂停收货发货，不便之处敬请谅解。预祝您和您的家人春节快乐，身体健康！谢谢！";
//	reval += "</div>";
//	$(".wrap").prepend(reval);
//	$("div.call-board").slideDown("slow").click(function(){
//	$(this).remove();
//	});
//});
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 setCookie(name, value)		//cookies设置
{
	var argv = setCookie.arguments;
	var argc = setCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	if(expires!=null)
	{
		var LargeExpDate = new Date ();
		LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24));
	}
	document.cookie = name + "=" + encodeURIComponent (value)+((expires == null) ? "" : ("; expires=" +LargeExpDate.toGMTString()));
}
//function getCookie(Name)			//cookies读取
//{
//	var search = Name + "="
//	if(document.cookie.length > 0) 
//	{
//		offset = document.cookie.indexOf(search)
//		if(offset != -1) 
//		{
//			offset += search.length
//			end = document.cookie.indexOf(";", offset)
//			if(end == -1) end = document.cookie.length
//			return unescape(document.cookie.substring(offset, end))
//		 } else{
//                return "";
//         }
//	  }
//}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) {return decodeURIComponent(arr[2]);}
     return null;

}
function delCookie(name)//删除cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval= getCookie(name);
    if(cval != null) {document.cookie= name + "="+cval+";expires="+exp.toGMTString();}
}