var sPop = null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Tahoma, 宋体; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 11px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; visibility: hidden;TEXT-ALIGN: left; filter: Alpha(Opacity=80)}");

document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000;filter:blendtrans(duration=.2) revealTrans(duration=.1,transition=12) alpha(opacity=90,enabled=1)' class='cPopText'></div>");


function showPopupText() {
	var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	if(o.alt!=null && o.alt!="") { o.pop=o.alt;o.alt="" }
        if(o.title!=null && o.title!=""){ o.pop=o.title;o.title="" } 
		if(o.pop) { 
			o.pop=o.pop.replace("\n","<br>"); 
		    o.pop=o.pop.replace("\n","<br>");	
					}
	if(o.pop!=sPop) {
		sPop=o.pop;
		if(sPop==null || sPop=="") {
			popLayer.filters[0].apply();
			popLayer.style.visibility="hidden";	
			popLayer.filters[0].play();
			popLayer.style.width=""
		} else {
			if(o.dyclass!=null) popStyle=o.dyclass 
			else popStyle="cPopText";
             
			popLayer.filters[1].apply();
			popLayer.style.visibility="visible";
			popLayer.filters[1].play();
			showIt();
			if (popLayer.offsetWidth>300)
			{
				popLayer.style.width=300
			}
		}
	}
}

function showIt() {
	popLayer.className=popStyle;
	popLayer.innerHTML=sPop;

	popWidth=popLayer.clientWidth;
	popHeight=popLayer.clientHeight;
	if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
		else popLeftAdjust=0;
	if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
		else popTopAdjust=0;
	popLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
	popLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
}

document.onmouseover=showPopupText;

var postSubmited = false;
function ctlent(obj) {
	if(postSubmited == false && (event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
			if(this.document.input.topicsubmit) this.document.input.topicsubmit.disabled = true;
			if(this.document.input.replysubmit) this.document.input.replysubmit.disabled = true;
			if(this.document.input.editsubmit) this.document.input.editsubmit.disabled = true;
			postSubmited = true;
			this.document.input.submit();
	}
}

var flag=false; 
function DrawImage(ImgD){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width>=720){ 
			ImgD.width=720; 
			ImgD.height=(image.height*720)/image.width; 
		}else{ 
			ImgD.width=image.width; 
			ImgD.height=image.height; 
		}  
	} 
} 

function showIntro(objID)
{
	if (document.getElementById(objID).style.display == "none") {
		document.getElementById(objID).style.display = "";
	}else{
		document.getElementById(objID).style.display = "none";
	}
}

function winconfirm(confirmMSG,confirmURL){
	question = confirm(confirmMSG);
	if (question != "0"){
		window.location=confirmURL;
	}
}

function CopyText(obj) {
	ie = (document.all)? true:false
	if (ie){
		var rng = document.body.createTextRange();
		rng.moveToElementText(obj);
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
	}
}

function copyCode(obj) {
	var rng = document.body.createTextRange();
	rng.moveToElementText(obj);
	rng.scrollIntoView();
	rng.select();
	rng.execCommand("Copy");
	rng.collapse(false);
}

function runCode(obj) {
	var winname = window.open('', "_blank", '');
	winname.document.open('text/html', 'replace');
	winname.document.writeln(obj.value);
	winname.document.close();
}

function saveCode(obj) {
	var winname = window.open('', '_blank', 'top=10000');
	winname.document.open('text/html', 'replace');
	winname.document.writeln(obj.value);
	winname.document.execCommand('saveas','','code.htm');
	winname.close();
}

