//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{timer=setInterval ("scrollwindow ()",30);}
function sc()
{clearInterval(timer);}
function scrollwindow()
{currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();}
document.onmousedown=sc;
document.ondblclick=initialize;

function myopen(objID)
{
	if (document.getElementById(objID).style.display == "none") {
		document.getElementById(objID).style.display = "";
	}else{
		document.getElementById(objID).style.display = "none";
	}
}
//缩放图片大小
function bbimg(o)
{var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;}
function window.onhelp() {//屏蔽F1帮助
return false}
function document.onkeydown() {
	if (event.keyCode==116) {//屏蔽F5键
		event.keyCode = 0;
		event.cancelBubble = true;
		return false;
	}
	if (event.keyCode==122) {//屏蔽F11键
		event.keyCode = 0;
		event.cancelBubble = true;
		return false;
	}
	if ((event.ctrlKey && event.keyCode==82)) {//屏蔽Ctrl+R
		event.keyCode = 0;
		event.cancelBubble = true;
		return false;
	}
	if ((event.ctrlKey && event.keyCode==78)) {//屏蔽Ctrl+N
		event.keyCode = 0;
		event.cancelBubble = true;
		return false;
	}
	if ((event.keyCode == 8) && (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password")) {//屏蔽BackSpace键
		event.keyCode = 0;
		event.cancelBubble = true;
		return false;
	}
}

// 新闻、文章的字体大小改变函数
function ContentSize(size)
{
var obj=document.getElementById("size");obj.style.fontSize=size+"px";
}
// 新闻、文章的复制文本函数
function copyText(obj) 
{
var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.scrollIntoView();rng.select();rng.execCommand("Copy");rng.collapse(false);
}
//UBB使用
function bookcount(message,total,used,remain)
{
	var max;
	max = total.value;
	if (message.value.length > max) {
	message.value = message.value.substring(0,max);
	used.value = max;
	remain.value = 0;
	alert("内容不能超过" +max+ "个字!");
	}
	else {
	used.value = message.value.length;
	remain.value = max - used.value;
	}
}
  function copycode(obj){
	obj.select();
	js=obj.createTextRange();
	js.execCommand("Copy");
}
function bookshowLen(obj)
{document.getElementById("wordsLen").value=obj.value.length;}
function bookcount(message,total,used,remain)
{
	var max;
	max = total.value;
	if (message.value.length > max) {
	message.value = message.value.substring(0,max);
	used.value = max;
	remain.value = 0;
	alert("内容不能超过" +max+ "个字!");
	}
	else {
	used.value = message.value.length;
	remain.value = max - used.value;
	}
}
function saveas(obj){
	var winname=window.open('','test','top=10000');
	winname.document.open("text/html", "replace");
	winname.document.write(obj.value);
	winname.document.execCommand('saveas','','YCMSCODE.html');
	winname.close();
}
function runcode(obj)
{
var winname=window.open("","test","");
winname.document.open("text/html", "replace");
winname.document.write(obj.value);
winname.document.close();
}
var oTRG;
function calLeftBytes(oTA,oNum)
{
	if(oTA.value.length > oNum)
		alert("你输入的内容已超出允许范围，请适当删减或分多帖发布。");
	else
		 alert("还可输入 " + (oNum - oTA.value.length) + " 个字符。");
}
function storeRng(oTA){
	if(document.all){
		if(oTRG = document.selection.createRange().duplicate())
		{
			return true;
		}
	}
}
function insertToRng(oTA,text,n){
	var oRng=oTA.createTextRange();
	if(oRng){
		if(!oTRG){
			oTRG=oRng;
			oTRG.moveStart('character',oTRG.text.length);
			oTRG.collapse(true);
			oTRG.select();
		}
		if(n>0){
			oTRG.text = text.substr(0,text.length-n) + oTRG.text + text.substr(text.length-n);
		}
		else{
			oTRG.text = oTRG.text + text;
		}
		oTRG.moveStart('character',-n);
		oTRG.collapse(true);	     
		oTRG.select();
	} else {
		oTA.value += text;
	}
}
function ubbAdd(str,n)
{
	if(document.all && document.w && document.w.content){
		insertToRng(document.w.content,str,n);
		document.w.content.focus();
		}else{
		document.w.content.value += str;
		document.w.content.focus();
		}
}
//翻页
function showPageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\" title='第 1 页'><FONT face=Webdings>9</FONT></a> ");
	document.write("<a href=\"" + sUrl + i + "\" title='上一页(第 " + i + " 页)'><FONT face=Webdings>7</FONT></a> ");
	for(i=Math.max(1,iPage-5);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\" title='第 " + i + " 页'><b>" + i + "</b></a> ");
	}
	document.write("<font color='#ff3333'><b>" + iPage + "</b></font> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+5);i++){
		document.write("<a href=\""+sUrl + i + "\" title='第 " + i + " 页'><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	if(iCount>iPage+5) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\" title='下一页(第 " + i + " 页)'><FONT face=Webdings>8</FONT></a> ");
	document.write("<a href=\"" + sUrl + iCount + "\" title='最后一页(第 " + iCount + " 页)'><FONT face=Webdings>:</FONT></a> ");
}
//控制面板
var flag=false;
function DrawImage(ImgD,iwidth,iheight){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
     if(image.width>iwidth){  
     ImgD.width=iwidth;
     ImgD.height=(image.height*iwidth)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     //ImgD.alt=image.width+"×"+image.height;
     }
    else{
     if(image.height>iheight){  
     ImgD.height=iheight;
     ImgD.width=(image.width*iheight)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     //ImgD.alt=image.width+"×"+image.height;
     }
    }
   /*else{
    ImgD.src="";
    ImgD.alt=""
    }*/
   } 
window.onerror=new Function("return true");
function $(ID)
{
    if(document.getElementById&&document.getElementById(ID))
	{
		return document.getElementById(ID);
	}
	else if (document.all&&document.all(ID)) 
	{
		return document.all(ID);
	}
	else if (document.layers&&document.layers[ID])
	{
		return document.layers[ID];
	}
    else
    {
		return false;
	}
}
function Display(ID){
	if ($(ID).style.display == "none"){
		$(ID).style.display="";
	}else{
	    $(ID).style.display="none";
	}
}

function Print(Str)
{
return document.write(Str);
}
function Flash(Path,Width,Height)
{
var Tmp
	Tmp='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="FlashH" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+Width+'" height="'+Height+'">'
	Tmp+='<param name="movie" value="'+Path+'"/>'
	Tmp+='<param name="quality" value="High"/>'
	Tmp+='<param name="scale" value="ExactFit"/>'
	Tmp+=' <param name="wmode" value="transparent"/>';
	Tmp+='<embed wmode="transparent" src="'+Path+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="FlashH" width="'+Width+'" height="'+Height+'" scale="ExactFit"/>'
	Tmp+='</object>'
Print(Tmp);
}