
function window_open(url, win_width, win_height) {
	
	var screen_width = window.screen.width;
	var screen_height = window.screen.height;
	
	var win_left = screen_width / 2 - win_width / 2;
	var win_top = screen_height / 2 - win_height / 2;
	
	var win = window.open(url, "", "width=" + win_width + ", height=" + win_height + ", location=0, menubar=0, resizable=0, status=0, titlebar=0, toolbar=0, screenX=100, left=" + win_left + ", screenY=30, top=" + win_top);
 	
}

function window_open_resizable(url, win_width, win_height) {
	
	var screen_width = window.screen.width;
	var screen_height = window.screen.height;
	
	var win_left = screen_width / 2 - win_width / 2;
	var win_top = screen_height / 2 - win_height / 2;
	
	var win = window.open(url, "", "width=" + win_width + ", height=" + win_height + ", location=0, menubar=0, resizable=1,scrollbars=1 status=0, titlebar=0, toolbar=0, screenX=100, left=" + win_left + ", screenY=30, top=" + win_top);
 	
}

function rollCatMenu() {
	
	var catMenu2 = document.getElementById("catMenu2");
	catMenu2.style.display = 'none';
	
	var catMenu4 = document.getElementById("catMenu4");
	catMenu4.style.display = 'block';
	
	var catMenu = document.getElementById("catMenu");
	catMenu.id = "catMenu3";
	
	setCookie("cat", "1", 100);
	
}

function rollCatMenu3() {
	
	var catMenu4 = document.getElementById("catMenu4");
	catMenu4.style.display = 'none';
	
	var catMenu2 = document.getElementById("catMenu2");
	catMenu2.style.display = 'block';
	
	var catMenu3 = document.getElementById("catMenu3");
	catMenu3.id = "catMenu";
	
	setCookie("cat", "0", 100);
	
}

function configureSubmit() {
	
	var action = "";
	
	var args = configureSubmit.arguments;
	
	for (var i = 1; i < args.length; i += 1) {
		
		var elems = document.getElementsByName(args[i]);
		var values = Array();
		
		for (var j = 0; j < elems.length; j += 1) {
			if (elems[j].type == "checkbox" && elems[j].checked) {
				values[j] = elems[j].value;
			}
			else if (elems[j].type == "text") {
				values[j] = elems[j].value;
			}
			else if (elems[j].type == "select-one") {
				values[j] = elems[j].value;
			}
		}
		
		var value = values.join(";");
		
		if (value.length >= elems.length) {
			action += args[i] + "/" + value + "/";
		}
		
	}
	
	//if (action != "") {
	window.location = args[0] + action;
	//}
	
	return false;
	
}

function chooseCurrency(currency) {
	
	setCookie("currency", currency, 100);
	
	var usds = document.getElementsByName("usd");
	var eurs = document.getElementsByName("eur");
	var rubs = document.getElementsByName("rub");
	
	for (var i = 0; i < usds.length; i += 1) {
		usds[i].style.display = currency == "usd" ? "block" : "none";
	}
	
	for (var i = 0; i < eurs.length; i += 1) {
		eurs[i].style.display = currency == "eur" ? "block" : "none";
	}
	
	for (var i = 0; i < rubs.length; i += 1) {
		rubs[i].style.display = currency == "rub" ? "block" : "none";
	}
	
	window.location = window.location;
	
}

function addToFavorite(name) {
     http = window.location.href;
     var ie5 = navigator.userAgent.indexOf("MSIE 5") > -1;
     var ie6 = navigator.userAgent.indexOf("MSIE 6") > -1 && navigator.userAgent.indexOf("Opera") == -1;
     if (ie5 || ie6) {
          window.external.AddFavorite(http, name);
     }
}