var category;
function DataLength(fData){
    var intLength = 0;
    for (var i = 0; i < fData.length; i++) {
        if ((fData.charCodeAt(i) < 0) || (fData.charCodeAt(i) > 255)) {
            intLength = intLength + 2;
        }
        else {
            intLength = intLength + 1;
        }
    }
    return intLength;
}
function IsEmpty(fData){
    return ((fData == null) || (fData.length == 0));
}
function IsDigit(fData){
    return ((fData >= "0") && (fData <= "9"));
}
function IsInteger(fData){
    if (IsEmpty(fData)) {
        return true;
    }
    if ((isNaN(fData)) || (fData.indexOf(".") != -1) || (fData.indexOf("-") != -1)) {
        return false;
    }
    
    return true;
}
function IsEmail(fData){
	if (IsEmpty(fData))
		return false;
	if (fData.indexOf(".") == 0)
		return false;
	if (fData.indexOf("@") == -1)
		return false;
	var NameList = fData.split("@");
	if (NameList.length != 2)
		return false;
	if (NameList[0].length < 1)
		return false;
	if (NameList[1].indexOf(".") <= 0)
		return false;
	if (NameList[1].indexOf(".") == NameList[1].length - 1)
		return false;
	var domainList = NameList[1].split(".");
	if (domainList.length>2){
		return false;
	}else{
		var string=domainList[1].toUpperCase();
		for (i=0;i<string.length ;i++ ){
			str = string.substring(i, i + 1);
			if (str>"Z" || str<"A")return false;
		}
	}
	return true;
}
function IsPhone(fData){
    var str;
    var fDatastr = "";
    if (IsEmpty(fData)) 
        return true;
    for (var i = 0; i < fData.length; i++) {
        str = fData.substring(i, i + 1);
        if (str != "(" && str != ")" && str != "（" && str != "）" && str != "+" && str != "-" && str != " ") 
            fDatastr = fDatastr + str;
    }
    //alert(fDatastr);
    if (isNaN(fDatastr)) 
        return false;
    return true;
}
function IsPlusNumeric(fData){
    if (IsEmpty(fData)) 
        return true;
    if ((isNaN(fData)) || (fData.indexOf("-") != -1)) 
        return false;
    return true;
}
function IsNumeric(fData){
    if (IsEmpty(fData)) 
        return true;
    if (isNaN(fData)) 
        return false;
    
    return true;
}
function Str1HasCharOfStr2(str1, str2){
    var i, j;
    for (i = 0; i < str1.length; i++) {
        j = str2.indexOf(str1.charAt(i));
        if (j != -1) {
            return 1;
        }
    }
    return 0;
}
function IsDate(DateString, Dilimeter){
    if (DateString == null) 
        return false;
    if (Dilimeter == '' || Dilimeter == null) 
        Dilimeter = '-';
    var tempy = '';
    var tempm = '';
    var tempd = '';
    var tempArray;
    if (DateString.length < 8 && DateString.length > 10) 
        return false;
    tempArray = DateString.split(Dilimeter);
    if (tempArray.length != 3) 
        return false;
    if (tempArray[0].length == 4) {
        tempy = tempArray[0];
        tempm = tempArray[1];
        tempd = tempArray[2];
    }
    else {
        tempy = tempArray[2];
        tempd = tempArray[1];
        tempm = tempArray[0];
    }
    
    if (tempm.toString().substring(0, 1) == "0") 
        tempm = tempm.toString().substring(1, 2)
    if (tempd.toString().substring(0, 1) == "0") 
        tempd = tempd.toString().substring(1, 2)
    var tDateString = tempy + '/' + tempm + '/' + tempd + ' 8:0:0';//加八小时是因为我们处于东八区 
    var tempDate = new Date(tDateString);
    if (isNaN(tempDate)) 
        return false;
    if (((tempDate.getUTCFullYear()).toString() == tempy) && (tempDate.getMonth() == parseInt(tempm) - 1) && (tempDate.getDate() == parseInt(tempd))) {
        return true;
    }
    else {
        return false;
    }
}
var strCharNum = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
var sPhoneChar = "0123456789()+-";
function IsAccount(string){
    return ISZhongWenAndZiFu(string, strCharNum);
}
function HasChinese(str){
    if (escape(str).indexOf("%u") != -1) 
        return true;
    else 
        return false;
    // for (lgth=0;lgth<=str.length;lgth++)
    //     if ( (str.charCodeAt(lgth)>128) )
    //	return true;
    //  return false;
}
function lTrim(str){
    if (str.charAt(0) == " ") {
        str = str.slice(1);
        //str = str.substring(1, str.length);
        str = lTrim(str);
    }
    return str;
}
function rTrim(str){
    var iLength;
    iLength = str.length;
    if (str.charAt(iLength - 1) == " ") {
        str = str.slice(0, iLength - 1);
        //str = str.substring(0, iLength - 1);
        str = rTrim(str);
    }
    return str;
}
function trim(str){
    return lTrim(rTrim(str));
}
String.prototype.trim = function(){
    return this.replace(/(^[ |　]*)|([ |　]*$)/g, "");
}
function $(s){
    return document.getElementById(s);
}
function $$(s){
    return document.frames ? document.frames[s] : $(s).contentWindow;
}
function getFrameNode(sNode){
    return document.frames ? document.frames[sNode] : document.getElementById(sNode).contentWindow;
}
function $c(s){
    return document.createElement(s);
}
function swap(s, a, b, c){
    $(s)[a] = $(s)[a] == b ? c : b;
}
function exist(s){
    return $(s) != null;
}
function dw(s){
    document.write(s);
}
function hide(s){
    $(s).style.display = $(s).style.display == "none" ? "" : "none";
}
function isNull(_sVal){
    return (_sVal == "" || _sVal == null || _sVal == "undefined");
}
function removeNode(s){
    if (exist(s)) {
        $(s).innerHTML = '';
        $(s).removeNode ? $(s).removeNode() : $(s).parentNode.removeChild($(s));
    }
}
function rsstry(_sUrl){
    try {
        new ActiveXObject("SinaRss.RssObject");
        window.open(_sUrl, "_self");
    } 
    catch (e) {
        window.open("http://rss.voole.com/rss_noreader.html");
    }
}
function getStyleCss(_sId, _sCss){
    var oObj = document.getElementById(_sId);
    return oObj.currentStyle ? oObj.currentStyle[_sCss] : window.getComputedStyle(oObj, "")[_sCss];
}
function setFavorite(){
	sURL = 'http://www.voole.com/';
	sTitle = '普乐网';
	if(document.all){
		window.external.AddFavorite(sURL, sTitle);
	}else{
		window.sidebar.addPanel(sTitle, sURL, "");
	}
}
function setHome(){
	if (document.all){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.voole.com');
	}/*else if(window.sidebar){
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch (e){
				opened("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 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','http://www.voole.com');
	}*/
}

