//加载中提示。
function loading() 
{ 
  var a = document.getElementById("loading");
  a.parentNode.removeChild(a);
}
document.write('<span id="loading" style="background:#CC4444;color:#FFF;height:23px;width:96px;padding:2px 0 0 5px;position:absolute"><img src="images/loading.gif">&nbsp;&nbsp;Loading...</span>');


//左侧菜单展开、收缩
function switchMenu(evt){
  var ele=evt.target||evt.srcElement; //分别针对非ie和ie，获取事件的源对象
  if(ele.className=="menu"){  //如果是<h1>
    do{
      ele=ele.nextSibling;  //反复取下一个兄弟节点，直到节点为<ul>或为null
    }while(ele&&ele.tagName!="UL");
    if(ele){
      var display=evt.target?getComputedStyle(ele,null).display:
        ele.currentStyle.display; //分别针对非ie和ie，获取<ul>的当前css属性display
      ele.style.display=display=="none"?"":"none"; //切换
    }
  }
}


//分页跳转菜单
function FormMenu(targ,selObj,restore){ 
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}


//图片缩放
function ImgAutoSize(){
for (j=0;j<document.images.length;j++)
{
//document.images[j].width=(document.images[j].width>420)?"420":document.images[j].width;
if(document.images[j].width>550){
document.images[j].width=500
document.images[j].style.cursor="pointer";
document.images[j].title="点击看大图..";
document.images[j].onclick=function(e){window.open(this.src)}
}
}
}

//复制代码
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);
		alert("已经成功复制到剪贴板！")
	}
}

//运行代码
function runEx(cod1) {
 cod=document.all(cod1)
  var code=document.getElementById(cod1).innerText;
  if (code!=""){
  var newwin=window.open('','','');  
  newwin.opener = null 
  newwin.document.write(code);  
  newwin.document.close();
}
}

//保存代码
function saveCode(obj) { 
    var winname = window.open('', '_blank', 'top=10000'); 
    winname.document.open('text/html', 'replace'); 
    winname.document.writeln(document.getElementById(obj).innerText); 
    winname.document.execCommand('saveas','','ciker.html'); 
    winname.close(); 
}

//显示隐藏主题
function TopicShow(e,TopicID){
e.className=(e.className=="BttnC")?"BttnE":"BttnC"
document.getElementById(TopicID).style.display=(e.className=="BttnC")?"":"none"
}

//CTRL+CENTER快速提交 快捷键
ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.replyform.submit();}}
}

//显示隐藏主题
function showhide(ID)
{
	obj=document.getElementById("div_"+ID);	
	img=document.getElementById("img_"+ID);
	if(obj.style.display=="none"){
		obj.style.display="";
		img.src=img.src.replace('show.gif','hide.gif');
	}else{
		obj.style.display="none";
		img.src=img.src.replace('hide.gif','show.gif');
	}
}


//显示隐藏登录
function manage(obj){
	target=document.getElementById(obj);
	if(target.style.display=="none"){
		target.style.display=""
	}else{
		target.style.display="none"
	}
}


//字体大小
function font(size)
{
document.getElementById("content").style.fontSize=(size)+'pt';
}


//代码区域自适应高度
function AutoSizeDIV(objID){
	var obj=document.getElementById(objID);
	if (obj.scrollHeight < obj.offsetHeight){
		obj.style.height = obj.scrollHeight+2;
	}
}


//删除提示
function ConfirmDel(){ 
if(confirm('确定要删除吗？数据在删除后不能恢复！')) 
return true; 
else 
return false; 
}


//添加Tags
function addtags(str){
if (document.getElementById('tags').value=="")
    {
    document.getElementById('tags').value+=str+","
    }
    else{
    document.getElementById('tags').value+=str+","
    }
}


//获取指定id的object
function getObject(elementId) {
	if (document.getElementById) { 
		return document.getElementById(elementId); 
	} else if (document.all) { 
		return document.all[elementId]; 
	} else if (document.layers) { 
		return document.layers[elementId]; 
	} 
}

