// JS
function bigImage(id, width, height) {
	newwidth = width + 30;
	newheight = height + 50;
	
	var w = window.open("big.php?id="+id, "Big Image", "width=" + newwidth + ", height=" + newheight + ", scrollbars=yes");
	w.focus();
}

function clearfields(fld) {
	$(fld).value = "";	
}

// Menu
var menu = {
	menuOn: function(id, name) {
		$(id).src = "images/" + name + "_on.jpg";
		$(id).style.cursor = "pointer";
	},
	menuOff: function(id, name) {
		$(id).src = "images/" + name + "_off.jpg";
		$(id).style.cursor = "pointer";
	},
	menuClick: function(url) {
		document.location.href = url;
	},
	menuDefault: function(id, name) {
		$(id).src = "images/" + name + "_on.jpg";
		$(id).style.cursor = "pointer";
	}
}

var emailRegEx = /^[a-zA-Z0-9._%+-]+@[A-Z0-9.-]+\.[a-zA-Z]{2,4}$/i;

function checkAngajari() {
	var frm = document.angajariForm;
	var nume = escape(frm.contact_name.value);
	var emailul = escape(frm.contact_email.value);
	var telefon = escape(frm.contact_telephone.value);
	var message = escape(frm.contact_message.value);
	
	if(nume != "" && emailul != "" && telefon != "" && message != "") {
		if(emailul.search(emailRegEx) == -1) {
			$("errorMsg").innerHTML = "Email invalid!";
			$("errorMsg").style.display = "block";
		}
		else {
			frm.action = "index.php?action=contact_action";
			frm.submit();
		}
	}
	else {
		$("errorMsg").innerHTML = "Toate campurile sunt obligatorii";
		$("errorMsg").style.display = "block";
	}
}