function popup_window(url, width, height)
{
	window.open(url, 'popup', 'width=' + width + ',height=' + height + ',status=no,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,screenX=0,screenY=0');
}

function strtrim() {
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
}
String.prototype.trim = strtrim;

function validate_form()
{
	var ok = true;
	var the_elements = document.forms[0].elements;
	for (var i = 0; i < the_elements.length; i++) {
		var the_input = the_elements[i];
		var div_container = the_input;
		while (div_container.tagName.toLowerCase() != "div") {
			div_container = div_container.parentNode;
		}
		if (div_container.className == "required error") {
			div_container.className = "required";
		}
		if ((div_container.style.display != "none") && (div_container.className == "required") && (the_input.value.trim() == "")) {
			div_container.className = "required error";
			ok = false;
		}
	}
	if (!ok) {
		alert("Užpildykite reikalingus laukus.");
	}
	return ok;
}

