	function linksets(index, a_list)
	{
		var i=0;
		var	a_arr	=	a_list.split("&&");
		
		for( i=0; i<a_arr.length; i++)
		{
			if(i==0)
				linkset[index]		=	a_arr[i];
			else
				linkset[index]		+=	a_arr[i];
		}
	}
	
	function js_trim(s)
	{
		s=s.replace(/ +$/, ""); // удаление хвостовых пробелов
		s=s.replace(/^ +/, ""); // удаление ведущих пробелов
		s.replace(/(^\s*)|(\s*$)/,"");  
		return s;	
	}
	
	var win=0;
	function WinPopup(winURL, winWidth, winHeight)
	{
		if(win)
		{
			if(!win.closed) 
				win.close();
		}
		
		screenWidth = screen.width;
		screenHeight = screen.height;
		winLeft = Math.round((screenWidth-winWidth)/2);
		winTop = Math.round((screenHeight-winHeight)/2);
		win = window.open(winURL,"image","width="+winWidth+",height="+winHeight+",top="+winTop+",left="+winLeft+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
		document.close();
		win.focus();
	}

	var popUpWin=0;
	function popUpWindow(URLStr, left, top, width, height)
	{
		width=width+10;
		height=height+10;  
		
		if(popUpWin)
		{
			if(!popUpWin.closed) 
				popUpWin.close();
		}
		
		popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,Resizable=0,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	}
	
	function view_pics(product_id)
	{
		window.open("pics/index.php?product_id="+product_id);
	}
	
	function modal_popap(URLStr, left, top, width, height)
	{
		width			=	width+10;
		height			=	height+10;  
		modal_window	=	window.showModalDialog(URLStr, '' ,"dialogWidth:"+width+"px; dialogHeight:"+height+"px; center:yes; Status:no; help:no;");
		location.reload();
	}
	
	function create_elements( tag_name, el_type, count, prefix, container_id, adds_text, adds_text_class) // tag_name vvodit' propisnimi
	{
		var i			=	0;
		var container	=	document.getElementById(container_id);
		var prev_count	=	container.childNodes.length;
		
		for( i=0; i<prev_count; i++)
		{
			if(container.childNodes[i].tagName==tag_name || container.childNodes[i].tagName=="LABEL")
			{
				container.removeChild(container.childNodes[i]);
				i--;
				prev_count--;
			}
		}
		
		for(i=0;i<count;i++)
		{
			var newElem = document.createElement(tag_name);
			var newElem1 = document.createElement("LABEL");
			
			newElem1.innerHTML=adds_text;
			newElem1.className=adds_text_class;
			if(tag_name=="input")
				newElem.type=el_type;
			
			newElem.id		=	prefix+i;
			newElem.name	=	prefix+'[]';
			container.appendChild(newElem);
			container.appendChild(newElem1);
		}
	}
	
	function gotoCountry(id)
	{
		if(id!=0)
			document.location="index.php?c_id="+id;
	}	
	
	function gotoHotel(href)
	{
		if(href!=0)
			document.location="index.php"+href;
	}
	
	function ToursSearch_ord1( zaezd_id , cur_name)
	{
		var c_id					=	document.getElementById("countries").value;
		var c_name					=	document.getElementById("c_name").value;
		var flight_from_city_name	=	document.getElementById("flight_from_city_name").value;
		var adult_q					=	document.getElementById("adult_q").value;
		var child_q					=	document.getElementById("child_q").value;
		var age_str					=	document.getElementById("ages_str").value;
		popUpWindow("/search/tour_order.php?flight_from_city_name="+flight_from_city_name+"&c_id="+c_id+"&adult_q="+adult_q+"&child_q="+child_q+"&age_str="+age_str+"&cur_name="+cur_name+"&zaezd_id="+zaezd_id+"&c_name="+c_name, 0, 0, 850, 600);
		return false;
	}			
