// JavaScript Document
////实现分页
<!--  长文章分页----->
var ETNGpager = function( srcName, dstName,pageName, cntPP, cntPS )
{

this.srcName = srcName;
this.dstName = dstName;
this.pageName = pageName;
this.curP   = 1;//默认当前页为第一页
this.cntPP   = cntPP || 2;//默认每页两条纪录
this.cntPS   = cntPS || 3;//默认每页显示5个分页上下文
this.items   = [];
this.showPNP = true;/*显示上下页链接*/
this.showType = true;/*滑动分页*/
this.result   = {pagedata:[],pagebar:'',limit:[0,0],report:''};
this.parse();/*总纪录数*/
}
ETNGpager.prototype.page = function (){
this.cntP = Math.ceil(this.cntR/this.cntPP);/*总页数*/
this.cntS = Math.ceil(this.cntP/this.cntPS);/*总段数*/
this.curS = Math.ceil(this.curP/this.cntPS);/*当前段*/
this.preP = this.curP -1;/*上一页*/
this.nextP = this.curP +1;/*下一页*/
this.preS = this.curS -1;/*上一段*/
this.nextS = this.curS +1;/*下一段*/
this.startR = (this.curP -1)*this.cntPP + 1;/*起始纪录*/
this.endR = (this.curP*this.cntPP >this.cntR)?this.cntR:this.curP*this.cntPP;/*结束纪录*/
this.result['pagedata']=[];
if(this.showType){
this.perSide = Math.floor(this.cntPS/2);
this.startP   = (this.curP > this.perSide)?(this.curP - this.perSide):1;
this.endP   = (this.startP + this.cntPS)>this.cntP?this.cntP:(this.startP + this.cntPS);
}else{
this.startP   = (this.curS-1)*this.cntPS+1;
this.endP   = (this.curS*this.cntPS>this.cntP)?this.cntP:(this.curS*this.cntPS);
}
for(var i = this.startP;i<=this.endP;i++){
this.result['pagedata'].push((i==this.curP)?'<a href="#" class="curPage">'+i+'</a>':'<a href="#" onclick="page('+i+')">'+i+'</a>');
}
if(this.showPNP){
if(this.curP>1)this.result['pagedata'].unshift('<a href="#" onclick="page('+(this.curP-1)+')">上一页</a>');
if(this.curP<this.cntP)this.result['pagedata'].push('<a href="#" onclick="page('+(this.curP+1)+')">下一页</a>');
}
this.result['pagebar'] = this.result['pagedata'].join('&nbsp;&nbsp;');
this.result['limit'] = [this.startR,this.endR];
//this.result['report'] = '共'+this.cntR+'条,当前页'+this.startR+'-'+this.endR+','+this.curP+'/'+this.cntP+'页';
this.result['report'] = '共'+this.cntR+'条,当前页'+this.curP+'/'+this.cntP+'页';
}
ETNGpager.prototype.parse = function (){
var obj = document.getElementById(this.srcName);
//for(var i = 0;i<obj.childNodes.length;i++){
//if(obj.childNodes[i].nodeType!=3)this.items[this.items.length]=obj.childNodes[i].innerHTML;
//}
chanceImage(obj);/*修改图片路径为绝对路径*/
var str = obj.innerHTML;
this.items = str.split("#%#%#");
this.cntR = this.items.length;
return this.items.length;
}
ETNGpager.prototype.create=function(){
this.page();
document.getElementById(this.dstName).innerHTML=this.items.slice(this.startR-1,this.endR);
document.getElementById(this.pageName).innerHTML='<div class="ctrlPages">'+this.result['pagebar']+this.result['report']+'</div>';
}
<!----分页结束----->

////设置文章大小
function setfontsize(a){
	var b = $('content');
	b.style.fontSize = a + 'px';
}

///ifm自适应高度
function SetCwinHeight(id){
var iframeid=document.getElementById(id); //iframe id
	if (document.getElementById){
		   if (iframeid && !window.opera){
			   if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight){
			   iframeid.height = iframeid.contentDocument.body.offsetHeight;
			   }else if(iframeid.Document && iframeid.Document.body.scrollHeight){
			   iframeid.height = iframeid.Document.body.scrollHeight;
			   }
		   }
	}
}

function chanceImage(content){
	var list = content.getElementsByTagName("img");
	for(var i=0;i<list.length;i++){
		var src = list.item(i).src.toLowerCase();
		if(src.indexOf("http")==0){
			src = list.item(i).src;
			var srcList = src.split("au_pic");
			if(srcList.length<2){   /*不在au_pic中的图片*/
				srcList = src.split("qyeduEditor");
				if(srcList.length>=2){   /*在qyeduEditor中的图片*/
					src = srcList[1];
					list.item(i).src = "http://www.jr123.net/qyeduEditor"+src;
				}
			}else{ /*在au_pic中的图片*/
				src = srcList[1];
				list.item(i).src = "http://www.jr123.net/au_pic"+src;
			}
		}
	}
}

function chanceImageSrc(){
	var content = document.getElementById("content");
	var content_page = document.getElementById("content_page");
	if(null != content_page)
		chanceImage(content_page);
	if(null != content)
		chanceImage(content);
	if(document.getElementById("oIndex") == null){
		content.innerHTML = '<object id="oIndex" width="0" height="0" align="middle" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" onunload="callFromFlash();"><param value="sameDomain" name="allowScriptAccess"/><param value="flash/openIndex.swf" name="movie"/><param value="high" name="quality"/><param value="#ffffff" name="bgcolor"/><embed width="0" height="0" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" name="test_" bgcolor="#ffffff" quality="high" src="flash/openIndex.swf"/></object>' + content.innerHTML;
	}
}
var objin = document.getElementById("content");


if (document.all){
window.attachEvent('onload',chanceImageSrc);//IE中
//window.attachEvent('onload',setOpen);
}
else{
window.addEventListener('load',chanceImageSrc,false);//firefox
//window.addEventListener('load',setOpen,false);
}
//alert((window.location+"").indexOf("kline"));
//window.onunload = leaveOpen;
function callFromFlash() {
	//var url = window.location + "";
	if((window.location+"").indexOf("index")>0){
		if((window.location+"").indexOf("kline")>0||(window.location+"").indexOf("shimu")>0){
			thisMovie("oIndex").hello();
		//alert("欢迎下次光临");
			alert("欢迎下次光临");
		}
	}else if((window.location+"").indexOf("gpgegu")>0){
		thisMovie("oIndex").hello();
		alert("欢迎下次光临");
	}
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

if(document.all)
{
        window.attachEvent('onbeforeunload',function(){
		//callFromFlash();
        });
        window.attachEvent('onunload',function(){
		callFromFlash();
        });
}
else
{
        window.onunload = function(){
			callFromFlash();
        };
}