/*trimiteNews ro*/
function trimiteNewsRO()
{
	mesaj='';
	/*putText(document.newsletterForm.email);*/
    
	if  (document.newsletterForm.email.value==''){
		 mesaj += "Adresa de e-mail este obligatorie!\n";
	}
	else 
	{
		if ( ((document.newsletterForm.email.value.indexOf('@',1))==-1)||(document.newsletterForm.email.value.indexOf('.',1))==-1 )
	    	mesaj += "Adresa introdusa nu este valida!";
	}	
	
	if  (document.newsletterForm.code.value==''){
		 mesaj += "Codul de siguranta este obligatoriu!\n";
	}
	
	if(mesaj!='')
	{
		/*alert(document.newsletter.abonare.value);*/
		alert(mesaj);
	   	return false;
	}else{

		document.newsletterForm.submit();
	}
}
/*end*/

/*trimiteNews en*/
function trimiteNewsEN()
{
	mesaj='';
	/*putText(document.newsletterForm.email);*/
    
	if  (document.newsletterForm.email.value==''){
		 mesaj += "Your e-mail adress is required!\n";
	}
	else 
	{
		if ( ((document.newsletterForm.email.value.indexOf('@',1))==-1)||(document.newsletterForm.email.value.indexOf('.',1))==-1 )
	    	mesaj += "The e-mail adress you entered is not valid!";
	}	
	
	if  (document.newsletterForm.code.value==''){
		 mesaj += "The safety code is required!\n";
	}
	
	if(mesaj!='')
	{
		/*alert(document.newsletter.abonare.value);*/
		alert(mesaj);
	   	return false;
	}else{

		document.newsletterForm.submit();
	}
}
/*end*/

/*trimiteDezabonare ro*/
function trimiteDezabonarero(){ 
   
	mesaj='';
	clearText(document.newsletter.abonare);
    if  (document.newsletter.nume.value==''){
		 mesaj += "Numele este obligatoriu!\n";
	}
	if  (document.newsletter.email.value==''){
		 mesaj += "Adresa de e-mail este obligatorie!\n";
	}
	else 
	{
		if ( ((document.newsletter.email.value.indexOf('@',1))==-1)||(document.newsletter.email.value.indexOf('.',1))==-1 )
	    	mesaj += "Adresa introdusa nu este valida!";
	}	
	
	if(mesaj!='')
	{
		/*alert(document.newsletter.abonare.value);*/
		alert(mesaj);
	   	return false;
	}else
	{
		document.newsletter.submit();
	}
}
/*end*/

/*trimiteDezabonare ro*/
function trimiteDezabonareen(){ 
   
	mesaj='';
	clearText(document.newsletter.abonare);
    if  (document.newsletter.nume.value==''){
		 mesaj += "Your name is required!\n";
	}
	if  (document.newsletter.email.value==''){
		 mesaj += "Your e-mail adress is required!\n";
	}
	else 
	{
		if ( ((document.newsletter.email.value.indexOf('@',1))==-1)||(document.newsletter.email.value.indexOf('.',1))==-1 )
	    	mesaj += "The e-mail adress you entered is not valid!";
	}	
	
	if(mesaj!='')
	{
		/*alert(document.newsletter.abonare.value);*/
		alert(mesaj);
	   	return false;
	}else
	{
		document.newsletter.submit();
	}
}
/*end*/


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

function putText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = "text"
} 


function validro(){ 
   
	mesaj='';
	var cod=document.getElementById('cod_prod');
	var adress=document.getElementById('dadresa');
	var loc=document.getElementById('oras');
	var tel=document.getElementById('phone');
	
	if  (cod.style.display == 'block')
	{
		if  (document.comanda.cod_statuie.value=='')
		{
			 mesaj += "Codul produslui este obligatoriu!\n";
		}
	}
	
	if  (document.comanda.nume.value=='')
	{
		 mesaj += "Numele este obligatoriu!\n";
	}
	
	if  (document.comanda.prenume.value=='')
	{
		 mesaj += "Prenumele este obligatoriu!\n";
	}
	
	if  (adress.style.display == 'block')
	{
		if  (document.comanda.adresa.value=='')
		{
			 mesaj += "Adresa este obligatorie!\n";
		}
	}
	
	if  (loc.style.display == 'block')
	{
		if  (document.comanda.localitate.value=='')
		{
			 mesaj += "Localitatea este obligatorie!\n";
		}
	}
	
	if  (tel.style.display == 'block')
	{
		if  (document.comanda.tel.value=='')
		{
			 mesaj += "Numarul de telefon este obligatoriu!\n";
		}
	}
	
	if  (document.comanda.email.value==''){
		 mesaj += "Adresa de e-mail este obligatorie!\n";
	}
	else 
	{
		if ( ((document.comanda.email.value.indexOf('@',1))==-1)||(document.comanda.email.value.indexOf('.',1))==-1 )
	    	mesaj += "Adresa introdusa nu este valida!";
	}	
	
	if(mesaj!='')
	{
		/*alert(document.newsletter.abonare.value);*/
		alert(mesaj);
	   	return false;
	}else
	{
		document.comanda.submit();
	}
}

/*valid en*/

