function PopupwithScrollbars(urlStr,X,Y)    
{
//将弹出带有滚动条的窗口定位于父窗口的正中位置.
// 参数:urlStr是链接页面的url;
//X是该弹出窗口的width;
//Y是该弹出窗口的height.

var pos_X = (screen.width)?(screen.width-X)/2:100;
var pos_Y= (screen.height)?(screen.height-Y)/2-50:100;
var winpos = "left="+pos_X+",top="+pos_Y+",width="+X+",height="+Y;
window.open(urlStr, "Popup", "fullscreen=0,center=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0,"+winpos);
}


function PopupwithScrollbarsWithMenu(urlStr,X,Y)    
{
//将弹出带有滚动条的窗口定位于父窗口的正中位置.
// 参数:urlStr是链接页面的url;
//X是该弹出窗口的width;
//Y是该弹出窗口的height.

var pos_X = (screen.width)?(screen.width-X)/2:100;
var pos_Y= (screen.height)?(screen.height-Y)/2-50:100;
var winpos = "left="+pos_X+",top="+pos_Y+",width="+X+",height="+Y;
window.open(urlStr, "Popup", "fullscreen=0,center=0,directories=0,location=0,menubar=1,resizable=0,scrollbars=1,status=0,toolbar=0,"+winpos);
}

function	showLoading (state) {
  		
		this.loadingPane = $("itown_loading");
		if (this.loadingPane == null) {
			var el = document.createElement('DIV');
			el.setAttribute("id","itown_loading");
			//el.style.cssText="display:none;font-family:Verdana;font-size:11px;border:1px solid #00CC00;background-color:#A4FFA4;padding:1px;position:absolute; right:1px; top:1px; width:110px; height:14px; z-index:10000";
			el.style.position = "absolute";
	        el.style.border = "1px solid #000000";
	        el.style.color = "#FFFF00";
	        el.style.backgroundColor = "#6699CC";
	        el.style.width = "100%";
	        el.style.lineHeigth = "50px";
	        el.style.fontFamily = "宋体";
	        el.style.fontWeight = "bold";
	        el.style.fontSize = "14px";
	        el.style.padding = "5px 5px 5px 5px";
	        el.style.filter="Alpha(opacity=90)";
	        el.style.zIndex="5";
			el.innerHTML="&nbsp;数据加载中，请稍候... ";
			document.body.appendChild(el);
			this.loadingPane = el;
		}

			if (state) {
				this.loadingPane.style.display="block";
				this.loadingPane.style.top = document.body.scrollTop+1;
			} else {
				this.loadingPane.style.display="none";
			}
	}
	/**
	替换 参数中%，并且编码
	*/
	function encodeURIAndRepace (strValue) {
		//var  url = strValue.replace(/\%/g,"%25");//直接替换%
    	return  encodeURI(strValue);
	}

	/**
	得到页面所有的值
	*/	
	function preparePostData (form) {
	    var result = "";
	    for (var i = 0; i < form.elements.length; i++) {
	        var el = form.elements[i];
	        if (el.tagName.toLowerCase() == "select") {
	            for (var j = 0; j < el.options.length; j++) {
	                var op = el.options[j];
	                if (op.selected) {
	                    result += "&" + (el.name) + "=" + this.encodeURIAndRepace(op.value);
	                }
	            }
	        } else {
	            if (el.tagName.toLowerCase() == "textarea") {
	                result += "&" + (el.name) + "=" + this.encodeURIAndRepace(el.value);
	            } else {
	                if (el.tagName.toLowerCase() == "input") {
	                    if (el.type.toLowerCase() == "checkbox" || el.type.toLowerCase() == "radio") {
	                        if (el.checked) {
	                            result += "&" + (el.name) + "=" + this.encodeURIAndRepace(el.value);
	                        }
	                    } else {
	                        if (el.type.toLowerCase() == "text" || el.type.toLowerCase() == "hidden") {
	                        	
	                            result += "&" + (el.name) + "=" + this.encodeURIAndRepace(el.value);
	                        }
	                    }
	                }
	            }
	        }
	    }
	    
	    return result;
	}
	function updateAjaxService(serviceId,filedId,formName)
	{
		var url ="./controller?SERVICE_ID="+serviceId;
		var myAjax = new Ajax.Updater(filedId,url,{method:'post',parameters:Form.serialize(formName)});


	}
	/**
	提交AJAX请求
	*/
	function loadAjaxService(serviceId,formName,param)
	{
		var url ="./controller?SERVICE_ID="+serviceId;
		var myAjax = new Ajax.Request(url,{method:'post',parameters:Form.serialize(formName),onComplete:param});		
	}
	function completeAjax(param)
	{
		
	}
	/**
	提交前的处理: onBeforeAjaxResponse
	
	onBeforeAjaxResponse

	*/
	/**
	提交后的处理
	
	onAfterAjaxResponse(originalRequest)

		
	实现这个回掉方法
     将返回的值附到指定的页面域中 如:document.form[0].fieldName.value=originalRequest.responseText
		

	*/	
