// Выделяет станцию метро в списке
function metro_select(station_id){
	mySelect = document.getElementById("metro");
	for (var i = 0; i < mySelect.options.length; i++) {
		if (mySelect.options[i].value == station_id)
			mySelect.options[i].selected = true;
	}
//	alert(station_id);
	
//	alert(document.getElementById("metro").selectedIndex);
//	select.selectedIndex = station_id;
//	alert(station_id);
	return;
}

// Открывает окно
function OpenWindow(url, name, width, height) {
	window.open(url, name, 'width=' + width + ', height=' + height + ', toolbar=no, status=no, resizable=no, scrollbars=no, left=' + ((screen.width - width)/2) + ', top=' + ((screen.height - height)/2));
//	window.open(url, name, 'width=' + width + ', height=' + height + ', scrollbars=0, resizable=0, left=' + ((screen.width - width)/2) + ', top=' + ((screen.height - height)/2));
}

// Открывает окно с возможностью изменения размеров
function OpenWindowResizable(url, name, width, height) {
	window.open(url, name, 'width=' + width + ', height=' + height + ', toolbar=no, status=no, resizable=yes, scrollbars=yes, left=' + ((screen.width - width)/2) + ', top=' + ((screen.height - height)/2));
//	window.open(url, name, 'width=' + width + ', height=' + height + ', scrollbars=1, resizable=1, left=' + ((screen.width - width)/2) + ', top=' + ((screen.height - height)/2));
}

// Кладет товар в корзину
function PutIntoCart(id, count, fullview, page, reload) {
//	alert(page);
// Create Window
//	window.open('/clients/cart/?do=add2cart&id='+id+'&count='+count+'&fullview='+fullview, '', 'toolbar=no, status=no, resizable=no, scrollbars=no, width=300, height=100, left=' + ((screen.width - 300)/2) + ', top=' + ((screen.height - 100)/2));
	window.open('/clients/cart/?do=add2cart&id='+id+'&count='+count+'&fullview='+fullview+'&page='+page+'&reload='+reload, '', 'scrollbars=0, resizable=0, width=300, height=100, left=' + ((screen.width - 300)/2) + ', top=' + ((screen.height - 100)/2));
//	window.open('/clients/cart/?do=add2cart&id='+id+'&count='+count+'&fullview='+fullview, '', 'channelmode=0, directories=0, fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=0, toolbar=0, width=300, height=100, left=' + ((screen.width - 300)/2) + ', top=' + ((screen.height - 100)/2));
//	var oPopup = window.createPopup();	
//	oPopup.location.href = '/clients/cart/?do=add2cart&id='+id+'&count='+count+'&fullview='+fullview;
//	oPopup.navigate('http://www.google.com');
//	var oBody = oPopup.document.body;
//	oBody.innerHTML = '<script>location.href="http://alf/clients/cart/?do=add2cart&id='+id+'&count='+count+'&fullview='+fullview+'";</script>';

//	var CartWnd = window.open('/clients/cart/?do=add2cart&id='+id+'&count='+count+'&fullview='+fullview, '', 'scrollbars=no, resizable=no, status=no, toolbar=no, menubar=no, width=300, height=100, left=' + ((screen.width - 300)/2) + ', top=' + ((screen.height - 100)/2));
//	CartWnd.focus()
/*
	CartWnd.document.open();
	CartWnd.document.write(
		"<html>\n" +
		"<body bgcolor='EDF7E6'>\n" +
		"	<form id='catalog' action='/index.php' method='post'>\n" +
		"		<input type='hidden' name='dirs' value='/clients/cart/'>\n" +
		"		<input type='hidden' name='fullview' value='"+fullview+"'>\n" +
		"		<input type='hidden' name='add2cart[id]' value='"+id+"'>\n" +
		"		<input type='hidden' name='add2cart[count]' value='"+count+"'>\n" +
		"		<input id='form_submit' type='submit' name='submit' value='' style='width: 0px; height; 0px;'>\n" +
		"	</form>\n" +
		"</body>\n" +
		"</html>"
	);
	CartWnd.document.all['form_submit'].click();
	CartWnd.document.close();
*/
}

// Скрывает\Открывает массив слоев
function reshowdt(id){
	for(var i=0; i < id.length; i++){
		//alert('section id='+id[i]);
		if (document.getElementById("dv"+id[i]).style.display=="none")
			document.getElementById("dv"+id[i]).style.display = "";
		else
			document.getElementById("dv"+id[i]).style.display = "none";
	}
}