﻿function ShowPageList(CurPage, PageSize, TotalRec, URLStr) {
	var PageCount, TempStr = '', StartPage, EndPage;
	if(TotalRec % PageSize == 0)
		PageCount = TotalRec / PageSize;
	else
		PageCount = Math.floor(TotalRec / PageSize) + 1;
	TempStr = TempStr + '<div class="PageBorder">\n';
	TempStr = TempStr + '<form action="' + URLStr + '" method="post" name="PageForm">\n';
	TempStr = TempStr + '<div class="PageTip" title="总记录数">&nbsp;&nbsp;' + TotalRec + '&nbsp;&nbsp;</div>\n';
	TempStr = TempStr + '<div class="PageTip" title="本页记录数">&nbsp;&nbsp;';
	if(CurPage == PageCount)
		TempStr = TempStr + (TotalRec - (PageSize * (CurPage - 1)));
	else
		TempStr = TempStr + PageSize;
	TempStr = TempStr + '&nbsp;&nbsp;</div>\n';
	TempStr = TempStr + '<div class="PageTip" title="当前页/总页数">&nbsp;' + CurPage + '/' + PageCount + '页&nbsp;</div>\n';
	if(CurPage == 1)
		TempStr = TempStr + '<div class="PageNav">&nbsp;<span style="font-family:webdings;color:red;">9</span>&nbsp;</div>\n';
	else
		TempStr = TempStr + '<div class="PageNav">&nbsp;&nbsp;<a href="' + URLStr + '&page=1" title="首页"><span style="font-family:webdings;">9</span></a>&nbsp;</div>\n';
	if(CurPage > 11)
		TempStr = TempStr + '<div class="PageNav">&nbsp;&nbsp;<a href="' + URLStr + '&page=' + (CurPage - 10) + '" title="前十页"><span style="font-family:webdings;">7</span></a>&nbsp;&nbsp;</div>\n';
	if(CurPage < 6)
		StartPage = 1;
	else
		StartPage = CurPage - 5;
	if(CurPage + 9 < PageCount)
		EndPage = StartPage + 9;
	else
		EndPage = PageCount;
	TempStr = TempStr + ShowOnePage(StartPage, EndPage, URLStr, CurPage);
	if(PageCount > CurPage + 10)
		TempStr = TempStr + '<div class="PageNav">&nbsp;&nbsp;<a href="' + URLStr + '&page=' + (CurPage + 10) + '" title="下十页"><span style="font-family:webdings;">8</span></a>&nbsp;&nbsp;</div>\n';
	if(CurPage != PageCount)
		TempStr = TempStr + '<div class="PageNav">&nbsp;&nbsp;<a href="' + URLStr + '&page=' + PageCount + '" title="尾页"><span style="font-family:webdings;">:</span></a>&nbsp;&nbsp;</div>\n';
	else
		TempStr = TempStr + '<div class="PageNav">&nbsp;&nbsp;<span style="font-family:webdings;color:red;">:</span>&nbsp;&nbsp;</div>\n';
	TempStr = TempStr + '<div class="PageInput"><input type="text" name="page" size="3" value="' + CurPage + '" class="txt"/><input type="submit" value="GO" name="submit" class="bton"/></div>\n';
	TempStr = TempStr + '</form>\n';
	TempStr = TempStr + '</div>\n'
	document.write(TempStr);
}
function ShowOnePage(StartPage, EndPage, URLStr, CurPage) {
	var TempStr = '';
	
	if(CurPage != StartPage)
		TempStr = TempStr + '<div class="PageList">&nbsp;&nbsp;<a href="' + URLStr + '&page=' + StartPage + '">' + StartPage + '</a>&nbsp;&nbsp;</div>\n';
	else
		TempStr = TempStr + '<div class="PageList">&nbsp;&nbsp;<span style="color:red;font-weight:bold;font-style:Italic;">' + StartPage + '</span>&nbsp;&nbsp;</div>\n';
	if(EndPage > StartPage)
		TempStr = TempStr + ShowOnePage(StartPage + 1, EndPage, URLStr, CurPage);
	return TempStr;
}
//Cookie Setting
var Cookies={
	setCookie:function(name,value,option){
		var str=name+"="+escape(value);
		if(option){
			if(option.expire){
				var timeType=option.expire[0];
				var newTime=new Date();
				var ms;
				if(timeType=="d")ms=option.expire[1]*24*60*60*1000;
				if(timeType=="h")ms=option.expire[1]*60*60*1000;
				if(timeType=="m")ms=option.expire[1]*60*1000;
				if(timeType=="s")ms=option.expire[1]*1000;
				newTime.setTime(newTime.getTime()+ms);
				str+="; expires="+newTime.toGMTString();
			}
			if(option.path){
				str+="; path="+option.path;
			}
			if(option.domain){
				str+="; domain="+option.domain;
			}
			if(option.secure){
				str+="; secure="+option.secure;
			}
		}
		document.cookie=str;
	},
	getCookie:function(name){
		var cookiesArray=document.cookie.split("; ");
		for(var i=0;i<cookiesArray.length;i++){
			var arr=cookiesArray[i].split("=");
			if(arr[0]==name){
				return unescape(arr[1]);
			}
		}
		return null;
	},
	deleteCookie:function(name){
		this.setCookie(name,"",{expire:["d",-1]});
	}
}

