var currentSelectedCat = 0;
var currentSelectedSubCat = 0;
function leftCatClick(id) {
	if (!$("catList" + id)) return;
	
	var ind = currentSelectedCat;
	if(currentSelectedCat) {
		$("catList" + ind).style.display = "none";		
		//$("catLI" + ind).className = "";
		$("catLIA" + ind).className = "link1";
	}
	currentSelectedCat = id;
	ind = id;
	$("catList" + ind).style.display = "";
	//$("catLI" + ind).className = "leftCatSel";
	$("catLIA" + ind).className = "linksel";	
}

function setSubmenuActive(id) {	
	var ind;
	if(currentSelectedSubCat) {
		ind = currentSelectedCat;	
		$("catLIA" + ind).className = "link1";
	}	
	if(currentSelectedCat == id) return;
	
	currentSelectedSubCat = id;
	ind = id;	
	$("catLIA" + ind).className = "linksel";
	
}


function mainSearchSubmit() {
	var el = $("mainSearch");
	var v = el.value.replace(/^\s+|\s+$/g,"");
	if(v == "") {
		var elB = $("q_br").value;
		if(elB == 0) {
			alert('Introduceti cuvantul cautat');
			el.focus();
			return false;
		}
	}
	return true;
}

function mainNewsletterSubmit() {
	var el = $("mainNewsletter");
	
	if(el.value=="") {
		el.value = " ";
		alert('Introduceti adresa de email');
		el.value = "";
		el.focus();
		return false;
	}
	
	var emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;		
	if(!emailRegExp.test(el.value)) {
		alert('Adresa de email introdusa nu este valida');
		el.focus();
		return false;
	}
	
	return true;
}