String.prototype.trim = function() 
{
	return this.replace(/^\s*|\s(?=\s)|\s*$/g, ""); 
};


function keyRestrict(e, validchars) {
 var key='', keychar='';
 key = getKeyCode(e);
 if (key == null) return true;
 keychar = String.fromCharCode(key);
 keychar = keychar.toLowerCase();
 validchars = validchars.toLowerCase();
 if (validchars.indexOf(keychar) != -1)
  return true;
 if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
  return true;
 return false;
}

function getKeyCode(e)
{
 if (window.event)
    return window.event.keyCode;
 else if (e)
    return e.which;
 else
    return null;
}


function validareCNP(s)
{
	var suma=0;
	if(s.length==13)
	{
		suma=parseInt(s.charAt(0))*2+parseInt(s.charAt(1))*7+parseInt(s.charAt(2))*9+parseInt(s.charAt(3))*1+parseInt(s.charAt(4))*4+parseInt(s.charAt(5))*6+parseInt(s.charAt(6))*3+parseInt(s.charAt(7))*5+parseInt(s.charAt(8))*8+parseInt(s.charAt(9))*2+parseInt(s.charAt(10))*7+parseInt(s.charAt(11))*9;
		suma=suma%11;
		if(suma==10)
		suma=1;
		if(suma==parseInt(s.charAt(12)))
		{ 
			return true;
		}
		else
		{
			return false;
		}

	}
	else
	{
		return false;
	}
}