function UBBShowObj(strType,strID,strURL,intWidth,intHeight)
{
	var varHeader="V";
	var tmpstr="";
	var bSwitch = false;
	bSwitch = document.getElementById(varHeader+strID).value;
	bSwitch	=~bSwitch;
	document.getElementById(varHeader+strID).value = bSwitch;
	if(bSwitch){
		document.getElementById(strID).innerHTML = "本影音源文件地址已隐藏，请点上面的显示连接直接播放欣赏";
	}else{
		switch(strType.toUpperCase()){
			case "SWF":
				tmpstr="<object codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+intWidth+"' height='"+intHeight+"'><param name='movie' value='"+strURL+"'><param name='quality' value='high'><param name='AllowScriptAccess' value='never'><embed src='"+strURL+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+intWidth+"' height='"+intHeight+"'>'"+strURL+"'</embed></OBJECT>";
				break;
			case "WMA":
				tmpstr="<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'  id='MediaPlayer' width='"+intWidth+"' height='"+intHeight+"'><param name='ShowStatusBar' value='-1'><param name='AutoStart' value='True'><param name='Filename' value='"+strURL+"'></object>";
				break;
			case "WMV":
				tmpstr="<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' width='"+intWidth+"' height='"+intHeight+"'><param name='ShowStatusBar' value='-1'><param name='AutoStart' value='Ture'><param name='Filename' value='"+strURL+"'></object>";
				break;
			case "RM":
				tmpstr="<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='"+intHeight+"' id='Player' width='"+intWidth+"' viewastext><param name='_ExtentX' value='12726'><param name='_ExtentY' value='8520'><param name='AUTOSTART' value='0'><param name='SHUFFLE' value='0'><param name='PREFETCH' value='0'><param name='NOLABELS' value='0'><param name='CONTROLS' value='ImageWindow'><param name='CONSOLE' value='_master'><param name='LOOP' value='0'><param name='NUMLOOP' value='0'><param name='CENTER' value='0'><param name='MAINTAINASPECT' value='"+strURL+"'><param name='BACKGROUNDCOLOR' value='#000000'></object><br><object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='32' id='Player' width='"+intWidth+"' VIEWASTEXT><param name='_ExtentX' value='18256'><param name='_ExtentY' value='794'><param name='AUTOSTART' value='-1'><param name='SHUFFLE' value='0'><param name='PREFETCH' value='0'><param name='NOLABELS' value='0'><param name='CONTROLS' value='controlpanel'><param name='CONSOLE' value='_master'><param name='LOOP' value='0'><param name='NUMLOOP' value='0'><param name='CENTER' value='0'><param name='MAINTAINASPECT' value='0'><param name='BACKGROUNDCOLOR' value='#000000'><param name='SRC' value='"+strURL+"'></object>";
				break;
			case "QT":
				tmpstr="<embed src='"+strURL+"' autoplay='true' Loop='false' controller='true' playeveryframe='false' cache='false' scale='TOFIT' bgcolor='#000000' kioskmode='false' targetcache='false' pluginspage='http://www.apple.com/quicktime/'>";
				break;
			case "RA":
				tmpstr="<object classid='clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' id='RAOCX' width='"+intWidth+"' height='"+intHeight+"'><param name='_ExtentX' value='6694'><param name='_ExtentY' value='1588'><param name='AUTOSTART' value='0'><param name='SHUFFLE' value='0'><param name='PREFETCH' value='0'><param name='NOLABELS' value='0'><param name='SRC' value='"+strURL+"'><param name='CONTROLS' value='StatusBar,ControlPanel'><param name='LOOP' value='0'><param name='NUMLOOP' value='0'><param name='CENTER' value='0'><param name='MAINTAINASPECT' value='0'><param name='BACKGROUNDCOLOR' value='#000000'><embed src='"+strURL+"' width='253' autostart='true' height='60'></embed></object>"
		}
		document.getElementById(strID).innerHTML = tmpstr;
	}
}

function AutoSizeDIV(objID){
	var obj=document.getElementById(objID);
	if (obj.scrollHeight < obj.offsetHeight){
		obj.style.height = obj.scrollHeight+2;
	}
}
var En=new Array()
var Ch=new Array()
var Ei=0
function showE(first){
if (first!=1) SEng.filters[0].apply();
SEng.innerHTML="<span class=EnText>"+En[Ei]+"</span><br><span class=ChText>"+Ch[Ei]+"</span>"
if (first!=1) SEng.filters[0].play();
Ei++
if (Ei==En.length) {Ei=0}
}

/*
纯粹手写板 V1.2
提供: 纯粹空间 http://www.softpure.com
作者: 暖阳
*/
var spcodeChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
function spcode_dec(c,spcodeChars){ //纯粹码转为数字
	c = c.split('');
	return spcodeChars.indexOf(c[0])*spcodeChars.length + spcodeChars.indexOf(c[1]);
}

