if (top.location.href==location.href){

	document.write('<script language=JavaScript src="http://images.xxsy.net/js/20110801/pagetop_20111013.js" charset="utf-8"><\/script>');
}

if(!window.$)window.$=function (s){return document.getElementById(s);}

function killErrors() {
  return true;
}
//window.onerror = killErrors;

if(document.location.href.toString().indexOf("vip.xxsy.net")>0)
{
 document.domain="xxsy.net";
}
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0,maxlimit);
	}else{ 
		countfield.value = maxlimit - field.value.length;
	}
}

function ignoreSpaces(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split(" "); //双引号之间是个空格； 
	for(i = 0; i < splitstring.length; i++){
		temp += splitstring[i];

	}
		var re=new RegExp("([\#\$\%\^\&\*\(\~\!\@\s\?\>\<\"\'\:\;\.\,\＃￥％……＆×｜｝｛［］：＂＜＞？（）\/]){2,}","gi")
		temp=temp.replace(re,"$1");
	return temp;
}


function autoResize()
{
	try	{
		
		 setTimeout('$("test").style.height=$("test").contentWindow.document.body.scrollHeight+"px";',200);
	}catch(e){}
}

function autoResize2()
{
	try{		
		  setTimeout('$("test2").style.height=$("test2").contentWindow.document.body.scrollHeight+"px";',200);
		
	}catch(e){}
}


function checkReg()
{
	if (document.form.memo.value == ""||document.form.memo.value=="游客可在此直接发表评论"){
		alert ("提示：\n\n必须输入书评内容");
		document.form.memo.focus();
		return false;
	}
	if (document.form.memo.value.length < 5||document.form.memo.value.length>5000){
		alert ("提示：\n\n书评内容不得少于 5 字,发表长评必须在500-5000字之间");
		document.form.memo.focus();
		return false;
	}
	if (document.form.memo.value.length < 500 && document.form.changping.checked==true){
		alert ("提示：\n\n发表长评必须在500-5000字之间");
		document.form.memo.focus();
		return false;
	}
	if (document.form.memo.value.length > 299 && document.form.changping.checked==false){
		alert ("提示：\n\n您的书评字数已经超过300字.\n\n请您在登陆后勾选[我要发表长篇评论]再进行提交.");
		document.form.memo.focus();
		return false;
	}
              var pattern = /[\u4E00-\u9FA5]/g;
              if (pattern.test(document.form.memo.value)==false){
		alert ("提示：\n\n必须输入正规的书评内容,不要胡乱发贴!");
		document.form.memo.focus();
		return false;
	}
      window.form.send.disabled = true;
}

function call(htmlurl)
{
	var sname="",vipbook=1;
	var thishref=document.location.href;
		
	if(thishref.indexOf("/info/")>0){sname=bookname;vipbook=bookvip;}
	if(thishref.indexOf("/vipshowbook\.asp")>0 || thishref.indexOf("/vipbook\.aspx")>0){sname=bookname;}
	if(thishref.indexOf("/books/")>0 ){sname=shuming;}
	
	var stitle="投月票给:" +sname;
	if(htmlurl.toString().indexOf("shoucang")>0){
		stitle="收藏作品:" +sname;
	}
	
		
	myBox.Frame(500,250,htmlurl+"&bookvip="+vipbook+"&authorid="+authorid,stitle,"no");
	return false;
}

function showauthor(authorid)
{
	myBox.Frame(500,280,'http://read.xxsy.net/authorinfo_index.asp?authorid='+authorid,"作者作品一览","no");
	return false;
}

function copyInBoard(s) { 			
	window.clipboardData.setData("text",s);
	alert("本书网址复制成功啦,请直接按Ctrl+V粘贴,送给QQ或MSN好友分享!");
}

function iecompattest(){
		return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
	}