function trim(str) 
{
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

function validare_email(mail)
{
	var x = mail;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;
}


function show_comments()
{
	document.getElementById("comments").style.display = "block";
	document.getElementById("div_add_comment").style.display = "none";
	
}

function cmt_peste_3() 
{
	document.getElementById("cmtpeste3").style.display = "block";
	document.getElementById("btn_mmc").style.display = "none";
}

function verifica_form_comment()
{
	if(document.getElementById("cmt_titlu").value!='' && document.getElementById("cmt_text").value!='') 
		{ document.frm_comment.submit(); }
	else
		{ document.getElementById("msg_err_comment").style.display = "block"; }
}



function afisez_comentarii() 
{
	var id_com_hidd = document.getElementById('id_com_hidd').value;
	var tabl_com_hidd = new Array();
	var id_com;
	tabl_com_hidd = id_com_hidd.split(',');

	for(var i=0; i<tabl_com_hidd.length; i++)
	{
		id_com = 'id_com_'+tabl_com_hidd[i];
		document.getElementById(id_com).style.display = 'block';
	}
	document.getElementById('btn_mmc').style.display = 'none';
}

function valideaza_sumar()
{
	if(document.getElementById('acord').checked) 
	{
		document.getElementById('loader').style.display="block";
	    document.getElementById('btn_submit').style.display="none"; 
		window.location='/procesare_comanda/';
	}
	else
	{	
		var lc = document.getElementById('lc').value;
		if (lc=='ro')
		{
			alert('Please check if you agree with the confidentiality policy');
		}
		else
		{
			alert('Please check if you agree with the confidentiality policy');
		}
	}
}


function white_space(field)
{
     document.getElementById(field).value = (field.value).replace(/^\s*|\s*$/g,'');
}



function sector(a)
{
	if ((a=='1') || (a=='2') || (a=='3') || (a=='4') || (a=='5') || (a=='6'))
	{
		return "sector "+a;
	}
	else
	{
		return a;
	}
}

function select_tab(q)
{	
	var arr_on = new Array();
	var arr_off = new Array();

	arr_on[0] = '/pages/tpl/front/images/mlh_notes_on.jpg';
	arr_on[1] = '/pages/tpl/front/images/size_fit_on.jpg';
	arr_on[2] = '/pages/tpl/front/images/details_on.jpg';

	arr_off[0] = '/pages/tpl/front/images/mlh_notes_off.jpg';
	arr_off[1] = '/pages/tpl/front/images/size_fit_off.jpg';
	arr_off[2] = '/pages/tpl/front/images/details_off.jpg';

	for(i=1;i<=3;i++)
	{
		if (i==q)
		{
			document.getElementById('cont_'+i).style.display='block';
			document.getElementById('tab_'+i).src = arr_on[i-1];	
		}
		else
		{
			document.getElementById('cont_'+i).style.display='none';
			document.getElementById('tab_'+i).src = arr_off[i-1];			
		}
			
	}
}

function marime_selectata(var_selectata)
{
	var stocuri_val		= document.getElementById('stocuri').value;
	var variante_val	= document.getElementById('variante').value;

	var arr_stocuri		= new Array();
	var arr_variante	= new Array();

	arr_stocuri			= stocuri_val.split(',');
	arr_variante		= variante_val.split(',');

	var citesc_stoc;
	var option;
	var id_marime;
	var nume_marime;
	var nr_bucati;

	
	for(var i=0; i<arr_variante.length; i++)
	{
		id_marime = 'marime_'+arr_variante[i];
		document.getElementById(id_marime).className='btn_marime_nesel'; 
		
		if(arr_variante[i] == var_selectata)
		{
			document.getElementById(id_marime).className='btn_marime_sel'; 

			//memorez idul variantei
			document.getElementById('mar_sel').value = arr_variante[i];

			//citesc dupa id, numele marimii
			nume_marime = document.getElementById(id_marime).innerHTML;

			//adaug textul cu marimea aleasa
			document.getElementById('err-marime-cantitate').style.display	= 'none';
			document.getElementById('marime-cantitate').style.display		= 'inline';
			document.getElementById('marime_aleasa').innerHTML				= 'marimea '+nume_marime;
		}
	}
	
	//adaug in memoria de la produsul respectiv calea
	var srvurl = document.getElementById('srvurl').value;
	var cale = srvurl+'procesare-cos/adauga/'+var_selectata+'/1/produs/';
	
	//memorez calea cu marimea selectata pentru adaugarea in cos
	document.getElementById('adauga_cos_prod').value = cale;
	//alert(cale)

}

///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

function marime_selectata_2(var_selectata) {
	if (var_selectata!='0' && var_selectata.length>=2) {
		//crappy inheritage
		if (var_selectata!='cs') {
			//hide custom size div
			$('#cs_form').hide();

			//clear 'custom size' flag
			$('#cs_on').val('0');

			var stocuri_val		= document.getElementById('stocuri').value;
			var variante_val	= document.getElementById('variante').value;

			var arr_stocuri		= new Array();
			var arr_variante	= new Array();
			var arr_marime		= new Array();

			arr_stocuri			= stocuri_val.split(',');
			arr_variante		= variante_val.split(',');
			arr_marime			= var_selectata.split('^');

			var citesc_stoc;
			var option;
			var id_marime;
			var nume_marime;
			var nr_bucati;

			for(var i=0; i<arr_variante.length; i++) {
				if(arr_variante[i] == var_selectata) {
					//memorez idul variantei
					document.getElementById('mar_sel').value = arr_variante[i];

					//citesc dupa id, numele marimii
					nume_marime = arr_marime[1];
					
					//adaug textul cu marimea aleasa
					document.getElementById('err-marime-cantitate').style.display	= 'none';
					document.getElementById('marime-cantitate').style.display		= 'inline';
					document.getElementById('marime_aleasa').innerHTML				= ' size: '+nume_marime;
				}
			}

			//document.getElementById('mar_sel').value = arr_variante[i];

			//adaug in memoria de la produsul respectiv calea
			var srvurl = document.getElementById('srvurl').value;

			var var_id_marime=document.getElementById('sel_marime').value;
			var arr_marime= new Array();
			arr_marime=var_id_marime.split('^');

			var cale = srvurl+'procesare-cos/adauga/'+arr_marime[0]+'/1/produs/';
			
			//memorez calea cu marimea selectata pentru adaugarea in cos
			document.getElementById('adauga_cos_prod').value = cale;
		}
		else {
			//hide previous selected size
			$('#marime-cantitate').hide();

			//set 'custom size' flag
			$('#cs_on').val('1');

			//hide error div
			$('#cs_form_err').hide();
			$('#err-marime-cantitate').hide();

			//show custom inputs div
			$('#cs_form').show();
		}
	}
	else {
		//hide custom size div
		$('#cs_form').hide();
		//empty prev values
		$('#mar_sel').val('0');
		//set 'custom size' flag
		$('#cs_on').val('0');
		//hide error div
		$('#cs_form_err').hide();
		$('#err-marime-cantitate').hide();
	}
}

///////////////////////////////////////////////////////////////////////////////////////////

function adauga_in_cos_2()
{	
	//citesc id-ul paginii
	//id=1, pagina produs; id=2, pagina cart
	var id_pag = document.getElementById('id_pagina').value;
	
	if(id_pag == '1')
	{
	
		//afisez imaginea seincarca
		document.getElementById('addtocart').style.display		= 'none';
		document.getElementById('addtocart_2').style.display	= 'inline';

	}


	//verificare daca am calea la marimea selectata
	var cale_adaug_cos = document.getElementById('adauga_cos_prod').value;
	//alert(cale_adaug_cos);
		
	//adaug in cos
	AARead(cale_adaug_cos, procesare_adaugare_in_cos_2, "");
}

///////////////////////////////////////////////////////////////////////////////////////////

function procesare_adaugare_in_cos_2(data, element)
{
	document.getElementById('adauga_cos_prod').value				= "";
	document.getElementById('marime_aleasa').innerHTML				= '';
	document.getElementById('mar_sel').value						= '0';
	
	document.getElementById('err_marime').style.display				='none'; 
	document.getElementById('err-marime-cantitate').style.display	='inline'; 
	document.getElementById('marime-cantitate').style.display		= 'none';	

	document.getElementById('addtocart').style.display				= 'inline';
	document.getElementById('addtocart_2').style.display			= 'none';

	document.getElementById('pana_in_cos').style.display			= 'none';
	document.getElementById('dupa_cos').style.display				= 'inline';

	window.location=document.getElementById('cale_cos').value;
}

///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

function adauga_in_cos()
{	
	var afisez_produse_rec = document.getElementById('afisez_prod_rec').value;
	
	if(afisez_produse_rec == '1')
	{
		//afisez imaginile seincarca2
		var prod_recomandate		= document.getElementById('produse_recomandate').value;
		var arr_prod_recomandate	= new Array();

		arr_prod_recomandate = prod_recomandate.split(',');

		var id_addtocart;
		var id_addtocart2;

		for(var i=0; i<arr_prod_recomandate.length; i++)
		{
			id_addtocart	= 'addtocart_pr_'+arr_prod_recomandate[i];	
			id_addtocart2	= 'addtocart2_pr_'+arr_prod_recomandate[i];

			document.getElementById(id_addtocart).style.display		= 'none';
			document.getElementById(id_addtocart2).style.display	= 'inline';
		}
	}


	//citesc id-ul paginii
	//id=1, pagina produs; id=2, pagina cart
	var id_pag = document.getElementById('id_pagina').value;
	
	if(id_pag == '1')
	{
	
		//afisez imaginea seincarca
		document.getElementById('addtocart').style.display		= 'none';
		document.getElementById('addtocart_2').style.display	= 'inline';

	}


	//verificare daca am calea la marimea selectata
	var cale_adaug_cos = document.getElementById('adauga_cos_prod').value;
	//alert(cale_adaug_cos);
	
	//adaug in cos
	AARead(cale_adaug_cos, procesare_adaugare_in_cos, "");
}

function procesare_adaugare_in_cos(data, element)
{
	//afisare cos
	xt();

	//adaug la marimile produselor recomandate clasa initiala, de marime neselectata
	var id_variante = document.getElementById('variante').value;

	var arr_id_variante = new Array();
	arr_id_variante = id_variante.split(',');

	for(var i=0; i<arr_id_variante.length; i++)
	{
		id_marime_div = 'marime_'+arr_id_variante[i];

		document.getElementById(id_marime_div).className = 'btn_marime_nesel';
	}

	document.getElementById('adauga_cos_prod').value			= "";
	document.getElementById('marime_aleasa').innerHTML			= '';
	document.getElementById('mar_sel').value					= '0';
	
	document.getElementById('err_marime').style.display				='none'; 
	document.getElementById('err-marime-cantitate').style.display	='inline'; 
	document.getElementById('marime-cantitate').style.display		= 'none';
	
}

function afiseaza_ascunde_video()
{
	var afisare_video_poze = document.getElementById('afisare_video_poze').value;
	var nume_produs = document.getElementById('titlu_produs').innerHTML;
	var cale_img = new Image();
	var cale_site = document.getElementById('srvurl').value;

	//afisez video si ascund poze
	if(afisare_video_poze == '0')
	{

		document.getElementById('poza').style.display		= 'none'; 
		document.getElementById('video').style.display		= 'block';

		cale_img = cale_site+'/pages/tpl/front/images/tab_photo_03.gif';
		document.getElementById('video_poze').src					= cale_img;
		document.getElementById('click_detalii').style.visibility	= 'hidden';

		//memorez in afisare_video_poze valoarea 1
		document.getElementById('afisare_video_poze').value = '1';

		var video_content = document.getElementById('video-content').innerHTML;
		var video_param = document.getElementById('prod_seo').value;
		
		var srvurl = document.getElementById('srvurl').value;

		if(video_content.length == 0)
		{
			AARead(srvurl+"video/"+video_param, proceseaza_video, "video-content");
		}
		try { pageTracker._trackEvent('Video', 'Play', nume_produs); } catch(err) {}
	
	//afisez poze si ascund video
	} else if(afisare_video_poze == '1')
	{
		document.getElementById('poza').style.display		= 'block';
		document.getElementById('video').style.display		= 'none';

		cale_img = cale_site+'/pages/tpl/front/images/tab_photo_02.gif';
		document.getElementById('video_poze').src					= cale_img;		
		document.getElementById('click_detalii').style.visibility	= 'visible';

		document.getElementById('afisare_video_poze').value = '0';

		try { pageTracker._trackEvent('Video', 'Stop', nume_produs); } catch(err) {}
	}
}

function proceseaza_video(data, element)
{
	document.getElementById('video-content').innerHTML = data;
}

function recomandari(id_produs, id_marime)
{
	//citesc variantele la produsul recomandat, a carui varianta am ales-o
	var id_var_prod = 'variante_'+id_produs;
	var variante_prod = document.getElementById(id_var_prod).value;

	var arr_variante_prod = new Array();
	arr_variante_prod = variante_prod.split(',');
	
	//alert(nr_marime);
	var id_marime_div;
	for(var i=0; i<arr_variante_prod.length; i++)
	{
		id_marime_div = 'marime_'+arr_variante_prod[i];	

		document.getElementById(id_marime_div).className = 'btn_marime_nesel';
	}

	//adaug clasa de selectat la marimea aleasa
	var id_marime_sel = 'marime_'+id_marime;
	document.getElementById(id_marime_sel).className = 'btn_marime_sel';

	//adaug in memoria de la produsul respectiv calea
	var id_adauga_cos = 'adauga_cos_'+id_produs;
	var srvurl = document.getElementById('srvurl').value;
	var cale = srvurl+'procesare-cos/adauga/'+id_marime+'/1/completeaza/';
	
	//memorez calea cu marimea selectata pentru adaugarea in cos
	document.getElementById(id_adauga_cos).value = cale;

	//ascund mesajul de eroare
	document.getElementById('err_marime_rec').style.display = 'none';
}

function adauga_cos(id_produs)
{	
	var id_adauga_cos = 'adauga_cos_'+id_produs;

	//verificare daca am calea la marimea selectata
	var cale_adaug_cos = document.getElementById(id_adauga_cos).value;
	
	if(cale_adaug_cos.length == 0)
	{
		document.getElementById('err_marime_rec').style.display = 'block';
		$('#err_marime_rec').fadeTo('fast', 0); 
		$('#err_marime_rec').fadeTo('slow', 1);
	}
	else
	{

		var afisez_produse_rec = document.getElementById('afisez_prod_rec').value;
		
		if(afisez_produse_rec == '1')
		{
			//afisez imaginile seincarca2
			var prod_recomandate		= document.getElementById('produse_recomandate').value;
			var arr_prod_recomandate	= new Array();

			arr_prod_recomandate = prod_recomandate.split(',');

			var id_addtocart;
			var id_addtocart2;

			for(var i=0; i<arr_prod_recomandate.length; i++)
			{
				id_addtocart	= 'addtocart_pr_'+arr_prod_recomandate[i];	
				id_addtocart2	= 'addtocart2_pr_'+arr_prod_recomandate[i];

				document.getElementById(id_addtocart).style.display		= 'none';
				document.getElementById(id_addtocart2).style.display	= 'inline';
			}
		}


		//citesc id-ul paginii
		//id: 1 - pagina produs; 2 - pagina cart; 3 = pagina tinuta;
		var id_pag = document.getElementById('id_pagina').value;

		if(id_pag == '1')
		{
		
			//afisez imaginea seincarca
			document.getElementById('addtocart').style.display		= 'none';
			document.getElementById('addtocart_2').style.display	= 'inline';

			
		}

		
		
		
		//adaug in cos
		AARead(cale_adaug_cos, procesare_adaugare_cos, "");
	}
}

function procesare_adaugare_cos(data, element)
{
	//afisare cos
	xt();


	//citesc id-ul paginii
	//id: 1 - pagina produs; 2 - pagina cart; 3 = pagina tinuta;
	var id_pag = document.getElementById('id_pagina').value;
	if(id_pag == '2')
		{
			var srvurl=document.getElementById('srvurl').value;
			var cale=srvurl+'cart/';
			window.location=cale;

		}

	//adaug la marimile produselor recomandate clasa initiala, de marime neselectata
	var id_produse = document.getElementById('produse_recomandate').value;

	var arr_id_produse = new Array();
	arr_id_produse = id_produse.split(',');

	var arr_id_variante = new Array();

	var id_var_prod;
	var var_prod;
	var mem_var_prod = "";
	var id_adauga_cos;

	for(var i=0; i<arr_id_produse.length; i++)
	{
		id_var_prod = 'variante_'+arr_id_produse[i];
		var_prod = document.getElementById(id_var_prod).value;

		id_adauga_cos = 'adauga_cos_'+arr_id_produse[i];
		document.getElementById(id_adauga_cos).value = "";

		mem_var_prod += var_prod+',';
	}
	mem_var_prod = mem_var_prod.slice(0, -1);

	arr_id_variante = mem_var_prod.split(',');

	for(var j=0; j<arr_id_variante.length; j++)
	{
		id_marime_div = 'marime_'+arr_id_variante[j];

		document.getElementById(id_marime_div).className = 'btn_marime_nesel';
	}
}


function valideaza_date_cont_nou()
{
	var poza = "<img id='loader_verde' src='/pages/tpl/front/images/loader-verde.gif' style='vertical-align:middle; line-height:24px; ' />";
	document.getElementById('err_login').innerHTML				= '&nbsp;' + poza + ' &nbsp;&nbsp;&nbsp&nbsp;Checking the login details...'; 
	document.getElementById('err_login').style.backgroundColor	= "#53B955"; 
	document.getElementById('err_login').style.backgroundImage	= "";
	document.getElementById('err_login').style.left				= "5px";
	document.getElementById('err_login').style.border			= "#53B955";	
	document.getElementById('err_login').style.display			= 'block'; 
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById('err_login').style.paddingTop	= "2px";
	}
	$('#err_login').fadeTo('fast', 0); 
	$('#err_login').fadeTo('slow', 1);
	var s=setTimeout("AARead(document.getElementById('srvurl').innerHTML + '/pages/js/verificare_date_cont_nou.php?mail='+document.getElementById('mail').value, proceseaza_date_cont_nou, 'mail_valid')", 1);

}

