/*----------------------------------------------------------------------------------------------------------
- author: Harry 
- version: 20080303
----------------------------------------------------------------------------------------------------------*/
var GOBJ_APP = 
{
/*----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------*/
	CONST_COL_SPLIT: String.fromCharCode(1),
	CONST_ROW_SPLIT: String.fromCharCode(2),
	CONST_TAB_SPLIT: String.fromCharCode(3),
/*----------------------------------------------------------------------------------------------------------
	AJAX - example
	function call_http_req()
	{
		var url = "AjaxHandle.aspx?reqID=2";
		GOBJ_APP.http_handle = "afterUpdate();";
		GOBJ_APP.ajax_http_get(url);
	}
	function afterUpdate()
	{
		alert(GOBJ_APP.http_req_text);
	}
----------------------------------------------------------------------------------------------------------*/
	// AJAX XMLHttpRequest
	http_req: null,
	http_req_text: "",
	http_handle: "alert('ok');",
	http_temp: null,
/*----------------------------------------------------------------------------------------------------------
	Ajax Get
----------------------------------------------------------------------------------------------------------*/
	ajax_http_get: function(url)
	{
		if (this.http_req == null) this.http_req = this.ajax_create_request();
		
		if (this.http_req != null)
		{
			this.http_req.open("GET", url, true);
			this.http_req.onreadystatechange = this.ajax_update_page;
			// jian_chen for remove cache
			this.http_req.setRequestHeader("If-Modified-Since","0"); 
			this.http_req.send(null);
		}
	},
/*----------------------------------------------------------------------------------------------------------
	Ajax Post
----------------------------------------------------------------------------------------------------------*/
	ajax_http_post: function(url)
	{
		if (this.http_req == null) this.http_req = this.ajax_create_request();
		
		if (this.http_req != null)
		{
			this.http_req.open("POST",url,false);
			this.http_req.onreadystatechange = this.ajax_update_page;
			this.http_req.send(null);
		}
	},
/*----------------------------------------------------------------------------------------------------------
	XMLHttpRequest
----------------------------------------------------------------------------------------------------------*/
	ajax_create_request: function()
	{	
	
		var req = null;
	
//		try
//		{
//			req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
//			req = new new XMLHttpRequest(); 
//		}
//		catch(tryOtherMS)
//		{
//			try
//			{
//				req = new ActiveXObject("Microsoft.XMLHTTP");
//			}
//			catch(failed)
//			{
//				req = null;
//			}
//		}

        if (window.ActiveXObject) { 
            req = new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
        else if (window.XMLHttpRequest) { 
            req = new XMLHttpRequest(); 
        }
        else{
            req = null;
        }

		return req;
	}, 

/*----------------------------------------------------------------------------------------------------------
	 XMLHttpRequest.onreadystatechange
----------------------------------------------------------------------------------------------------------*/
	ajax_update_page: function()
	{
		if (GOBJ_APP.http_req.readyState == 4)
		{
			if (GOBJ_APP.http_req.status == 200)
			{
				GOBJ_APP.http_req_text = GOBJ_APP.http_req.responseText;
				eval(GOBJ_APP.http_handle);
			}		
		}
	},
/*----------------------------------------------------------------------------------------------------------
	string
----------------------------------------------------------------------------------------------------------*/
	get_unique_id: function()
	{
		var now = new Date();
		return Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 
			now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds()).toString();
	},
/*----------------------------------------------------------------------------------------------------------
	None
----------------------------------------------------------------------------------------------------------*/
	get_now_date: function()
	{
		var now = new Date();
		return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate();
	},
/*----------------------------------------------------------------------------------------------------------
	None
----------------------------------------------------------------------------------------------------------*/
	get_now_time: function()
	{
		var now = new Date();
		return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate() + " " +
			 + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
	}
}

/*----------------------------------------------------------------------------------------------------------
- UO(User Object)
----------------------------------------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------*/
function UoPoint(x, y)
{
	if (x == null) x = 0;
	if (y == null) y = 0;

	this.x = x;
	this.y = y;
}
UoPoint.prototype=
{
}

/*----------------------------------------------------------------------------------------------------------
	uo_list
----------------------------------------------------------------------------------------------------------*/
function UoList()
{
	this.keys = new Array(),
	this.list = new Array(),
	this.count = 0	
}

UoList.prototype = 
{
/*----------------------------------------------------------------------------------------------------------
	UoList
----------------------------------------------------------------------------------------------------------*/
	add: function(key, item)
	{
		if (item != null)
		{  
			this.keys.push(key);
			this.list.push(item);
			this.count++;
		}
	},
/*----------------------------------------------------------------------------------------------------------
	Key
----------------------------------------------------------------------------------------------------------*/
	get_by_key: function(key)
	{
		var item = null;
	
		if (key.length > 0)
		{
			for (var i in this.keys)
			{
				if (this.keys[i] == key)
				{
					item = this.list[i];
					break;
				}
			}
		}
		
		return item;
	},
/*----------------------------------------------------------------------------------------------------------
	Index
----------------------------------------------------------------------------------------------------------*/
	get_by_index: function(index)
	{
		var item = null;
	
		if (index > -1)
		{
			for (var i in this.keys)
			{
			    if (i == index)
			    {
				     item = this.list[i];
				     break;
			    }
			}
		}
		
		return item;
	},

/*----------------------------------------------------------------------------------------------------------
	UoList
----------------------------------------------------------------------------------------------------------*/
	remove_by_key: function(key)
	{
		if (key.length > 0)
		{
			var obj = this.get_by_key(key);
			if (obj != null)
			{
				delete obj;
				this.count--;
			}
		}
	},
/*----------------------------------------------------------------------------------------------------------
	UoList
----------------------------------------------------------------------------------------------------------*/
	remove_by_index: function(index)
	{
		if (index > -1)
		{
			try
			{
				var obj = this.get_item_by_index(index);
				if (obj != null)
				{
					delete obj;
					this.count--;
				}
			}
			catch(E)
			{
			}
		}
	}
}


/*----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------*/
function UcManager()
{
	this.list = new UoList();
	this.arr = new Array();
}

UcManager.prototype = 
{
}
// 
var GOBJ_UC_MAN = new UcManager();

