
	function GO(elemid)
	{
		var elem;

		if(typeof elemid == 'object')
		{
			elem=elemid;
		}
		else
		{
			if(document.getElementById)
			{
				elem=document.getElementById(elemid);
			}
			else if(document.all)
			{
				elem=document.all(elemid);
			}
			else if(document.layers)
			{
				elem=document.all[elemid];
			}
		}

		return elem;
	}



	function CCS(elemid, css_style, css_value, gett)
	{
		var elem;

		elem=GO(elemid);

		if(!elem)
		{
			if(gett) return Array(false, false);
			return false;
		}

		if(gett) return Array(true, elem.style[css_style]);


		if(elem.style)
		{
			elem.style[css_style]=css_value;
		}

		return true;
	}

	var CCB, CCBO, CCBIE6, CCBIE=false;

	function CCBD()
	{
		if(navigator.userAgent.indexOf('MSIE 8') > 0)
		{
			CCB='ien';
			CCBIE=true;
		}
		else if(GO('top').style.opacity != undefined)
		{
			CCB='moz';
		}
		else if(GO('top').style.filter != undefined)
		{
			CCB='ie';
			CCBIE=true;
		}
		else
		{
			CCB='other';
		}

		if(window.opera != undefined)
		{
			CCBO=true;
		}

		if(navigator.userAgent.indexOf('MSIE 6') > 0)
		{
			CCBIE6=true;
		}
	}