function proceseaza_date_cont_nou(data, element)
{
	//document.getElementById('date_valide').value = data;

	//var date_valide = document.getElementById('date_valide').value;

	//daca datele introduse nu corespund unei persoane, am eroare, nu trimit formul
	if(data == 'false')
	{
		//afisez background normal la campuri
		document.getElementById('div_nume').className					= 'bg_input_ok';
		document.getElementById('div_mail').className					= 'bg_input_ok';
		document.getElementById('div_parola').className					= 'bg_input_ok';
		document.getElementById('div_parola2').className			    = 'bg_input_ok';
		
		document.getElementById('div_mail').className					= 'bg_input_err';
		
		//afisez eroarea / erorile
		document.getElementById('err_login').innerHTML				= " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;This e-mail address already exists in our database. Please sign in!"; 
		document.getElementById('err_login').style.display			= 'block';
		document.getElementById('err_login').style.backgroundColor	= "#FF0000";
		document.getElementById('err_login').style.border			= "#FF0000";
		document.getElementById('err_login').style.left				= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);
	}
	//daca datele introduse sunt corecte, trimit formul
	else
	{
		var poza = "<img src='/pages/tpl/front/images/loader-verde.gif' style='vertical-align:middle; line-height:24px;' />";
		document.getElementById('err_login').innerHTML				= poza + ' &nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;The data are correct'; 
		document.getElementById('err_login').style.display			= "block";
		document.getElementById('err_login').style.backgroundColor	= "#53B955"; 
		document.getElementById('err_login').style.border			= "#53B955";
		document.getElementById('err_login').style.backgroundImage	= "";
		document.getElementById('err_login').style.left				= "5px";
		
		setTimeout("document.frm.submit()", 1);	
	}
}
 
 //----  formular cont nou  -------------------------------------------------------------
 
 function verificare_formular_cont_nou() {
	var nume 		= document.getElementById('nume').value;
	var mail 		= document.getElementById('mail').value;
	var parola 		= document.getElementById('parola').value;
	var parola2     = document.getElementById('parola2').value;
	var sintaxa		= "false";
	
	nume 			= trim(nume);
	mail 			= trim(mail);


	

	if(validare_email(mail) == true)
	{ 
		sintaxa = true;
	}


	var mesaj 		= "";
	var numar_erori = 0;
	
	//definesc variabile pentru numele campurilor verificate
	//dau valoarea 0 la inceput, le afisez avand culoarea mov normal
	var nume_tx 	= 0;
	var email_tx 	= 0;
	var parola_tx 	= 0;
	var parola2_tx	= 0;

	var campuri		= new Array();
	var contor		= 0;

	var arr_nume_pren	= new Array();
	arr_nume_pren		= nume.split(' ');
	
	
	//verific formularul cont nou
	
	//campul Nume
	if(nume.length == 0)
	{		
		campuri[contor++] = "name";
		numar_erori += 1;
		nume_tx = 1;
	}
	else if(nume.length < 6)
	{
		mesaj += "Name must have at least 6 characters! ";		
		numar_erori += 1;
		nume_tx = 1;
	}
	else if(arr_nume_pren.length < 2)
	{
		mesaj += "Insert your name and surname!";
		numar_erori += 1;
		nume_tx = 1;
	}
	
	//campul Mail
	var mail_sintaxa_c = sintaxa;
	if(mail.length == 0)
	{
		campuri[contor++] = "e-mail";
		numar_erori += 1;
		email_tx = 1;
	}
	else if(mail_sintaxa_c == 'false')
	{
		mesaj += "The e-mail address is invalid! \n";
		numar_erori += 1;
		email_tx = 1;
	}
	
	//campul Parola
	if(parola.length == 0)
	{
		campuri[contor++] = "password";
		numar_erori += 1;
		parola_tx = 1;
	}
	else if(parola.length < 6)
	{
		mesaj += "Password must have at least 6 characters! \n";
		numar_erori += 1;
		parola_tx = 1;
	}
	
	//campurile Parola si Parola2 sa fie identice
	else if(parola != parola2)
	{
		mesaj += "The confirmation password does not match! \n";
		numar_erori += 1;
		parola_tx = 1;
		parola2_tx = 1;
	}

	
	//Daca am erori nu trimit formul, daca nu am erori trimit formul
	if(numar_erori != 0)
	{
	
		
		
		//afisez background normal la campuri
		document.getElementById('nume').className		= 'input_cont_ok';
		document.getElementById('mail').className		= 'input_cont_ok';
		document.getElementById('parola').className		= 'input_cont_ok';
		document.getElementById('parola2').className	= 'input_cont_ok';
		
		//afisez cu background rosu la campurile cu erori
		if(nume_tx == 1)
		{
			document.getElementById('nume').className		= 'input_cont_err';	
		}
		if(email_tx == 1)
		{
			document.getElementById('mail').className		= 'input_cont_err';
		}
		if(parola_tx == 1)
		{
			document.getElementById('parola').className		= 'input_cont_err';
		}
		if(parola2_tx == 1)
		{
			document.getElementById('parola2').className	= 'input_cont_err';
		}


		
		//alert(mesaj);
		if(campuri.length > 0)
		{
			var necompletat		= " Please fill in the ";
			necompletat			+= campuri.join(', ');			
			necompletat			+= "!";
		}
		else
		{
			var necompletat		= "";			
		}
		document.getElementById('err_login').innerHTML			="&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;"+mesaj+necompletat; 
		document.getElementById('err_login').style.display		='block'; 
		document.getElementById('err_login').style.left			= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);

		
		//alert("Numar erori :"+numar_erori+" \n\n"+mesaj);
		
		return false;
	}
	else
	{
		valideaza_date_cont_nou();
		/*var poza = "<img src='/pages/tpl/front/images/loader-verde.gif' style='vertical-align:middle; line-height:24px;' />";
		document.getElementById('err_login').innerHTML				= '&nbsp;' + poza + ' &nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;Datele sunt corecte'; 
		document.getElementById('err_login').style.display			= "block";
		document.getElementById('err_login').style.backgroundColor	= "#53B955"; 
		document.getElementById('err_login').style.border			= "#53B955";
		document.getElementById('err_login').style.backgroundImage	= "";
		document.getElementById('err_login').style.left				= "5px";
		if(navigator.appName == "Microsoft Internet Explorer")
		{
			document.getElementById('err_login').style.paddingTop	= "2px";
		}
		
		setTimeout("document.frm.submit()", 1);	
		*/

		return false;
	}
	
	
}

function valideaza_adresa_mail()
{
	AARead(document.getElementById('srvurl').innerHTML + "/pages/js/verificare_mail.php?mail="+document.getElementById('mail').value, proceseaza_mail, "mail_valid");
}

function proceseaza_mail(data, element)
{
	document.getElementById('mail_valid').value = data;
}

function valideaza_date_logare()
{
	var j=1;
	var poza = "<img id='loader_verde' src='/pages/tpl/front/images/loader-verde.gif' style='vertical-align:middle; line-height:24px; ' />";
	document.getElementById('err_login').innerHTML				= '&nbsp;' + poza + ' &nbsp;&nbsp;&nbsp&nbsp;The login details are being verified'; 
	document.getElementById('err_login').style.backgroundColor	= "#53B955"; 
	document.getElementById('err_login').style.backgroundImage	= "";
	document.getElementById('err_login').style.left				= "5px";
	document.getElementById('err_login').style.border			= "#53B955";	
	document.getElementById('err_login').style.display			= 'block'; 
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById('err_login').style.paddingTop	= "2px";
	}
	$('#err_login').fadeTo('fast', 0); 
	$('#err_login').fadeTo('slow', 1);
	var s=setTimeout("AARead(document.getElementById('srvurl').innerHTML + 'pages/js/verificare_date_logare.php?mail=' + document.getElementById('log_username').value+'&parola='+document.getElementById('log_password').value, proceseaza_date_logare, 'date_valide')", 1);

}

function proceseaza_date_logare(data, element)
{
	document.getElementById('date_valide').value = data;

	var date_valide = document.getElementById('date_valide').value;


	


	//daca datele introduse nu corespund unei persoane, am eroare, nu trimit formul
	if(date_valide == '0')
	{
		document.getElementById('log_username').className		= 'input_cont_ok';
		document.getElementById('log_password').className		= 'input_cont_ok';
		
		//afisez eroarea / erorile
		document.getElementById('err_login').innerHTML				= "&nbsp;&nbsp;&nbsp;&nbsp;Please check the login details!"; 
		document.getElementById('err_login').style.display			= 'block';
		document.getElementById('err_login').style.backgroundColor	= "#FF0000";
		document.getElementById('err_login').style.border			= "#FF0000";
		document.getElementById('err_login').style.left				= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);
	}
	//daca datele introduse sunt corecte, trimit formul
	else
	{
		var poza = "<img src='/pages/tpl/front/images/loader-verde.gif' style='vertical-align:middle; line-height:24px;' />";
		document.getElementById('err_login').innerHTML				= poza + '&nbsp&nbsp;&nbsp;&nbsp;Correct login data.'; 
		document.getElementById('err_login').style.display			= "block";
		document.getElementById('err_login').style.backgroundColor	= "#53B955"; 
		document.getElementById('err_login').style.border			= "#53B955";
		document.getElementById('err_login').style.backgroundImage	= "";
		document.getElementById('err_login').style.left				= "5px";
		
		document.frm_login.submit();	
	}
}