function showList(_sId, _iBegin, _iEnd, _sShow, _sStr){
    var _str;
    for (var i = _iBegin; i <= _iEnd; i++) {
        if (exist(_sShow + i)) {
            $(_sShow + i).style.display = 'none';
        }
    }
    $(_sShow + _sId).style.display = 'block';
    for (var i = _iBegin; i <= _iEnd; i++) {
        _str = $(_sShow + i).style.display;
        //_str == 'none' ? $(_sStr + i).className = 'down' : $(_sStr + i).className = 'up';
    }
}
function hideList(_sId, _sStr, _iBegin, _iEnd, _sShow){
    for (var i = _iBegin; i <= _iEnd; i++) 
        if (exist(_sId + i)) {
            $(_sId + i).style.display = _sStr;
            _sStr == 'none' ? $(_sShow + i).className = 'down' : $(_sShow + i).className = 'up'
        }
}
function getAnchor(_sStr){
    _sStr = _sStr ? _sStr : '#';
    var sUrl = document.location.href;
	return sUrl.indexOf(_sStr) != -1 ? sUrl.substr(sUrl.lastIndexOf(_sStr) + 1) : null;
}
function output(_sHtml, _box){
    var oOutput = typeof(_box) == "object" ? _box : $(_box);
    oOutput.innerHTML = _sHtml;
}
function openWindow(_sUrl, _sWidth, _sHeight, _sTitle, _sScroll){
    var oEdit = new dialog();
    oEdit.init();
    oEdit.set('title', _sTitle ? _sTitle : "系统提示信息");
    oEdit.set('width', _sWidth);
    oEdit.set('height', _sHeight);
    oEdit.open(_sUrl, _sScroll ? 'no' : 'yes');
}
function setCopy(){
	try {
		window.clipboardData.setData('Text',''+ window.document.location +''); 
    } 
    catch (e) {
    }
}
function dwSwf(_sName, _sSrc, _sWidth, _sHeight, _sMode, _aValue){
    var sValue = '';
    var aFlashVars = [];
    if (_aValue) {
        for (key in _aValue) {
            aFlashVars[aFlashVars.length] = key + "=" + _aValue[key];
        }
        sValue = aFlashVars.join('&');
    }
    _sMode = _sMode ? 'wmode="transparent"' : '';
    return '<embed id="' + _sName + '" name="' + _sName + '" src="' + _sSrc + '" ' + _sMode + ' quality="high" align="top" salign="lt" allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + _sWidth + '" height="' + _sHeight + '" flashVars="' + sValue + '"></embed>';
}
function resizeImg(_oObj, _iWidth){
    var tMark = true;
    var iWidth = 0;
    var sOuterHtml;
    var aNode = _oObj.attributes;
    for (var i = 0; i < aNode.length; i++) {
        if (aNode[i].specified) {
            if (aNode[i].name == "width" || aNode[i].name == "height") {
                tMark = false;
            }
        }
    }
    if (tMark) {
        if (_iWidth) {
            setTimeout("resize()", 500);
        }
    }
    this.resize = function(){
        if (_oObj.width > _iWidth) {
            _oObj.width = _iWidth;
        }
    }
}
function ReSizeImg(cName, w, h){
    var reImgs = document.getElementsByTagName("img");
    for (j = 0; j < reImgs.length; j++) {
        if (reImgs[j].className == cName && (reImgs[j].height > h || reImgs[j].width > w)) {
            if (reImgs[j].height == reImgs[j].width) {
                reImgs[j].height = h;
                reImgs[j].width = w;
            }
            else 
                if (reImgs[j].height > reImgs[j].width) {
                    reImgs[j].height = h;
                }
                else 
                    if (reImgs[j].height < reImgs[j].width) {
                        reImgs[j].width = w;
                    }
        }
    }
}
var dd = new Array();
function re_menu(cat, img){
    var step = 40;
    var zoom_0;
    var zoom_1;
    var _h = 0;
    var _obj = document.getElementById(cat);
    var _img = document.getElementById("img" + img);
    if (_obj.style.height == "0px") {
        _img.src = "images/tr_40_1.gif";
        zoom_0 = window.setInterval("movedown()", 30);
    }
    else {
        _img.src = "images/tr_40.gif";
        dd[img] = _obj.offsetHeight;
        zoom_1 = window.setInterval("moveup()", 30);
    }
    this.moveup = function(){
        _h = _obj.offsetHeight;
        _h = _h - step;
        if (_h < 0) {
            window.clearInterval(zoom_1);
            _h = 0;
            _obj.style.height = "0px";
            _obj.style.display = "none";
        }
        else {
            _obj.style.height = _h + "px";
        }
    }
    this.movedown = function(){
        _obj.style.display = "";
        _h = _obj.offsetHeight;
        _h = _h + 10;
        if (_h >= dd[img]) {
            window.clearInterval(zoom_0);
            _h = dd[img];
            _obj.style.height = dd[img] - 20 + "px";
        }
        else {
            _obj.style.height = _h + "px";
        }
    }
}
function linkHref(pars){
    window.location.href = encodeURI(pars);
}
function init_menu(_url){
    var pos, parastr, para, tempstr;
    var hrefstr = window.location.href;
    pos = hrefstr.indexOf("/");
    parastr = hrefstr.substring(pos + 1);
    para = parastr.split("/");
	if(document.referrer.indexOf('best')!=-1){
		para[2]='best';
	}
	if(category!=undefined){
		if(category!=''){
			para[2]=category;
		}
	}
    switch (para[2]) {
        case "new":
            document.getElementById("top_2").innerHTML = '<a href="'+_url+'/new"><img src="/style/images/main_nav2s.jpg" alt="看新片" /></a>';
            break;
		case "news":
            document.getElementById("top_2").innerHTML = '<a href="'+_url+'/new"><img src="/style/images/main_nav2s.jpg" alt="看新片" /></a>';
            break;
        case "movie":
        	if(para[1]=='voole.ha.vnet.cn'){
                document.getElementById("top_2").innerHTML = '<a href="'+_url+'/movie"><img src="/style/images/nav_hnmovies.jpg" alt="电影" /></a>';
                document.getElementById("txt_type").options[0].selected=true;
                break;
        	}else{
                document.getElementById("top_3").innerHTML = '<a href="'+_url+'/movie"><img src="/style/images/main_nav3s.jpg" alt="看电影" /></a>';
                document.getElementById("txt_type").options[0].selected=true;
                break;
        	}

        case "tv":
        	if(para[1]=='voole.ha.vnet.cn'){
                document.getElementById("top_3").innerHTML = '<a href="'+_url+'/movie"><img src="/style/images/nav_hntvs.jpg" alt="电视剧" /></a>';
                document.getElementById("txt_type").options[1].selected=true;
                break;
        	}else{
                document.getElementById("top_4").innerHTML = '<a href="'+_url+'/tv"><img src="/style/images/main_nav4s.jpg" alt="看电视剧" /></a>';
    			document.getElementById("txt_type").options[1].selected=true;
    			break;
        	}
		case "space":
            document.getElementById("top_5").innerHTML = '<a href="'+_url+'/space"><img src="/style/images/main_nav5s.jpg" alt="我的VOOLE" /></a>';
            break;
		case "user":
            document.getElementById("top_5").innerHTML = '<a href="'+_url+'/space"><img src="/style/images/main_nav5s.jpg" alt="我的VOOLE" /></a>';
            break;
		case "best":
            document.getElementById("top_5").innerHTML = '<a href="'+_url+'/best"><img src="/style/images/main_nav9s.jpg" alt="影视快车" /></a>';
            break;
		case "free":
            document.getElementById("top_4").innerHTML = '<a href="'+_url+'/free"><img src="/style/images/nav_hnfrees.jpg" alt="免费体验" /></a>';
            document.getElementById("txt_type").options[3].selected=true;
            break;
		case "hd":
            document.getElementById("top_5").innerHTML = '<a href="'+_url+'/hd"><img src="/style/images/nav_hnhds.jpg" alt="高清影视" /></a>';
            document.getElementById("txt_type").options[2].selected=true;
            break;
		case "search":
			//处理影视快车的更多页面
			best_pos = para[4].indexOf("best");
			if(best_pos>=0){
				document.getElementById("top_5").innerHTML = '<a href="'+_url+'/best"><img src="/style/images/main_nav9s.jpg" alt="影视快车" /></a>';
			}
			tempstr = decodeURI(para[6]);
			if (tempstr.indexOf("_")>-1){
				para = tempstr.split("_");
				tempstr = para[0];
			}
			if (tempstr!="undefined"){document.getElementById("txt_key").value = tempstr;}
            break;
        default:
        	if(para[1]='hn.vnet.voole.com'){
                document.getElementById("top_1").innerHTML = '<a href="'+_url+'/movie"><img src="/style/images/nav_hns.jpg" alt="首页" /></a>';
        	}else{
                document.getElementById("top_1").innerHTML= '<a href="'+_url+'/"><img src="/style/images/main_nav1s.jpg" alt="首页" /></a>';
        	}
  
    }
}
function getparastr(strname){
    var pos, parastr, para, tempstr;
    var hrefstr = window.location.href;
    hrefstr = decodeURI(hrefstr);
    pos = hrefstr.indexOf("?");
    parastr = hrefstr.substring(pos + 1);
    para = parastr.split("&");
    tempstr = "";
    for (i = 0; i < para.length; i++) {
        tempstr = para[i];
        pos = tempstr.indexOf("=");
        if (tempstr.substring(0, pos) == strname) {
            return tempstr.substring(pos + 1);
        }
    }
    return null;
}
function change_class(_sId, _sCss){
    if (exist(_sId)) {
        document.getElementById(_sId).ClassName = _sCss;
    }
}
function change_img(_sId, _sImg){
    if (exist(_sId)) {
        document.getElementById(_sId).src = _sImg;
    }
}
function handleKeyDown(eEvent){
    var oParent = eEvent.target ? eEvent.target : event.srcElement;
    if (eEvent.keyCode == 9) {
        if (eEvent.target) {
            var oStart = oParent.selectionStart;
            var oPos = oParent.selectionEnd;
            var sStart = oParent.value.slice(0, oStart);
            var sEnd = oParent.value.slice(oPos);
            oParent.value = sStart + String.fromCharCode(9) + sEnd;
            setTimeout(function(){
                oParent.focus()
            }, 200);
            oParent.selectionEnd = oPos + 1;
        }
        else {
            oParent.selection = document.selection.createRange();
            oParent.selection.text = String.fromCharCode(9);
            eEvent.returnValue = false;
        }
    }
}
function initSendTime(){
    SENDTIME = new Date();
}
function getSend(){
    var sCurrTime = Math.floor((new Date() - SENDTIME) / 1000);
    return sCurrTime < 0 ? 60 : sCurrTime;
}

