
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 selectPrice() {
	
	var elems = document.forms['prices'].elements;
	
	for (var i = 0; i < elems.length; i += 1) {
		if (elems[i].type == 'checkbox' && elems[i].checked) {
			window.location.href = elems[i].value;
			return;
		}
	}
	
}

var curelm = null;
var curcat = null;
var curlen = null;

function check_catlen(l, c) {
	
	var elm = document.getElementById('price[' + l + '][' + c + ']');
	var len = document.getElementById('len[' + l + ']');
	var cat = document.getElementById('cat[' + c + ']');
	
	if (curelm != null) {
		curelm.checked = false;
	}
	
	curelm = elm;
	
	if (cat && len) {
		
		if (curcat != null) {
			curcat.className = '';
		}
		
		if (curlen != null) {
			curlen.className = '';
		}
		
		if (curelm.checked == false) {
			return;
		}
		
		curcat = cat;
		curlen = len;
		
		curcat.className = 'checked';
		curlen.className = 'checked';
		
	}
	
}