function validen(){ 
   
	mesaj='';
	var cod=document.getElementById('cod_prod');
	var adress=document.getElementById('dadresa');
	var loc=document.getElementById('oras');
	var tel=document.getElementById('phone');
	
	if  (cod.style.display == 'block')
	{
		if  (document.comanda.cod_statuie.value=='')
		{
			 mesaj += "Product code is required!\n";
		}
	}
	
	if  (document.comanda.nume.value=='')
	{
		 mesaj += "Your name is required!\n";
	}
	
	if  (document.comanda.prenume.value=='')
	{
		 mesaj += "Your forname is required!\n";
	}
	
	if  (adress.style.display == 'block')
	{
		if  (document.comanda.adresa.value=='')
		{
			 mesaj += "Your adress is required!\n";
		}
	}
	
	if  (loc.style.display == 'block')
	{
		if  (document.comanda.localitate.value=='')
		{
			 mesaj += "The locality is required!\n";
		}
	}
	
	if  (tel.style.display == 'block')
	{
		if  (document.comanda.tel.value=='')
		{
			 mesaj += "Your phone nr. is required!\n";
		}
	}
	
	if  (document.comanda.email.value==''){
		 mesaj += "Your e-mail adress is required!\n";
	}
	else 
	{
		if ( ((document.comanda.email.value.indexOf('@',1))==-1)||(document.comanda.email.value.indexOf('.',1))==-1 )
	    	mesaj += "The e-mail adress you entered is not valid!";
	}	
	
	if(mesaj!='')
	{
		/*alert(document.newsletter.abonare.value);*/
		alert(mesaj);
	   	return false;
	}else
	{
		document.comanda.submit();
	}
}


/*end valid en*/

maramures = {
	curent : null,
	menu : function(){
	
		//if (window.attachEvent)
			//sfHover();
		k = 0;
		if(document.getElementById("menuMain")){
			men = document.getElementById("menuMain");
			for(i=0;i< men.childNodes.length; i++){
				if(men.childNodes[i].nodeType == 1 && men.childNodes[i].tagName == "LI"){
					link = men.childNodes[i].firstChild;					
					while(link.nodeType != 1 && link.tagName != "A"){
						link = link.nextSibling;						
					}
					submenu = null;
					submenu = link.nextSibling;					
					while(submenu && submenu.nodeType != 1 && submenu.tagName != "UL"){
						submenu = submenu.nextSibling;
					}
					if(submenu && submenu.tagName == "UL"){
						link.onclick = function(){
							submenu = this.nextSibling;
							while(submenu && submenu.nodeType != 1 && submenu.tagName != "UL"){
								submenu = submenu.nextSibling;
							}
							if(maramures.curent != null){
								/*maramures.curent.style.display = "none";*/
							}
							if(maramures.curent != submenu){
								maramures.curent = submenu;
								maramures.curent.style.display = "block";
							}else{
								maramures.curent = null;
							}
							this.blur();
							return false;
						}
					/*	if (menuActiv == k){
							submenu.style.display = "block";
							maramures.curent = submenu;							
						}
						k++;
					*/
					}
				}
			}
		}
		maramures.proceseazaImagini();
	},
	
	proceseazaImagini : function(){		    	    
		sursa = document.getElementById("continut");		
		imagini = sursa.getElementsByTagName("IMG");	
		
		for(i=0; i< imagini.length; i++){
			media = imagini[i].src.indexOf("images/media/");			
			th = imagini[i].src.indexOf("/th_");
			if(media > 0 && th > 0 && th > media){
				if(imagini[i].align){
					imagini[i].className = "imagine" + imagini[i].align;
				}
				imagini[i].onclick = function(){
					maramures.deschide(this.src.replace('th_',''));
				}
				imagini[i].style.cursor = "hand";
			}
		}
	},
	
	deschide : function (imagine){
		win = window.open( "", "_blank", "resizable=0,scrollbars=1,HEIGHT=100,WIDTH=100"); 
		obiect = new Image();
		obiect.src = imagine;
		obiect.onload = function()
		{
			latime = document.all?win.document.body.clientWidth:win.window.innerWidth; 
			inaltime = document.all?win.document.body.clientHeight:win.window.innerHeight;
			win.document.write("<html><head style=\"margin: 0; padding: 0;\"></head><body style=\"margin: 0; padding: 0;\"><img src=\""+imagine+"\" alt=\"Click pentru a inchide poza\" onclick=\"window.close()\" /></body></html>");
			win.resizeBy((obiect.width - latime), (obiect.height - inaltime));
			win.focus();
		}
	}
}
//onload = maramures.menu

//var delayObject;
//var delayID;

function sfHover() {
	var sfEls = document.getElementById("menuMain").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" menuHover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("menuHover"), "");
		}
	}
}
function showhide(id)
{ 
	if (document.getElementById)
	{ 
		obj = document.getElementById(id); 
		if (obj.style.display == "none")
		{ 
			obj.style.display = ""; 
		} 
		else 
		{ 
			obj.style.display = "none"; 
		}
	} 
} 

function hide(id){
    if (document.getElementById){ 
        obj = document.getElementById(id);
        obj.style.display = "none";
    }
}