function raw_popup(url) {
    var theWindow = window.open(url, '_blank', 'menubar=no,toolbar=no,location=no,width=506,height=312,top=250,left=350,scrollbars=yes,resizable=no,status=no,directories=no');
    theWindow.focus();
    return theWindow;
}
	
function schimbare_parola (){
 var x = document.schimba_parola;
 var ok=1;

 if (x.utilizator.value == '')   { alert ('Introduceti numele dvs.de identificare pe acest sit'); ok = 0;}
 if (x.parola_v.value == '')       { alert ('Introduceti parola veche'); ok = 0;}
 if (x.parola_n.value == '') { alert ('Introduceti parola noua'); ok = 0;} 
 if (x.parola_n.value.length <5)       { alert ('Parola noua trebuie sa contina minim 5 caractere !'); ok=0;}
 if (x.re_parola_n.value == '')  { alert ('Confirmati parola noua'); ok = 0;} 
 if (x.parola_n.value != x.re_parola_n.value) {alert('Parola confirmata nu corespunde cu cea introdusa!'); ok=0;}
if (ok == 0) return false;
         else return true;
}

function creare_cont (){
 var y = document.add_client;
 var ok=1;

 if (y.login_id.value == '')   { alert ('Introduceti numele dvs.de identificare pe acest sit !'); ok=0;}
 if (y.login_id.value.length <5)       { alert ('ID-ul de utilizator trebuie sa contina minim 5 caractere !'); ok=0;}
 if (y.parola.value == '')       { alert ('Introduceti parola !'); ok=0;}
 if (y.parola.value.length <5)       { alert ('Parola trebuie sa contina minim 5 caractere !'); ok=0;}
 if (y.re_parola.value == '')  { alert ('Confirmati parola noua !'); ok=0;} 
 if (y.parola.value != y.re_parola.value) {alert('Parola confirmata nu corespunde cu cea introdusa !'); ok=0;}
if ( (y.tip.value=='pf') && (y.nume.value == ''))  { alert ('Completati numele si prenumele dumneavoastra !'); return false;} 
if ( (y.tip.value=='pj') && (y.denumire.value == ''))  { alert ('Completati denumirea firmei !'); return false;} 
 if (y.email.value == '')  { alert ('Completati adresa de e-mail !'); ok=0;} 
 if ( (y.email.value.indexOf("@")== -1) || (y.email.value.indexOf(".") == -1)) { 
    alert( "Completati adresa de e-mail corect" );
	ok=0;}
 if (y.telefon.value == '')  { alert ('Completati numarul de telefon !'); ok=0;}
 if (ok == 0) return false;
         else return true;

}
function upd_cont (){
 var z= document.upd_client;
  var ok=1;

if ( (z.tip.value=='pf') && (z.nume.value == ''))  { alert ('Completati numele si prenumele dumneavoastra !'); return false;} 
if ( (z.tip.value=='pj') && (z.denumire.value == ''))  { alert ('Completati denumirea firmei !'); return false;} 
 if (z.email.value == '')  { alert ('Completati adresa de e-mail !'); ok=0;} 
 if ( (z.email.value.indexOf("@")== -1) || (z.email.value.indexOf(".") == -1)) { 
    alert( "Completati adresa de e-mail corect" );
	ok=0;}
 if (z.telefon.value == '')  { alert ('Completati numarul de telefon !'); ok=0;}
 if (ok == 0) return false;
         else return true;

}
function ascunde_campuri(tip) {
var i,elem;
for(i=0; (elem= document.getElementsByTagName("div")[i]); i++) {
  if (elem.id==tip||elem.id=='') {elem.style.display="block";} else {elem.style.display="none";}
    }
}

function logare (){
var x = document.login;
var ok=1;

if (x.utilizator.value == '')   { alert ('Introduceti numele dvs.de identificare pe acest sit'); ok = 0;}
if (x.parola.value == '')       { alert ('Introduceti parola'); ok = 0;}
if (ok == 0) return false;
         else return true;
}

function checkEmail(){
 var x = document.contact;
 var ok=1;
 if (x.nume.value == '')  { alert ('Completati numele!'); ok = 0;} 
 if ( (x.email.indexOf("@")== -1) || (x.email.indexOf(".") == -1)) { 
    alert( "Va rugam sa va completati adresa de e-mail!" );
	ok=0;}
 if (x.mesaj.value == '')  { alert ('Scrieti un mesaj!'); ok = 0;} 
 if (ok == 0) return false;
         else return true;
}

function activare(frame_id) {
	var fr= document.getElementById(frame_id);
    fr.style.display="block";	
	var i, elem;
	for(i=0; (elem= document.getElementById("categ")[i]); i++) {
	if (elem.className=='bread_activ') { elem.className="bread";} else	{elem.className="bread_activ";}
	}
	
}

function TotalC() {
var total = 0;
var cnt=0;
var tot_red=0;

for (var i=1;i<=6;i++) {
	    box=eval("document.produse.m"+i);
		pret=eval("document.produse.p"+i);
		if(box.checked == true) { total += parseFloat(pret.value); cnt+=1;}}
	
if (cnt<=2) {tot_red=total;}
if (cnt>2) {tot_red=total-(0.1*total);}
if (cnt>4) {tot_red=total-(0.2*total);}
if (cnt>6) {tot_red=total-(0.3*total);}
var ts = new String(tot_red);
var ct = new String(cnt);
if(ts.indexOf('.') < 0) { ts += '.00'; }
if(ts.indexOf('.') == (ts.length - 2)) { ts += '0'; }
document.produse.T.value = ts;
document.produse.c.value = ct;
}

function check_chk() {
	var contor=document.linii.counter.value;
	var nr=0;
	var sir="";

	for(var j=1; j<=contor; j++) {
	box=eval("document.linii.chk"+j);
	if (box.checked == true) { nr+=1;
	              if (nr>1) {sir+=",'"+box.value+"'";} else {sir+="'"+box.value+"'";}
						  } 
	}
	document.linii.array.value = sir;
}