//切换样式
function changeStyle(id){
	var stylesheet=getObject("skin").href="style/"+id+"/style.css";
	document.cookie="stylesheet="+escape(stylesheet);	//写入Cookie
	if(id=="j8"){getObject("ciker_head").style.display="none";}
	else
	{getObject("ciker_head").style.display="";}
}
//初始化样式，如果cookie存在样式，则加载cookie样式，否则加载默认样式
function initStyle(){
		if(/stylesheet=([^;]+)/.test(document.cookie))
			getObject("skin").href=unescape(RegExp.$1);
}
initStyle();


//联系作者E-mail
function eMail() {
  var sb = "mula@ai.al:otewotw:boc.@ivike:eu.rhc@kl1w@2.i6bm.wxc:uo@em";
  var sr = "";
  for (var n = 0; n < sb.length; n += 3)
    sr += sb.substr(n,1);
  location.href = sr;
}


//友好提示
function sAlert(title,msg,url){
var eSrc=arguments[1];
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "0px";
shield.style.top = "0px";
shield.style.width = "100%";
shield.style.height = document.body.scrollHeight+"px";
shield.style.background = "#333";
shield.style.textAlign = "center";
shield.style.zIndex = "10000";
var alertFram = document.createElement("DIV");
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.left = "50%";
alertFram.style.top = "40%";
alertFram.style.marginLeft = "-225px" ;
alertFram.style.marginTop = -75+document.documentElement.scrollTop+"px";
alertFram.style.width = "450px";
alertFram.style.height = "150px";
//alertFram.style.background = "#fff";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "150px";
alertFram.style.zIndex = "10001";
strHtml = "<ul id=\"ciker_ul\" style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n";
strHtml += " <li style=\"background:#DD828D;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #F9CADE;\">"+title+"</li>\n";
strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;height:100px;line-height:100px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;\">"+msg+"</li>\n";
strHtml += " <li style=\"background:#FDEEF4;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #F9CADE;\"><input type=\"button\" value=\"Yes,Sir.\" "
if(url != "back") {
strHtml += "onclick=window.location.href='" + url + "'"
}
else if(url == "back") {
strHtml += "onclick=history.back()"
}
else {
strHtml += "onclick=ciker_ul.style.display='none'"
}
strHtml += " /></li>\n";
strHtml += "</ul>\n";
alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
}


//非本站链接安全检查
     function safe()
     {
       //var ciker_msg = "<img src='./images/safe.gif'><font color='darkpink'> [Ciker]提醒:</font><font color='green'>此为站外链接,可能不安全,请谨慎打开.</font>";

       //var aList = document.getElementById('content').getElementsByTagName('a');
       var aList = document.getElementById('content').getElementsByTagName('a');
       var iCount = aList.length;
       for(var i = 0;i<iCount;i++)
       {
         if(!chkMyLink(aList[i].href,aList[i].innerHTML))
         {
           //aList[i].id ='msg';
           aList[i].className ='other';
           //aList[i].innerHTML = aList[i].innerHTML + "<span><p>"+ ciker_msg +"</p></span>";
        aList[i].title = "$见习刺客$ 提醒:\n------------------------\n链接指向站外,请谨慎打开.\n------------------------";
         }
       }
     }
    
    //s是链接的url,innerhtml是链接文本
     function chkMyLink(s,innerhtml)
     {
       xml = new ActiveXObject("Microsoft.XMLHTTP"); //声明对象 
       xml.open("GET","plus/ip.asp",false); 
       xml.send(); //发送请求 
       Ciker_ServerIP = xml.responseText; 

       if(innerhtml.replace( /^\s*/,"").match(/^\<img/gi)) return true;
       var reg = /^http\:\/\//gi;
       if(s.match(reg))
       {
          reg1 = /^http\:\/\/www.ciker.net/gi;
          reg2 = /^http\:\/\/ciker.net/gi;
          reg3 = /^http\:\/\/ciker/gi;
          reg4 = Ciker_ServerIP;
          reg5 = /^http\:\/\/www.jinbangtiming.net/gi;
          if(s.match(reg1) || s.match(reg2) || s.match(reg3) || s.match(reg4) || s.match(reg5))
          {
            return true;
          }
          else
          {
            return false;
          }
       }
      return true;
     }


