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 $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.sina.com.cn/rss_noreader.html");}}
function getStyleCss(_sId, _sCss){var oObj = document.getElementById(_sId);return oObj.currentStyle ? oObj.currentStyle[_sCss] : window.getComputedStyle(oObj, "")[_sCss];}
function setHome(){try{window.external.AddFavorite(window.document.location,window.document.title)}catch(e){};}
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 read(_sUid,_sDate){get('/sns/service.php?m=aListByDate&uid=' + _sUid + '&date=' + _sDate,'/xsl/feeds.xsl','feeds','output','box_2');}
function commentSubmit(_sVid){$("src_title" + _sVid).value = $("commentText" + _sVid).innerHTML;$("src_uname" + _sVid).value = AUTHOR;$('form' + _sVid).submit();}
function output(_sHtml, _box){var oOutput = typeof(_box) == "object" ? _box : $(_box);oOutput.innerHTML = _sHtml;}
function setCopy(_sTxt){try{clipboardData.setData('Text',_sTxt)}catch(e){}}
function isIE(){return BROWSER.indexOf('ie') > -1;}

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 initLoad(){if(BONLOADMARK){for(key in AONLOAD){eval(AONLOAD[key]);}}}
function vbbcode_winshow(c, p){	var i = p.style.display;c.innerHTML	= c.innerHTML == "&lt;&lt;&nbsp;" ? "&gt;&gt;&nbsp;" : "&lt;&lt;&nbsp;"; p.style.display = (i == "") ? "none" : "";}

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 initSendTime(){
	SENDTIME = new Date();
}
function getSend(){
	var sCurrTime = Math.floor((new Date() - SENDTIME)/1000);
	return sCurrTime < 0 ? 20 : sCurrTime;
}
function sns_resize(_oObj){
	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){setTimeout("resize()",500);}
	this.resize = function(){if(!_oObj.attributes['RESIZEWIDTH']){return}if(_oObj.width > _oObj.attributes['RESIZEWIDTH'].value){_oObj.width = _oObj.attributes['RESIZEWIDTH'].value;}}
}

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 showCount(){
	try{
		show=count;
		if(Math.abs(show) > 0){
			for(i = show.length; i < 5; i++){show = "0" + show;}
			for(i = 0; i < show.length; i++){
				document.write("<img alt='" + show.substr(i,1) + "' title='" + show.substr(i,1) + "' src='http://image2.sina.com.cn/blog/tmpl/v3/images/counter/" + COUNTTHEME + "/" + show.substr(i,1) + ".gif'/>");
			}
		}
	}
	catch(e){}
}

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 browserDetect(){
	var sUA = navigator.userAgent.toLowerCase();
	var sIE = sUA.indexOf("msie");
	var sOpera = sUA.indexOf("opera");
	var sMoz = sUA.indexOf("gecko");
	if (sOpera != -1) return "opera";
	if (sIE != -1){
		nIeVer = parseFloat(sUA.substr(sIE + 5));
		if (nIeVer >= 6) return "ie6";
		else if (nIeVer >= 5.5) return "ie55";
		else if (nIeVer >= 5 ) return "ie5";
	}
	if (sMoz != -1)	return "moz";
	return "other";
}
var BROWSER = browserDetect();
document.write("<script type='text/javascript' src='/js/" + BROWSER + ".js'></script>");
var CACHE = {"outline":[]};
var CONFIG = {"readfile":""};
var AONLOAD = [];
var SENDTIME = new Date("2005","9","8","10","0","0");
var BONLOADMARK = true;
function commentSubmit(_sVid){
	var sHomePage = $('form' + _sVid)['homepage'].value;
	var sLoginName = $('form' + _sVid)['loginname'].value;
	var sCheckWd = $('form' + _sVid)['checkwd'].value;
	var sContent = $('form' + _sVid)['content'].value;
	var sDialog = new dialog();
	sDialog.init();
	if(getSend()<10){
		sDialog.event('请勿在短时间内多次发送信息 :)<br/> 您需要耐心等待 ' + (10 - getSend()) + ' 秒，就可以发表评论了.','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	if(sLoginName == ''){
		sDialog.event('请输入您的昵称!','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	
	if(sHomePage != '' && sHomePage.substr(0, 7) != 'http://' && sHomePage.length < 8){
		sDialog.event('请输入URL地址!','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	
	if(sCheckWd == ''){
		sDialog.event('请输入验证码!','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	
	if(sContent == ''){
		sDialog.event('请输入评论内容!','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	initSendTime();
	$("src_title" + _sVid).value = $("commentText" + _sVid).innerHTML;
	$("src_uname" + _sVid).value = AUTHOR;$('form' + _sVid).submit();
}
function gbookSubmit(_sVid){
	var sCheckWd = $('form' + _sVid)['checkwd'].value;
	var sContent = $('form' + _sVid)['content'].value;
	var sDialog = new dialog();
	sDialog.init();
	if(getSend()<10){
		sDialog.event('请勿在短时间内多次发送信息 :)<br/> 您需要耐心等待 ' + (10 - getSend()) + ' 秒，就可以发表留言了.','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	if(sCheckWd == ''){
		sDialog.event('请输入验证码!','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	
	if(sContent == ''){
		sDialog.event('请输入留言内容!','');
		sDialog.button('dialogOk','void 0');
		$('dialogOk').focus();
		return false;
	}
	initSendTime();
	return true;
}
function getFrameNode(sNode){
	return document.frames ? document.frames[sNode] : document.getElementById(sNode).contentWindow;
}
function checkwd_reload(){
		if (document.getElementById("user_login_info")) {
			ob = getFrameNode("user_login_info").document.getElementById("chk_img");
		}
		else {
       		 ob = document.getElementById("chk_img");
		 }
		ob.src = '/myblog/checkwd_image.php?' + new Date();
}
function ResizeSWF(nWidth, nHeight) {
	var swf = $("music");
	var obj = $("musicFlash");
	swf.style.width = nWidth;
	swf.style.height = nHeight;
	obj.width = nWidth;
	obj.height = nHeight;
}
function SearchIASK(sString) {
	var _form = document.createElement("form");
	_form.style.display = "none";
	_form.action = "http://m.iask.com/g";
	_form.target = "_blank";
	var _input = document.createElement("input");
	_input.value = "yes";
	_input.name = "utf";
	_form.appendChild(_input);
	var _input = document.createElement("input");
	_input.value = sString;
	_input.name = "k";
	_form.appendChild(_input);
	document.body.appendChild(_form);
	_form.submit();
	_form.parentNode.removeChild(_form);
}

function LocalPlay(sString) {
	window.open(sString);
}
function openPic(sString) {
	window.open(sString);
}