function getCookie(cookie_name){
	var allcookies = document.cookie;
	var cookie_pos = allcookies.indexOf(cookie_name);

	if (cookie_pos != -1){
		cookie_pos += cookie_name.length + 1;
		var cookie_end = allcookies.indexOf(";", cookie_pos);
		if (cookie_end == -1){
			cookie_end = allcookies.length;
		}
		var value = decodeURIComponent(allcookies.substring(cookie_pos, cookie_end));
		//decodeURIComponent 可以直接读取Utf-8编码的PHP设置的中文Cookie,如果是GBK,要用unescape，同时PHP设置中文Cookie要escape
	}
	return value;
}
//check ISBROWSER;
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
window.ActiveXObject ? Sys.ie = ua.match(/msie ([\d.]+)/)[1] :
document.getBoxObjectFor ? Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1] :
window.MessageEvent && !document.getBoxObjectFor ? Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1] :
window.opera ? Sys.opera = ua.match(/opera.([\d.]+)/)[1] :
window.openDatabase ? Sys.safari = ua.match(/version\/([\d.]+)/)[1] : 0;
//end
function getFunShowMore(firstId){
    var showId = firstId;
    return function(currShowId){
        document.getElementById(showId).style.display = "none";
        document.getElementById(currShowId).style.display = "";
        showId = currShowId;
    };
}
function CreateFunLabelChange(IDHeader, changeMode, headerShowClass, headerHiddenClass){
    headerShowClass = headerShowClass || '';
    headerHiddenClass = headerHiddenClass || '';
    var headerShowId = IDHeader + '1';
    var divShowId = IDHeader + '1_div';
    return function(currHeaderShowId){
        if (currHeaderShowId == headerShowId) 
            return;
        var currDivShowId = currHeaderShowId + '_div';
        if (changeMode == 0) {
            document.getElementById(currHeaderShowId).className = headerShowClass;
            document.getElementById(headerShowId).className = headerHiddenClass;
        }
        else 
            if (changeMode == 1) {
                document.getElementById(headerShowId).src = document.getElementById(headerShowId).src.replace('s.jpg', '.jpg');
                if (document.getElementById(currHeaderShowId).src.indexOf('s.jpg') == -1) {
                    document.getElementById(currHeaderShowId).src = document.getElementById(currHeaderShowId).src.replace('.jpg', 's.jpg');
                }
            }
        document.getElementById(divShowId).style.display = 'none';
        document.getElementById(currDivShowId).style.display = '';
        headerShowId = currHeaderShowId;
        divShowId = currDivShowId;
    }
    
}
function CreateLabelChangeFun(firstId, changeMode, headerShowClass,
		headerHiddenClass) {
	headerShowClass = headerShowClass || '';
	headerHiddenClass = headerHiddenClass || '';
	var headerShowId = firstId;
	var divShowId = firstId + '_div';
	return function(currHeaderShowId) {
		if (currHeaderShowId == headerShowId)
			return;
		var currDivShowId = currHeaderShowId + '_div';
		if (changeMode == 0) {
			document.getElementById(currHeaderShowId).className = headerShowClass;
			document.getElementById(headerShowId).className = headerHiddenClass;

		} else if (changeMode == 1) {
			document.getElementById(headerShowId).src = document
					.getElementById(headerShowId).src.replace('s.jpg', '.jpg').replace('s.gif','.gif');
			if (document.getElementById(currHeaderShowId).src.indexOf('s.jpg') == -1&&document.getElementById(currHeaderShowId).src.indexOf('s.gif')==-1) {
				document.getElementById(currHeaderShowId).src = document
						.getElementById(currHeaderShowId).src.replace('.jpg',
						's.jpg').replace('.gif','s.gif');
			}
		}
		document.getElementById(divShowId).style.display = 'none';
		document.getElementById(currDivShowId).style.display = '';
		headerShowId = currHeaderShowId;
		divShowId = currDivShowId;
	}
}
var s_id = -1;
var s_num = 0;
var s_tas = 0;
var s_str = '';
function sousuo(){
	window.document.location = '/search/'+$('txt_type').value+'/any/update/'+$('txt_key').value;
}
function hnsousuo(){
	window.document.location = '/search/'+$('txt_type').value+'/hn/update/'+$('txt_key').value;
}
function KeyDowns(e){
	if (e) {
		Key = e.keyCode;
	}else{
		Key = window.event.keyCode;
	}
	switch (Key) {
        case 13://
			sousuo();
			break;
		case 27://esc
            $('search_div').innerHTML = '';
			$("search_div").style.display = 'none';
			$('txt_key').value = s_str;
			s_tas = 0;
			s_id = -1;
            break;
		case 38://up
			Dir(-1);
			break;
		case 40://down
			Dir(1);
			break;
		default:
			if (s_tas==0){
				s_str = $('txt_key').value;
				t_str = $('txt_type').value;
				s_str = trim(s_str);
				if (s_str.length>0){
					var pars=encodeURI('type='+ t_str +'&keyword='+ s_str);
					var myAjax = new Ajax.Request('/search/action/ajaxsearch.php',{method: 'get',requestHeaders:['If-Modified-Since',0],parameters: pars,onComplete: process_key_list});
				}else{
					$('search_div').innerHTML = '';
					$("search_div").style.display = 'none';
				}
			}
		break;
    }
}
function process_key_list(originalRequest){
	var result = originalRequest.responseText;
	if (!IsEmpty(result)&&result!=''){
		var rows = new Array();
			rows = result.split("|");
		if (rows.length>0){
			$("search_div").style.display = 'block';
			s_num = rows.length;
			var textHtml="";
			for (var i = 0; i < rows.length; i++){
				textHtml += '<div id="div_s' + i + '" onmouseover="suggestOver(this);" ';
				textHtml += 'onmouseout="suggestOut(this);" ';
				textHtml += 'onclick="setSearch(this.innerHTML);" ';
				textHtml += 'class="search_link">' + rows[i] + '</div>';
			}
			$('search_div').innerHTML = textHtml;
		}
	}
}
function setSearch(div_value){
	$("txt_key").value = div_value;
	$("search_div").style.display = 'none';
}

