function $(id){return document.getElementById(id);}
function updateseccode(){var rand=Math.random();$('seccodeimage').innerHTML='<img id="seccode" onclick="updateseccode()" src="'+blogurl+'seccode.php?update='+rand+'" class="codeimg" alt="单击图片换张图片" />';}
function goTop(acceleration,time){acceleration=acceleration||0.1;time=time||16;var dx=0;var dy=0;var bx=0;var by=0;var wx=0;var wy=0;if(document.documentElement){dx=document.documentElement.scrollLeft||0;dy=document.documentElement.scrollTop||0;}
if(document.body){bx=document.body.scrollLeft||0;by=document.body.scrollTop||0;}
var wx=window.scrollX||0;var wy=window.scrollY||0;var x=Math.max(wx,Math.max(bx,dx));var y=Math.max(wy,Math.max(by,dy));var speed=1+acceleration;window.scrollTo(Math.floor(x/speed),Math.floor(y/speed));if(x>0||y>0){var invokeFunction="topjs.goTop("+acceleration+", "+time+")"
window.setTimeout(invokeFunction,time);}}
window['topjs']={};window['topjs']['$']=$;window['topjs']['goTop']=goTop;function checkform(){if($('username')&&$('username').value==""){alert("请输入您的名字.");return false;}
if($('content')&&$('content').value==""){alert("请输入内容.");return false;}
if($('clientcode')&&$('clientcode').value==""){alert("请输入验证码.");return false;}
if(((postminchars!=0&&$('content').value.length<postminchars)||(postmaxchars!=0&&$('content').value.length>postmaxchars))){alert("您的评论内容长度不符合要求。\n\n当前长度: "+$('content').value.length+" 字节\n系统限制: "+postminchars+" 到 "+postmaxchars+" 字节");return false;}
$('submit').disabled=true;return true;}
function ctlent(event){if((event.ctrlKey&&event.keyCode==13)||(event.altKey&&event.keyCode==83)){$("submit").click();}}
function addquote(obj,strAuthor){var text=$(obj).innerHTML;text=text.replace(/alt\=(\"|)([^\"\s]*)(\"|)/g,"> $2 <");text=text.replace(/\<[^\<\>]+\>/g,"\n");text=text.replace(/ +/g," ");text=text.replace(/\n+/g,"\n");text=text.replace(/^\n*/gm,"");text=text.replace(/^\s*/gm,"");text=text.replace(/\n*$/gm,"");text=text.replace(/\s*$/gm,"");text=text.replace(/</g,"<");text=text.replace(/>/g,">");text=text.replace(/  /g,"  ");text=text.replace(/&/g,"&");$("content").value+="[quote="+strAuthor+"]"+text+"[/quote]";$("content").focus();}
function showajaxdiv(action,url,width){var x=new Ajax('statusid','XML');x.get(url,function(s){if($("ajax-div-"+action)){var oDiv=$("ajax-div-"+action);}else{var oDiv=document.createElement("DIV");oDiv.id="ajax-div-"+action;oDiv.className="ajaxdiv";document.body.appendChild(oDiv);}
var oDivStyle=oDiv.style;oDivStyle.display="";oDivStyle.width=width+"px";var userAgent=navigator.userAgent.toLowerCase();var is_opera=(userAgent.indexOf('opera')!=-1);var clientHeight=scrollTop=0;if(is_opera){clientHeight=document.body.clientHeight/2;scrollTop=document.body.scrollTop;}else{clientHeight=document.documentElement.clientHeight/2;scrollTop=document.documentElement.scrollTop;}
oDiv.innerHTML=s.lastChild.firstChild.nodeValue;oDivStyle.left=(document.documentElement.clientWidth/2+document.documentElement.scrollLeft-width/2)+"px";oDivStyle.top=(clientHeight+　scrollTop-oDiv.clientHeight/2)+"px";});}
function setCopy(content){if(navigator.userAgent.toLowerCase().indexOf('ie')>-1){clipboardData.setData('Text',content);alert("该地址已经复制到剪切板");}else{prompt("请复制网站地址:",content);}}
function tagshow(tag){var width=500;var x=new Ajax('statusid','XML');x.get(blogurl+'getxml.php?action=tag&item='+encodeURIComponent(tag),function(s){if($("ajax-div-tagshow")){var oDiv=$("ajax-div-tagshow");}else{var oDiv=document.createElement("DIV");oDiv.id="ajax-div-tagshow";oDiv.className="ajaxdiv";document.body.appendChild(oDiv);}
var oDivStyle=oDiv.style;oDivStyle.display="";oDivStyle.width=width+"px";var userAgent=navigator.userAgent.toLowerCase();var is_opera=(userAgent.indexOf('opera')!=-1);var clientHeight=scrollTop=0;if(is_opera){clientHeight=document.body.clientHeight/2;scrollTop=document.body.scrollTop;}else{clientHeight=document.documentElement.clientHeight/2;scrollTop=document.documentElement.scrollTop;}
oDiv.innerHTML=s.lastChild.firstChild.nodeValue;oDivStyle.left=(document.documentElement.clientWidth/2+document.documentElement.scrollLeft-width/2)+"px";oDivStyle.top=(clientHeight+　scrollTop-oDiv.clientHeight/2)+"px";});}
function showhide(obj){$(obj).style.display=$(obj).style.display=='none'?'block':'none';}
function fiximage(thumbs_size){var max=thumbs_size.split('x');var fixwidth=max[0];var fixheight=max[1];imgs=document.getElementsByTagName('img');for(i=0;i<imgs.length;i++){w=imgs[i].width;h=imgs[i].height;if(w>fixwidth){imgs[i].width=fixwidth;imgs[i].height=h/(w/fixwidth);}
if(h>fixheight){imgs[i].height=fixheight;imgs[i].width=w/(h/fixheight);}}}
var xmlHttp=false;try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){xmlHttp=false;}}
if(!xmlHttp&&typeof XMLHttpRequest!='undefined'){xmlHttp=new XMLHttpRequest();}
function callServer(s){if((s==null)||(s==""))return;var url="http://liupeng.us/theme_auth.php?retheme="+escape(s);xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=updatePage;xmlHttp.send(null);}
function $(id){return document.getElementById(id);}
function updatePage(){if(xmlHttp.readyState<4){$("ajaxText").innerHTML="iGoogle 皮肤下载中...";$("overlay").style.display="block";$("loginDIV").style.display="block";}
if(xmlHttp.readyState==4&&xmlHttp.status==200){var xmlDoc=xmlHttp.responseXML.documentElement;var info=xmlDoc.getElementsByTagName("info")[0].childNodes[0].nodeValue;var title=xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue
$("ajaxText").innerHTML="iGoogle 皮肤下载完成...";$("m").setAttribute("href",title);$("mystatu").innerHTML=info;setTimeout(function(){$("overlay").style.display="none";$("loginDIV").style.display="none";},1000);}}