//----  formular logare  ---------------------------------------------------------------

function verificare_formular_logare()
{
	var mail_log 		= document.getElementById('log_username').value;
	var parola_log 		= document.getElementById('log_password').value;
	var sintaxa			= 'false';

	var email_tx 		= 0;
	var parola_tx 		= 0;

	var numar_erori		= 0;
	var mesaj			= "";

	var campuri			= new Array();
	var contor			= 0;

	if(validare_email(mail_log) == true) 
	{
		sintaxa = 'true'; 
	} 


	//verificare formular logare
	
	//campul Mail
	var mail_sintaxa_cor = sintaxa;
	if(mail_log.length == 0)
	{
		campuri[contor++] = "the email address";
		numar_erori += 1;
		email_tx = 1;
	}
	else if(mail_sintaxa_cor == 'false')
	{
		mesaj += "The e-mail address is incorect! \n";
		numar_erori += 1;
		email_tx = 1;
	}
	else
	{
		var mail_valid = document.getElementById('mail_valid').value;
		if(mail_valid == 'false')
		{
			mesaj += "The e-mail address already exists in the database! \n";
			numar_erori += 1;
			email_tx = 1;
		}
	}
	
	//campul Parola
	if(parola_log.length == 0)
	{
		campuri[contor++] = "the password";
		numar_erori += 1;
		parola_tx = 1;
	}
	else if(parola_log.length < 6)
	{
		mesaj += "The password should have at least 6 letters! \n";
		numar_erori += 1;
		parola_tx = 1;
	}
	
	
	//Daca am erori nu trimit formul
	if(numar_erori != 0)
	{
		
		
		//afisez background normal la campuri
		document.getElementById('log_username').className		= 'input_cont_ok';
		document.getElementById('log_password').className		= 'input_cont_ok';
		
		//afisez cu background rosu la campurile cu erori
		if(email_tx == 1)
		{
			document.getElementById('log_username').className		= 'input_cont_err';	
		}
		if(parola_tx == 1)
		{
			document.getElementById('log_password').className		= 'input_cont_err';
		}


		
		if(campuri.length > 0)
		{
			var necompletat		= " Please fill in ";
			necompletat			+= campuri.join(', ');			
			necompletat			+= "!";
		}
		else
		{
			var necompletat		= "";
		}
		
		//afisez eroarea / erorile
		document.getElementById('err_login').innerHTML			="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+mesaj+necompletat; 
		document.getElementById('err_login').style.display		='block'; 
		document.getElementById('err_login').style.left			= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);
		
		return false;
	}
	else
	{
		//fac verificare daca datele introduse corespund unei persoane
		
		//verific emailul si parola pentru logare
		valideaza_date_logare();
		return false;
	}

}


function err_login_comment()
{
	document.getElementById('err-log-comment').style.display	='block'; 
	$('#err-log-comment').fadeTo('fast', 0); 
	$('#err-log-comment').fadeTo('slow', 1);
}

function err_prea_mult_in_cos()
{
	document.getElementById('err-prea-mult-in-cos').style.display	='block'; 
	$('#err-prea-mult-in-cos').fadeTo('fast', 0); 
	$('#err-prea-mult-in-cos').fadeTo('slow', 1);
}


//----  Verificare formulare: 
//----	> date cont  > schimba parola  > date personale  > adresa de livrare  > date firma

//----  > date cont  ---------------------------------------------------------------------

function date_cont_form()
{
	
	//var mail = document.getElementById('mail').value;

	var mail_tx = 0;

	var numar_erori		= 0;
	
	var mesaj_mail		= "";

	var campuri			= new Array();
	var contor			= 0;

	
	//verificare formular date cont

	
	//campul Mail
	/*if(mail.length == 0)
	{
		mesaj_mail = "Completati campul mail!";
		numar_erori += 1;
		mail_tx = 1;
	}
	else if(validare_email(mail) == false)
	{
		mesaj_mail = "Adresa de Email este incorecta!";
		numar_erori += 1;
		mail_tx = 1;
	}
	*/

	
	//Daca am erori nu trimit formul
	if(numar_erori != 0)
	{
		
		
		//afisez background normal la campuri
		document.getElementById('mail_class').className		= 'bg_input_ok';

		//inchid mesajul de eroare
		document.getElementById('mail_tx').style.display	= 'none';
		
		var poza = "<img src='/pages/tpl/front/images/!rosu_ico.gif' border='0' style='padding-left:10px;'>";

		//afisez cu background rosu la campurile cu erori
		if(mail_tx == 1)
		{
			document.getElementById('mail_class').className		= 'bg_input_err';
			document.getElementById('mail_tx').style.display	= 'inline';
			document.getElementById('mail_tx').style.color		= '#FF0000';
			document.getElementById('mail_tx').innerHTML		= poza+mesaj_mail;			
		}


		return false;
	}
	//Daca nu am erori trimit formul
	else
	{	
		setTimeout("document.frm_datecont.submit()", 1);
		
		return true;
	}

}


//----  > schimba parola  ----------------------------------------------------------------

function schimba_parola()
{
	var parola_noua = document.getElementById('parola_noua').value;
	var v_parola	= document.getElementById('v_parola').value;

	var parola_noua_tx	= 0;
	var v_parola_tx		= 0;

	var numar_erori		= 0;
	var mesaj			= "";

	var campuri			= new Array();
	var contor			= 0;

	
	//verificare formular schimba parola
	
	//campul Parola
	if(parola_noua.length == 0)
	{
		mesaj = "Please fill in the password field!";
		numar_erori += 1;
		parola_noua_tx = 1;
	}
	else if(parola_noua.length < 6)
	{
		mesaj = "The password must have at least 6 characters! \n";
		numar_erori += 1;
		parola_noua_tx = 1;
	}
	else if(parola_noua != v_parola)
	{
		mesaj = "The confirmation password does not match! \n";
		numar_erori += 1;
		parola_noua_tx = 1;
		v_parola_tx = 1;
	}

	
	//Daca am erori nu trimit formul
	if(numar_erori != 0)
	{
		
		//afisez background normal la campuri
		document.getElementById('parola_noua').className	= 'input_cont_ok';
		document.getElementById('v_parola').className		= 'input_cont_ok';

		//inchid mesajul de eroare
		document.getElementById('parola_noua_tx').style.display	= 'none';
		document.getElementById('v_parola_tx').style.display	= 'none';
		
		var poza = "<img src='/pages/tpl/front/images/!rosu_ico.gif' border='0' style='padding-left:10px;'>";

		//afisez cu background rosu la campurile cu erori
		if(parola_noua_tx == 1)
		{
			document.getElementById('parola_noua').className		= 'input_cont_err';	
			document.getElementById('parola_noua_tx').style.display		= 'inline';
			document.getElementById('parola_noua_tx').style.color		= '#FF0000';
			document.getElementById('parola_noua_tx').innerHTML			= poza+mesaj;			
		}
		if(v_parola_tx == 1)
		{
			document.getElementById('v_parola').className		= 'input_cont_err';
			document.getElementById('v_parola_tx').style.display	= 'inline';
			document.getElementById('v_parola_tx').style.color		= '#FF0000';
			document.getElementById('v_parola_tx').innerHTML		= poza+mesaj;			
		}


		return false;
	}
	//Daca nu am erori trimit formul
	else
	{	
		setTimeout("document.frm_pw.submit()", 1);
		
		return true;
	}
}


//----  > date personale  ----------------------------------------------------------------

