// Degin by Shili 
(function(){
	
	window["ADS"]={};
	
	function $(Element)
	{
		return document.getElementById(Element)	
	}
	window["ADS"]["$"]=$;
	
	function $ce(Element)
	{
		return document.createElement(Element)	
	}
	window["ADS"]["$ce"]=$ce;
	
	function $ct(Element)
	{
		return document.createTextNode(Element)	
	}
	window["ADS"]["$ct"]=$ct;
	
	
	function CreateAjaxObject() {
	
		http_request = false;
		//建立对象 FF
		
		if(window.XMLHttpRequest)
		{
			http_request = new XMLHttpRequest();
		}
		
		//IE
		if(!http_request){
			if(window.ActiveXObject)
			{
				try
				{
					http_request = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e)
				{
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
		}
		
		return http_request;
	}
	window["ADS"]["AjaxObj"]=CreateAjaxObject;
	
	function CheckSub(temp_list)
	{
		Err = ""
		a_list = new Array;
		a_list1 = temp_list.split(",");
		for(i=0;i<a_list1.length;i++)
		{
			a_list2 = new Array;
			a_list2 = a_list1[i].split("|");
			temp_input = $(a_list2[1])
			
			if(a_list2[0]=="1")
			{
				if(temp_input.value=="")
				{
					Err += a_list2[2]+"不能为空\n";
				}
			}
			
			if(a_list2[0]=="2")
			{
				if(temp_input.value!=$(a_list2[3]).value)
				{
					Err += a_list2[2]+"必须相同\n";
				}
			}
			
			if(a_list2[0]=="3")
			{
				if(isNaN(parseInt(temp_input.value)))
				{
					Err += a_list2[2]+"必须为数字\n";
				}
			}
			
			if(a_list2[0]=="4")
			{
				if(temp_input.value.length<Number(a_list2[3]))
				{
					Err += a_list2[2]+"最少"+ a_list2[3] +"个字符\n";
				}
			}
		}
		
		if(Err!="")
		{
			alert(Err);
			return false;
		}
		else
		{
			return true;
		}
	}
	window["ADS"]["CheckSub"]=CheckSub;
	
	function loadJS(url,load)
	{
		var _script = $ce('script');
		_script.setAttribute('type','text/javascript');
		_script.setAttribute('src',url);
		document.getElementsByTagName('head')[0].appendChild(_script);
		if(!load)	return;
		if(document.all){
			_script.onreadystatechange = function(){
				if (this.readyState=='loaded' || this.readyState=='complete')
				{
					load();
				}
			};
		}else{
			_script.onload = function(){
				load();
			};
		}
	}
	window["ADS"]["LoadJs"]=loadJS;

	
	function getElementOffsetTop(element)
	{
		_y = element.offsetTop;	
		while(element=element.offsetParent)
		{
			_y += element.offsetTop;	
		}
		return _y;
	}
	window["ADS"]["TotalTop"]=getElementOffsetTop;
	
	function getElementOffsetLeft(element)
	{
		_x = element.offsetLeft;	
		while(element=element.offsetParent)
		{
			_x += element.offsetLeft;	
		}
		return _x;
	}
	window["ADS"]["TotalLeft"]=getElementOffsetLeft;

})()
if (top.location != self.location)
{
	top.location=self.location;
}
