	var g_url = '';
		
	function GoToUrl(_href)
	{
		window.location = _href;
	}
	
	function GoToGlobalUrl()
	{
		GoToUrl(g_url);
	}
		
	function gE(el)
	{ return document.getElementById(el); }
	
	function UcWords(str)
	{ return str.toLowerCase().replace(/\w+/g, function(s){return s.charAt(0).toUpperCase() + s.substr(1);}) }
	
	function Trim(str)
	{ str = str.replace(/\s+$/, ''); str = str.replace(/^\s+/, ''); return str; }
	
	function GetX(el)
	{
			var left = 0;
			do
			{
				left += el.offsetLeft || 0;																	
				el 	 =  el.offsetParent;
			} while (el);
			return left+(window.ie6||window.ie7?1:0);
	}
	
	function GetY(el)
	{
			var top = 0;
			do
			{
				top += el.offsetTop || 0;
				el 	=  el.offsetParent;
			} while (el);
			return top+(window.ie6||window.ie7?1:0);
	}
	
	function SetOpacity(obj,value)
	{
		obj.style.MozOpacity = value/100;
		obj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+value+")";
	}
	
	function Hide(el)
	{ el.style.display = 'none'; }
	
	function Show(el)
	{ el.style.display = 'block'; }
	
	function ValidateEmail(str)
	{
		var re_1 = /^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/i;
		return (Trim(str).length && Trim(str).match(re_1))?true:false;
	}
	
	function InArray(needle, haystack)
	{	
		for (var i = 0; i < haystack.length; i++)
			if (haystack[i] == needle) return true;
		return false;
	}
	
	function IsInt(v)
	{ return parseInt(v).toString()===v.toString(); }
	
	function ToInt(v)
	{ return (v*1); }
	
	function Sav(str,type) 
	{
		if(typeeof(str)=="undefined")	str="";
		if(typeeof(type)!="number") 	type=2;
		
		type = Math.max(0,Math.min(3,parseInt(type)));
		
		var from	= new Array(/</g,/>/g);
		var to		= new Array("&lt;","&gt;");
		if(type==1 || type==3)
		{
			from.push(/'/g);
			to.push("&#039;");
		}
		if(type==2 || type==3)
		{
			from.push(/"/g);
			to.push("&quot;");
		}
		for(var i in from)
			str=str.replace(from[i],to[i]);
		
		return str;
	}
	
	function AddLoadEvent(func)
	{
		var oldonload = window.onload;
		if (typeof window.onload != 'function')
			window.onload = func;
		else
		{
			window.onload = function()
			{
				oldonload();
				func();
			}
		}
	}
	
	function InnerToFromAjax(_url, oInsertTo)
	{
		var oAjax;

		if (window.XMLHttpRequest)
		{
			oAjax = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			try 
			{
				oAjax = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e){}
			try 
			{
				oAjax = new ActiveXObject('Microsoft.XMLHTTP');
			} catch (e){}
		}

		if (oAjax)
		{
			oAjax.onreadystatechange = function()
			{
				if (oAjax.readyState == 4 && oAjax.status == 200) 
				{
					var sContent = oAjax.responseText;
					oInsertTo.innerHTML = sContent;
				}
			};
			oAjax.open("POST", _url, true);
			oAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			oAjax.send('is_ajax=1');
		}
		else
		{
			alert("AJAX not init!");
		}
	}
	
	function SetValueFromAjax(_url, obj)
	{
		var oAjax;

		if (window.XMLHttpRequest)
		{
			oAjax = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			try 
			{
				oAjax = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e){}
			try 
			{
				oAjax = new ActiveXObject('Microsoft.XMLHTTP');
			} catch (e){}
		}

		if (oAjax)
		{
			oAjax.onreadystatechange = function()
			{
				if (oAjax.readyState == 4 && oAjax.status == 200) 
				{
					obj.value 		= oAjax.responseText;
				}
			};
			oAjax.open("POST", _url, true);
			oAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			oAjax.send('is_ajax=1');
		}
		else
		{
			alert("AJAX not init!");
		}
	}
	
	function AlertFromAjax(_url)
	{
		var oAjax;

		if (window.XMLHttpRequest)
		{
			oAjax = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			try 
			{
				oAjax = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e){}
			try 
			{
				oAjax = new ActiveXObject('Microsoft.XMLHTTP');
			} catch (e){}
		}

		if (oAjax)
		{
			oAjax.onreadystatechange = function()
			{
				if (oAjax.readyState == 4 && oAjax.status == 200) 
				{
					alert( oAjax.responseText );
				}
			};
			oAjax.open("POST", _url, true);
			oAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			oAjax.send('is_ajax=1');
		}
		else
		{
			alert("AJAX not init!");
		}
	}
	
	function InnerDescMenuItemRU(idItemMenu)
	{
		var ret = "Простые и безопасные операции по обмену электронных валют";
		switch(idItemMenu)
		{
			case 1:
				ret = "Простые и безопасные операции по обмену, покупке и продаже электронных валют";
				break;
			case 2:
				ret = "Покупка и продажа электронных валют за реальные деньги";
				break;
			case 3:
				ret = "Гарантия надежности сервиса обеспечивается компанией InstaForex";
				break;
			case 4:
				ret = "Что такое Insta Change";
				break;
			case 5:
				ret = "В чём наши преимущества";
				break;
			case 6:
				ret = "Список наиболее часто задаваемых вопросов по обмену электронных валют";
				break;
		};
		
		gE("isubmenu").innerHTML = ret;
	}
	
	function InnerDescMenuItemEN(idItemMenu)
	{
		//@todo не те пункты
		var ret = "Simple and safe operations concerning exchange, buying and selling of the e-currencies";
		switch(idItemMenu)
		{
			case 1:
				ret = "Simple and safe operations concerning exchange, buying and selling of the e-currencies";
				break;
			case 2:
				ret = "Buying and selling e-currencies for real money";
				break;
			case 3:
				ret = "The service safety guarantee is provided by InstaForex company";
				break;
			case 4:
				ret = "What is Insta Change";
				break;
			case 5:
				ret = "What are the advantages";
				break;
			case 6:
				ret = "FAQ (Frequently Asked Questions)";
				break;
		};
		
		gE("isubmenu").innerHTML = ret;
	}
	
	function isset(varname)  
	{
	  if(typeof(varname)=="undefined") 
		return false;
	  else 
		return true;
	}
	
	/**
	 * Аналог функции file_get_contents() в php
	 */
	function FileGetContents(url)
	{
		var req = null;
		try 
		{
			req = new ActiveXObject("Msxml2.XMLHTTP"); 
		}
		catch (e)
		{
			try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {
				try { req = new XMLHttpRequest(); } catch(e) {}
			}
		}
		if (req == null) throw new Error('XMLHttpRequest not supported');
	 
		req.open("GET", url, false);
		req.send(null);
	 
		return req.responseText;
	}
	
	/**
	 * Разделяем строку по delimiter и возврящает массив
	 */
	function Explode(delimiter, string)
	{ 
		var emptyArray = { 0: '' };
	 
		if ( arguments.length != 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' )
		{
			return null;
		}
	 
		if ( delimiter === '' || delimiter === false || delimiter === null )
		{
			return false;
		}
	 
		if ( typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object' )
		{
			return emptyArray;
		}
	 
		if ( delimiter === true ) 
		{
			delimiter = '1';
		}
	 
		return string.toString().split ( delimiter.toString() );
	}
	
	/**
	 * Зависимость второго списка от первого - исключение повторений
	 */
	 function AutoD(sFirstList, sSecondList)
	{	
		var i = 0;
		
		from 	= gE(sFirstList).options[gE(sFirstList).selectedIndex].innerHTML;
		to 		= gE(sSecondList).options[gE(sSecondList).selectedIndex].innerHTML;																				

		if(typeof(this.Name)!="undefined")
		{
			var select = gE(sSecondList);
			var first = gE(sSecondList).options[this.Value-1]
			var option;
			
			option = document.createElement('option');
			option.value = this.Value;
			option.innerHTML = this.Name;
			select.insertBefore(option, first)
		}

		this.Name = gE(sSecondList).options[gE(sSecondList).selectedIndex].text;
		this.Value = gE(sSecondList).options[gE(sSecondList).selectedIndex].value;
		
		if(from == to)
		{
			gE(sSecondList).options[gE(sSecondList).selectedIndex] = null;
			gE(sSecondList).options[0].selected=true;
		}
		else
		{
			this.Name = undefined;
			this.Value = undefined;
		
			while(i < gE(sSecondList).options.length)
			{	
				from 	= gE(sFirstList).options[gE(sFirstList).selectedIndex].innerHTML;
				to 		= gE(sSecondList).options[i].innerHTML;
				
				if(from==to)
				{
					this.Name = gE(sSecondList).options[i].text;
					this.Value = gE(sSecondList).options[i].value;
					gE(sSecondList).options[i] = null;
					break;
				}
			
				i++;
			}
		}
	}