﻿document.write("<script src=\'/scripts/command.js\'></\script>");
function addbq(str) 
{ 
	var TxtContent=document.getElementById("content"); 
	var TxtContentLength=TxtContent.value.length; 
	TxtContent.focus(); 
	if(typeof document.selection !="undefined") 
	{ 
		document.selection.createRange().text=str; 
	} 
	else 
	{ 
		TxtContent.value=TxtContent.value.substr(0,TxtContent.selectionStart)+str+TxtContent.value.substring(TxtContent.selectionStart,TxtContentLength); 
	} 
}
function onShowtemt(){			
	if (document.getElementById('temt').value != ''){
		document.getElementById('showtemt').innerHTML='<img src=\"images\/gbooktemt\/' + document.getElementById('temt').value + '.gif\" />';}
	else{
		document.getElementById('showtemt').innerHTML='';
	}
} 
function onShowface(){			
	if (document.getElementById('uface').value != ''){
		document.getElementById('showface').innerHTML='<img src=\"images\/gbookface\/' + document.getElementById('uface').value + '.jpg\" />';}
	else{
		document.getElementById('showface').innerHTML='';
	}
} 
//跳转页面显示
function ad_cutPage(url,TotalPage,PageIndex,detNum,pagePaName){
	document.write("<form onsubmit=\"return false;\"><a class=\'MultiPages\'>"+PageIndex+"/"+TotalPage+"</a>");
	var showLend;
	var Biaozhun;
	Biaozhun = parseInt(detNum / 2);
	if(url.indexOf("?")==(-1)){
			showLend="?";
	}
	else
	{
			showLend="&";
	}
	if (PageIndex<(Biaozhun + 1)) {
		PageLong=detNum + 1 -PageIndex;
	}
	else
		if (TotalPage-PageIndex<(Biaozhun + 1)) {
			PageLong= detNum -(TotalPage-PageIndex)
		}
		else {
			PageLong=Biaozhun;
		}
	for (var i=1; i <= TotalPage; i++) {
		if (i < PageIndex+PageLong && i > PageIndex-PageLong || i==1 || i==TotalPage){
			if (PageIndex==i) {
				document.write("<a class=curpage>"+ i +"</a>");
			}
			else {
				document.write("<a class=uncurpage href="+url+showLend+""+ pagePaName +"="+i+">"+ i +"</a>");
			}
		}
	}
	document.write("<input onkeydown=if((event.keyCode==13)&&(this.value!=''))window.location=\""+url+showLend+pagePaName+"=\"+this.value+\"\"; onkeyup=if(isNaN(this.value))this.value='' class=PageInput></form>");
}

function showflash(swfurl,swfwidth,swfheight,sValue){
        document.writeln("<object id=\"FlashID\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+ swfwidth +"\" height=\""+ swfheight +"\">");
        document.writeln("  <param name=\"movie\" value=\""+ swfurl +"\" />");
        document.writeln("  <param name=\"quality\" value=\"high\" />");
        document.writeln("  <param name=\"wmode\" value=\""+ sValue +"\" />");
        document.writeln("  <param name=\"swfversion\" value=\"8.0.35.0\" />");
        document.writeln("  <!--[if !IE]>-->");
        document.writeln("  <object type=\"application/x-shockwave-flash\" data=\""+ swfurl +"\" width=\""+ swfwidth +"\" height=\""+ swfheight +"\">");
        document.writeln("    <param name=\"quality\" value=\"high\" />");
        document.writeln("    <param name=\"wmode\" value=\""+ sValue +"\" />");
        document.writeln("    <param name=\"swfversion\" value=\"8.0.35.0\" />");
        document.writeln("  </object>");
        document.writeln("  <!--<![endif]-->            ");
        document.writeln("</object> ");
}

// 修复 IE 下 PNG 图片不能透明显示的问题
function fixPNG(myImage) {
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
 if ((version >= 5.5) && (version < 7) && (document.body.filters))
{
    var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
    var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
    var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' ";
    var imgStyle = "display:inline-block;" + myImage.style.cssText;
    var strNewHTML = "<span " + imgID + imgClass + imgTitle

   + " style=\"" + "width:" + myImage.width

   + "px; height:" + myImage.height

   + "px;" + imgStyle + ";"

   + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"

   + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
    myImage.outerHTML = strNewHTML;
} } 