try{
	window.top.document;
}catch(e){
	window.top.location = window.location;
}
//字符长度检测
function strLen(str){
	var strTemp=0;
	if(str=="")return 0;
	for(var i=0;i<str.length;i++){
		if(str.charCodeAt(i)<0 || str.charCodeAt(i)>255){
			strTemp=strTemp+2;
		}else{strTemp=strTemp+1;}
	}
	return strTemp;
}
function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function
function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;
	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} //End While
	return strTemp;
} //End Function
function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
			}
			else{
				strTemp = VALUE.substring(iTemp,v_length);
				break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function
function chkall(chkName,_target){
	var allchk=eval('document.getElementById("'+chkName+'")');
	var chk=eval('document.getElementsByName("'+_target+'")');
	for(var i=0;i<chk.length;i++){
		chk[i].checked=allchk.checked;
	}
}
function handChkBoxResults(type,action,CtrlName,handPage,curPage,msg){
	var result="";
	var chk=eval('document.getElementsByName("'+CtrlName+'")');
	if(chk){
		for (var i=0;i<chk.length;i++){
			if(chk[i].checked){
				if(result==""){
						result=chk[i].value;
				}else{
						result=result+","+chk[i].value;
				}
			}
		}
	}
	result=result.replace(/s/g,"")
	if(result==""){
		alert("请先选择选项后再做此操作!");
		return;
	}else{
		var con=confirm(msg)
		if(con){
			if(handPage.indexOf("?")>0){
					return window.location.href=handPage+"&"+type+"="+action+"&id="+result+"&page="+curPage;
			}else{
					return window.location.href=handPage+"?"+type+"="+action+"&id="+result+"&page="+curPage;
			}
		}
	}
}
function toSearchAt(handPage,Para,id,curPage){
	if(id==""){
			window.location.href=handPage;
	}else{
		if(handPage.indexOf("?")>0){
			window.location.href=handPage+"&"+Para+"="+id+"&page="+curPage;
		}else{
			window.location.href=handPage+"?"+Para+"="+id+"&page="+curPage;
		}
	}
}
//双击滚动，单击停止
var shida_top,timer;  
function shida_stop() {timer=setInterval("shida_scrollwindow()",1);}
function shida_start(){clearInterval(timer);}
function shida_scrollwindow() {shida_top=document.body.scrollTop; window.scroll(0,++shida_top); 
if (shida_top != document.body.scrollTop) shida_start();} 
document.onmousedown=shida_start;
document.ondblclick=shida_stop;

function WriteHeadFlash(Path,Width,Height,Transparent){
	 var Temp,T=""
	 Temp='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="FlashH" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+Width+'" height="'+Height+'">'
	 Temp+='<param name="movie" value="'+Path+'"/>'
	 Temp+='<param name="quality" value="High"/>'
	 Temp+='<param name="scale" value="ExactFit"/>'
	 if (Transparent) {Temp+=' <param name="wmode" value="transparent"/>';T='wmode="transparent"'}
	 Temp+='<embed src="'+Path+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="FlashH" width="'+Width+'" height="'+Height+'" quality="High"'+T+' scale="ExactFit"/>'
	 Temp+='</object>'
	 document.getElementById("FlashHead").innerHTML=Temp
}

 function focusMe(o){
 	 o.inFocus=true;
 	 o.style.border="1px solid #AAC1E6";
 	 o.style.backgroundColor="#fff";
 	 o.style.cursor="text";
 	 o.style.overflowY="scroll";
	 reHeight(o);
 }
 
 function blurMe(o){
 	 o.inFocus=false;
	 o.style.border="0px #fff solid"
 	 o.style.padding="1px";
 	 o.style.backgroundColor="transparent";
 	 o.style.cursor="pointer";
 	 o.style.overflowY="hidden";
 	 o.style.height="33px";
 }
 function overMe(o){
 	 if (!o.inFocus) {
 	 	 o.style.border="1px solid #AAC1E6";
 	 	 o.style.padding="0px";
 	 	 o.style.backgroundColor="#F3F8FF";
 	 }
 }
 
 function outMe(o){
 	 if (!o.inFocus) {
	 	 o.style.border="0px #fff solid"
 	 	 o.style.padding="1px";
 	 	 o.style.backgroundColor="transparent";
  	 }
 }
 
 function checkMe(o){
 	 if (o.value.length>0) {
 	 	  o.previousSibling.innerHTML="回复内容:"
 	 }
 	 else{
 	 	  o.previousSibling.innerHTML="回复内容:<span class=\"tip\">(无回复留言)</span>"
 	 }
 }
 
 function reHeight(o){
  	 if (o.inFocus) {o.style.height = "120px";}
 }
 	 
 function highLight(o){
 	 o.parentNode.style.backgroundColor = (o.checked)?"#AAC1E6":"#E6EBF7"
 	 o.parentNode.parentNode.style.border = (o.checked)?"1px solid #AAC1E6":"1px solid #D6DEF1";
 }
 function tabit(tabName,btnId,tabNumber){
	for(i=0;i<tabNumber;i++){
		document.getElementById(tabName+"_div"+i).style.display = "none";
		document.getElementById(tabName+"_btn"+i).className = "tabBtnoff";
	}
	document.getElementById(tabName+"_div"+btnId).style.display = "block";
	document.getElementById(tabName+"_btn"+btnId).className = "tabBtnon";
	
}

function bbimg(o){
	if(!event.altKey)return true;
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