//多媒体播放
var MediaTemp=new Array()
function MediaShow(strType,strID,strURL,intWidth,intHeight)
{
	var tmpstr
	if (MediaTemp[strID]==undefined) MediaTemp[strID]=false; else MediaTemp[strID]=!MediaTemp[strID];
	if(MediaTemp[strID]){
			if ( document.all )	{
	         	document.getElementById(strID).outerHTML = '<div id="'+strID+'"></div>'
			}
			else
			{
	         	document.getElementById(strID).innerHTML = ''
			}

		document.images[strID+"_img"].src="images/mm_snd.gif" 		
		document.getElementById(strID+"_text").innerHTML="在线播放"	
	}else{
		document.images[strID+"_img"].src="images/mm_snd_stop.gif" 		
		document.getElementById(strID+"_text").innerHTML="关闭在线播放"
		switch(strType){
			case "swf":
				tmpstr='<div style="height:6px;overflow:hidden"></div><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+'" /></object>';
				break;
			case "wma":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object id="player" classid="CLSid:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" type="application/x-oleobject" standby="Loading..." width="'+intWidth+'" height="45px"><param NAME="AutoStart" VALUE="-1"><param NAME="Balance" VALUE="0"><param name="enabled" value="-1"><param NAME="EnableContextMenu" VALUE="0"><param NAME="url" VALUE="'+strURL+'"><param NAME="PlayCount" VALUE="1"><param name="rate" value="1"><param name="currentPosition" value="0"><param name="currentMarker" value="0"><param name="defaultFrame" value=""><param name="invokeURLs" value="0"><param name="baseURL" value=""><param name="stretchToFit" value="0"><param name="volume" value="100"><param name="mute" value="0"><param name="uiMode" value="Full"><param name="windowlessVideo" value="-1"><param name="fullScreen" value="0"><param name="enableErrorDialogs" value="-1"><param name="SAMIStyle" value><param name="SAMILang" value><param name="SAMIFilename" value></object>';
				break;
			case "wmv":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object id="player" classid="CLSid:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" type="application/x-oleobject" standby="Loading..." width="'+intWidth+'" height="'+intHeight+'"><param NAME="AutoStart" VALUE="-1"><param NAME="Balance" VALUE="0"><param name="enabled" value="-1"><param NAME="EnableContextMenu" VALUE="-1"><param NAME="url" VALUE="'+strURL+'"><param NAME="PlayCount" VALUE="1"><param name="rate" value="1"><param name="currentPosition" value="0"><param name="currentMarker" value="0"><param name="defaultFrame" value=""><param name="invokeURLs" value="0"><param name="baseURL" value=""><param name="stretchToFit" value="0"><param name="volume" value="100"><param name="mute" value="0"><param name="uiMode" value="Full"><param name="windowlessVideo" value="-1"><param name="fullScreen" value="0"><param name="enableErrorDialogs" value="-1"><param name="SAMIStyle" value><param name="SAMILang" value><param name="SAMIFilename" value></object>';
				break;
			case "rm":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="'+intHeight+'"><param name="SRC" value="'+strURL+'" /><param name="CONTROLS" VALUE="ImageWindow" /><param name="CONSOLE" value="one" /><param name="AUTOSTART" value="true" /><embed src="'+strURL+'" nojava="true" controls="ImageWindow" console="one" width="'+intWidth+'" height="'+intHeight+'"></object>'+
                '<br/><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="32" /><param name="CONTROLS" value="StatusBar" /><param name="AUTOSTART" value="true" /><param name="CONSOLE" value="one" /><embed src="'+strURL+'" nojava="true" controls="StatusBar" console="one" width="'+intWidth+'" height="24" /></object>'+'<br /><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="32" /><param name="CONTROLS" value="ControlPanel" /><param name="AUTOSTART" value="true" /><param name="CONSOLE" value="one" /><embed src="'+strURL+'" nojava="true" controls="ControlPanel" console="one" width="'+intWidth+'" height="24" autostart="true" loop="false" /></object>';
				break;
			case "ra":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" id="RAOCX" width="450" height="60"><param name="_ExtentX" value="6694"><param name="_ExtentY" value="1588"><param name="AUTOSTART" value="true"><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="450" autostart="true" height="60"></embed></object>';
				break;
			case "qt":
				tmpstr='<div style="height:6px;overflow:hidden"></div><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/" />';
		}
		document.getElementById(strID).innerHTML = tmpstr;
	}
		document.getElementById(strID+"_href").blur()
}