﻿// JScript 文件
<!--
        //得到焦点和失去焦点时改变背景色，并且过滤掉非法字符
	    function chBgOnB(element,elementvalue)
	    {
	        element.style.background='#CCFF99';
	        element.style.border="1px solid #36F";
	    }
	    function chBgOnF(element,elementvalue)
	    {
	        element.style.background='#fff';
	        element.style.border="1px #cccccc solid";
	    }	
	   //控制非法字符的输入
	    function checktel(element,elementvalue)
	    {
	        if( elementvalue == "")
	        {
	              return false;
	        }
		    var str=elementvalue;
		     //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		    var Expression=/(\d{3}-)?\d{8}|(\d{4}-)(\d{7})/; 
		    var objExp=new RegExp(Expression);
		    if(objExp.test(str)==true)
		    {
			        return true;
		    }
		    else
			{
			        alert('對不起,閣下輸入的電話號碼格式不正確。');
			        elementvalue = "";
				    return false;
			}
	    }
	    //控制邮箱格式
	     function checkemail(element,elementvalue)
	     {
	        if( elementvalue == "")
	        {
	              return false;
	        }
		    var str=elementvalue;
		     //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		    var Expression=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
		    var objExp=new RegExp(Expression);
		    if(objExp.test(str)==true)
		    {
			        return true;
		    }
		    else
			{
			        alert('閣下輸入的電郵地址格式不正確，請從新輸入。');
			        //sAlert('閣下輸入的電郵地址格式不正確，請從新輸入！！！','績王足球會:');
			        element.focus();
			        elementvalue = "";
				    return false;
			}
	     }
	     function check_email(element,elementvalue)
	     {
	        if( elementvalue == "")
	        {
	              return false;
	        }
		    var str=elementvalue;
		     //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		    var Expression=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
		    var objExp=new RegExp(Expression);
		    if(objExp.test(str)==true)
		    {
			        return true;
		    }
		    else
			{
			        alert('閣下輸入的電郵地址格式不正確，請從新輸入。');
			        //sAlert('閣下輸入的電郵地址格式不正確，請從新輸入！！！','績王足球會:');
			        element.focus();
			        elementvalue = "";
				    return false;
			}
	     }
	     //
	     function checkusername(element,elementvalue)
	     {
	        if( elementvalue == "")
	        {
	              return false;
	        }
		    var str=elementvalue;
		     //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		    var Expression=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
		    var objExp=new RegExp(Expression);
		    if(objExp.test(str)==true)
		    {
			        return true;
		    }
		    else
			{
			        alert('對不起,閣下輸入的用戶名信息格式不正確。');
			        elementvalue = "";
			        element.focus();
				    return false;
			}
	    }
	    //控制只能输入英文字母
	    function checkenglishname(element,elementvalue)
	     {
	            if( elementvalue == "")
	            {
	                  return false;
	            }
		        var str=elementvalue;
		         //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		        var Expression=/^[a-zA-Z]*$/; 
		        var objExp=new RegExp(Expression);
		        if(objExp.test(str)==true)
		        {
			            return true;
		        }
		        else
			    {
			            sAlert('對不起,閣下輸入的用戶英文名稱格式不正確！！！','績王足球會:');
			            elementvalue = "";
			            element.focus();
				        return false;
			    }
	    }
	      //控制只能输入中文漢字
	    function checkchinesename(element,elementvalue)
	     {
	        if( elementvalue == "")
	        {
	              return false;
	        }
		    var str=elementvalue;
		     //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		    var Expression=/[^\u4E00-\u9FA5]/g;
		    var objExp=new RegExp(Expression);
		    if(objExp.test(str)==true)
		    {
			        sAlert('對不起,閣下輸入的用戶中文名稱格式不正確！！！','績王足球會:');
			        elementvalue = "";
				    return false;
		    }
		    else
			{
				    return true;
			}
	    }
	    
	    //控制密码输入格式
	    function checkpwd(element,elementvalue)
	     {
	        if( elementvalue == "")
	        {
	              return false;
	        }
		    var str=elementvalue;
		     //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		    var Expression=/^(\w){6,20}$/; 
		    var objExp=new RegExp(Expression);
		    if(objExp.test(str)==true)
		    {
			        return true;
		    }
		    else
			{
			        sAlert('對不起,閣下輸入的密碼格式不正確，只能輸入由6-25個字母、數字！！！','績王足球會:');
			        elementvalue = "";
				    return false;
			}
	    }
         //window.showModalDialog
         function sAlert(str,titleStr)
         {     //xWin(id,w,h,l,t,tit,msg)
               var sWidth,sHeight;
               sWidth = document.body.offsetWidth;
               sHeight = document.body.offsetHeight; 
               var msgw,msgh;
               msgw = 350;
               msgh = 100;
               
               var a = new xWin("1",msgw,msgh,(sWidth-msgw)/2,document.documentElement.scrollTop + (sHeight-msgh)/2,titleStr,str);
              //alertWin(titleStr, str, 350, 100);
//            var msgw,msgh,bordercolor;
//            msgw=350;//提示窗口的宽度
//            msgh=100;//提示窗口的高度
//            bordercolor="#006400";//提示窗口的边框颜色
//            titlecolor="#006200";//提示窗口的标题颜色
//            
//            var sWidth,sHeight;
//            sWidth=document.body.offsetWidth;
//            sHeight=document.body.offsetHeight; 

//            var bgObj=document.createElement("div");
//            bgObj.setAttribute('id','bgDiv');
//            bgObj.style.position="absolute";
//            bgObj.style.top="0";
//            bgObj.style.background="#777";
//            bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75);";
//            bgObj.style.opacity="0.6";
//            bgObj.style.left="0";
//            bgObj.style.width=sWidth + "px";
//            bgObj.style.height=sHeight + "px";
//            document.body.appendChild(bgObj);
//            var msgObj=document.createElement("div")
//            msgObj.setAttribute("id","msgDiv");
//            msgObj.setAttribute("align","center");
//            msgObj.style.position="absolute";
//            msgObj.style.background="white";
//            msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
//            msgObj.style.border="1px solid " + bordercolor;
//            msgObj.style.width=msgw + "px";
//            msgObj.style.height=msgh + "px";
//            msgObj.style.top=(document.documentElement.scrollTop + (sHeight-msgh)/2) + "px";
//            msgObj.style.left=(sWidth-msgw)/2 + "px";
//            //msgObj.onmousedown = drag(event,this);
//            
//          var title=document.createElement("h4");
//          title.setAttribute("id","msgTitle");
//          title.setAttribute("align","left");
//          title.style.margin="0";
//          title.style.padding="3px";
//          title.style.background=bordercolor;
//          title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
//          title.style.opacity="0.75";
//          title.style.border="1px solid " + bordercolor;
//          title.style.height="18px";
//          title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
//          title.style.color="white";
//          title.style.cursor="pointer";
//          title.innerHTML=titleStr ;
//         
//          document.body.appendChild(msgObj);
//          document.getElementById("msgDiv").appendChild(title);
//         //document.getElementById("msgDiv").appendChild(btn);
//          var txt=document.createElement("p");
//          txt.style.margin="1em 0";
//          txt.setAttribute("id","msgTxt");
//          txt.innerHTML=str;
//          document.getElementById("msgDiv").appendChild(txt);
//          
//          //關閉按钮
//          var btn = document.createElement("input");
//          btn.setAttribute("id","ok");
//          btn.setAttribute("align","center");
//          btn.type= "button";
//          btn.value = "關  閉";
//          btn.style.margin="0";
//          btn.style.padding="3px";
//          btn.style.background=bordercolor;
//          btn.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
//          btn.style.opacity="0.75";
//          btn.style.border="1px solid " + bordercolor;
//          btn.style.height="18px";
//          btn.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
//          btn.style.color="white";
//          btn.style.cursor="pointer";
//          btn.onclick=function(){
//            document.body.removeChild(bgObj);
//            document.getElementById("msgDiv").removeChild(title);
//            document.body.removeChild(msgObj);
//          }
//          document.getElementById("msgDiv").appendChild(btn);
    }
    <!--
        //可以打包为js文件;
        var x0=0,y0=0,x1=0,y1=0;
        var offx=6,offy=6;
        var moveable=false;
        var hover='orange',normal='#006200';//color;
        var index=10000;//z-index;
        //开始拖动;
        function startDrag(obj)
        {
        //锁定标题栏;
        obj.setCapture();
        //定义对象;
        var win = obj.parentNode;
        var sha = win.nextSibling;
        //记录鼠标和层位置;
        x0 = event.clientX;
        y0 = event.clientY;
        x1 = parseInt(win.style.left);
        y1 = parseInt(win.style.top);
        //记录颜色;
        normal = obj.style.backgroundColor;
        //改变风格;
        obj.style.backgroundColor = hover;
        win.style.borderColor = hover;
        obj.nextSibling.style.color = hover;
        sha.style.left = x1 + offx;
        sha.style.top = y1 + offy;
        moveable = true;
        }
        //拖动;
        function drag(obj)
        {
        var win = obj.parentNode;
        var sha = win.nextSibling;
        if(moveable)
        {
         win.style.left = x1 + event.clientX - x0;
         win.style.top = y1 + event.clientY - y0;
         sha.style.left = parseInt(win.style.left) + offx;
         sha.style.top = parseInt(win.style.top) + offy;
        }
        }
        //停止拖动;
        function stopDrag(obj)
        {
        var win = obj.parentNode;
        var sha = win.nextSibling;
        win.style.borderColor = normal;
        obj.style.backgroundColor = normal;
        obj.nextSibling.style.color = normal;
        sha.style.left = obj.parentNode.style.left;
        sha.style.top = obj.parentNode.style.top;
        //放开标题栏;
        obj.releaseCapture();
        moveable = false;
        }
        //获得焦点;
        function getFocus(obj)
        {
        index = index + 2;
        var idx = index;
        obj.style.zIndex=idx;
        obj.nextSibling.style.zIndex=idx-1;
        }
        function min(obj)
        {
        var win = obj.parentNode.parentNode;
        var sha = win.nextSibling;
        var tit = obj.parentNode;
        var msg = tit.nextSibling;
        var flg = msg.style.display=="none";
        if(flg)
        {
         win.style.height = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2;
         sha.style.height = win.style.height;
         msg.style.display = "block";
         obj.innerHTML = "0";
        }
        else
        {
         win.style.height = parseInt(tit.style.height) + 2*2;
         sha.style.height = win.style.height;
         obj.innerHTML = "2";
         msg.style.display = "none";
        }
        }
        function cls(obj)
        {
        var win = obj.parentNode.parentNode;
        var sha = win.nextSibling;
        win.style.visibility = "hidden";
        sha.style.visibility = "hidden";
        }
        //创建一个对象;
        function xWin(id,w,h,l,t,tit,msg)
        {
        index = index+2;
        this.id   = id;
        this.width  = w;
        this.height = h;
        this.left  = l;
        this.top   = t;
        this.zIndex = index;
        this.title  = tit;
        this.message = msg;
        this.obj   = null;
        this.bulid  = bulid;
        this.bulid();
        }
        //初始化;
        function bulid()
        {
        var str = ""
         + "<div id=xMsg" + this.id + " "
         + "style='"
         + "z-index:" + this.zIndex + ";"
         + "width:" + this.width + ";"
         + "height:" + this.height + ";"
         + "left:" + this.left + ";"
         + "top:" + this.top + ";"
         + "background-color:" + normal + ";"
         + "color:" + normal + ";"
         + "font-size:12px;"
         + "font-family:Verdana;"
         + "position:absolute;"
         + "cursor:default;"
         + "border:2px solid " + normal + ";"
         + "' "
         + "onmousedown='getFocus(this)'>"
          + "<div "
          + "style='"
          + "background-color:" + normal + ";"
          + "width:" + (this.width-2*2) + ";"
          + "height:20;"
          + "color:white;"
          + "' "
          + "onmousedown='startDrag(this)' "
          + "onmouseup='stopDrag(this)' "
          + "onmousemove='drag(this)' "
          + ">"
          + "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;'>" + this.title + "</span>"
          + "<span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='min(this)'>0</span>"
          + "<span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='cls(this)'>r</span>"
          + "</div>"
          + "<div style='"
          + "width:100%;"
          + "height:" + (this.height-20-4) + ";"
          + "background-color:white;"
          + "line-height:14px;"
          + "word-break:break-all;"
          + "padding:3px;"
          + "'>" 
          + "<table style='width:100%;height:"+(this.height-20-4)+"'>" 
          + "<tr>" 
          + "<td style ='" 
          + "text-align:center;" 
          + "vertical-align:middle;" 
          + "'>" + this.message 
          + "</td>"
          + "</tr>"
          + "<tr><td></td><tr>" 
          + "</table>"
          + "</div>"
          + "</div>"
          + "<div style='"
          + "width:" + this.width + ";"
          + "height:" + this.height + ";"
          + "top:" + this.top + ";"
          + "left:" + this.left + ";"
          + "z-index:" + (this.zIndex-1) + ";"
          + "position:absolute;"
          + "background-color:black;"
          + "filter:alpha(opacity=40);"
          + "'>?</div>";
          //alert(str);
         document.body.insertAdjacentHTML("beforeEnd",str);
        }
        //-->