/*
	var CCB, CCBO, CCBIE6;

	function CCBD()
	{
		if(navigator.userAgent.indexOf('MSIE 8') > 0)
		{
			CCB='ien';
		}
		else if(GO('top').style.filter != undefined)
		{
			CCB='ie';
		}
		else if(GO('top').style.opacity != undefined)
		{
			CCB='moz';
		}
		else
		{
			CCB='other';
		}

		if(window.opera != undefined)
		{
			CCBO=true;
		}

		if(navigator.userAgent.indexOf('MSIE 6') > 0)
		{
			CCBIE6=true;
		}
	}
*/

	function IE6()
	{
		var appVer=navigator.appVersion;
		appVer=appVer.split(';');
		if(appVer[1] == ' MSIE 6.0')
		{
			return true;
		}
	}



	function CCO(elemid, val)
	{
		if(!CCB) CCBD();

		if(CCB != 'other')
		{
			if(typeof elemid != 'object')
			{
				elemid=GO(elemid);
			}

			if(CCB == 'ie')
			{
				elemid.style.filter='alpha(opacity=' + val + ')';
			}
			else if(elemid)
			{
				elemid.style.opacity=val / 100;
			}
		}
	}



	function Trim(string)
	{
		return string.replace(/^\s*((?:[\S\s]*\S)?)\s*$/, '$1');
	}



	/**
	*
	*  URL encode / decode
	*  http://www.webtoolkit.info/
	*
	**/

	var Url = {

		// public method for url encoding
		encode : function (string) {
			return escape(this._utf8_encode(string));
		},

		// public method for url decoding
		decode : function (string) {
			return this._utf8_decode(unescape(string));
		},

		// private method for UTF-8 encoding
		_utf8_encode : function (string) {
			string = string.replace(/\r\n/g,"\n");
			var utftext = "";

			for (var n = 0; n < string.length; n++) {

				var c = string.charCodeAt(n);

				if (c < 128) {
					utftext += String.fromCharCode(c);
				}
				else if((c > 127) && (c < 2048)) {
					utftext += String.fromCharCode((c >> 6) | 192);
					utftext += String.fromCharCode((c & 63) | 128);
				}
				else {
					utftext += String.fromCharCode((c >> 12) | 224);
					utftext += String.fromCharCode(((c >> 6) & 63) | 128);
					utftext += String.fromCharCode((c & 63) | 128);
				}

			}

			return utftext;
		},

		// private method for UTF-8 decoding
		_utf8_decode : function (utftext) {
			var string = "";
			var i = 0;
			var c = c1 = c2 = 0;

			while ( i < utftext.length ) {

				c = utftext.charCodeAt(i);

				if (c < 128) {
					string += String.fromCharCode(c);
					i++;
				}
				else if((c > 191) && (c < 224)) {
					c2 = utftext.charCodeAt(i+1);
					string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
					i += 2;
				}
				else {
					c2 = utftext.charCodeAt(i+1);
					c3 = utftext.charCodeAt(i+2);
					string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
					i += 3;
				}

			}

			return string;
		}

	}



	function getPageSize()
	{
		var xScroll, yScroll;

		if(window.innerHeight && window.scrollMaxY)
		{
			xScroll=document.body.scrollWidth;
			yScroll=window.innerHeight + window.scrollMaxY;
		}
		else if(document.body.scrollHeight > document.body.offsetHeight)
		{
			xScroll=document.body.scrollWidth;
			yScroll=document.body.scrollHeight;
		}
		else
		{
			xScroll=document.body.offsetWidth;
			yScroll=document.body.offsetHeight;
		}

		var windowWidth, windowHeight;

		if(self.innerHeight)
		{
			windowWidth=self.innerWidth;
			windowHeight=self.innerHeight;
		}
		else if(document.documentElement && document.documentElement.clientHeight)
		{
			windowWidth=document.documentElement.clientWidth;
			windowHeight=document.documentElement.clientHeight;
		}
		else if (document.body)
		{
			windowWidth=document.body.clientWidth;
			windowHeight=document.body.clientHeight;
		}

		if(yScroll < windowHeight)
		{
			pageHeight=windowHeight;
		}
		else
		{
			pageHeight=yScroll;
		}

		if(xScroll < windowWidth)
		{
			pageWidth=windowWidth;
		}
		else
		{
			pageWidth=xScroll;
		}

		arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);

		return arrayPageSize;
	}



	function CCR(classname, cname, cvalue)
	{

	}



	function HS(string)
	{
		string=string.replace(/&/g, '&amp;');
		string=string.replace(/</g, '&lt;');
		string=string.replace(/>/g, '&gt;');
		string=string.replace(/"/g, '&quot;');
		//string=string.replace(/'/g, '&#039;');

		return string;
	}



	function Post(url, vals)
	{
		var param=Array(), i=0, params, http, key, key2, key3;

		for(key in vals)
		{
			if(isArray(vals[key]))
			{
				for(key2 in vals[key])
				{
					if(isArray(vals[key][key2]))
					{
						for(key3 in vals[key][key2])
						{
							if(!isNaN(vals[key][key2][key3]))
							{
								param[i++]=key + '[' + key2 + '][' + key3 + ']=' + (vals[key][key2][key3] ? vals[key][key2][key3] : '');
							}
							else
							{
								param[i++]=key + '[' + key2 + '][' + key3 + ']=' + (vals[key][key2][key3] ? Url.encode(vals[key][key2][key3]) : '');
							}
						}
					}
					else if(!isNaN(vals[key][key2]))
					{
						param[i++]=key + '[' + key2 + ']=' + (vals[key][key2] ? vals[key][key2] : '');
					}
					else
					{
						param[i++]=key + '[' + key2 + ']=' + (vals[key][key2] ? Url.encode(vals[key][key2]) : '');
					}
				}
			}
			else if(!isNaN(vals[key]))
			{
				param[i++]=key + '=' + vals[key];
			}
			else
			{
				param[i++]=key + '=' + Url.encode(vals[key] ? vals[key] : '');
			}
		}

		url+=(url.match('=') ? '&' : '?') + 'rdm=' + Math.random();
		params=param.join('&');

		http=new XMLHttpRequest();
		http.open('POST', url, true);
		http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
		http.setRequestHeader('Content-length', params.length);
		http.setRequestHeader('Connection', 'close');
		http.onreadystatechange=function() { if(http.readyState == 4) {	Post_Response(http.responseText); } }
		http.send(params);
	}



	function Post_Response(string)
	{
		var ex;

		ex=string.split("\n");

		if((ex[0] == '-start-') && (ex[ex.length-1] == '-end-'))
		{
			for(key in ex)
			{
				if((key == 0) || (key == (ex.length - 1))) continue;

				eval(ex[key]);
			}
		}
		else
		{
			//alert('ERJS: ' + string);
		}
	}



	function isArray(mixed_var)
	{
		if(!mixed_var) return false;

		if(typeof mixed_var === 'object')
		{
  			 if (mixed_var.hasOwnProperty)
  			 {
				for(key in mixed_var)
				{
					if(false === mixed_var.hasOwnProperty(key))
					{
						return false;
					}
				}
			}

			return true;
  		}

		return false;
	}
