
	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;

	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;
		}
	}



	function CCO(elemid, val)
	{
		if(!CCB) CCBD();

		if(CCB != 'other')
		{
			if(typeof elemid != 'object')
			{
				elemid=GO(elemid);
			}

			if(CCB == 'ien')
			{
				elemid.style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=' + val + ')';
			}
			if(CCB == 'ie')
			{
				elemid.style.filter='alpha(opacity=' + val + ')';
			}
			else
			{
				elemid.style.opacity=val / 100;
			}
		}
	}



	function getPageSize()
	{
		var xScroll, yScroll, pageWidth, pageHeight;

		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;
		}

		var arrayPageSize=new Array(pageWidth, pageHeight, windowWidth, windowHeight);

		return arrayPageSize;
	}


	function SL(id, url)
	{
		head=document.getElementsByTagName('head')[0];
	    	loader=document.getElementById('loader');

	    	if(loader) head.removeChild(loader);

	    	script=document.createElement('script');
	    	script.id='loader-' + id;
		script.src=url + Math.random() + 'a/';

		cache=document.getElementsByTagName('head')[0];
	    	cache.appendChild(script);
	}



	function Post(url, vals)
	{
		var param='';

		for(key in vals)
		{
			param+=key + '=' + (vals[key] ? vals[key] : '') + '&';
		}

		http=new XMLHttpRequest();
		http.open('POST', url, true);
		http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
		http.setRequestHeader('Content-length', param.length);
		http.setRequestHeader('Connection', 'close');

		http.onreadystatechange=function()
		{
			if(http.readyState == 4)
			{
				Post_Response(http.responseText);
			}
		}

		http.send(param);
	}



	function Post_Response(string)
	{
		var ex;

		ex=string.split("\n");

		if((ex[0] == '-start-') && (ex[ex.length-1] == '-end-'))
		{
			for(key in ex)
			{
				//alert(ex[key]);
				if((key == 0) || (key == (ex.length - 1))) continue;

				eval(ex[key]);
			}
		}
		else
		{
			alert('ERJS: ' + string);
		}
	}

	/**
	*
	*  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 HS(string)
	{
		string=string.replace(/&/g, '&amp;');
		string=string.replace(/</g, '&lt;');
		string=string.replace(/>/g, '&gt;');
		string=string.replace(/"/g, '&quot;');

		return string;
	}
