function openwin(url, width, height){
	var Win = window.open(url,'','width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
function CheckIsNull(obj,msg)
{
	if(obj.value=="")
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}
function CheckIsNumeric(obj,msg)
{
	var reg=/^[0-9]*$/
	if(!reg.exec(obj.value))
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}
//会员退出by zzGxp
function log_out()
{
	zz = document.getElementsByTagName("html");
	zz[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1,Opacity=0.75)";
	if (confirm('您确定要退出吗？'))
	{
		return true;
	}
	else
	{
		zz[0].style.filter = "";
		return false;
	}
}
function checkLength(which,maxn) {
		var maxChars = maxn;
	
		if (which.value.length > maxChars)
			which.value = which.value.substring(0,maxChars);
	
		var curr = maxChars - which.value.length;
		
		document.getElementById("chLeft").innerHTML = curr.toString();
}

function CheckAll(form){for (var i=0;i<form.elements.length;i++){var e = form.elements[i];if (e.name != 'chkall')e.checked = form.chkall.checked;}}

function ChangeColor(obj,c1,c2){//by zzGxp色彩变换
	var obj=obj;
	var color=obj.bgColor;
	//alert(color);
	if(c1==color){obj.bgColor=c2;}else{obj.bgColor=c1;}
}

//正则限制输入
function regInput(reg)
{
	var srcElem	= event.srcElement
	var oSel	= document.selection.createRange()
	var srcRange	= srcElem.createTextRange()
	oSel.setEndPoint("StartToStart", srcRange)
	var num = oSel.text + String.fromCharCode(event.keyCode) + srcRange.text.substr(oSel.text.length)
	event.returnValue = reg.test(num)
}
//图片自动缩放
function resizeimg(ImgD,iwidth,iheight) { 
     var image=new Image(); 
     image.src=ImgD.src; 
     if(image.width>0 && image.height>0){ 
        if(image.width/image.height>= iwidth/iheight){ 
           if(image.width>iwidth){ 
               ImgD.width=iwidth; 
               ImgD.height=(image.height*iwidth)/image.width; 
           }else{ 
                  ImgD.width=image.width; 
                  ImgD.height=image.height; 
                } 
               ImgD.alt=image.width+"×"+image.height; 
        } 
        else{ 
                if(image.height>iheight){ 
                       ImgD.height=iheight; 
                       ImgD.width=(image.width*iheight)/image.height; 
                }else{ 
                        ImgD.width=image.width; 
                        ImgD.height=image.height; 
                     } 
                ImgD.alt=image.width+"×"+image.height; 
            } 
　　　　　ImgD.style.cursor= "pointer"; //改变鼠标指针 
　　　　　ImgD.onclick = function() { window.open(this.src);} //点击打开大图片 
　　　　if (navigator.userAgent.toLowerCase().indexOf("ie") > -1) { //判断浏览器，如果是IE 
　　　　　　ImgD.title = "请使用鼠标滚轮缩放图片，点击图片可在新窗口打开"; 
　　　　　　ImgD.onmousewheel = function img_zoom() //滚轮缩放 
　　　　　 { 
　　　　　　　　　　var zoom = parseInt(this.style.zoom, 10) || 100; 
　　　　　　　　　　zoom += event.wheelDelta / 12; 
　　　　　　　　　　if (zoom> 0)　this.style.zoom = zoom + "%"; 
　　　　　　　　　　return false; 
　　　　　 } 
　　　  } else { //如果不是IE 
　　　　　　　     ImgD.title = "点击图片可在新窗口打开"; 
　　　　　　   } 
    } 
}
//不可滚动缩放
function resizeimg2(ImgD,iwidth,iheight) { 
     var image=new Image(); 
     image.src=ImgD.src; 
     if(image.width>0 && image.height>0){ 
        if(image.width/image.height>= iwidth/iheight){ 
           if(image.width>iwidth){ 
               ImgD.width=iwidth; 
               ImgD.height=(image.height*iwidth)/image.width; 
           }else{ 
                  ImgD.width=image.width; 
                  ImgD.height=image.height; 
                } 
        } 
        else{ 
                if(image.height>iheight){ 
                       ImgD.height=iheight; 
                       ImgD.width=(image.width*iheight)/image.height; 
                }else{ 
                        ImgD.width=image.width; 
                        ImgD.height=image.height; 
                     } 
            } 
    } 
}

function checkselect(form){
	var UId = document.getElementsByName("e");
	var length=UId.length;
	var num=0
	for(i=0;i<length;i++)
	{
	//	alert(UId[i].checked);
		if(UId[i].checked==true)
		 {
			num+=1;	
		 }
	}
	if(num==0){alert("请先选择要删除的选项");return false;}
	if(!confirm("确定要删除吗?此操作不能恢复")){return false;}
	return true;
}

function ShowPage(TotalPage,PageIndex,url){
//document.write("<table cellspacing=1 class=a2><tr class=a3><td class=a1><b>"+PageIndex+"/"+TotalPage+"</b></td>");
document.write(" <div style='line-height=30px'> ")
document.write(" <a href=?PageIndex=1&"+url+">[首页]</a> ")
if(PageIndex>1){
	PI=PageIndex-1;
	document.write(" <a href=?PageIndex="+PI+"&"+url+">[上一页]</a> ")
}

if (PageIndex<6){PageLong=11-PageIndex;}
else
if (TotalPage-PageIndex<6){PageLong=10-(TotalPage-PageIndex)}
else{PageLong=5;}
for (var i=1; i <= TotalPage; i++) {
if (i < PageIndex+PageLong && i > PageIndex-PageLong){
if (PageIndex==i){document.write("&nbsp;"+ i +"&nbsp;");}else{document.write("&nbsp;<a href=?PageIndex="+i+"&"+url+">["+ i +"]</a>&nbsp;");}
}
}
//document.write("<td>")
if(PageIndex<TotalPage){
	PI=PageIndex+1;
	document.write(" <a href=?PageIndex="+PI+"&"+url+">[下一页]</a> ")
}
//document.write("</td><td class=a4><input onkeydown=if((event.keyCode==13)&&(this.value!=''))window.location='?PageIndex='+this.value+'&"+url+"'; onkeyup=if(isNaN(this.value))this.value='' style='border:1px solid #698cc3;' size=2></td>")
//document.write("</table>");
document.write(" <a href=?PageIndex="+TotalPage+"&"+url+">[尾页]</a> ")
document.write(" </div> ")
}