function date_personale()
{
	var cmp_nume	= document.getElementById('cmp_nume').value;
	var cmp_telefon = document.getElementById('cmp_telefon').value;
	var cmp_adresa	= document.getElementById('cmp_adresa').value;
	var cmp_oras	= document.getElementById('cmp_oras').value;
	//var cmp_judet	= document.getElementById('cmp_judet').value;
	var cmp_zip		= document.getElementById('cmp_zip').value;
	//var cmp_cnp		= document.getElementById('cmp_cnp').value;

	var cmp_nume_tx		= 0;
	var cmp_telefon_tx	= 0;
	var cmp_adresa_tx	= 0;
	var cmp_oras_tx		= 0;
	//var cmp_judet_tx	= 0;
	var cmp_zip_tx		= 0;
	//var cmp_cnp_tx		= 0;

	var numar_erori		= 0;
	
	var mesaj_nume		= "";
	var mesaj_telefon	= "";
	var mesaj_adresa	= "";
	var mesaj_oras		= "";
	//var mesaj_judet		= "";
	var mesaj_zip		= "";
	//var mesaj_cnp		= "";

	var campuri			= new Array();
	var contor			= 0;

	var arr_nume_pren	= new Array();
	arr_nume_pren		= cmp_nume.split(' ');

	
	//verificare formular date personale
	
	//campul Nume
	if(cmp_nume.length == 0)
	{		
		mesaj_nume = "Please fill in the name field!";
		numar_erori += 1;
		cmp_nume_tx = 1;
	}
	else if(cmp_nume.length < 6)
	{
		mesaj_nume = "The name must contain at least 6 characters! ";		
		numar_erori += 1;
		cmp_nume_tx = 1;
	}
	else if(arr_nume_pren.length < 2)
	{
		mesaj_nume = "Insert your name and surname!";
		numar_erori += 1;
		cmp_nume_tx = 1;
	}

	//campul Telefon
	if(cmp_telefon.length == 0)
	{		
		mesaj_telefon = "Please fill the phone field! \n";
		numar_erori += 1;
		cmp_telefon_tx = 1;
	}
	else if(cmp_telefon.length < 10 || isNaN(cmp_telefon))
	{
		mesaj_telefon = "Insert at least 10 characters in the phone field! \n";
		numar_erori += 1;
		cmp_telefon_tx = 1;
	}

	//campul Adresa
	if(cmp_adresa.length == 0)
	{
		mesaj_adresa = "Please fill in the address field! \n";
		numar_erori += 1;
		cmp_adresa_tx = 1;
	}
	else if(cmp_adresa.length < 7)
	{
		mesaj_adresa = "Insert at least 7 characters in the address field! \n";
		numar_erori += 1;
		cmp_adresa_tx = 1;
	}
	
	//campul Oras
	if(cmp_oras.length == 0)
	{
		mesaj_oras = "Please fill in the city field! \n";
		numar_erori += 1;
		cmp_oras_tx = 1;
	}
	else if(cmp_oras.length < 3)
	{
		mesaj_oras = "Insert at least 3 characters in the city field! \n";
		numar_erori += 1;
		cmp_oras_tx = 1;
	}

	//campul Judet
	/*
	if(cmp_judet.length == 0)
	{
		mesaj_judet = "Please fill in the state/province field! \n";
		numar_erori +=1;
		cmp_judet_tx = 1;
	}
	else if(cmp_judet.length < 3)
	{
		mesaj_judet = "Insert at least 3 characters in the state/province field! \n";
		numar_erori +=1;
		cmp_judet_tx = 1;
	}
	*/
	//campul Zip
	if(cmp_zip.length == 0)
	{
		mesaj_zip = "Please fill in the zip-code field! \n";
		numar_erori += 1;
		cmp_zip_tx = 1;
	}
	else if(cmp_zip.length < 3)
	{
		mesaj_zip = "Insert at least 3 characters in the zip-code field! \n";
		numar_erori += 1;
		cmp_zip_tx = 1;
	}

	//campul CNP
	/*
	if(validareCNP(cmp_cnp)==false) 
	{
		mesaj_cnp = "The SSN is invalid! \n";
		numar_erori += 1;
		cmp_cnp_tx = 1;
	}
	*/

	//Daca am erori nu trimit formul
	if(numar_erori != 0)
	{
		
		//afisez background normal la campuri
		document.getElementById('cmp_nume').className		= 'input_cont_ok';
		document.getElementById('cmp_telefon').className	= 'input_cont_ok';
		document.getElementById('cmp_adresa').className		= 'area_cont_ok';
		document.getElementById('cmp_oras').className		= 'input_cont_ok';
		//document.getElementById('cmp_judet').className		= 'input_cont_ok';
		document.getElementById('cmp_zip').className		= 'input_cont_ok';
		//document.getElementById('cmp_cnp').className		= 'input_cont_ok';

		//inchid mesajul de eroare
		document.getElementById('cmp_nume_tx').style.display	= 'none';
		document.getElementById('cmp_telefon_tx').style.display	= 'none';
		document.getElementById('cmp_adresa_tx').style.display	= 'none';
		document.getElementById('cmp_oras_tx').style.display	= 'none';
		//document.getElementById('cmp_judet_tx').style.display	= 'none';
		document.getElementById('cmp_zip_tx').style.display		= 'none';
		//document.getElementById('cmp_cnp_tx').style.display		= 'none';
		
		var poza = "<img src='/pages/tpl/front/images/!rosu_ico.gif' border='0' style='padding-left:10px;'>";

		//afisez cu background rosu la campurile cu erori
		if(cmp_nume_tx == 1)
		{
			document.getElementById('cmp_nume').className			= 'input_cont_err';	
			document.getElementById('cmp_nume_tx').style.display	= 'inline';
			document.getElementById('cmp_nume_tx').style.color		= '#FF0000';
			document.getElementById('cmp_nume_tx').innerHTML		= poza+mesaj_nume;			
		}
		if(cmp_telefon_tx == 1)
		{
			document.getElementById('cmp_telefon').className		= 'input_cont_err';
			document.getElementById('cmp_telefon_tx').style.display	= 'inline';
			document.getElementById('cmp_telefon_tx').style.color	= '#FF0000';
			document.getElementById('cmp_telefon_tx').innerHTML		= poza+mesaj_telefon;			
		}
		if(cmp_adresa_tx == 1)
		{
			document.getElementById('cmp_adresa').className			= 'area_cont_err';	
			document.getElementById('cmp_adresa_tx').style.display	= 'inline';
			document.getElementById('cmp_adresa_tx').style.color	= '#FF0000';
			document.getElementById('cmp_adresa_tx').innerHTML		= poza+mesaj_adresa;			
		}
		if(cmp_oras_tx == 1)
		{
			document.getElementById('cmp_oras').className			= 'input_cont_err';	
			document.getElementById('cmp_oras_tx').style.display	= 'inline';
			document.getElementById('cmp_oras_tx').style.color		= '#FF0000';
			document.getElementById('cmp_oras_tx').innerHTML		= poza+mesaj_oras;			
		}
		/*
		if(cmp_judet_tx == 1)
		{
			document.getElementById('cmp_judet').className			= 'input_cont_err';	
			document.getElementById('cmp_judet_tx').style.display	= 'inline';
			document.getElementById('cmp_judet_tx').style.color		= '#FF0000';
			document.getElementById('cmp_judet_tx').innerHTML		= poza+mesaj_judet;			
		}
		*/
		if(cmp_zip_tx == 1)
		{
			document.getElementById('cmp_zip').className			= 'input_cont_err';	
			document.getElementById('cmp_zip_tx').style.display		= 'inline';
			document.getElementById('cmp_zip_tx').style.color		= '#FF0000';
			document.getElementById('cmp_zip_tx').innerHTML			= poza+mesaj_zip;			
		}
		/*
		if(cmp_cnp_tx == 1)
		{
			document.getElementById('cmp_cnp').className			= 'input_cont_err';	
			document.getElementById('cmp_cnp_tx').style.display		= 'inline';
			document.getElementById('cmp_cnp_tx').style.color		= '#FF0000';
			document.getElementById('cmp_cnp_tx').innerHTML			= poza+mesaj_cnp;			
		}
		*/

		return false;
	}
	//Daca nu am erori trimit formul
	else
	{			
		document.frm_dp.submit();
		
		return true;
	}

}


//----  > adresa de livrare  -------------------------------------------------------------

