//*********************************************************
// By Cason 
// Http://www.ybso.com
//
//*********************************************************
	var isLoop	= true;
	function XHConn()
	{
	  var xmlhttp = false, bComplete = false;
	  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
	  catch (e) { alert(e);xmlhttp = false; }}}
	  if (!xmlhttp) return null;
	  this.connect = function(sURL, sMethod, sVars, fnDone, parObj)
	  {
		 parObj.innerHTML	= "Loading...";
		 Loading(parObj);
		 if (!xmlhttp) return false;
		bComplete = false;
		sVars = (sVars == '') ? Math.random() : sVars + '&' + Math.random( );
		sMethod = sMethod.toUpperCase();

		try {
		  if (sMethod == "GET")
		  {
			xmlhttp.open(sMethod, sURL + '?' + sVars, true);
			xmlhttp.setRequestHeader("Content-Type", "text/html;charset=utf-8");
			sVars = "";
		  }
		  else
		  {
			xmlhttp.open(sMethod, sURL, true);
			xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		  }
		  xmlhttp.onreadystatechange = function(){
				if (xmlhttp.readyState == 4 && !bComplete)
				{
					bComplete = true;
					isLoop	  = false;
					fnDone(xmlhttp, parObj);
				}
		  }
		  xmlhttp.send(sVars);
		}
		catch(z) { return false; }
		return true;
	  }
	  return this;
	}

	function Loading(parObj){

		if (!isLoop) return false;
		parObj.innerHTML = parObj.innerHTML + " ..";
		window.setTimeout(function(){this.Loading(parObj);}, '500');
		
		
	}

	function YL_Main(){
		this.Version	= function(){
			return "v1.20"
		}
		//含有非数字字?返回 true
		this.IsNumber	= function(s){ //适于校验非负整数
		   var reg = /^[01233456789]{1,}$/;
			if(reg.test(s))
				return true;
			else
				return false;
		}
	this.hidden	= function(aId){
		if (typeof aId != 'object'){
			obj	= this.getElement(aId);
		}
		obj.style.visibility="hidden";
	}
		this.getElement = function(aID){
			if(document.getElementById && document.getElementById(aID)) {
			// W3C DOM
			return document.getElementById(aID);
			} else if (document.all && document.all(aID)) {
			// MSIE 4 DOM
			return document.all(aID);
			} else if (document.layers && document.layers[aID]) {
			// NN 4 DOM.. note: this won't find nested layers
			return document.layers[aID];
			} else {
			return false;
			}
		}
		this.GetPass = function(len){
			var sRandom		= (Math.random())*10;
			var iNo		= 	Math.floor(sRandom*999999999999999999).toString();
			if (iNo.length>len)
			{
				iNo	= iNo.substring(0,len);
			}
			return iNo;
		}
		this.SetCookies=function (name, value, day) {   
			var today = new Date();
			var expire = new Date();
			expire.setTime(today.getTime() + 1000*60*60*24*day);
			window.document.cookie = name + "=" + escape(value) + ((day == null) ? "" : ("; expires=" + expire.toGMTString()));
		}
		this.GetCookies	= function (sname){
			var cookieValue = "";
			var search = sname + "=";
			if(document.cookie.length > 0){ 
				offset = document.cookie.indexOf(search);
				if (offset != -1){ 
					offset += search.length;
					end = document.cookie.indexOf(";", offset);
					if (end == -1) end = document.cookie.length;
					cookieValue = unescape(document.cookie.substring(offset, end))
				}
			}
			return cookieValue;
		}
		this.setQueryString = function (aId){
			var queryString = "";
			var frm = this.getElement(aId);
			var numberElements	= frm.elements.length;
			for(var i=0;i<numberElements;i++){
				if(i<numberElements-1){
					if (frm.elements[i].type=="radio" && frm.elements[i].checked==false)
					{
					}else{
						if (frm.elements[i].id=="" && frm.elements[i].name=="")
						{
						}else{
							queryString +=(frm.elements[i].id==""?frm.elements[i].name:frm.elements[i].id)+ "=" +frm.elements[i].value + "&";
						}
					}
				}
			}
			return queryString + "YonLi=0";
		}
	}
		function ImgSize(img,iw,ih){
			if (img.width > iw)
			{
				img.width	= iw;
				if (img.height > ih)
				{
					img.height = ih;
				}
			}
		}
