﻿

function $(id){
return document.getElementById(id);
}

function showAD(pos){
if(pos=='listAD'){
	var pic='s';
	u=document.location.href;
	if(u.indexOf('jiaoshi')>-1){pic='t';}
	if(u.indexOf('jiazhang')>-1){pic='p';}
	$(pos).innerHTML='<a href="http://bbs.spthome.com/" target=_blank><img src="http://i1.spthome.cn/ggpic/'+pic+'.jpg" alt="酸葡萄家园·互动社区"></a>';
}
}

function showBBS(n){
$('bbsA1').className='';
$('bbsA2').className='';
$('bbs1').className='none';
$('bbs2').className='none';
$('bbsA'+n).className='Hover';
$('bbs'+n).className='';
}
function showOL(){
document.write ('<ol id="bbs1">');
document.write ('<script type="text/javascript" src="http://bbs.spthome.com/api/javascript.php?key=study_sTop10"></script>');
document.write ('</ol>');
document.write ('<ol id="bbs2" class="none">');
document.write ('<script type="text/javascript" src="http://bbs.spthome.com/api/javascript.php?key=study_dlTop10"></script></ol>');

}

function formartText(){
if($('content')){
txt=$('content').innerHTML;
txt=txt.replace(/&nbsp;&nbsp;/gi,'　');
txt=txt.replace(/&nbsp; /gi,'　');
txt=txt.replace(/,/gi,'，');
txt=txt.replace(/\./gi,'．');
txt=txt.replace(/\?/gi,'？');
txt=txt.replace(/\!/gi,'！');
txt=txt.replace(/\$/gi,'＄');
txt=txt.replace(/\*/gi,'＊');
txt=txt.replace(/1/gi,'１');
txt=txt.replace(/2/gi,'２');
txt=txt.replace(/3/gi,'３');
txt=txt.replace(/4/gi,'４');
txt=txt.replace(/5/gi,'５');
txt=txt.replace(/6/gi,'６');
txt=txt.replace(/7/gi,'７');
txt=txt.replace(/8/gi,'８');
txt=txt.replace(/9/gi,'９');
txt=txt.replace(/0/gi,'０');
txt=txt.replace(/&nbsp;/gi,' ');
txt=txt.replace(/　 /gi,'　 ');
txt=txt.replace(/\(/gi,'（');
txt=txt.replace(/\)/gi,'）');
txt=txt.replace(/<P> <\/P>/gi,'');
txt=txt.replace(/<P><\/P>/gi,'');
$('content').innerHTML=txt;
}}

function msg(o){
if($(o)){$(o).innerHTML='本站所有内容源于网上的共享资源和本站网友投稿，转载的文章仅免费供网友间相互学习交流之用。<br />如有侵犯您的版权请联系指出，我们会在第一时间改正或删除有关内容！';}
}

function searchFrom(){
document.write('<div><h4><strong>内容搜索</strong></h4></div>\
<form action="http://study.spthome.com/plus/search.php" name="formsearch">\
<input type="hidden" name="kwtype" value="1" />\
<input type="hidden" name="searchtype" value="titlekeyword" />\
<input name="keyword" id="keyword" type="text" class="searchtxt" value="" />\
<input type="submit" id="submit" value="" />\
</form>\
<tt id="hotKey"><!-- hot key --></tt>');
}

function changeTpye(n){
$('typeid').value=n;
for(var i=1;i<15;i++){
	if($('t'+i))$('t'+i).className='';
}
$('t'+n).className='Hover';
}

function randChange(a,b){
$('Rand'+a).className='tabHover hand';
$('Rand'+b).className='tab hand';

$('Ol'+a).className='';
$('Ol'+b).className='none';

}

//----lib---------
//删除左右两端的空格
function trim(str){  
 return str.replace(/(^\s*)|(\s*$)/g, "");
}
//删除左边的空格
function ltrim(str){ 
 return str.replace(/(^\s*)/g,"");
}
//删除右边的空格
function rtrim(str){  
 return str.replace(/(\s*$)/g,"");
}



function tongji(){
document.write('<div style="position:absolute; left:-100px;top:-100px;font:1px/1px 宋体"><scr'+'ipt src="http://s41.cnzz.com/stat.php?id=1137852&web_id=1137852" language="JavaScript" charset="gb2312"></scr'+'ipt>\
<scri'+'pt type="text/javascript" src="http://js.tongji.cn.yahoo.com/880092/ystat.js"></scr'+'ipt><noscript><a href="http://tongji.cn.yahoo.com"><img src="http://img.tongji.cn.yahoo.com/880092/ystat.gif"/></a></noscript>');
}
function tongjiBBS(){
document.write('<div style="position:absolute; left:-100px;top:-100px;font:1px/1px 宋体"><scri'+'pt src="http://s90.cnzz.com/stat.php?id=1030275&web_id=1030275" language="JavaScript" charset="gb2312"></scri'+'pt>');
}