function displaySubMenu(li) {
var subMenu = li.getElementsByTagName("ul")[0];
subMenu.style.display = "block";
}
function hideSubMenu(li) {
var subMenu = li.getElementsByTagName("ul")[0];
subMenu.style.display = "none";
}


function ShowMenu(MenuID) 
{ 
	if(MenuID.style.display=="none"){ 
		MenuID.style.display="";
		} 
	else 
	{ 
		MenuID.style.display="none";

	} 
} 

//选项卡切换
function ShowLayers(obj,n){
	var titparent=obj.parentNode; 
	var tempa=titparent.getElementsByTagName('a')
	for(i=0;i<tempa.length;i++){
		tempa[i].className='';
	}
	obj.className='on';
	
	var parentdiv=obj.parentNode.parentNode.parentNode;
	var cotdiv=parentdiv.childNodes;
	for(i=0;i<cotdiv.length;i++){
	  if (cotdiv[i].getAttribute('class')=='cot'){
		  cotdiv[i].style.display='none';
	  }			
	}		  
	cotdiv[n].style.display='';
}

function flvplayer(filepath){
    var str= ""
	var wid=arguments[1]?arguments[1]:400;
	var hei=arguments[2]?arguments[2]:340;
    str = '<object data="images/mediaplayer.swf?playmedia='+ filepath +'&autoplay=true&dockcontrols=false&panelcolor=000000" id="player" width="'+wid+'" height="'+hei+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0">'+
    '<param name="movie" value="images/mediaplayer.swf?playmedia='+filepath+'&autoplay=true&dockcontrols=false&panelcolor=000000" />'+
    '<param name="quality" value="high" /><param name="menu" value="false" /><param name="allowFullScreen" value="true" />'+
	'<embed src="images/mediaplayer.swf?playmedia='+ filepath +'&autoplay=true&dockcontrols=true&panelcolor=000000" width="'+wid+'" height="'+hei+'" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" menu="false" allowFullScreen="true" /></embed></object>';
    return str;
}

function mediaplayer(filepath){
    var str= ""
	var wid=arguments[1]?arguments[1]:400;
	var hei=arguments[2]?arguments[2]:340;
    str = '<object id="player" width="'+wid+'" height="'+hei+'" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"><param NAME="AutoStart" VALUE="1">'+
    '<param NAME="url" VALUE="'+filepath+'">'+
    '<param name="currentPosition" value="0"><param name="stretchToFit" value="0"><param name="volume" value="70"><param name="mute" value="0"><PARAM NAME="windowlessVideo" VALUE="-1"><param name="uiMode" value="Full">'+
    '<!--播放器显示模式:Full显示全部;mini最简化;None不显示播放控制,只显示视频窗口;invisible全部不显示--><param name="windowlessVideo" value="0"><param name="fullScreen" value="0"></object>';
    return str;
}

function submenuShow(id){
    $("#menu_s").children("div").hide();
    $("#menu_s").children("#"+ id).show();
}
//网站搜索功能
function gosearch(){
    var toselect = $("#toselect").val();
    var kw = $("#kw").val();
    if (kw==''){
        alert('请输入关键词');
        return false;
    }
    if(toselect!='local'){
        kw="site:(sjpopc.net)"+kw;
        window.open("http://www.baidu.com/s?wd="+kw+"");        
    }else{
        window.location.href="/search.asp?wd="+kw;
    }
}

function marquee(shudu,divid,divid1,divid2){    
    var Picspeed=shudu;    
    document.getElementById(divid2).innerHTML=document.getElementById(divid1).innerHTML;    
    function Marquee1(){     
        if(document.getElementById(divid2).offsetWidth-document.getElementById(divid).scrollLeft<=0){
            document.getElementById(divid).scrollLeft-=document.getElementById(divid1).offsetWidth ;
        }else{     
            document.getElementById(divid).scrollLeft++ ;    
        }     
    }     
    var MyMar1=setInterval(Marquee1,Picspeed);
    document.getElementById(divid).onmouseover=function() {clearInterval(MyMar1)}
    document.getElementById(divid).onmouseout=function() { MyMar1=setInterval(Marquee1,Picspeed);}
}

function killerrors() {
        return true;
}
window.onerror = killerrors;
/*window.onload=function (){
	var fuHeight = document.getElementById("subfu").offsetHeight;
	var mainHeight = document.getElementById("submain").offsetHeight;
	if (fuHeight < mainHeight && fuHeight != "underfine" && mainHeight != "underfine" ){
		document.all["subfu"].style.height = mainHeight;
	}
}*/

