// JavaScript Document
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function get_element(id){
	var obj;

	if (document.all) {
			eval('obj = document.all("' + id + '")');
	}
	else if (document.layers) {                
			eval('obj = document.layers["' + id + '"]');
	}	
	else if (document.getElementById) {        
			eval('obj = document.getElementById("' + id + '")');
	}
	return obj;
}

function showUL(ob1,ob2)
{
	var obiect1 = get_element(ob1);
	var obiect2 = get_element(ob2);
	
	obiect1.style.display='block';
	obiect2.style.backgroundColor = '#222222'
}
function hideUL(ob1,ob2)
{
	var obiect1 = get_element(ob1);
	var obiect2 = get_element(ob2);
	
	obiect1.style.display='none';
	obiect2.style.backgroundColor = 'transparent';
}

function onSubcat(ob1)
{
	var obiect1 = get_element(ob1);
	obiect1.style.backgroundColor = '#222222'
	obiect1.style.color = '#ffffff';
}

function offSubcat(ob1)
{
	var obiect1 = get_element(ob1);
	obiect1.style.backgroundColor = 'transparent';
	obiect1.style.color = '#dedede'
}

// top menu section 
function onMenu(ob1,clasa)
{
	var obiect1 = get_element(ob1);
	obiect1.className = clasa;
}
function outMenu(ob1,clasa)
{
	var obiect1 = get_element(ob1);
	obiect1.className = clasa;
}
function showCateg(ob1)
{
	var obiect1 = get_element(ob1);
	obiect1.style.display='block';
}
function hideCateg(ob1)
{
	var obiect1 = get_element(ob1);
	obiect1.style.display='none';
}
function checkmail(forma)
{
	var nume = get_element('nume');
	var telefon = get_element('telefon');
	var eMail = get_element('eMail');
	var mesaj = get_element('mesaj');

	if (nume.value == '')
	{
		alert("Va rugam completati numele");
		nume.focus();
		return false;
	}
	
	if (eMail.value == '' && telefon.value == '')
	{
  		alert("Va rugam completati telefonul sau adresa de e-mail");
		telefon.focus;
		return false;		
	}
	
	if (eMail.value != '')
	{
		if(!check_email(eMail.value))
		{
			alert("Adresa de e-mail este incorecta");
		 	eMail.focus();
			return false;
		}	
	}
	if (mesaj.value == '')
	{
		alert("Va rugam completati mesajul");
		mesaj.focus();
		return false;
	}	
}

function check_email(e) 
{
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++)
	{
		if(ok.indexOf(e.charAt(i))<0)
		{ 
			return (false);
		}
	} 
	
	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) 
		{
			return (-1);		
		} 
	}
}