//    <!--
//    function initialize()
//    {
//    var a = new xWin("1",160,200,200,200,"Message","xWin <br> A Cool Pop Div Window<br>Version:1.0<br>2002-8-13");
//    }
//    window.onload = initialize;
//    //-->

    function alertWin(title, msg, w, h){ 
	var titleheight = "22px"; // 提示窗口标题高度 
	var bordercolor = "#666699"; // 提示窗口的边框颜色 
	var titlecolor = "#FFFFFF"; // 提示窗口的标题颜色 
	var titlebgcolor = "#666699"; // 提示窗口的标题背景色
	var bgcolor = "#FFFFFF"; // 提示内容的背景色
	
	var iWidth = document.documentElement.clientWidth; 
	var iHeight = document.documentElement.clientHeight; 
	var bgObj = document.createElement("div"); 
	bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.clientHeight, iHeight)+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:101;";
	document.body.appendChild(bgObj); 
	
	var msgObj=document.createElement("div");
	msgObj.style.cssText = "position:absolute;font:11px '宋体';top:"+(iHeight-h)/2+"px;left:"+(iWidth-w)/2+"px;width:"+w+"px;height:"+h+"px;text-align:center;border:1px solid "+bordercolor+";background-color:"+bgcolor+";padding:1px;line-height:22px;z-index:102;";
	document.body.appendChild(msgObj);
	
	var table = document.createElement("table");
	msgObj.appendChild(table);
	table.style.cssText = "margin:0px;border:0px;padding:0px;";
	table.cellSpacing = 0;
	var tr = table.insertRow(-1);
	var titleBar = tr.insertCell(-1);
	titleBar.style.cssText = "width:100%;height:"+titleheight+"px;text-align:left;padding:3px;margin:0px;font:bold 13px '宋体';color:"+titlecolor+";border:1px solid " + bordercolor + ";cursor:move;background-color:" + titlebgcolor;
	titleBar.style.paddingLeft = "10px";
	titleBar.innerHTML = title;
	var moveX = 0;
	var moveY = 0;
	var moveTop = 0;
	var moveLeft = 0;
	var moveable = false;
	var docMouseMoveEvent = document.onmousemove;
	var docMouseUpEvent = document.onmouseup;
	titleBar.onmousedown = function() {
		var evt = getEvent();
		moveable = true; 
		moveX = evt.clientX;
		moveY = evt.clientY;
		moveTop = parseInt(msgObj.style.top);
		moveLeft = parseInt(msgObj.style.left);
		
		document.onmousemove = function() {
			if (moveable) {
				var evt = getEvent();
				var x = moveLeft + evt.clientX - moveX;
				var y = moveTop + evt.clientY - moveY;
				if ( x > 0 &&( x + w < iWidth) && y > 0 && (y + h < iHeight) ) {
					msgObj.style.left = x + "px";
					msgObj.style.top = y + "px";
				}
			}	
		};
		document.onmouseup = function () { 
			if (moveable) { 
				document.onmousemove = docMouseMoveEvent;
				document.onmouseup = docMouseUpEvent;
				moveable = false; 
				moveX = 0;
				moveY = 0;
				moveTop = 0;
				moveLeft = 0;
			} 
		};
	}
	
	var closeBtn = tr.insertCell(-1);
	closeBtn.style.cssText = "cursor:pointer; padding:2px;background-color:" + titlebgcolor;
	closeBtn.innerHTML = "<span style='font-size:15pt; color:"+titlecolor+";'>×</span>";
	closeBtn.onclick = function(){ 
		document.body.removeChild(bgObj); 
		document.body.removeChild(msgObj); 
	} 
	var msgBox = table.insertRow(-1).insertCell(-1);
	msgBox.style.cssText = "font:10pt '宋体';";
	msgBox.colSpan  = 2;
	msgBox.innerHTML = msg;
	
    // 获得事件Event对象，用于兼容IE和FireFox
    function getEvent() {
	    return window.event || arguments.callee.caller.arguments[0];
    }
}

function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}
 //-->