function adresa_livrare()
{
	var adr_nume	= document.getElementById('adr_nume').value;
	var adr_telefon = document.getElementById('adr_telefon').value;
	var adr_adresa	= document.getElementById('adr_adresa').value;
	var adr_oras	= document.getElementById('adr_oras').value;
	//var adr_judet	= document.getElementById('adr_judet').value;
	var adr_zip		= document.getElementById('adr_zip').value;

	var adr_nume_tx		= 0;
	var adr_telefon_tx	= 0;
	var adr_adresa_tx	= 0;
	var adr_oras_tx		= 0;
	//var adr_judet_tx	= 0;
	var adr_zip_tx		= 0;

	var numar_erori		= 0;
	
	var mesaj_nume		= "";
	var mesaj_telefon	= "";
	var mesaj_adresa	= "";
	var mesaj_oras		= "";
	//var mesaj_judet		= "";
	var mesaj_zip		= "";

	var campuri			= new Array();
	var contor			= 0;

	var arr_nume_pren	= new Array();
	arr_nume_pren		= adr_nume.split(' ');

	
	//verificare formular adresa livrare

	//campul Nume
	if(adr_nume.length == 0)
	{		
		mesaj_nume = "Please fill in the delivery-name field!";
		numar_erori += 1;
		adr_nume_tx = 1;
	}
	else if(adr_nume.length < 6)
	{
		mesaj_nume = "Insert at least 6 characters in the delivery-name field! ";		
		numar_erori += 1;
		adr_nume_tx = 1;
	}
	else if(arr_nume_pren.length < 2)
	{
		mesaj_nume = "Please insert the company name!";
		numar_erori += 1;
		adr_nume_tx = 1;
	}

	//campul Telefon
	if(adr_telefon.length == 0)
	{		
		mesaj_telefon = "Please fill in the delivery-phone field! \n";
		numar_erori += 1;
		adr_telefon_tx = 1;
	}
	else if(adr_telefon.length < 10 || isNaN(adr_telefon))
	{
		mesaj_telefon = "Insert at least 10 characters in the phone field! \n";
		numar_erori += 1;
		adr_telefon_tx = 1;
	}

	//campul Adresa
	if(adr_adresa.length == 0)
	{
		mesaj_adresa = "Please fill in the delivery-address field! \n";
		numar_erori += 1;
		adr_adresa_tx = 1;
	}
	else if(adr_adresa.length < 7)
	{
		mesaj_adresa = "Insert at least 7 characters in the delivery-address field! \n";
		numar_erori += 1;
		adr_adresa_tx = 1;
	}

	//campul Oras
	if(adr_oras.length == 0)
	{
		mesaj_oras = "Please fill in the delivery-city field! \n";
		numar_erori += 1;
		adr_oras_tx = 1;
	}
	else if(adr_oras.length < 3)
	{
		mesaj_oras = "Insert at least 3 characters in the delivery-city field! \n";
		numar_erori += 1;
		adr_oras_tx = 1;
	}

	//campul Judet
	/*
	if(adr_judet.length == 0)
	{
		mesaj_judet = "Please fill in the delivery-state/province field! \n";
		numar_erori +=1;
		adr_judet_tx = 1;
	}
	else if(adr_judet.length < 3)
	{
		mesaj_judet = "Insert at least 3 characters in the delivery-state/province field! \n";
		numar_erori +=1;
		adr_judet_tx = 1;
	}
	*/
	//campul Zip
	if(adr_zip.length == 0)
	{
		mesaj_zip = "Please fill in the delivery-zip-code field! \n";
		numar_erori += 1;
		adr_zip_tx = 1;
	}
	else if(adr_zip.length < 3)
	{
		mesaj_zip = "Insert at least 3 characters in the delivery-zip-code field! \n";
		numar_erori += 1;
		adr_zip_tx = 1;
	}


	//Daca am erori nu trimit formul
	if(numar_erori != 0)
	{
		
		//afisez background normal la campuri
		document.getElementById('adr_nume').className		= 'input_cont_ok';
		document.getElementById('adr_telefon').className	= 'input_cont_ok';
		document.getElementById('adr_adresa').className		= 'area_cont_ok';
		document.getElementById('adr_oras').className		= 'input_cont_ok';
		//document.getElementById('adr_judet').className		= 'input_cont_ok';
		document.getElementById('adr_zip').className		= 'input_cont_ok';

		//inchid mesajul de eroare
		document.getElementById('adr_nume_tx').style.display	= 'none';
		document.getElementById('adr_telefon_tx').style.display	= 'none';
		document.getElementById('adr_adresa_tx').style.display	= 'none';
		document.getElementById('adr_oras_tx').style.display	= 'none';
		//document.getElementById('adr_judet_tx').style.display	= 'none';
		document.getElementById('adr_zip_tx').style.display		= 'none';
		
		var poza = "<img src='/pages/tpl/front/images/!rosu_ico.gif' border='0' style='padding-left:10px;'>";

		//afisez cu background rosu la campurile cu erori
		if(adr_nume_tx == 1)
		{
			document.getElementById('adr_nume').className			= 'input_cont_err';	
			document.getElementById('adr_nume_tx').style.display	= 'inline';
			document.getElementById('adr_nume_tx').style.color		= '#FF0000';
			document.getElementById('adr_nume_tx').innerHTML		= poza+mesaj_nume;			
		}
		if(adr_telefon_tx == 1)
		{
			document.getElementById('adr_telefon').className		= 'input_cont_err';
			document.getElementById('adr_telefon_tx').style.display	= 'inline';
			document.getElementById('adr_telefon_tx').style.color	= '#FF0000';
			document.getElementById('adr_telefon_tx').innerHTML		= poza+mesaj_telefon;			
		}
		if(adr_adresa_tx == 1)
		{
			document.getElementById('adr_adresa').className			= 'area_cont_err';	
			document.getElementById('adr_adresa_tx').style.display	= 'inline';
			document.getElementById('adr_adresa_tx').style.color	= '#FF0000';
			document.getElementById('adr_adresa_tx').innerHTML		= poza+mesaj_adresa;			
		}
		if(adr_oras_tx == 1)
		{
			document.getElementById('adr_oras').className			= 'input_cont_err';	
			document.getElementById('adr_oras_tx').style.display	= 'inline';
			document.getElementById('adr_oras_tx').style.color		= '#FF0000';
			document.getElementById('adr_oras_tx').innerHTML		= poza+mesaj_oras;			
		}
		/*
		if(adr_judet_tx == 1)
		{
			document.getElementById('adr_judet').className			= 'input_cont_err';	
			document.getElementById('adr_judet_tx').style.display	= 'inline';
			document.getElementById('adr_judet_tx').style.color		= '#FF0000';
			document.getElementById('adr_judet_tx').innerHTML		= poza+mesaj_judet;			
		}
		*/
		if(adr_zip_tx == 1)
		{
			document.getElementById('adr_zip').className			= 'input_cont_err';	
			document.getElementById('adr_zip_tx').style.display		= 'inline';
			document.getElementById('adr_zip_tx').style.color		= '#FF0000';
			document.getElementById('adr_zip_tx').innerHTML			= poza+mesaj_zip;			
		}


		return false;
	}
	//Daca nu am erori trimit formul
	else
	{	
		setTimeout("document.frm_al.submit()", 1);
		
		return true;
	}

}


//----  > date firma  --------------------------------------------------------------------

function date_firma()
{
	var cmp_firma	= document.getElementById('cmp_firma').value;
	var cmp_cif		= document.getElementById('cmp_cif').value;
	var cmp_banca	= document.getElementById('cmp_banca').value;
	var cmp_iban	= document.getElementById('cmp_iban').value;
	//var cmp_reg		= document.getElementById('cmp_reg').value;
	var cmp_adresa2 = document.getElementById('cmp_adresa2').value;
	var cmp_oras2	= document.getElementById('cmp_oras2').value;
	//var cmp_judet2	= document.getElementById('cmp_judet2').value;
	var cmp_zip2	= document.getElementById('cmp_zip2').value;

	var cmp_firma_tx	= 0;
	var cmp_cif_tx		= 0;
	var cmp_banca_tx	= 0;
	var cmp_iban_tx		= 0;
	//var cmp_reg_tx		= 0;
	var cmp_adresa2_tx	= 0;
	var cmp_oras2_tx	= 0;
	//var cmp_judet2_tx	= 0;
	var cmp_zip2_tx		= 0;

	var numar_erori		= 0;

	var mesaj_firma		= "";
	var mesaj_cif		= "";
	var mesaj_banca		= "";
	var mesaj_iban		= "";
	//var mesaj_reg		= "";
	var mesaj_adresa2	= "";
	var mesaj_oras2		= "";
	//var mesaj_judet2	= "";
	var mesaj_zip2		= "";

	var campuri			= new Array();
	var contor			= 0;

	var arr_nume_pren	= new Array();
	arr_nume_pren		= cmp_firma.split(' ');

	
	//verificare formular date firma

	//campul Nume
	if(cmp_firma.length == 0)
	{		
		mesaj_nume = "Please fill in the company-name field!";
		numar_erori += 1;
		cmp_firma_tx = 1;
	}
	else if(cmp_firma.length < 6)
	{
		mesaj_nume = "The company-name field must contain at least 6 characters! ";		
		numar_erori += 1;
		cmp_firma_tx = 1;
	}
	else if(arr_nume_pren.length < 2)
	{
		mesaj_nume = "Please fill in the name field!";
		numar_erori += 1;
		cmp_firma_tx = 1;
	}

	//campul Cif
	if(cmp_cif.length == 0)
	{
		mesaj_cif = "Please fill in the C.I.F. field!";
		numar_erori += 1;
		cmp_cif_tx = 1;
	}
	else if(cmp_cif.length < 3)
	{
		mesaj_cif = "The C.I.F. field must contain at least 3 characters! \n";
		numar_erori += 1;
		cmp_cif_tx = 1;
	}

	//campul Banca
	if(cmp_banca.length == 0)
	{
		mesaj_banca = "Please fill in the bank field!";
		numar_erori += 1;
		cmp_banca_tx = 1;
	}
	else if(cmp_banca.length < 3)
	{
		mesaj_banca = "The bank field must contain at least 3 characters!";
		numar_erori += 1;
		cmp_banca_tx = 1;
	}

	//campul Iban
	if(cmp_iban.length == 0)
	{
		mesaj_iban = "Please fill in the IBan field!";
		numar_erori += 1;
		cmp_iban_tx = 1;
	}
	else if(cmp_iban.length != 24)
	{
		mesaj_iban = "The IBan field must contain exactly 24 characters!";
		numar_erori += 1;
		cmp_iban_tx = 1;
	}

	//campul Reg Com
	/*
	if(cmp_reg.length == 0)
	{
		mesaj_reg = "Please fill in the Reg. Com. field! ";
		numar_erori += 1;
		cmp_reg_tx = 1;
	}
	else if(cmp_reg.length < 3)
	{
		mesaj_reg = "The Reg. com. field must contain at least 3 characters!";
		numar_erori += 1;
		cmp_reg_tx = 1;
	}
	*/
	//campul Adresa
	if(cmp_adresa2.length == 0)
	{
		mesaj_adresa2 = "Please fill in the company-address field! \n";
		numar_erori += 1;
		cmp_adresa2_tx = 1;
	}
	else if(cmp_adresa2.length < 7)
	{
		mesaj_adresa2 = "The company-address field must contain at least 7 characters! \n";
		numar_erori += 1;
		cmp_adresa2_tx = 1;
	}

	//campul Oras
	if(cmp_oras2.length == 0)
	{
		mesaj_oras2 = "Please fill in the company-city field! \n";
		numar_erori += 1;
		cmp_oras2_tx = 1;
	}
	else if(cmp_oras2.length < 3)
	{
		mesaj_oras2 = "The company-city field must contain at least 3 characters! \n";
		numar_erori += 1;
		cmp_oras2_tx = 1;
	}

	//campul Judet
	/*
	if(cmp_judet2.length == 0)
	{
		mesaj_judet2 = "Please fill in the company-state/province field! \n";
		numar_erori +=1;
		cmp_judet2_tx = 1;
	}
	
	else if(cmp_judet2.length < 3)
	{
		mesaj_judet2 = "The company-state/province field must contain at least 3 characters! \n";
		numar_erori +=1;
		cmp_judet2_tx = 1;
	}
	*/
	//campul Zip
	if(cmp_zip2.length == 0)
	{
		mesaj_zip2 = "Please fill in the company-zip-code! \n";
		numar_erori += 1;
		cmp_zip2_tx = 1;
	}
	else if(cmp_zip2.length < 3)
	{
		mesaj_zip2 = "The company-zip-code must contain at least 3 characters! \n";
		numar_erori += 1;
		cmp_zip2_tx = 1;
	}



	
	//Daca am erori nu trimit formul
	//------------------------------
	
	if(numar_erori != 0)
	{
		
		//afisez background normal la campuri
		document.getElementById('cmp_firma').className			= 'input_cont_ok';
		document.getElementById('cmp_cif').className			= 'input_cont_ok';
		document.getElementById('cmp_banca').className			= 'input_cont_ok';
		document.getElementById('cmp_iban').className			= 'input_cont_ok';
		//document.getElementById('cmp_reg').className			= 'input_cont_ok';
		document.getElementById('cmp_adresa2').className		= 'area_cont_ok';
		document.getElementById('cmp_oras2').className			= 'input_cont_ok';
		//document.getElementById('cmp_judet2').className			= 'input_cont_ok';
		document.getElementById('cmp_zip2').className			= 'input_cont_ok';

		//inchid mesajul de eroare
		document.getElementById('cmp_firma_tx').style.display		= 'none';
		document.getElementById('cmp_cif_tx').style.display			= 'none';
		document.getElementById('cmp_banca_tx').style.display		= 'none';
		document.getElementById('cmp_iban_tx').style.display		= 'none';
		//document.getElementById('cmp_reg_tx').style.display			= 'none';
		document.getElementById('cmp_adresa2_tx').style.display		= 'none';
		document.getElementById('cmp_oras2_tx').style.display		= 'none';
		//document.getElementById('cmp_judet2_tx').style.display		= 'none';
		document.getElementById('cmp_zip2_tx').style.display		= 'none';
		
		var poza = "<img src='/pages/tpl/front/images/!rosu_ico.gif' border='0' style='padding-left:10px;'>";

		//afisez cu background rosu la campurile cu erori
		if(cmp_firma_tx == 1)
		{
			document.getElementById('cmp_firma').className				= 'input_cont_err';	
			document.getElementById('cmp_firma_tx').style.display		= 'inline';
			document.getElementById('cmp_firma_tx').style.color			= '#FF0000';
			document.getElementById('cmp_firma_tx').innerHTML			= poza+mesaj_nume;			
		}
		if(cmp_cif_tx == 1)
		{
			document.getElementById('cmp_cif').className				= 'input_cont_err';
			document.getElementById('cmp_cif_tx').style.display			= 'inline';
			document.getElementById('cmp_cif_tx').style.color			= '#FF0000';
			document.getElementById('cmp_cif_tx').innerHTML				= poza+mesaj_cif;	
		}
		if(cmp_banca_tx == 1)
		{
			document.getElementById('cmp_banca').className				= 'input_cont_err';	
			document.getElementById('cmp_banca_tx').style.display		= 'inline';
			document.getElementById('cmp_banca_tx').style.color			= '#FF0000';
			document.getElementById('cmp_banca_tx').innerHTML			= poza+mesaj_banca;			
		}
		if(cmp_iban_tx == 1)
		{
			document.getElementById('cmp_iban').className				= 'input_cont_err';	
			document.getElementById('cmp_iban_tx').style.display		= 'inline';
			document.getElementById('cmp_iban_tx').style.color			= '#FF0000';
			document.getElementById('cmp_iban_tx').innerHTML			= poza+mesaj_iban;		
		}
		/*
		if(cmp_reg_tx == 1)
		{
			document.getElementById('cmp_reg').className				= 'input_cont_err';	
			document.getElementById('cmp_reg_tx').style.display			= 'inline';
			document.getElementById('cmp_reg_tx').style.color			= '#FF0000';
			document.getElementById('cmp_reg_tx').innerHTML				= poza+mesaj_reg;	
		}
		*/
		if(cmp_adresa2_tx == 1)
		{
			document.getElementById('cmp_adresa2').className			= 'area_cont_err';	
			document.getElementById('cmp_adresa2_tx').style.display		= 'inline';
			document.getElementById('cmp_adresa2_tx').style.color		= '#FF0000';
			document.getElementById('cmp_adresa2_tx').innerHTML			= poza+mesaj_adresa2;
		}
		if(cmp_oras2_tx == 1)
		{
			document.getElementById('cmp_oras2').className				= 'input_cont_err';	
			document.getElementById('cmp_oras2_tx').style.display		= 'inline';
			document.getElementById('cmp_oras2_tx').style.color			= '#FF0000';
			document.getElementById('cmp_oras2_tx').innerHTML			= poza+ mesaj_oras2;
		}
		/*
		if(cmp_judet2_tx == 1)
		{
			document.getElementById('cmp_judet2').className				= 'input_cont_err';	
			document.getElementById('cmp_judet2_tx').style.display		= 'inline';
			document.getElementById('cmp_judet2_tx').style.color		= '#FF0000';
			document.getElementById('cmp_judet2_tx').innerHTML			= poza+mesaj_judet2;			
		}
		*/
		if(cmp_zip2_tx == 1)
		{
			document.getElementById('cmp_zip2').className				= 'input_cont_err';	
			document.getElementById('cmp_zip2_tx').style.display		= 'inline';
			document.getElementById('cmp_zip2_tx').style.color			= '#FF0000';
			document.getElementById('cmp_zip2_tx').innerHTML			= poza+mesaj_zip2;			
		}


		return false;
	}
	//Daca nu am erori trimit formul
	else
	{	
		setTimeout("document.frm_df.submit()", 1);
		
		return true;
	}

}