function createShapes(code,win){
	try{	
		win.teller = 0;
		code = code.replace(/(^\s*\[whitepad\])|(\[\/whitepad\]\s*$)/gim,'').replace(/\*(\d+)\//g,function(a,b){var i,s='';for(i=0;i<b;i++) s+='*';return s}).replace(/\*/g,"*;");
		if(!code) return true;

		var allowShapes = "shape;oval;rect;roundrect";
		var props = ('tagName=shape;style.left=0;style.top=0;style.width=1600;style.height=1200;coordsize=1600,1200;fillcolor=;strokecolor=black;strokeweight=1.5;path').split(';');
		var lastValues = new Array(props.length);

		var shapes = code.split('|');
		for(i=0;i<shapes.length;i++){
			var shape = shapes[i].split(';');
			var node = null;			
			for(j=0;j<props.length;j++){
				var prop_arr = props[j].split('=',2);
				if(i==0 && (prop_arr[1]||prop_arr[1]==='')) lastValues[j] = prop_arr[1];
				var prop = prop_arr[0];
				var value = shape[j];
				if(value=='*') value = lastValues[j];
				else lastValues[j] = value;
				if(prop=='tagName' && value){
					var re =  new RegExp("(^|;)("+value+")(;|$)","i");
					if(allowShapes.match(re))
						node = win.document.createElement('<v:'+value+' id="nr'+(win.teller+1)+'" style="POSITION:absolute;"></v:'+value+'>');
				}else if(node && value){
					if(prop=='path' && value.match(/^\w+$/)){
						value = value.replace(/(\w{2})/g,function(a){return ','+spcode_dec(a,spcodeChars)}).replace(/^(,)(\d+)(,)(\d+)(,)(\d+)/g,"m$2$3$4 l$6")+' e';
					}
					eval("node."+prop+" = \""+value+"\";");
				}
				else if(prop=='fillcolor' && !value) node.filled = false;
				else if(prop=='strokecolor' && !value) node.stroked=false;
			}
			if(node){
				win.teller ++;
				node.style.zIndex = win.teller ;
				win.document.body.insertBefore(node);
			}
		}
		return true;
	}catch(e){
		return false;
	}
}

//myColor is create by GuoBar,guobar.com
// writeCookie
function writeCookie(name, value, expires)
{
  var expire = "";
  if(expires != null)
  {
    expire = new Date((new Date()).getTime() + expires * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

//readCookie
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

//setColor
function setColor(color_val) {
	document.getElementById('zoom').style.backgroundColor = color_val;
    writeCookie("bgColor_cookie", color_val, 24)
}

//getColor
function getColor() {
  myTable.style.backgroundColor = "#FFFFFF";
	var bg_color = readCookie("bgColor_cookie");
	if (bg_color != null) {
    	zoom.style.backgroundColor = bg_color
		//alert(bg_color);
	}
}

var currentpos,timer;
function initialize()
{
timer=setInterval("scrollwindow()",50);
}
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 doZoom(size){
	document.getElementById('zoom').style.fontSize=size+'px'
}
/*控制字数*/
function textCount(obj,a_limit){
	if (obj.value.length > a_limit) {
		obj.value = obj.value.substring(0,a_limit); 
		}
  else {
		document.input.inputname.value = obj.value.length;
		}
	}
//图像处理
function imgzoom(o) {
	if(event.ctrlKey) {
		var zoom = parseInt(o.style.zoom, 10) || 100;
		zoom -= event.wheelDelta / 12;
		if(zoom > 0) {
			o.style.zoom = zoom + '%';
		}
		return false;
	} else {
		return true;
	}
}
 function docheck()
 {

if (document.all.log_Title){
 if (document.all.log_Title.value.length==0) 
  {
   alert("请输入文章标题!");
   document.all.log_Title.focus()
   return false
  }
 }
if (document.all.message.value.length==0) 
  {
   alert("请输入文章内容!");
   document.all.message.focus()
   return false
  }
  return true
 }

//-------------风格切换开始----------------

var thisskin;
thisskin=readCookie("GuoBar_com_skin");
if(thisskin!="")
{
	GuoBar__comskin.href=thisskin;
}
else
{ GuoBar__comskin.href="styles/default1.css";
}

function changecss(url){
 if(url!=""){
GuoBar__comskin.href=url;
 writeCookie("GuoBar_com_skin", url, 365*24);

 }
}
//-------------风格切换结束----------------
//flash音乐播放器
var ap_instances = new Array();

function ap_stopAll(playerID) {
	for(var i = 0;i<ap_instances.length;i++) {
		try {
			if(ap_instances[i] != playerID) document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
			else document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
		} catch( errorObject ) {
			// stop any errors
		}
	}
}

function ap_registerPlayers() {
	var objectID;
	var objectTags = document.getElementsByTagName("object");
	for(var i=0;i<objectTags.length;i++) {
		objectID = objectTags[i].id;
		if(objectID.indexOf("audioplayer") == 0) {
			ap_instances[i] = objectID.substring(11, objectID.length);
		}
	}
}

var ap_clearID = setInterval( ap_registerPlayers, 100 );
//-------------播放器控制结束----------------