/* author: atlant-soyuz */
/* Creation date: 03.06.09 */

		function setCookieBook(name, value) // Функция сохранения параметра в куке 
		{ 
			document.cookie = name + "=" + escape(value) + ";";
		}

		function getCookieBook(name) // Функция получения параметра из куков
                { 
			var cookie = " " + document.cookie; 
			var search = " " + name + "="; 
			var setStr = null; 
			var offset = 0; 
			var end = 0; 
			if (cookie.length > 0) { 
				offset = cookie.indexOf(search); 
				if (offset != -1) { 
				offset += search.length; 
				end = cookie.indexOf(";", offset) 
				if (end == -1) { 
					end = cookie.length; 
					} 
						setStr = unescape(cookie.substring(offset, end)); 
					} 
			} 
			return(setStr);
		}
		
		function setCurrentCityFromBook()
		{
						var CurrCityFrom = getCookieBook("city_from_book");
						for(var i=0;i<document.reg_form.depart.length;i++)
						{
							if (unescape(CurrCityFrom)==unescape(document.reg_form.depart.options[i].value))
							document.reg_form.depart.options[i].selected = true;
						}
		}

                function saveTo() // Функция сохранения в куке кода города назначения
                {                  
                   var ccode=document.getElementById("arrival").value;    
                   setCookieBook('city_to_book',ccode); 
                }


                function get() // Функция загрузки селекта пунктов назначения
                {                  
                   var ccode=document.getElementById("depart").value;    
                   setCookieBook('city_from_book',ccode); 
                   var select=document.getElementById("arrival");
                   select.options.length=0;  
                   select.options[0] = new Option("Loading...","",false,false); 
                   var WebPath = "http://"+ document.domain +"/info/dest/load_en.php?";
                   var codeURL = "code="+ccode+"&rnd="+Math.random();
                   document.getElementById("srcCity").src = WebPath+codeURL;
                }