function nota_comentariu(nota_primita)
{
	//memorez nota
	document.getElementById('nota_com').value = nota_primita;

	//alert(document.getElementById('nota_com').value)

	//afisez nota
	document.getElementById('nota_acordata').innerHTML = nota_primita;

	var id_nota;
	
	//afisez stelute deschise
	for(var i=1; i<=5; i++)
	{
		id_nota = "nota_"+i;
		
		document.getElementById(id_nota).src = "/pages/tpl/front/images/inima2.gif";
	}
	
	//afisez stelute cu nota primita
	for(var i=1; i<=nota_primita; i++)
	{
		id_nota = "nota_"+i;
		
		document.getElementById(id_nota).src = "/pages/tpl/front/images/inima1.gif";
	}
}


//----  formular contact  ----------------------------------------------------------------

function contact()
{
	var nume		= document.getElementById('nume').value;
	var mail		= document.getElementById('mail').value;
	var telefon		= document.getElementById('telefon').value;
	var mesaj_val	= document.getElementById('mesaj').value;

	nume		= trim(nume);
	mail		= trim(mail);
	telefon		= trim(telefon);
	mesaj_val	= trim(mesaj_val);

	var nume_tx		= 0;
	var mail_tx		= 0;
	var telefon_tx	= 0;
	var mesaj_tx	= 0;

	var mesaj		= "";
	var numar_erori = 0;

	var campuri		= new Array();
	var contor		= 0;

	var arr_nume_pren	= new Array();
	arr_nume_pren		= nume.split(' ');

	
	//verificare formular contact

	//campul Nume
	if(nume.length == 0)
	{		
		campuri[contor++] = "name";
		numar_erori += 1;
		nume_tx = 1;
	}
	else if(nume.length < 6)
	{
		mesaj += "Name must have at least 6 characters! ";		
		numar_erori += 1;
		nume_tx = 1;
	}
	else if(arr_nume_pren.length < 2)
	{
		mesaj += "Insert your name and surname!";
		numar_erori += 1;
		nume_tx = 1;
	}
	
	//campul Mail
	if(mail.length == 0)
	{
		campuri[contor++] = "e-mail";
		numar_erori += 1;
		mail_tx = 1;
	}
	else if(validare_email(mail) == false)
	{
		mesaj += "The e-mail address is not valid! \n";
		numar_erori += 1;
		mail_tx = 1;
	}

	//campul Telefon
	if(telefon.length == 0)
	{		
		campuri[contor++] = "phone";
		numar_erori += 1;
		telefon_tx = 1;
	}
	else if(telefon.length < 10)
	{
		mesaj += "Phone must have at least 10 characters! ";		
		numar_erori += 1;
		telefon_tx = 1;
	}

	//campul Mesaj
	if(mesaj_val.length == 0)
	{		
		campuri[contor++] = "message";
		numar_erori += 1;
		mesaj_tx = 1;
	}


	
	//Daca am erori nu trimit formul, daca nu am erori trimit formul
	if(numar_erori != 0)
	{
	
		//afisez background normal la campuri
		document.getElementById('nume').className		= 'input_cont_ok';
		document.getElementById('mail').className		= 'input_cont_ok';
		document.getElementById('telefon').className	= 'input_cont_ok';
		document.getElementById('mesaj').className		= 'area_cont_ok';
		
		//afisez cu background rosu la campurile cu erori
		if(nume_tx == 1)
		{
			document.getElementById('nume').className		= 'input_cont_err';	
		}
		if(mail_tx == 1)
		{
			document.getElementById('mail').className		= 'input_cont_err';
		}
		if(telefon_tx == 1)
		{
			document.getElementById('telefon').className	= 'input_cont_err';
		}
		if(mesaj_tx == 1)
		{
			document.getElementById('mesaj').className		= 'area_cont_err';
		}


		//alert(mesaj);
		if(campuri.length > 0)
		{
			var necompletat		= " Please fill in the ";
			necompletat			+= campuri.join(', ');			
			necompletat			+= "!";
		}
		else
		{
			var necompletat		= "";
		}
		document.getElementById('err_login').innerHTML			="&nbsp;&nbsp&nbsp;&nbsp;"+mesaj+necompletat; 
		document.getElementById('err_login').style.display		='block'; 
		document.getElementById('err_login').style.paddingLeft	= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);
		
		return false;
	}
	else
	{
		document.frm_contact.submit();	

		return true;
	}


}


//----  formular recuperare_parola  ---------------------------------------------------