function suggestOver(div_value){
	div_value.className = 'search_link_over';
}

function suggestOut(div_value){
	div_value.className = 'search_link';
}
function sel(id){
	for (var j=0;j<s_num ;j++ ){ 
		suggestOut($('div_s'+j));
	}
	if (id>=0){
		suggestOver($('div_s'+id));
	}
}
function Dir(num){
    s_tas = 1;
	s_id += num;
	if (s_id>=s_num||s_id==-1) {
		s_id = -1;
		_SStr = s_str;
	}else if(s_id<-1){
		s_id = s_num-1;
		_SStr = $('div_s'+s_id).innerHTML;
	}else{
		_SStr = $('div_s'+s_id).innerHTML;
	}
	sel(s_id);
	$("txt_key").value = _SStr;
}
//
var _defaultUpdatingIcon = '<img style="vertical-align: middle" src="images/loader.gif">&nbsp;&nbsp;';
var _defaultUpdatingMessage = '正在查询，请稍后...';
var _updatingResultsMessage = null;
function showmessage(text,msgdivId){
    var msgbox = document.getElementById(msgdivId);
    if (msgbox != null) {
        msgbox.innerHTML = text;
        msgbox.style.left  = Math.round((document.body.clientWidth - msgbox.offsetWidth) / 2) + "px" ;
        msgbox.style.top   = Math.round(((document.body.clientHeight - msgbox.offsetHeight) / 3) + document.body.scrollTop) + "px";
        msgbox.style.visibility = 'visible';
    }
}

function hidemessage(msgdivId){
    var msgbox = document.getElementById(msgdivId);
    if (msgbox != null) {
        msgbox.innerHTML = "";
        msgbox.style.visibility = 'hidden';
    }
}

function getUpdateMessage(defaultMsg){
        var msgToShow = _defaultUpdatingIcon;
        if (_updatingResultsMessage != null && _updatingResultsMessage.length > 0) {
            msgToShow += _updatingResultsMessage;
        } else if (defaultMsg != null && defaultMsg.length > 0) {
            msgToShow += defaultMsg;
        } else {
            msgToShow += _defaultUpdatingMessage;
        }
        return msgToShow;
}
//
function startLoadingAnimation() {
	$('loading_animation').style.visibility = 'visible';
}

function stopLoadingAnimation() {
	$('loading_animation').style.visibility = 'hidden';
}

function removePreloadedImages(evt) {
	$(this).stopObserving();
}

function preloadImage(url) {
	var img = new Image();
	img.src = url;
	Event.observe(img, "load", removePreloadedImages.bindAsEventListener(img));
}