function recuperare_parola()
{
	var recpw_mail		= document.getElementById('mail').value;

	var numar_erori		= 0;
	var mesaj			= "";
	
	var recpw_mail_tx	= 0;

	var campuri			= new Array();
	var contor			= 0;

	
	//verificare formular wishlist

	//campul E-mail
	var mail_sintaxa_c_rec = document.getElementById('mail_sintaxa_c_rec').value;
	if(recpw_mail.length == 0)
	{
		campuri[contor++] = "e-mail";
		numar_erori += 1;
		recpw_mail_tx = 1;
	}
	else if(mail_sintaxa_c_rec == 'false')
	{
		mesaj = "The e-mail address is invalid! \n";
		numar_erori += 1;
		recpw_mail_tx = 1;
	}
	else
	{
		var mail_valid = document.getElementById('mail_valid').value;
		if(mail_valid == 'true')
		{
			mesaj = "This e-mail address is not in our database! \n";
			numar_erori += 1;
			recpw_mail_tx = 1;
		}
	}

	//Daca am erori nu trimit formul, daca nu am erori trimit formul
	if(numar_erori != 0)
	{
	
		//afisez background normal la campul email
		document.getElementById('mail').className		= 'input_cont_ok';
		
		//afisez cu background rosu campul email daca are erori
		if(recpw_mail_tx == 1)
		{
			document.getElementById('mail').className		= 'input_cont_err';
		}
		
		//alert(mesaj);
		if(campuri.length > 0)
		{
			var necompletat		= " Please fill in the ";
			necompletat			+= campuri.join(', ');			
			necompletat			+= "!";
		}
		else
		{
			var necompletat		= "";
		}
		document.getElementById('err_login').innerHTML			="&nbsp;&nbsp&nbsp;&nbsp;"+mesaj+necompletat; 
		document.getElementById('err_login').style.display		='block'; 
		document.getElementById('err_login').style.paddingLeft	= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);

		
		//alert("Numar erori :"+numar_erori+" \n\n"+mesaj);
		
		return false;
	}
	else
	{

		setTimeout("document.frm_recpw.submit()", 1);

		return true;
	}

}


//----  formular dezabonare newsletter  -----------------------------------------------

function dezabonare_newsletter()
{
	var dez_email		= document.getElementById('mail').value;
	var dez_email_v		= document.getElementById('dez_email_v').value;

	var mail_valid		= document.getElementById('mail_valid').value;

	var numar_erori		= 0;
	var mesaj			= "";
	
	var dez_email_tx	= 0;
	var dez_email_v_tx	= 0;

	var campuri			= new Array();
	var contor			= 0;

	
	//verificare formular dezabonare newsletter

	//campul E-mail
	var mail_1_sintaxa_c = document.getElementById('mail_1_sintaxa_c').value;
	if(dez_email.length == 0)
	{
		campuri[contor++] = "email-ul";
		numar_erori += 1;
		dez_email_tx = 1;
	}
	else if(mail_1_sintaxa_c == 'false')
	{
		mesaj = "Adresa de Email este incorecta! \n";
		numar_erori += 1;
		dez_email_tx = 1;
	}
	else if(mail_valid == 'true')
	{
		mesaj = "Aceasta adresa de e-mail nu exista in baza de date sau contul dvs. a fost blocat! \n";
		numar_erori += 1;
		dez_email_tx = 1;
	}
	else if(dez_email != dez_email_v) 
	{
		mesaj = "Adresele de email nu sunt identice!";
		numar_erori += 1;
		dez_email_tx = 1;
		dez_email_v_tx = 1;
	}

	//Daca am erori nu trimit formul, daca nu am erori trimit formul
	if(numar_erori != 0)
	{
	
		//afisez background normal la campul email
		document.getElementById('dez_email_class').className		= 'bg_input_ok';
		document.getElementById('dez_email_v_class').className		= 'bg_input_ok';
		
		//afisez cu background rosu campul email daca are erori
		if(dez_email_tx == 1)
		{
			document.getElementById('dez_email_class').className		= 'bg_input_err';	
		}
		if(dez_email_v_tx == 1)
		{
			document.getElementById('dez_email_v_class').className		= 'bg_input_err';	
		}
		
		if(campuri.length > 0)
		{
			var necompletat		= " Va rugam completati ";
			necompletat			+= campuri.join(', ');			
			necompletat			+= "!";
		}
		else
		{
			var necompletat		= "";
		}
		
		//inchid mesajul ok
		document.getElementById('mesaj_ok').style.display = 'none';
		
		document.getElementById('err_login').innerHTML			="&nbsp;&nbsp&nbsp;&nbsp;"+mesaj+necompletat; 
		document.getElementById('err_login').style.display		='block'; 
		document.getElementById('err_login').style.paddingLeft	= "8px";
		$('#err_login').fadeTo('fast', 0); 
		$('#err_login').fadeTo('slow', 1);
		
		return false;
	}
	else
	{
		setTimeout("document.frm_dezabonare.submit()", 1);

		return true;
	}

}

function valideaza_abonare_news_pop()
{
	if (validare_email(document.getElementById('news_mail_input').value))
	{
		AARead(document.getElementById('srvurl').value + "pages/js/abonare_news_popup.php?mail="+document.getElementById('news_mail_input').value, proceseaza_abonare_news_pop, "news_pop_test_cont");
	}
	else
	{
		alert("The e-mail address is invalid!");
	}
}

function proceseaza_abonare_news_pop(data, element)
{
		document.getElementById('news_mail_input').style.display = "none";
		document.getElementById('popupContactClose3').style.display = "none";
		document.getElementById('popuptitle').style.display = "none";
		document.getElementById('popupbtnsubmit').style.display = "none";
		document.getElementById('popupdivok').style.display = "block";
		setTimeout('disablePopup3()', 1000);
}

function seteaza_tab_faq(id) 
{
	for (i=1; i<=45; i++) 
	{
		if (document.getElementById('tab_'+i))
			{
			document.getElementById('tab_'+i).style.display="none";
			
			document.getElementById('but_'+i).style.fontWeight="normal";
			}
	}
    document.getElementById('tab_'+id).style.display="block";
	document.getElementById('but_'+id).style.fontWeight="bold"; 
}


//--------------------------------------------------------------------------
//-------------------------------- custom popup ----------------------------
//--------------------------------------------------------------------------

function mlhPopItUp(url,name,w,h) {
	var newPopUpLeft	=100;
	newPopUpLeft=Math.floor((screen.width-w)/2);
	var newPopUpTop		=100;
	newPopUpTop=Math.floor((screen.height-h)/2);
	var newPopUp		=window.open(url,name,'width='+w+',height='+h+',left='+newPopUpLeft+',top='+newPopUpTop+',menubar=no,location=no,resizable=1,status=no,scrollbars=1');
	if (window.focus) newPopUp.focus();
}

//--------------------------------------------------------------------------
//-------------------------------- news ticker -----------------------------
//--------------------------------------------------------------------------

jQuery.fn.liScroll = function(settings) {
	settings = jQuery.extend({ travelocity: 0.07 }, settings);		
	return this.each(
		function() {
			var $strip = jQuery(this);
			$strip.addClass("mlh_tk");
			var stripWidth = 0;
			var $mask = $strip.wrap("<div class='mask' style='background-color: "+mlh_tk_bgColor+";'></div>");
			var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");								
			var containerWidth = $strip.parent().parent().width();

			$strip.find("li").each(
				function(i){
					stripWidth += jQuery(this, i).width();
				}
			);

			$strip.width(stripWidth);			
			var totalTravel = stripWidth+containerWidth;
			var defTiming = totalTravel/settings.travelocity;

			function scrollnews(spazio, tempo) {
				$strip.animate(
					{left: '-='+ spazio},
					tempo,
					"linear",
					function() {
						$strip.css("left", containerWidth);
						scrollnews(totalTravel, defTiming);
					}
				);
			}

			scrollnews(totalTravel, defTiming);

			$strip.hover(
				function() {
					jQuery(this).stop();
				},
				function() {
					var offset = jQuery(this).offset();
					var residualSpace = offset.left + stripWidth;
					var residualTime = residualSpace/settings.travelocity;
					scrollnews(residualSpace, residualTime);
				}
			);
		}
	);	
};


//check if item can be added to cart
function mlhChkAddCart() {
	//if custom size ..
	if ($('#cs_on').val()=='1') {
		//check if all fields are propper filled
		if (
			($('#cs_height').val().trim().length>=1 && $('#cs_height').val().trim().length<=3)
			&&
			($('#cs_bust').val().trim().length>=1 && $('#cs_bust').val().trim().length<=3)
			&&
			($('#cs_bra').val().trim().length>=1 && $('#cs_bra').val().trim().length<=3)
			&&
			($('#cs_waist').val().trim().length>=1 && $('#cs_waist').val().trim().length<=3)
			&&
			($('#cs_hip').val().trim().length>=1 && $('#cs_hip').val().trim().length<=3)
		) {
			//add this to cart ..
			$('#addtocart').hide();
			$('#addtocart_2').show();

			var params=$('#cs_id').val()+'|'+$('#cs_height').val().trim()+'|'+$('#cs_bust').val().trim()+'|'+$('#cs_bra').val().trim()+'|'+$('#cs_waist').val().trim()+'|'+$('#cs_hip').val().trim()+'/1/produs/';

			AARead($('#srvurl').val()+'procesare-cos/adaugac/'+params, procesare_adaugare_in_cos_2, "");
		}
		//show error
		else {
			$('#cs_form_err').hide();
			$('#cs_form_err').show('slow');
		}
	}
	//normal size ..
	else {
		if (parseInt($('#mar_sel').val()) == 0 || $('#mar_sel').val()=='undefined') {
			document.getElementById('err-marime-cantitate').style.display='inline';
			document.getElementById('err_marime').style.display='inline';
			document.getElementById('marime-cantitate').style.display = 'none'; 
			$('#err_marime').fadeTo('fast', 0);
			$('#err_marime').fadeTo('slow', 1); 
		} 
		else adauga_in_cos_2();
	}
}


