
function inscrie_newsletter(){
    var valid = 1;
    var message = '';
    var nume = document.getElementById('news_name').value;
    var email = document.getElementById('news_email').value;
    if(document.getElementById('news_name').value=='') {
        message+='Va rugam completati numele dvs.\n';
        valid=0;
        } 
    if(document.getElementById('news_email').value=='') {
        message+='Va rugam completati e-mailul dvs.\n';
        valid=0;
        } 
        
    if(valid==0) alert(message);
    else {
       getHTTPObject('ajax/abonare.php?nume='+nume+'&email='+email,'status_abonare');
	   document.getElementById('status_abonare').innerHTML = '..se incarca';
    }  
}
function verifica_formular(){
   var valid=1;
   var message1='';
   
   if(document.getElementById('nume').value=='') {
        message1+='Va rugam completati numele dvs.\n';
        valid=0;
        } 

   if(document.getElementById('email').value=='') {
        message1+='Va rugam completati adresa dvs. de e-mail.\n';
        valid=0;
        } 

   if(document.getElementById('telefon').value=='') {
        message1+='Va rugam completati telefonul dvs.\n';
        valid=0;
        } 
   
    if(document.getElementById('mesaj').value=='') {
        message1+='Va rugam completati mesajul dvs.\n';
        valid=0;
        } 
        
    if(valid==0) alert(message1);
    else document.getElementById('formular_trimitere').submit();    
}

function show_fizica(){ 
    var i=0;
	for (i=1;i<7;i++)
	   document.getElementById('cont_firma'+i).style.display='none';
	for (i=0;i<3;i++)
	   document.getElementById('cont_fizica'+i).style.display='';
}
function show_firma(){ 
    var i=0;
	for (i=1;i<7;i++)
	   document.getElementById('cont_firma'+i).style.display='';
	for (i=0;i<3;i++)
	   document.getElementById('cont_fizica'+i).style.display='none';
}
 
function show_fizica2(){ 
    var i=0;
	for (i=7;i<13;i++)
	   document.getElementById('cont_firma'+i).style.display='none';
	for (i=0;i<3;i++)
	   document.getElementById('cont_fizica'+i).style.display='';
}
function show_firma2(){ 
    var i=0;
	for (i=7;i<13;i++)
	   document.getElementById('cont_firma'+i).style.display='';
	for (i=0;i<3;i++)
	   document.getElementById('cont_fizica'+i).style.display='none';
}
   
function register_checkout () {
 
    var elefant = '';
    
    
    var tip_persoana='';
    if(document.getElementById('pers_fizica').checked == true)
        var tip_persoana=1;
    
    if(document.getElementById('pers_juridica').checked == true)
        var tip_persoana=2;
    elefant += 'tip_persoana='+tip_persoana;
    
    var email=document.getElementById('email').value;
    elefant += '&email='+email;
    
    var pass1=document.getElementById('pass1').value;
    elefant += '&pass1='+pass1;
    
    var pass2=document.getElementById('pass2').value;
    elefant += '&pass2='+pass2;
    
    var telefon =  document.getElementById("telefon").value;
    elefant +='&telefon='+telefon;
    
    if(tip_persoana==2) {
        var bill_company =  document.getElementById("bill_company").value;
        elefant +='&bill_company='+bill_company;
        var bill_company_cui =  document.getElementById("bill_company_cui").value;
        elefant +='&bill_company_cui='+bill_company_cui;
        var bill_company_reg_com =  document.getElementById("bill_company_reg_com").value;
        elefant +='&bill_company_reg_com='+bill_company_reg_com;
        var bill_company_iban =  document.getElementById("bill_company_iban").value;
        elefant +='&bill_company_iban='+bill_company_iban;
        var bill_company_banca =  document.getElementById("bill_company_banca").value;
        elefant +='&bill_company_banca='+bill_company_banca;
    }
  
    var prenume =  document.getElementById("prenume").value;
    elefant +='&prenume='+prenume;
    
    var nume =  document.getElementById("nume").value;
    elefant +='&nume='+nume;
    
    var sex='';
    if(document.getElementById('male').checked == true)
        var sex="m";

    if(document.getElementById('female').checked == true)
        var sex="f";
        
    elefant +='&sex='+sex;
    
    var cnp =  document.getElementById("cnp").value;
    elefant +='&cnp='+cnp;
    
    var serie_ci =  document.getElementById("serie_ci").value;
    elefant +='&serie_ci='+serie_ci;
    
    
  //  var data_nasterii =  document.getElementById("data_an_1").value+'-'+document.getElementById("data_luna_1").value+'-'+document.getElementById("data_zi_1").value;
   // elefant +='&data_nasterii='+data_nasterii;
    
    var numar_ci =  document.getElementById("numar_ci").value;
    elefant +='&numar_ci='+numar_ci;
    
    var county =  document.getElementById("county").value;
    elefant +='&county='+county;
    
    var city =  document.getElementById("city").value;
    elefant +='&city='+city;
    
    var city1 =  document.getElementById("city1").value;
    elefant +='&city1='+city1;
    
    var strada =  document.getElementById("strada").value;
    elefant +='&strada='+strada;
    
    var bloc =  document.getElementById("bloc").value;
    elefant +='&bloc='+bloc;
    
    var strada_nr =  document.getElementById("strada_nr").value;
    elefant +='&strada_nr='+strada_nr;
    
    var scara =  document.getElementById("scara").value;
    elefant +='&scara='+scara;
    
    var etaj =  document.getElementById("etaj").value;
    elefant +='&etaj='+etaj;
    
    var apartament =  document.getElementById("apartament").value;
    elefant +='&apartament='+apartament;

    var sector =  document.getElementById("sector").value;
        elefant +='&sector='+sector;
    
    var postal_code =  document.getElementById("postal_code").value;
        elefant +='&postal_code='+postal_code;
    var newsletter =  document.getElementById("newsletter").value;
        elefant +='&newsletter='+newsletter;
  
    postHTTPObject('ajax/checkout_register.php',elefant,'checkout_register1');
}

function arata_register(localitate) {
    getHTTPObject('ajax/checkout_register_formular.php','checkout_one_step');
	document.getElementById('checkout_one_step').innerHTML = '..se incarca';
}


function reset_adresa(localitate){
    //document.getElementById("livrare_klient1").checked=false;
    //document.getElementById("livrare_klient2").checked=false;
    document.getElementById("cost_transport").innerHTML='';
    document.getElementById('localitate_livrare').value=localitate;
}

function cost_transport (id) {
    if(!id)
        var localitate_livrare=document.getElementById('localitate_livrare').value;
    else
        var localitate_livrare=id;
	getHTTPObject('ajax/cost_livrare.php?l='+localitate_livrare,'cost_transport');
	document.getElementById('cost_transport').innerHTML = '';
}
function trimite_comanda(){
    var tip_plata='';
    
    if(document.getElementById('plata1').checked == true)
        var tip_plata=document.getElementById('plata1').value;
    
    if(document.getElementById('plata2').checked == true)
        var tip_plata=document.getElementById('plata2').value;
    
    
    var tip_livrare='';
    if(document.getElementById('livrare_klient1').checked == true)
        var tip_livrare = document.getElementById('livrare_klient1').value;
    
    if(document.getElementById('livrare_klient2').checked == true)
        var tip_livrare = document.getElementById('livrare_klient2').value;
        
    var total_facturare  = document.getElementsByName("adresa_facturare").length;
    var total_livrare  = document.getElementsByName("adresa_livrare").length;
    var gasit_facturare = '';
    var gasit_livrare = '';
    var telefon_comanda = document.getElementById('telefon_comanda').value;
    var nota = document.getElementById('nota').value;
    
    var pret_transport = document.getElementById('pret_transport').value;
    
    for(i=0;i<total_facturare;i++)
		if(document.getElementsByName("adresa_facturare")[i].checked==true) { 
		  gasit_facturare='1';
          valoare_facturare = document.getElementsByName("adresa_facturare")[i].value;
          }
    
    for(i=0;i<total_livrare;i++)
		if(document.getElementsByName("adresa_livrare")[i].checked==true) {
		  gasit_livrare='1';
          valoare_livrare = document.getElementsByName("adresa_livrare")[i].value;
		} 
        
   
    var valid=1;
    var message1='';
    
    if(tip_plata=='') {
        message1+='Va rugam completati Modalitatea de plata a comenzii\n';
        valid=0;
        } 

    if(tip_livrare=='') {
        message1+='Va rugam completati modalitatea de livrare a comenzii\n';
        valid=0;
        } 

    if(gasit_facturare=='') {
        message1+='Va rugam completati/bifati adresa de facturare\n';
        valid=0;
        } 

    if(gasit_livrare=='') {
        message1+='Va rugam completati/bifati adresa de livrare\n';
        valid=0;
        } 
    
    elefant='plata='+tip_plata+'&livrare_klient='+tip_livrare+'&adresa_facturare='+valoare_facturare+'&adresa_livrare='+valoare_livrare+'&pret_transport='+pret_transport+'&telefon_comanda='+telefon_comanda+'&nota='+nota;
    
    if(valid==0) alert(message1);
    else {
        postHTTPObject('ajax/finalizare.php',elefant,'shopping_cart');
        //postHTTPObject('ajax/adrese.php',elefant,'list_addr_delivery');
        ke_byID('shopping_cart').style.display='..se incarca'; 
        //ke_byID('btn_add_adr_fact').style.display='';
        location.href=location.href + '#shopping_cart';
    }  
    
}
function memorare_pozitie(pozitie,tip) {
     getHTTPObject('ajax/memorare_pozitie.php?poz='+pozitie+'&tip='+tip,'sh');
     
}
function add_adresa () {
    var judet=document.getElementById('county').value;
    var localitate = document.getElementById('city').value;
    var localitate1 = document.getElementById('city1').value;
    
    var strada = document.getElementById('strada').value;
    var strada_nr = document.getElementById('strada_nr').value;
    var bloc = document.getElementById('bloc').value;
    var scara = document.getElementById('scara').value;
    var etaj = document.getElementById('etaj').value;
    var apartament = document.getElementById('apartament').value;
    var sector = document.getElementById('sector').value;
    var postal_code = document.getElementById('postal_code').value;
    
    elefant='county='+judet+'&city='+localitate+'&city1='+localitate1+'&strada='+strada+'&strada_nr='+strada_nr+'&bloc='+bloc+'&scara='+scara+'&etaj='+etaj+'&apartament='+apartament+'&sector='+sector+'&postal_code='+postal_code+'&insert_adresa=1';
    var valid=1;
    var message1='';
    if(judet=='') {
        message1+='Va rugam completati judetul adresei de facturare\n';
        valid=0;
        } 

    if( (localitate=='') && (localitate1=='') ) {
        message1+='Va rugam completati localitatea adresei de facturare\n';
        valid=0;
        } 

    if(strada=='') {
        message1+='Va rugam completati strada adresei de facturare\n';
        valid=0;
        } 

    if(strada_nr=='') {
        message1+='Va rugam completati numarul strazii adresei de facturare\n';
        valid=0;
        } 
    if(postal_code=='') {
        message1+='Va rugam completati codul postal al adresei de facturare\n';
        valid=0;
        }
    
    if(valid==0) alert(message1);
    else {
        postHTTPObject('ajax/adrese.php',elefant,'list_addr_billing');
        //postHTTPObject('ajax/adrese.php',elefant,'list_addr_delivery');
        ke_byID('add_adr_fact').style.display='none'; 
        ke_byID('btn_add_adr_fact').style.display='';
        
    }
}

function f_add_adresa (unde) {
    var judet=document.getElementById('f_county').value;
    var localitate = document.getElementById('city').value;
    var localitate1 = document.getElementById('city1').value;
    
    var strada = document.getElementById('f_strada').value;
    var strada_nr = document.getElementById('f_strada_nr').value;
    var bloc = document.getElementById('f_bloc').value;
    var scara = document.getElementById('f_scara').value;
    var etaj = document.getElementById('f_etaj').value;
    var apartament = document.getElementById('f_apartament').value;
    var sector = document.getElementById('f_sector').value;
    var postal_code = document.getElementById('f_postal_code').value;
    
    elefant='county='+judet+'&city='+localitate+'&city1='+localitate1+'&strada='+strada+'&strada_nr='+strada_nr+'&bloc='+bloc+'&scara='+scara+'&etaj='+etaj+'&apartament='+apartament+'&sector='+sector+'&postal_code='+postal_code;
    var valid=1;
    var message1='';
    if(judet=='') {
        message1+='Va rugam completati judetul adresei de livrare\n';
        valid=0;
        } 

    if( (localitate=='') && (localitate1=='') ) {
        message1+='Va rugam completati localitatea adresei de livrare\n';
        valid=0;
        } 

    if(strada=='') {
        message1+='Va rugam completati strada adresei de livrare\n';
        valid=0;
        } 

    if(strada_nr=='') {
        message1+='Va rugam completati numarul strazii adresei de livrare\n';
        valid=0;
        } 
    if(postal_code=='') {
        message1+='Va rugam completati codul postal al adresei de livrare\n';
        valid=0;
        }
    
    if(valid==0) alert(message1);
    else {
        
        if(document.getElementById('tip_adresa_deschisa').value=="livrare") elefant+='&memo=livrare';
        else if(document.getElementById('tip_adresa_deschisa').value=="facturare") elefant+='&memo=facturare';
        postHTTPObject('ajax/adrese.php',elefant+'&insert_adresa=2','list_addr_billing');
        postHTTPObject('ajax/adrese.php',elefant+'&insert_adresa=3','list_addr_delivery');
        //ke_byID('add_adr_livrare').style.display='none'; 
        //ke_byID('livrare').style.display='';
        
        if(localitate>0) document.getElementById("localitate_livrare").value=localitate;
        else document.getElementById("localitate_livrare").value='localitate noua';
        //document.getElementById("livrare_klient1").checked=false;
        //document.getElementById("livrare_klient2").checked=false;
        document.getElementById("cost_transport").innerHTML='';
        cost_transport();
       
    }
}

function login_checkout() {
    var email=document.getElementById('login_email').value;
    var pass = document.getElementById('lpsw').value;
    postHTTPObject('ajax/checkout.php','email='+email+'&pass1='+pass,'check_login');
}

function cos_q(pozitie,produs) {
    var cantitate=document.getElementById('qty_'+pozitie).value;
	getHTTPObject2('ajax/cos2.php?t=1&q='+cantitate+'&poz='+pozitie+'&p='+produs,'subtotal',pozitie);
    getHTTPObject('ajax/cos2.php?t=3','total_cos');
    document.getElementById('total_cos').innerHTML = '...';
    getHTTPObject('ajax/cos2.php?t=4','total_verde');
    document.getElementById('total_verde').innerHTML = '...';
	document.getElementById('subtotal_'+pozitie).innerHTML = '..se incarca';
    
    //transport//
    if(document.getElementById('localitate_livrare'))
        var localitate_livrare=document.getElementById('localitate_livrare').value;
        
    if(localitate_livrare>0) {
	   getHTTPObject('ajax/cost_livrare.php?l='+localitate_livrare,'cost_transport');
	   document.getElementById('cost_transport').innerHTML = '';
    }
    //transport//
    var cantitate2=document.getElementById('qty_'+pozitie).value;
    if(cantitate2<=0) document.location='/cart.php?delete_product='+pozitie+'&cod='+produs;
    
    
}
function cos_plus(pozitie,produs) {
    var cantitate=document.getElementById('qty_'+pozitie).value;
    cantitate++; 
    document.getElementById('qty_'+pozitie).value++;
	getHTTPObject2('ajax/cos2.php?t=1&q='+cantitate+'&poz='+pozitie+'&p='+produs,'subtotal',pozitie);
    
    getHTTPObject('ajax/cos2.php?t=3','total_cos');
    document.getElementById('total_cos').innerHTML = '...';
    getHTTPObject('ajax/cos2.php?t=4','total_verde');
    document.getElementById('total_verde').innerHTML = '...';
	document.getElementById('subtotal_'+pozitie).innerHTML = '..se incarca';
    //transport//
    if(document.getElementById('localitate_livrare'))
        var localitate_livrare=document.getElementById('localitate_livrare').value;
    if(localitate_livrare>0) {
	   getHTTPObject('ajax/cost_livrare.php?l='+localitate_livrare,'cost_transport');
	   document.getElementById('cost_transport').innerHTML = '';
    }
    //transport//
    var cantitate2=document.getElementById('qty_'+pozitie).value;
    if(cantitate2<=0) document.location='/cart.php?delete_product='+pozitie+'&cod='+produs;
}

function cos_minus(pozitie,produs) {
    var cantitate=document.getElementById('qty_'+pozitie).value;
    cantitate--; 
    document.getElementById('qty_'+pozitie).value--;
	getHTTPObject2('ajax/cos2.php?t=1&q='+cantitate+'&poz='+pozitie+'&p='+produs,'subtotal',pozitie);
    
    getHTTPObject('ajax/cos2.php?t=3','total_cos');
    document.getElementById('total_cos').innerHTML = '...';
    getHTTPObject('ajax/cos2.php?t=4','total_verde');
    document.getElementById('total_verde').innerHTML = '...';
    
	document.getElementById('subtotal_'+pozitie).innerHTML = '..se incarca';
    //transport//
    if(document.getElementById('localitate_livrare'))
        var localitate_livrare=document.getElementById('localitate_livrare').value;
    if(localitate_livrare>0) {
	   getHTTPObject('ajax/cost_livrare.php?l='+localitate_livrare,'cost_transport');
	   document.getElementById('cost_transport').innerHTML = '';
    }
    //transport//
     var cantitate2=document.getElementById('qty_'+pozitie).value;
    if(cantitate2<=0) document.location='/cart.php?delete_product='+pozitie+'&cod='+produs;
}

function update_total (pret,id_produs,burl) {
    var cantitate=document.getElementById('qty').value; 
    document.getElementById('addtocart').href='add_cart.php?p='+id_produs+'&q='+cantitate+'&burl='+burl;
	getHTTPObject('ajax/cos1.php?t=1&pret='+pret+'&q='+cantitate+'&p='+id_produs+'&burl='+burl,'subtotal');
   // getHTTPObject('ajax/cos1.php?t=2&pret='+pret+'&q='+cantitate+'&p='+id_produs,'link_cos');
	document.getElementById('pretTotal').innerHTML = '..se incarca';
   // document.getElementById('link_cos').innerHTML = '..se incarca';
}

function orase_judet(){
    var id_judet=document.getElementById('county').value; 
	getHTTPObject('ajax/orase.php?id_jud='+id_judet,'orase');
	document.getElementById('lista_orase').innerHTML = '..se incarca';
}

function f_orase_judet(){
    var id_judet=document.getElementById('f_county').value; 
	getHTTPObject('ajax/orase.php?t=2&id_jud='+id_judet,'f_orase');
	document.getElementById('lista_orase').innerHTML = '..se incarca';

}

function refresh_filtre() {
    var nr = document.getElementById('nr_filtre').value;
    var link ='';
    var root = document.getElementById('root_address').value;
    
    for(i=1;i<=nr;i++)
        if(document.getElementById('filtru'+i).value>0) {
            link += document.getElementById('nume_filtru'+i).value +'__'+document.getElementById('filtru'+i).value + '___';
            } 
    root += link+'/';
    document.location =root; 
}

function trimite_prieten() {
   var gasit=0;
   var valid=1;
   var message1='';
   
  

   if(document.getElementById('your_name').value=='') {
        message1+='Va rugam completati numele dvs.\n';
        valid=0;
        } 

   if(document.getElementById('your_email').value=='') {
        message1+='Va rugam completati adresa dvs. de e-mail.\n';
        valid=0;
        } 

   if(document.getElementById('friend_email').value=='') {
        message1+='Va rugam completati adresa de e-mail a prietenului dvs.\n';
        valid=0;
        } 
   
    if(document.getElementById('mesaj').value=='') {
        message1+='Va rugam completati mesajul dvs.\n';
        valid=0;
        } 
    if(document.getElementById('cod').value=='') {
        message1+='Va rugam completati codul de securitate.\n';
        valid=0;
        } 
        
    if(valid==0) alert(message1);
    else document.getElementById('recomanda_form').submit();
}

function vd_comment() {
   var gasit=0;
   var valid=1;
   var message1='';
   
   for(i=0;i<=4;i++)
    if(document.getElementsByName("stele")[i].checked==true) gasit='1';
   
    if(gasit==0) {
        message1+='Va rugam acordati un punctaje (de 1 la 6 stele)\n';
        valid=0;
        } 
     
   if(document.getElementById('review_text').value=='') {
        message1+='Va rugam completati comentariul dvs.\n';
        valid=0;
        } 

   if(document.getElementById('name').value=='') {
        message1+='Va rugam completati numele dvs.\n';
        valid=0;
        } 

   if(document.getElementById('email').value=='') {
        message1+='Va rugam completati adresa dvs. de e-mail.\n';
        valid=0;
        } 

   if(document.getElementById('location').value=='') {
        message1+='Va rugam completati localitatea in care locuiti.\n';
        valid=0;
        } 
    if(valid==0) alert(message1);
    else document.getElementById('comment_form').submit();
}


function aproba(id) {
	getHTTPObject2('ajax/comentarii.php?tip=ok&id='+id,'aprobare',id);
	document.getElementById('status_'+id).innerHTML = '';
}
function sterg_item_ajax (id) {
	getHTTPObject('ajax/comentarii.php?tip=sterg&id='+id,'continut',id);
	document.getElementById('continut_'+id).innerHTML = '';	

}

function checkAll(field)
{
    field=document.getElementsByName('abonati[]');
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field) {
    field=document.getElementsByName('abonati[]');
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function sterge_poza(adresa) {
    if(confirm("Sunteti sigur?")) document.location=adresa;
}

function add_specs(id_subcategorie,id_produs) {
    $('#specificatii').append(getHTTPObject('ajax/specs.php?id='+id_subcategorie+'&id_produs='+id_produs,'specificatii'));
	}   

function contact() {
    var message1='';
    if(document.getElementById('name').value=='') {
        message1+='Va rugam completati numele dvs.\n';
        valid=0;
        }
    
    if(document.getElementById('phone').value=='') {
        message1+='Va rugam completati telefonul dvs.\n';
        valid=0;
        }

    if(document.getElementById('email').value=='') {
        message1+='Va rugam completati adresa dvs. de e-mail\n';
        valid=0;
        }
    
    
    if(document.getElementById('subject').value=='') {
        message1+='Va rugam introduceti subiectul mesajului\n';
        valid=0;
        }
    
    //index1=document.getElementById('subject').selectedIndex;
    /*if(index1=='') {
        message1+='Va rugam completati subiectul\n';
        valid=0;
        }*/


    if(document.getElementById('message_content').value=='') {
        message1+='Va rugam introduceti mesajul\n';
        valid=0;
        }
    
    if(message1!='') { alert(message1);}
	else document.getElementById('contact_form').submit();
    
    
}

function editare_date(){
	var mesaj='';
    var mesaj_cont='';
    var mesaj_bill='';
    var mesaj_shipp='';
     
    if(document.getElementById('nume').value=='') mesaj_cont+='Campul Nume este obligatoriu\n';
    if(document.getElementById('prenume').value=='') mesaj_cont+='Campul Prenume este obligatoriu\n';
    if(document.getElementById('email').value=='') mesaj_cont+='Campul Email este obligatoriu\n';
	if(document.getElementById('telefon').value=='') mesaj_cont+='Campul Telefon este obligatoriu\n';
        
    if(mesaj_cont!="")
        mesaj+='Informatii necesare contului dvs.: \n\n'+mesaj_cont;
        
    if(document.getElementById('bill_nume').value==''){ mesaj_bill='Campul Nume este obligatoriu\n';}
    if(document.getElementById('bill_prenume').value==''){ mesaj_bill+='Campul Prenume este obligatoriu\n';}   
    if(document.getElementById('bill_telefon').value=='') mesaj_bill+='Campul Telefon este obligatoriu\n'; 
	if(document.getElementById('bill_cnp').value==''){ mesaj_bill+='Campul CNP este obligatoriu\n';}
	if(document.getElementById('bill_serie_ci').value=='')  mesaj_bill+='Campul Serie CI este obligatoriu\n';
	if(document.getElementById('bill_nr_ci').value=='')  mesaj_bill+='Campul Numar CI este obligatoriu\n';    
	if(document.getElementById('bill_city').value=='')  mesaj_bill+='Campul Localitate este obligatoriu\n';
    if(document.getElementById('bill_strada').value=='')  mesaj_bill+='Campul Strada este obligatoriu\n';
	if(document.getElementById('bill_strada_nr').value=='')  mesaj_bill+='Campul Numar (numarul strazii) este obligatoriu\n';
	
    index1=document.getElementById('bill_county').selectedIndex;
	valoare_judet=document.getElementById('bill_county').options[index1].value;
	if( valoare_judet=='')
		mesaj_bill+='Campul Judet este obligatoriu\n';
	if (document.getElementById('bill_postal_code').value.length!=6) mesaj_bill+='Campul Cod Postal trebuie sa contina exact 6 caractere\n';
	
    if(document.getElementById('juridica').checked==true) {
   	    if(document.getElementById('bill_company').value=='')  mesaj_bill+='Campul Nume firma este obligatoriu\n';
        if(document.getElementById('bill_company_cui').value=='')  mesaj_bill+='Campul Cod Fiscal este obligatoriu\n';
        if(document.getElementById('bill_company_reg_com').value=='')  mesaj_bill+='Campul Nr. inreg. fiscala este obligatoriu\n';
        }   
    if(mesaj_bill!="")
        mesaj+='\nInformatii necesare facturarii: \n\n'+mesaj_bill;
    
    if(document.getElementById('shipp_nume').value==''){ mesaj_shipp='Campul Nume este obligatoriu\n';}
    if(document.getElementById('shipp_prenume').value==''){ mesaj_shipp+='Campul Prenume este obligatoriu\n';}   
    if(document.getElementById('shipp_telefon').value=='') mesaj_shipp+='Campul Telefon este obligatoriu\n'; 
	if(document.getElementById('shipp_city').value=='')  mesaj_shipp+='Campul Localitate este obligatoriu\n';
    if(document.getElementById('shipp_strada').value=='')  mesaj_shipp+='Campul Strada este obligatoriu\n';
	if(document.getElementById('shipp_strada_nr').value=='')  mesaj_shipp+='Campul Numar (numarul strazii) este obligatoriu\n';
	index1=document.getElementById('shipp_county').selectedIndex;
	valoare_judet=document.getElementById('shipp_county').options[index1].value;
	if( valoare_judet=='')
		mesaj_shipp+='Campul Judet este obligatoriu\n';
	if (document.getElementById('shipp_postal_code').value.length!=6) mesaj_shipp+='Campul Cod Postal trebuie sa contina exact 6 caractere\n';
	
    if(document.getElementById('juridica').checked==true) 
   	    if(document.getElementById('shipp_company').value=='')  mesaj_shipp+='Campul Nume firma este obligatoriu\n';
        
    if(mesaj_shipp!="")
        mesaj+='\nInformatii necesare livrarii: \n\n'+mesaj_shipp;
    
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();  
}



function inregistrare(){
	var mesaj='';
    var mesaj_cont='';
    var mesaj_bill='';
    var mesaj_shipp='';
     
    if(document.getElementById('nume').value=='') mesaj_cont+='Campul Nume este obligatoriu\n';
    if(document.getElementById('prenume').value=='') mesaj_cont+='Campul Prenume este obligatoriu\n';
    if(document.getElementById('email').value=='') mesaj_cont+='Campul Email este obligatoriu\n';
	if(document.getElementById('telefon').value=='') mesaj_cont+='Campul Telefon este obligatoriu\n';
    if(document.getElementById('pass1').value=='') mesaj_cont+='Campul Parola este obligatoriu\n';
    
    if(mesaj_cont!="")
        mesaj='Informatii necesare contului dvs.: \n\n'+mesaj_cont;
        
    if(document.getElementById('bill_nume').value==''){ mesaj_bill='Campul Nume este obligatoriu\n';}
    if(document.getElementById('bill_prenume').value==''){ mesaj_bill+='Campul Prenume este obligatoriu\n';}   
    if(document.getElementById('bill_telefon').value=='') mesaj_bill+='Campul Telefon este obligatoriu\n'; 
	if(document.getElementById('bill_cnp').value==''){ mesaj_bill+='Campul CNP este obligatoriu\n';}
	if(document.getElementById('bill_serie_ci').value=='')  mesaj_bill+='Campul Serie CI este obligatoriu\n';
	if(document.getElementById('bill_nr_ci').value=='')  mesaj_bill+='Campul Numar CI este obligatoriu\n';    
	if(document.getElementById('bill_city').value=='')  mesaj_bill+='Campul Localitate este obligatoriu\n';
    if(document.getElementById('bill_strada').value=='')  mesaj_bill+='Campul Strada este obligatoriu\n';
	if(document.getElementById('bill_strada_nr').value=='')  mesaj_bill+='Campul Numar (numarul strazii) este obligatoriu\n';
	
    index1=document.getElementById('bill_county').selectedIndex;
	valoare_judet=document.getElementById('bill_county').options[index1].value;
	if( valoare_judet=='')
		mesaj_bill+='Campul Judet este obligatoriu\n';
	if (document.getElementById('bill_postal_code').value.length!=6) mesaj_bill+='Campul Cod Postal trebuie sa contina exact 6 caractere\n';
	
    if(document.getElementById('juridica').checked==true) {
   	    if(document.getElementById('bill_company').value=='')  mesaj_bill+='Campul Nume firma este obligatoriu\n';
        if(document.getElementById('bill_company_cui').value=='')  mesaj_bill+='Campul Cod Fiscal este obligatoriu\n';
        if(document.getElementById('bill_company_reg_com').value=='')  mesaj_bill+='Campul Nr. inreg. fiscala este obligatoriu\n';
        }   
    if(mesaj_bill!="")
        mesaj+='\nInformatii necesare facturarii: \n\n'+mesaj_bill;
    
    if(document.getElementById('shipp_nume').value==''){ mesaj_shipp='Campul Nume este obligatoriu\n';}
    if(document.getElementById('shipp_prenume').value==''){ mesaj_shipp+='Campul Prenume este obligatoriu\n';}   
    if(document.getElementById('shipp_telefon').value=='') mesaj_shipp+='Campul Telefon este obligatoriu\n'; 
	if(document.getElementById('shipp_city').value=='')  mesaj_shipp+='Campul Localitate este obligatoriu\n';
    if(document.getElementById('shipp_strada').value=='')  mesaj_shipp+='Campul Strada este obligatoriu\n';
	if(document.getElementById('shipp_strada_nr').value=='')  mesaj_shipp+='Campul Numar (numarul strazii) este obligatoriu\n';
	index1=document.getElementById('shipp_county').selectedIndex;
	valoare_judet=document.getElementById('shipp_county').options[index1].value;
	if( valoare_judet=='')
		mesaj_shipp+='Campul Judet este obligatoriu\n';
	if (document.getElementById('shipp_postal_code').value.length!=6) mesaj_shipp+='Campul Cod Postal trebuie sa contina exact 6 caractere\n';
	
    if(document.getElementById('juridica').checked==true) 
   	    if(document.getElementById('shipp_company').value=='')  mesaj_shipp+='Campul Nume firma este obligatoriu\n';
        
    if(mesaj_shipp!="")
        mesaj+='\nInformatii necesare livrarii: \n\n'+mesaj_shipp;
    
    if (document.getElementById('termeni_cond').checked==false)  mesaj+='\nTrebuie sa fii de acord cu termenii si conditiile de utilizare\n';
	
     
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();  
}

function inregistrare_hu(){
	var mesaj='';
    var mesaj_cont='';
    var mesaj_bill='';
    var mesaj_shipp='';
     
    if(document.getElementById('nume').value=='') mesaj_cont+='A vezetéknév mező kitöltése kötelező!\n';
    if(document.getElementById('prenume').value=='') mesaj_cont+='A keresztnév mező kitöltése kötelező!\n';
    if(document.getElementById('email').value=='') mesaj_cont+='E-mail mező kitöltése kötelező\n';
	if(document.getElementById('telefon').value=='') mesaj_cont+='Telefonszám mező kitöltése kötelező\n';
    if(document.getElementById('pass1').value=='') mesaj_cont+='Jelszó mező kitöltése kötelező\n';
    
    if(mesaj_cont!="")
        mesaj='Fiók információk: \n\n'+mesaj_cont;
        
    if(document.getElementById('bill_nume').value==''){ mesaj_bill='A vezetéknév mező kitöltése kötelező!\n';}
    if(document.getElementById('bill_prenume').value==''){ mesaj_bill+='A keresztnév mező kitöltése kötelező!\n';}   
    if(document.getElementById('bill_telefon').value=='') mesaj_bill+='Telefonszám mező kitöltése kötelező\n'; 
	if(document.getElementById('bill_city').value=='')  mesaj_bill+='A helységnév mező kitöltése kötelező!\n';
    if(document.getElementById('bill_strada').value=='')  mesaj_bill+='Az utcanév mező kitöltése kötelező!\n';
	if(document.getElementById('bill_strada_nr').value=='')  mesaj_bill+='A házszám mező kitöltése kötelező!\n';
	
    index1=document.getElementById('bill_county').selectedIndex;
	valoare_judet=document.getElementById('bill_county').options[index1].value;
	if( valoare_judet=='')
		mesaj_bill+='A megye mező kitöltése kötelező!\n';
	if (document.getElementById('bill_postal_code').value=='') mesaj_bill+='Irányítószám mező kitöltése kötelező!\n';
	
    if(document.getElementById('juridica').checked==true) {
   	    if(document.getElementById('bill_company').value=='')  mesaj_bill+='Campul Nume firma este obligatoriu\n';
        if(document.getElementById('bill_company_cui').value=='')  mesaj_bill+='Campul Cod Fiscal este obligatoriu\n';
        }   
    if(mesaj_bill!="")
        mesaj+='\nSzámlázási adatok: \n\n'+mesaj_bill;
    
    if(document.getElementById('shipp_nume').value==''){ mesaj_shipp='A vezetéknév mező kitöltése kötelező!\n';}
    if(document.getElementById('shipp_prenume').value==''){ mesaj_shipp+='A keresztnév mező kitöltése kötelező!\n';}   
    if(document.getElementById('shipp_telefon').value=='') mesaj_shipp+='Telefonszám mező kitöltése kötelező\n'; 
	if(document.getElementById('shipp_city').value=='')  mesaj_shipp+='A helységnév mező kitöltése kötelező!\n';
    if(document.getElementById('shipp_strada').value=='')  mesaj_shipp+='Az utcanév mező kitöltése kötelező!\n';
	if(document.getElementById('shipp_strada_nr').value=='')  mesaj_shipp+='A házszám mező kitöltése kötelező!\n';
	index1=document.getElementById('shipp_county').selectedIndex;
	valoare_judet=document.getElementById('shipp_county').options[index1].value;
	if( valoare_judet=='')
		mesaj_shipp+='Campul Judet este obligatoriu\n';
	if (document.getElementById('shipp_postal_code').value=='') mesaj_shipp+='Irányítószám mező kitöltése kötelező!\n';
	
    if(document.getElementById('juridica').checked==true) 
       	    if(document.getElementById('shipp_company').value=='')  mesaj_shipp+='Campul Nume firma este obligatoriu\n';
        
    if(mesaj_shipp!="")
        mesaj+='\nSzállítási információ: \n\n'+mesaj_shipp;
    
    if (document.getElementById('termeni_cond').checked==false)  mesaj+='\nEl kell fogadnia a felhasználás feltételeit!\n';
	
     
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();  
}

function hide_company() {
    document.getElementById('show_bill_company').style.display='none';
    document.getElementById('show_bill_company_cui').style.display='none';
    document.getElementById('show_bill_company_reg_com').style.display='none';
    document.getElementById('show_bill_company_banca').style.display='none';
    document.getElementById('show_bill_iban').style.display='none';
    document.getElementById('show_shipp_company').style.display='none';
       
}

function show_company() {
    document.getElementById('show_bill_company').style.display='block';
    document.getElementById('show_bill_company_cui').style.display='block';
    document.getElementById('show_bill_company_reg_com').style.display='block';
    document.getElementById('show_bill_company_banca').style.display='block';
    document.getElementById('show_bill_iban').style.display='block';
    document.getElementById('show_shipp_company').style.display='block';
       
}

function contact_en() {
    var message1='';
    if(document.getElementById('name').value=='') {
        message1+='Please fill in your name\n';
        valid=0;
        }
    
    if(document.getElementById('phone').value=='') {
        message1+='Please fill in your phone number\n';
        valid=0;
        }

    if(document.getElementById('email').value=='') {
        message1+='Please fill in your e-mail address\n';
        valid=0;
        }

    if(document.getElementById('subject').value=='') {
        message1+='Please fill in the subject\n';
        valid=0;
        }

    if(document.getElementById('message_content').value=='') {
        message1+='Please fill in your message\n';
        valid=0;
        }
    
    if(message1!='') { alert(message1);}
	else document.getElementById('contact_form').submit();
    
    
}   

function go_to_cat_prod(categorie,poz) {
   
   document.location=categorie+document.getElementById('producator'+poz).value+'/';
}

function click_same_bill() {
    if(document.getElementById('same_bill').checked==true) {
        document.getElementById('bill_nume').value=document.getElementById('nume').value;
        document.getElementById('bill_prenume').value=document.getElementById('prenume').value;
        document.getElementById('bill_telefon').value=document.getElementById('telefon').value;
    }
    else {
        document.getElementById('bill_nume').value='';
        document.getElementById('bill_prenume').value='';
        document.getElementById('bill_telefon').value='';
    }
     
}
function click_same_shipp() {
   
    if(document.getElementById('same_shipp').checked==true) {
        document.getElementById('shipp_nume').value=document.getElementById('bill_nume').value;
        document.getElementById('shipp_prenume').value=document.getElementById('bill_prenume').value;
        document.getElementById('shipp_telefon').value=document.getElementById('bill_telefon').value;        
        index1=document.getElementById('bill_county').selectedIndex;
        document.getElementById('shipp_county').selectedIndex=index1;        
        document.getElementById('shipp_strada').value=document.getElementById('bill_strada').value;
        document.getElementById('shipp_company').value=document.getElementById('bill_company').value;        
        document.getElementById('shipp_strada_nr').value=document.getElementById('bill_strada_nr').value;
        document.getElementById('shipp_bloc').value=document.getElementById('bill_bloc').value;
        document.getElementById('shipp_scara').value=document.getElementById('bill_scara').value;
        document.getElementById('shipp_apartament').value=document.getElementById('bill_apartament').value;
        document.getElementById('shipp_sector').value=document.getElementById('bill_sector').value;        
        document.getElementById('shipp_city').value=document.getElementById('bill_city').value;
        document.getElementById('shipp_postal_code').value=document.getElementById('bill_postal_code').value;
        } 
    else {
        
        document.getElementById('shipp_nume').value='';
        document.getElementById('shipp_prenume').value='';
        document.getElementById('shipp_telefon').value='';
        document.getElementById('shipp_county').selectedIndex='';        
        document.getElementById('shipp_strada').value='';
        document.getElementById('shipp_company').value='';     
        document.getElementById('shipp_strada_nr').value='';
        document.getElementById('shipp_bloc').value='';
        document.getElementById('shipp_scara').value='';
        document.getElementById('shipp_apartament').value='';
        document.getElementById('shipp_sector').value='';        
        document.getElementById('shipp_city').value='';
        document.getElementById('shipp_postal_code').value='';
    }
}

function cauta_cod(){
	var bulk='';
	
	index1=document.getElementById('cod_jud').selectedIndex;
	valoare_judet=document.getElementById('cod_jud').options[index1].value;
	bulk+='jud='+valoare_judet;
	
	loc=document.getElementById('cod_loc').value;
	bulk+='&loc='+loc;
	
	strada=document.getElementById('cod_str').value;
	bulk+='&str='+strada;
	
	window.open('http://www.coduripostale.ro/new/index.php?'+bulk+'&list=Cauta');
}



function kiki(img,ind){	
	var img2=img.split(',');
	
	if(ind<img2.length){
		document.getElementById('top_news').innerHTML=img2[ind];
		ind++;
		setTimeout('kiki2(\''+img+'\',\''+(ind)+'\')',5000);
		}
	else{	
		document.getElementById('top_news').innerHTML=img2[0];
		setTimeout('kiki2(\''+img+'\',\'1\')',5000);
		}
	
	}

function kiki2(img,ind){
	var img2=img.split(',');
	if(ind<img2.length){
		document.getElementById('top_news').innerHTML=img2[ind];
		ind++;
		setTimeout('kiki(\''+img+'\',\''+(ind)+'\')',5000);
		}
	else{
		document.getElementById('top_news').innerHTML=img2[0];
		setTimeout('kiki(\''+img+'\',\'1\')',5000);
		}
	}



function NewWindow(mypage,myname,w,h,scroll,pos) 
{ 
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor		
	(Math.random()*((screen.height-h)-75)):100;} 
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} 
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; win=window.open(mypage,myname,settings); 
}  




function getHTTPObject(url,c) { 
	  var http_request;
	 
	  if (window.XMLHttpRequest) { // Mozilla, Safari,... alte browsere normale
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                
            }
        } else if (window.ActiveXObject) { // IE
            try {
		    //ie 6 sp
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
			// ie 5,6
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e2) {
			// daca e un browser de consola n-ar trebui sa fie deranjat de alert
		alert('Your browser doesnt understand Ajax. Use Firefox');
		}
            }
        }

        if (!http_request) {
		// daca e un browser de consola n-ar trebui sa fie deranjat de alert
            alert('Your browser doesnt understand Ajax. Use Firefox');
            return false;
        }
	
	http_request.onreadystatechange = function() { handleHttpResponse(http_request,c); };
        http_request.open('GET', url, true);
	// nefolosit
        http_request.send(null);
  }
  
function postHTTPObject(url,params,c) { 
    var http = new XMLHttpRequest();
    http.open("POST", url, true);
    //Send the proper header information along with the request
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", params.length);
    http.setRequestHeader("Connection", "close");
    http.onreadystatechange = function() {//Call a function when the state changes.
	   if(http.readyState == 4 && http.status == 200) {
	       switch (c)	{
				// start introducere 
				case 'check_login':
				document.getElementById('checkout_one_step').innerHTML =  http.responseText;
				break;
                
                case 'list_addr_billing':
				document.getElementById('list_addr_billing').innerHTML =  http.responseText;
				break;
                
                
                case 'list_addr_delivery':
				document.getElementById('list_addr_delivery').innerHTML =  http.responseText;
				break;
                
                case 'shopping_cart':
                document.getElementById('shopping_cart').innerHTML =  http.responseText;
                break;
                case 'checkout_register1':
                document.getElementById('checkout_register1').innerHTML =  http.responseText;
                break;
              
            }
	   }
    }
    http.send(params);
  }
  
  
function handleHttpResponse(http_request,c) {

	if (http_request.readyState == 4) {
		// ca sa ii afisam un div cu Loading... sa stie omul ca dureaza - acum nefolosit
		//document.getElementById('loading').style.display = 'none';
        
		 
		if (http_request.status == 200) {
			
			switch (c)	{
				// start introducere 
				case 'select_produse':
				document.getElementById('select_produse').innerHTML =  http_request.responseText;
				break;
                
                case 'specificatii':
				
                $('#specificatii').append(innerHTML =  http_request.responseText);
				break;
				
				case 'disc_plata':
				document.getElementById('discount_plata').innerHTML =  http_request.responseText;
				break;
                
                case 'orase':
				document.getElementById('lista_orase').innerHTML =  http_request.responseText;
				break;
                
                case 'f_orase':
				document.getElementById('f_lista_orase').innerHTML =  http_request.responseText;
				break;

                case 'subtotal':
				document.getElementById('pretTotal').innerHTML =  http_request.responseText;
				break;

                case 'link_cos':
				document.getElementById('link_cos').innerHTML =  http_request.responseText;
				break;
                
                case 'check_login':
				document.getElementById('checkout_one_step').innerHTML =  http_request.responseText;
				break;
                
				 case 'cost_transport':
                document.getElementById('cost_transport').innerHTML =  http_request.responseText;
                break;
				case 'news':
				
				document.getElementById('search2').innerHTML =  http_request.responseText;
				break;
                case 'checkout_one_step':
                document.getElementById('checkout_one_step').innerHTML =  http_request.responseText;
                break;
                
				   case 'total_cos':
                document.getElementById('total_cos').innerHTML =  http_request.responseText;
                break;
                
                case 'total_verde':
                document.getElementById('total_verde').innerHTML =  http_request.responseText;
                break;
                                
                case 'status_abonare':
                document.getElementById('status_abonare').innerHTML =  http_request.responseText;
                break;
                
			//end introducere start search
			/*
			case 'oferte_search':
			var xmlDocument = http_request.responseXML;
			var title = xmlDocument.getElementsByTagName('content').item(0).firstChild.data;
			
			document.getElementById('tari').innerHTML = title;
			break;*/
			
				}
            } 
		//else 
                //alert('There was a problem with the request.');
            
			
		
        }
	else
	{
		// ca sa ii afisam un div cu Loading... sa stie omul ca dureaza -nefolosit acum
		//document.getElementById('loading').style.display = 'inline';
	}
		
}




//functie ajax cu 2 parametrii

function getHTTPObject2(url,c,d) { 
	  var http_request;
	  
	 
	  if (window.XMLHttpRequest) { // Mozilla, Safari,... alte browsere normale
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                
            }
        } else if (window.ActiveXObject) { // IE
            try {
		    //ie 6 sp
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
			// ie 5,6
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e2) {
			// daca e un browser de consola n-ar trebui sa fie deranjat de alert
		alert('Your browser doesnt understand Ajax. Use Firefox');
		}
            }
        }

        if (!http_request) {
		// daca e un browser de consola n-ar trebui sa fie deranjat de alert
            alert('Your browser doesnt understand Ajax. Use Firefox');
            return false;
        }
	
	http_request.onreadystatechange = function() { handleHttpResponse2(http_request,c,d); };
        http_request.open('GET', url, true);
	// nefolosit
        http_request.send(null);
  }
  

  
function handleHttpResponse2(http_request,c,where) {

	if (http_request.readyState == 4) {
		// ca sa ii afisam un div cu Loading... sa stie omul ca dureaza - acum nefolosit
		//document.getElementById('loading').style.display = 'none';
        
		
		if (http_request.status == 200) {
			
			switch (c)	{
				// start introducere
				
				case 'nume_produse_admin':
				document.getElementById('rez_nume_'+where).innerHTML =  http_request.responseText;
				break;
				case 'schimba_produse_admin':
				document.getElementById('nume_afisat_'+where).innerHTML =  http_request.responseText;
				break;
				
				case 'schimba_pret_produse_admin':
				document.getElementById('pret_'+where).innerHTML =  http_request.responseText;
				break;
				
				case 'schimb_pret_produs':
			
				document.getElementById('pret_'+where).innerHTML =  http_request.responseText;
				break;
				
				case 'aprobare':
				document.getElementById('status_'+where).innerHTML =  http_request.responseText;
				break; 
                
				case 'schimba_pret_subtotal_produse_admin':
				
				document.getElementById('subtotal_pret_'+where).innerHTML =  http_request.responseText;
				break;
				
				
				case 'schimba_subtotal_produse_admin':
				
				document.getElementById('subtotal_pret_'+where).innerHTML =  http_request.responseText;
				break;
				
				case 'subtotal':
				
				document.getElementById('subtotal_'+where).innerHTML =  http_request.responseText;
				break;
				
				case 'schimba_total_pret_produse_admin':
				
				document.getElementById('total_produse').innerHTML =  http_request.responseText;
				break;
				
				case 'schimba_total_produse_admin':
				document.getElementById('total_produse').innerHTML =  http_request.responseText;
				break;
						
				case 'schimb_cantitate_produs':
				document.getElementById('cant_'+where).innerHTML =  http_request.responseText;
				break;
				
				case 'schimba_disc_subtotal_produse_admin':
				document.getElementById('subtotal_pret_'+where).innerHTML =  http_request.responseText;
				break;
				
				
				case 'add_produs':
				document.getElementById('rezultate_nume').innerHTML =  http_request.responseText;
				break;
				
				case 'discount_total':
				document.getElementById('total_produse').innerHTML =  http_request.responseText;
				break;
				
				case 'continut':

				document.getElementById('continut_'+where).innerHTML =  http_request.responseText;

				break;
			
			//end introducere start search
			/*
			case 'oferte_search':
			var xmlDocument = http_request.responseXML;
			var title = xmlDocument.getElementsByTagName('content').item(0).firstChild.data;
			
			document.getElementById('tari').innerHTML = title;
			break;*/
			
				}
            } 
	//	else 
        //        alert('There was a problem with the request.');
            
			
		
        }
	else
	{
		// ca sa ii afisam un div cu Loading... sa stie omul ca dureaza -nefolosit acum
		//document.getElementById('loading').style.display = 'inline';
	}
		
}





function change_nume(id) {
	document.getElementById('nume_'+id).style.display='block';	
	}

function add_altul() {
	document.getElementById('adauga_nou').style.display='block';	
	}


function change_pret(id) {
	document.getElementById('schimba_pret_'+id).style.display='block';	
	}

function change_cant(id) {
	document.getElementById('schimba_cant_'+id).style.display='block';	
	}

function stergere(id,id_comanda) {
	if(confirm("Sunteti sigur ca doriti sa stergeti ?"))
		document.location='comenzi.php?act=sterge&id_comanda='+id_comanda+'&id='+id;
	}
	

function salveaza_produs_pret(id,id_old) {
	document.getElementById('schimba_pret_'+id).style.display='none';	
	pret=document.getElementById('pret_nou_'+id).value;
	document.getElementById('disc_nou_'+id).value='';
	getHTTPObject2('ajax/comenzi.php?act=schimb_pret2&id_old='+id_old+'&nr='+id+'&pret='+pret,'schimb_pret_produs',id);
	setTimeout('1',1000);

	getHTTPObject2('ajax/comenzi.php?act=subtotal_produs&id_nume='+id_old+'&nr='+id,'schimba_pret_subtotal_produse_admin',id);
	setTimeout('1',1000);
	
	getHTTPObject2('ajax/comenzi.php?act=subtotal','schimba_total_pret_produse_admin',id);
	}
	

function salveaza_cant_pret(id,id_old) {
	document.getElementById('schimba_cant_'+id).style.display='none';	
	cant=document.getElementById('cant_nou_'+id).value;
	document.getElementById('disc_nou_'+id).value='';
	getHTTPObject2('ajax/comenzi.php?act=cantitate&id_old='+id_old+'&nr='+id+'&cant='+cant,'schimb_cantitate_produs',id);
	
	document.getElementById('cant_'+id).innerHTML='<img src="../img/loading.gif" />';	
	
	setTimeout('1',1000);
	getHTTPObject2('ajax/comenzi.php?act=subtotal_produs&id_nume='+id_old+'&nr='+id,'schimba_pret_subtotal_produse_admin',id);
	document.getElementById('subtotal_pret_'+id).innerHTML='<img src="../img/loading.gif" />';	
	setTimeout('1',1000);
	getHTTPObject2('ajax/comenzi.php?act=subtotal','schimba_total_pret_produse_admin',id);
	}

function discount_produs(id,id_old) {
	document.getElementById('schimba_cant_'+id).style.display='none';	
	disc=document.getElementById('disc_nou_'+id).value;
	getHTTPObject2('ajax/comenzi.php?act=discount&id_old='+id_old+'&nr='+id+'&disc='+disc,'schimba_disc_subtotal_produse_admin',id);
	setTimeout('1',1000);
	
	getHTTPObject2('ajax/comenzi.php?act=subtotal','schimba_total_pret_produse_admin',id);
	}
	
function cauta_produs_nume(id,id_old) {
	nume=document.getElementById('nume_cauta_'+id).value;
	
	getHTTPObject2('ajax/comenzi.php?act=caut_nume&id_old='+id_old+'&nr='+id+'&nume='+nume,'nume_produse_admin',id);
	
	
	}
	
function discount_total() {
	disc=document.getElementById('discount_total').value;
	getHTTPObject2('ajax/comenzi.php?act=discount_total&disc='+disc,'discount_total');
	}	
	

function cauta_produs_nume2(id_com) {
	nume=document.getElementById('nume_produs').value;
	id=1;
	getHTTPObject2('ajax/comenzi.php?act=caut_nume_add&id_com='+id_com+'&nume='+nume,'add_produs',id);
	
	
	}


function go_up(id,id_nume,id_old) {

getHTTPObject2('ajax/comenzi.php?act=schimb_nume&id_old='+id_old+'&nr='+id+'&id_nume='+id_nume,'schimba_produse_admin',id);
document.getElementById('rez_nume_'+id).innerHTML='';	

setTimeout('1',1000);
getHTTPObject2('ajax/comenzi.php?act=schimb_pret1&id_old='+id_old+'&nr='+id+'&id_nume='+id_nume,'schimba_pret_produse_admin',id);
document.getElementById('pret_'+id).innerHTML='<img src="../img/loading.gif" />';	
setTimeout('1',1000);
getHTTPObject2('ajax/comenzi.php?act=subtotal_produs&id_old='+id_old+'&nr='+id+'&id_nume='+id_nume,'schimba_subtotal_produse_admin',id);
document.getElementById('subtotal_pret_'+id).innerHTML='<img src="../img/loading.gif" />';	

setTimeout('1',1000);
getHTTPObject2('ajax/comenzi.php?act=subtotal&id_old='+id_old+'&nr='+id+'&id_nume='+id_nume,'schimba_total_produse_admin',id);
document.getElementById('total_produse').innerHTML='<img src="../img/loading.gif" />';	

}


function scoate(id) {
	
	getHTTPObject('ajaxing/comparator.php?id_prod='+id,'select_produse');
	
}



	function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
		doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";  
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

	function hidesnow(){
		if (window.snowtimer) clearTimeout(snowtimer)
		for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
	}
		
		
function check_tip_plata(url) {
	getHTTPObject(url+'?tip='+document.getElementById('tip_plata').value,'disc_plata');
	
	}
		
		
function add_news(tip) {
	document.getElementById('search2').innerHTML = '<br />..se incarca';
	getHTTPObject('ajax/newsletter.php?email='+document.getElementById('email2').value,'news');
	
	}
	

function submit_fiz2() {
	var mesaj='';
    
    if(document.getElementById('nume').value==''){ mesaj='Campul Nume este obligatoriu\n';}
    if(document.getElementById('prenume').value==''){ mesaj+='Campul Prenume este obligatoriu\n';}
   
   
	if(document.getElementById('cnp_fiz').value==''){ mesaj+='Campul CNP este obligatoriu\n';}
	if(document.getElementById('serie_ci_fiz').value=='')  mesaj+='Campul Serie CI este obligatoriu\n';
	if(document.getElementById('nr_ci_fiz').value=='')  mesaj+='Campul Numar CI este obligatoriu\n';
	
	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='Campul Localitate este obligatoriu\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='Campul Numar (numarul strazii) este obligatoriu\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Campul Judet este obligatoriu\n';
	
	index1=document.getElementById('tip_plata').selectedIndex;
	valoare_plata=document.getElementById('tip_plata').options[index1].value;
	if( valoare_plata=='0')
		mesaj+='Campul Tip Plata este obligatoriu. Nu a fost selectat tipul platii.\n';
	
	
	if(document.getElementById('strada').value=='')  mesaj+='Campul Strada este obligatoriu\n';
	
	
	if(document.getElementById('email_fiz').value=='') mesaj+='Campul Email este obligatoriu\n';
	if (document.getElementById('telefon_fiz').value=='') mesaj+='Campul Telefon este obligatoriu\n';
    if (document.getElementById('PFCodPostalHtml').value=='') mesaj+='Campul Cod Postal este obligatoriu\n';
    
	
    if(document.getElementById('formular_pers_jur').style.display=='block') {
   	    if(document.getElementById('PJNumeFirmaHtml').value=='')  mesaj+='Campul Nume firma este obligatoriu\n';
        if(document.getElementById('cui').value=='')  mesaj+='Campul Cod Fiscal este obligatoriu\n';
        if(document.getElementById('PJInregFiscHtml').value=='')  mesaj+='Campul Nr. inreg. fiscala este obligatoriu\n';
    
        }    
    
	if(document.getElementById('termeni_cond').checked==false)  mesaj+='Trebuie sa fii de acord cu termenii si conditiile de utilizare\n';
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

function submit_fiz2_en() {
	var mesaj='';
     
    if(document.getElementById('bill_nume').value==''){ mesaj+='Billing Last Name\n';}
    if(document.getElementById('bill_prenume').value==''){ mesaj+='Billing Name\n';}
  //  if(document.getElementById('bill_telefon').value=='') mesaj+='Billing Phone number\n';
    if(document.getElementById('bill_country').value=='') mesaj+='Billing Country\n';
    if(document.getElementById('bill_adresa').value=='') mesaj+='Billing Address\n';
    if(document.getElementById('bill_city').value=='') mesaj+='Billing City\n';
   
    index1=document.getElementById('bill_county').selectedIndex;
	valoare_judet=document.getElementById('bill_county').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Billing County/Region\n';
    if(document.getElementById('bill_postal_code').value=='') mesaj+='Billing Postal Code\n';
    
    if(document.getElementById('shipp_nume').value==''){ mesaj+='Shipping Last Name\n';}
    if(document.getElementById('shipp_prenume').value==''){ mesaj+='Shipping Name\n';}
 //   if(document.getElementById('shipp_telefon').value=='') mesaj+='Shipping Phone number\n';
    if(document.getElementById('shipp_country').value=='') mesaj+='Shipping Country\n';
    if(document.getElementById('shipp_adresa').value=='') mesaj+='Shipping Address\n';
    if(document.getElementById('shipp_city').value=='') mesaj+='Shipping City\n';
    index1=document.getElementById('shipp_county').selectedIndex;
	valoare_judet=document.getElementById('shipp_county').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Shipping County/Region\n';
    if(document.getElementById('shipp_postal_code').value=='') mesaj+='Shipping Postal Code\n';
    
   	if(mesaj!='') 
        mesaj='Please fill in the following fields:\n'+mesaj;
        
 	if(document.getElementById('termeni_cond').checked==false)  mesaj+='You have to agree the terms and conditions\n';
    
    
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

function submit_fiz2_hu() {
	var mesaj='';
    
    if(document.getElementById('nume').value==''){ mesaj='A vezetéknév mező kitöltése kötelező!\n';}
    if(document.getElementById('prenume').value==''){ mesaj+='A keresztnév mező kitöltése kötelező!\n';}
   
    if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='A helységnév mező kitöltése kötelező!\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='A házszám mező kitöltése kötelező!\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='A megye kiválasztása kötelező!\n';
	
	index1=document.getElementById('tip_plata').selectedIndex;
	valoare_plata=document.getElementById('tip_plata').options[index1].value;
	if( valoare_plata=='0')
		mesaj+='A fizetési mód kiválasztása kötelező!\n';
	
	
	if(document.getElementById('strada').value=='')  mesaj+='Az utcanév mező kitöltése kötelező!\n';
	
    if(document.getElementById('email_fiz').value=='') mesaj+='E-mail mező kitöltése kötelező\n';
	if (document.getElementById('telefon_fiz').value=='') mesaj+='Telefonszám mező kitöltése kötelező\n';  
        
        
        
        
        
        
	
	if(document.getElementById('termeni_cond').checked==false)  mesaj+='El kell fogadnia a felhasználás feltételeit!\n';
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

function submit_fiz5() {
	var mesaj='';
	index1=document.getElementById('tip_plata').selectedIndex;
	valoare_plata=document.getElementById('tip_plata').options[index1].value;
	if( valoare_plata=='0')
		mesaj+='Campul Tip Plata este obligatoriu. Nu a fost selectat tipul platii.\n';
	
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

function submit_fiz5_en() {
	var mesaj='';
	index1=document.getElementById('tip_plata').selectedIndex;
	valoare_plata=document.getElementById('tip_plata').options[index1].value;
	if( valoare_plata=='0')
		mesaj+='Please select a payment method.\n';
	
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}
    
function submit_fiz5_hu() {
	var mesaj='';
	index1=document.getElementById('tip_plata').selectedIndex;
	valoare_plata=document.getElementById('tip_plata').options[index1].value;
	if( valoare_plata=='0')
		mesaj+='A fizetési mód kiválasztása kötelező!\n';
	
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}
	
    	
function submit_fiz() {
	var mesaj='';
    
	if(document.getElementById('cnp_fiz').value==''){ mesaj='Campul CNP este obligatoriu\n';}
	if(document.getElementById('serie_ci_fiz').value=='')  mesaj+='Campul Serie CI este obligatoriu\n';
	if(document.getElementById('nr_ci_fiz').value=='')  mesaj+='Campul Numar CI este obligatoriu\n';
	
	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='Campul Localitate este obligatoriu\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='Campul Numar este obligatoriu\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Campul Judet este obligatoriu\n';
	
	
	
	if(document.getElementById('strada').value=='')  mesaj+='Campul Strada este obligatoriu\n';
	
	
	if( (document.getElementById('telefon_fiz').value=='') && (document.getElementById('email_fiz').value=='') )  
		mesaj+='Campul Telefon sau Email este obligatoriu\n';
	
	if(document.getElementById('termeni_cond').checked==false)  mesaj+='Trebuie sa fii de acord cu termenii si conditiile de utilizare\n';
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('form_fiz').submit();
	}
	
function submit_fiz4() {
	var mesaj='';
    if(document.getElementById('PFNumeHtml').value==''){ mesaj='Campul Nume este obligatoriu \n';}
    if(document.getElementById('PFPrenumeHtml').value==''){ mesaj+='Campul Prenume este obligatoriu \n';}
    
	if(document.getElementById('cnp').value==''){ mesaj='Campul CNP este obligatoriu\n';}
	if(document.getElementById('serie_ci').value=='')  mesaj+='Campul Serie CI este obligatoriu\n';
	if(document.getElementById('nr_ci').value=='')  mesaj+='Campul Numar CI este obligatoriu\n';
	
	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='Campul Localitate este obligatoriu\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='Campul Numar (numarul strazii) este obligatoriu\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Campul Judet este obligatoriu\n';
	
	if(document.getElementById('strada').value=='')  mesaj+='Campul Strada este obligatoriu\n';
	
	
	if(document.getElementById('email_fiz').value=='') mesaj+='Campul Email este obligatoriu\n';
	if (document.getElementById('telefon_fiz').value=='') mesaj+='Campul Telefon este obligatoriu\n';
    if (document.getElementById('PFCodPostalHtml').value=='') mesaj+='Campul Cod Postal este obligatoriu\n';
    
    	
    if(document.getElementById('formular_pers_jur').style.display=='block') {
   	    if(document.getElementById('PJNumeFirmaHtml').value=='')  mesaj+='Campul Nume firma este obligatoriu\n';
        if(document.getElementById('cui').value=='')  mesaj+='Campul Cod Fiscal este obligatoriu\n';
        if(document.getElementById('PJInregFiscHtml').value=='')  mesaj+='Campul Nr. inreg. fiscala este obligatoriu\n';
    
        }    
    
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}
	
function submit_fiz4_hu() {
	var mesaj='';

    if(document.getElementById('PFNumeHtml').value==''){ mesaj='A vezetéknév mező kitöltése kötelező!\n';}
    if(document.getElementById('PFPrenumeHtml').value==''){ mesaj+='A keresztnév mező kitöltése kötelező!\n';}

	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='A helységnév mező kitöltése kötelező!\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='A házszám mező kitöltése kötelező!\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='A megye kiválasztása kötelező!\n';
	
	if(document.getElementById('strada').value=='')  mesaj+='Az utcanév mező kitöltése kötelező!\n';
	
    if(document.getElementById('email_fiz').value=='') mesaj+='E-mail mező kitöltése kötelező\n';
	if(document.getElementById('telefon_fiz').value=='') mesaj+='Telefonszám mező kitöltése kötelező\n';  

    if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

function submit_fiz3() {
	var mesaj='';
     
    if(document.getElementById('nume').value==''){ mesaj='Campul Nume este obligatoriu\n';}
    if(document.getElementById('prenume').value==''){ mesaj+='Campul Prenume este obligatoriu\n';}
    
	if(document.getElementById('cnp').value==''){ mesaj+='Campul CNP este obligatoriu\n';}
	if(document.getElementById('serie_ci').value=='')  mesaj+='Campul Serie CI este obligatoriu\n';
	if(document.getElementById('nr_ci').value=='')  mesaj+='Campul Numar CI este obligatoriu\n';
	
	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='Campul Localitate este obligatoriu\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='Campul Numar (numarul strazii) este obligatoriu\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Campul Judet este obligatoriu\n';
	
	if(document.getElementById('strada').value=='')  mesaj+='Campul Strada este obligatoriu\n';
	
	
	if(document.getElementById('email_fiz').value=='') mesaj+='Campul Email este obligatoriu\n';
	if (document.getElementById('telefon_fiz').value=='') mesaj+='Campul Telefon este obligatoriu\n';
    if (document.getElementById('PFCodPostalHtml').value=='') mesaj+='Campul Cod Postal este obligatoriu\n';
    
	if(document.getElementById('formular_pers_jur').style.display=='block') {
   	    if(document.getElementById('PJNumeFirmaHtml').value=='')  mesaj+='Campul Nume firma este obligatoriu\n';
        if(document.getElementById('cui').value=='')  mesaj+='Campul Cod Fiscal este obligatoriu\n';
        if(document.getElementById('PJInregFiscHtml').value=='')  mesaj+='Campul Nr. inreg. fiscala este obligatoriu\n';
    
        }   
	if(document.getElementById('termeni_cond').checked==false)  mesaj+='Trebuie sa fii de acord cu termenii si conditiile de utilizare\n';
	
     
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}
	
function inregistrare_en() {
	var mesaj='';
     
    if(document.getElementById('nume').value==''){ mesaj='Last Name\n';}
    if(document.getElementById('prenume').value==''){ mesaj+='Name\n';}
    if(document.getElementById('email').value=='') mesaj+='E-mail\n';
	if(document.getElementById('telefon').value=='') mesaj+='Phone\n';
    if(document.getElementById('pass1').value=='') mesaj+='Password\n';
    if(document.getElementById('pass2').value=='') mesaj+='Password Confirmation\n';        
	
    if(document.getElementById('bill_nume').value==''){ mesaj+='Billing Last Name';}
    if(document.getElementById('bill_prenume').value==''){ mesaj+='Billing Name\n';}
  //  if(document.getElementById('bill_telefon').value=='') mesaj+='Billing Phone number\n';
    if(document.getElementById('bill_country').value=='') mesaj+='Billing Country\n';
    if(document.getElementById('bill_adresa').value=='') mesaj+='Billing Address\n';
    if(document.getElementById('bill_city').value=='') mesaj+='Billing City\n';
    index1=document.getElementById('bill_county').selectedIndex;
	valoare_judet=document.getElementById('bill_county').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Billing County/Region\n';
    if(document.getElementById('bill_postal_code').value=='') mesaj+='Billing Postal Code\n';
    
    if(document.getElementById('shipp_nume').value==''){ mesaj+='Shipping Last Name';}
    if(document.getElementById('shipp_prenume').value==''){ mesaj+='Shipping Name\n';}
  //  if(document.getElementById('shipp_telefon').value=='') mesaj+='Shipping Phone number\n';
    if(document.getElementById('shipp_country').value=='') mesaj+='Shipping Country\n';
    if(document.getElementById('shipp_adresa').value=='') mesaj+='Shipping Address\n';
    if(document.getElementById('shipp_city').value=='') mesaj+='Shipping City\n';
    index1=document.getElementById('shipp_county').selectedIndex;
	valoare_judet=document.getElementById('shipp_county').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Shipping County/Region\n';
    if(document.getElementById('shipp_postal_code').value=='') mesaj+='Shipping Postal Code\n';
    
   	if(mesaj!='') 
        mesaj='Please fill in the following fields:\n'+mesaj;
        
 	if(document.getElementById('termeni_cond').checked==false)  mesaj+='You have to agree the terms and conditions\n';
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

function editare_en() {
	var mesaj='';
     
    if(document.getElementById('nume').value==''){ mesaj='Last Name\n';}
    if(document.getElementById('prenume').value==''){ mesaj+='Name\n';}
    if(document.getElementById('email').value=='') mesaj+='E-mail\n';
	if(document.getElementById('telefon').value=='') mesaj+='Phone\n';

    if(document.getElementById('bill_nume').value==''){ mesaj+='Billing Last Name';}
    if(document.getElementById('bill_prenume').value==''){ mesaj+='Billing Name\n';}
    if(document.getElementById('bill_telefon').value=='') mesaj+='Billing Phone number\n';
    if(document.getElementById('bill_country').value=='') mesaj+='Billing Country\n';
    if(document.getElementById('bill_adresa').value=='') mesaj+='Billing Address\n';
    if(document.getElementById('bill_city').value=='') mesaj+='Billing City\n';
    index1=document.getElementById('bill_county').selectedIndex;
	valoare_judet=document.getElementById('bill_county').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Billing County/Region\n';
    if(document.getElementById('bill_postal_code').value=='') mesaj+='Billing Postal Code\n';
    
    if(document.getElementById('shipp_nume').value==''){ mesaj+='Shipping Last Name';}
    if(document.getElementById('shipp_prenume').value==''){ mesaj+='Shipping Name\n';}
    if(document.getElementById('shipp_telefon').value=='') mesaj+='Shipping Phone number\n';
    if(document.getElementById('shipp_country').value=='') mesaj+='Shipping Country\n';
    if(document.getElementById('shipp_adresa').value=='') mesaj+='Shipping Address\n';
    if(document.getElementById('shipp_city').value=='') mesaj+='Shipping City\n';
    index1=document.getElementById('shipp_county').selectedIndex;
	valoare_judet=document.getElementById('shipp_county').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Shipping County/Region\n';
    if(document.getElementById('shipp_postal_code').value=='') mesaj+='Shipping Postal Code\n';
    
   	if(mesaj!='') 
        mesaj='Please fill in the following fields:\n'+mesaj;
        
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}	
    
function submit_fiz3_hu() {
	var mesaj='';
     
    if(document.getElementById('nume').value==''){ mesaj='A vezetéknév mező kitöltése kötelező!\n';}
    if(document.getElementById('prenume').value==''){ mesaj+='A keresztnév mező kitöltése kötelező!\n';}
    
	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='A helységnév mező kitöltése kötelező!\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='A házszám mező kitöltése kötelező!\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='A megye kiválasztása kötelező!\n';
	
	if(document.getElementById('strada').value=='')  mesaj+='Az utcanév mező kitöltése kötelező!\n';
	
	
	if(document.getElementById('email_fiz').value=='') mesaj+='E-mail mező kitöltése kötelező\n';
	if(document.getElementById('telefon_fiz').value=='') mesaj+='Telefonszám mező kitöltése kötelező\n';  
	
	if(document.getElementById('termeni_cond').checked==false)  mesaj+='El kell fogadnia a felhasználás feltételeit!\n';
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}

	

function submit_jur2() {
	var mesaj='';
	if(document.getElementById('cui').value==''){ mesaj='Campul Cod Fiscal este obligatoriu\n';}
	if(document.getElementById('strada_jur').value=='')  mesaj+='Campul Strada este obligatoriu\n';
	
	
	if(document.getElementById('PFLocalitateHtml_jur').value=='')  mesaj+='Campul Localitate este obligatoriu\n';
	if(document.getElementById('PFStrNrHtml_jur').value=='')  mesaj+='Campul Numar este obligatoriu\n';
	index1=document.getElementById('PFJudetHtml_jur').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml_jur').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Campul Judet este obligatoriu\n';
		
	index1=document.getElementById('tip_plata').selectedIndex;
	valoare_plata=document.getElementById('tip_plata').options[index1].value;
	if( valoare_plata=='0')
		mesaj+='Campul Tip Plata este obligatoriu. Nu a fost selectat tipul platii.\n';
	
	
	if( (document.getElementById('telefon_jur').value=='') && (document.getElementById('email_fiz').value=='') )  
		mesaj+='Campul Telefon sau Email este obligatoriu\n';
	
	if(document.getElementById('termeni_cond_jur').checked==false)  mesaj+='Trebuie sa fii de acord cu termenii si conditiile de utilizare\n';
	
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('formular').submit();
	}	
	
function submit_jur() {
	var mesaj='';
	if(document.getElementById('cui').value==''){ mesaj='Campul Cod Fiscal este obligatoriu\n';}
	if(document.getElementById('strada').value=='')  mesaj+='Campul Strada este obligatoriu\n';
	
	
	if(document.getElementById('PFLocalitateHtml').value=='')  mesaj+='Campul Localitate este obligatoriu\n';
	if(document.getElementById('PFStrNrHtml').value=='')  mesaj+='Campul Numar este obligatoriu\n';
	index1=document.getElementById('PFJudetHtml').selectedIndex;
	valoare_judet=document.getElementById('PFJudetHtml').options[index1].value;
	if( valoare_judet=='')
		mesaj+='Campul Judet este obligatoriu\n';
	
	
		
	if( (document.getElementById('telefon_fiz').value=='') && (document.getElementById('email_fiz').value=='') )  
		mesaj+='Campul Telefon sau Email este obligatoriu\n';
	
	if(document.getElementById('termeni_cond').checked==false)  mesaj+='Trebuie sa fii de acord cu termenii si conditiile de utilizare\n';
	
	
	if(mesaj!='') { alert(mesaj);}
	else
		document.getElementById('form_jur').submit();
	}	

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} 

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} 
return strTemp;

} 

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} 
return strTemp;
} 



var digits = "0123456789";
var lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"
var uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var whitespace = " \t\n\r";

var decimalPointDelimiter = "."

var phoneNumberDelimiters = "()- ";

var validUSPhoneChars = digits + phoneNumberDelimiters;

var validWorldPhoneChars = digits + phoneNumberDelimiters + "+";

var SSNDelimiters = "- ";

var validSSNChars = digits + SSNDelimiters;

var digitsInSocialSecurityNumber = 9;

var digitsInUSPhoneNumber = 10;

var ZIPCodeDelimiters = "-";

var ZIPCodeDelimeter = "-"

var validZIPCodeChars = digits + ZIPCodeDelimiters

var digitsInZIPCode1 = 5
var digitsInZIPCode2 = 9

var creditCardDelimiters = " "

function isOkBag (s, bag)

{   var i;
    var returnString = "";

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return false;
    }
    return true;
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

function isWhiteSpace (s)
{   var i;

    if (isEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}

function stripCharsInBag (s, bag)

{   var i;
    var returnString = "";

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }

    return returnString;
}

function stripCharsNotInBag (s, bag)

{   var i;
    var returnString = "";

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (bag.indexOf(c) != -1) returnString += c;
    }

    return returnString;
}

function stripWhitespace (s)

{   return stripCharsInBag (s, whitespace)
}

function charInString (c, s)
{   for (i = 0; i < s.length; i++)
    {   if (s.charAt(i) == c) return true;
    }
    return false
}

function stripInitialWhitespace (s)

{   var i = 0;

    while ((i < s.length) && charInString (s.charAt(i), whitespace))
       i++;
    
    return s.substring (i, s.length);
}

function isLetter (c)
{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

function isLetterOrDigit (c)
{   return (isLetter(c) || isDigit(c))
}



function isInteger (s)

{   var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);


    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    return true;
}

function isSignedInteger (s)

{   if (isEmpty(s)) 
       if (isSignedInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isSignedInteger.arguments[1] == true);

    else {
        var startPos = 0;
        var secondArg = defaultEmptyOK;

        if (isSignedInteger.arguments.length > 1)
            secondArg = isSignedInteger.arguments[1];

        if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
           startPos = 1;    
        return (isInteger(s.substring(startPos, s.length), secondArg))
    }
}

function isPositiveInteger (s)
{   var secondArg = defaultEmptyOK;

    if (isPositiveInteger.arguments.length > 1)
        secondArg = isPositiveInteger.arguments[1];

    return (isSignedInteger(s, secondArg)
         && ( (isEmpty(s) && secondArg)  || (parseInt (s) > 0) ) );
}

function isNonnegativeInteger (s)
{   var secondArg = defaultEmptyOK;

    if (isNonnegativeInteger.arguments.length > 1)
        secondArg = isNonnegativeInteger.arguments[1];

    return (isSignedInteger(s, secondArg)
         && ( (isEmpty(s) && secondArg)  || (parseInt (s) >= 0) ) );
}


function isNegativeInteger (s)
{   var secondArg = defaultEmptyOK;

    if (isNegativeInteger.arguments.length > 1)
        secondArg = isNegativeInteger.arguments[1];

    return (isSignedInteger(s, secondArg)
         && ( (isEmpty(s) && secondArg)  || (parseInt (s) < 0) ) );
}


function isNonpositiveInteger (s)
{   var secondArg = defaultEmptyOK;

    if (isNonpositiveInteger.arguments.length > 1)
        secondArg = isNonpositiveInteger.arguments[1];

    return (isSignedInteger(s, secondArg)
         && ( (isEmpty(s) && secondArg)  || (parseInt (s) <= 0) ) );
}


function isFloat (s)

{   var i;
    var seenDecimalPoint = false;

    if (isEmpty(s)) 
       if (isFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isFloat.arguments[1] == true);

    if (s == decimalPointDelimiter) return false;


    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;
        else if (!isDigit(c)) return false;
    }

    return true;
}


function isSignedFloat (s)

{   if (isEmpty(s)) 
       if (isSignedFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isSignedFloat.arguments[1] == true);

    else {
        var startPos = 0;
        var secondArg = defaultEmptyOK;

        if (isSignedFloat.arguments.length > 1)
            secondArg = isSignedFloat.arguments[1];

        if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
           startPos = 1;    
        return (isFloat(s.substring(startPos, s.length), secondArg))
    }
}


function isAlphabetic (s)

{   var i;

    if (isEmpty(s)) 
       if (isAlphabetic.arguments.length == 1) return defaultEmptyOK;
       else return (isAlphabetic.arguments[1] == true);

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (!isLetter(c))
        return false;
    }

    return true;
}

function isAlphanumeric (s)

{   var i;

    if (isEmpty(s)) 
       if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK;
       else return (isAlphanumeric.arguments[1] == true);

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (! (isLetter(c) || isDigit(c) ) )
        return false;
    }

    return true;
}

function reformat (s)

{   var arg;
    var sPos = 0;
    var resultString = "";

    for (var i = 1; i < reformat.arguments.length; i++) {
       arg = reformat.arguments[i];
       if (i % 2 == 1) resultString += arg;
       else {
           resultString += s.substring(sPos, sPos + arg);
           sPos += arg;
       }
    }
    return resultString;
}

function reformatZIPCode (ZIPString)
{   if (ZIPString.length == 5) return ZIPString;
    else return (reformat (ZIPString, "", 5, "-", 4));
}

function reformatUSPhone (USPhone)
{   return (reformat (USPhone, "(", 3, ") ", 3, "-", 4))
}

function reformatSSN (SSN)
{   return (reformat (SSN, "", 3, "-", 2, "-", 4))
}

function isLeapYear(argYear) {
	return ((argYear % 4 == 0) && (argYear % 100 != 0)) || (argYear % 400 == 0) 
}

function daysInMonth(argMonth, argYear) {
	switch (Number(argMonth)) {
		case 1:		// Jan
		case 3:		// Mar
		case 5:		// May
		case 7:		// Jul
		case 8:		// Aug
		case 10:		// Oct
		case 12:		// Dec
			return 31;
			break;
		
		case 4:		// Apr
		case 6:		// Jun
		case 9:		// Sep
		case 11:		// Nov
			return 30;
			break;
		
		case 2:		// Feb
			if (isLeapYear(argYear))
				return 29
			else
				return 28
			break;
		
		default:
			return 0;
	}
}

function getDateSeparator(argDate) {
	if ((argDate.indexOf('-') > 0) && (argDate.indexOf('/') > 0))
		return ' '

	if (argDate.indexOf('-') > 0)
		return '-'
	else
		if (argDate.indexOf('/') > 0)
			return '/'
		else
			return ' '
}

function getYear(argDate) {
	var dateSep = getDateSeparator(argDate)
	
	if (dateSep == ' ')
		return 0

	if(argDate.split(dateSep).length == 3)
		return argDate.split(dateSep)[2]
	else
		return 0
}

function getMonth(argDate) {
	var dateSep = getDateSeparator(argDate)
	
	if (dateSep == ' ')
		return 0

	if(argDate.split(dateSep).length == 3)
		return argDate.split(dateSep)[0]
	else
		return 0
}

function getDay(argDate) {
	var dateSep = getDateSeparator(argDate)
	
	if (dateSep == ' ')
		return 0

	if(argDate.split(dateSep).length == 3)
		return argDate.split(dateSep)[1]
	else
		return 0
}

function isProperDay(argDay, argMonth, argYear) {
	if ((isWhiteSpace(argDay)) || (argDay == 0))
		return false

	if ((argDay > 0) && (argDay < daysInMonth(argMonth, argYear) + 1))
		return true
	else 
		return false
}

function isProperMonth(argMonth) {
	if ((isWhiteSpace(argMonth)) || (argMonth == 0))
		return false
	
	if ((argMonth > 0) && (argMonth < 13))
		return true
	else
		return false
}

function isProperYear(argYear) {
	if ((isWhiteSpace(argYear)) || (argYear.toString().length > 4) || (argYear.toString().length == 3))
		return false
	
	switch (argYear.toString().length) {
		case 1:
			if (argYear >=0 && argYear < 10)
				return true
			else
				return false
			
		case 2:
			if (argYear >=0 && argYear < 100)
				return true
			else
				return false
			
		case 4:
			if (((argYear >=1900) || (argYear >=2000)) && ((argYear < 3000) || (argYear < 2000)))
				return true
			else
				return false
		
		default:
			return false
	}
}

function isProperDate(argDate) {
	var tmpDay = getDay(argDate)
	var tmpMon = getMonth(argDate)
	var tmpYear = getYear(argDate)

	return isProperDay(tmpDay, tmpMon, tmpYear) && isProperMonth(tmpMon) && isProperYear(tmpYear)
}

function charOccurences(argString, argChar) {
	var intCt = 0

	for(var intI=0; intI < argString.length; intI++)
		if (argString.charAt(intI) == argChar)
			intCt++
	
	return intCt
}

function isProperEmail(argEmail) {
	if (charOccurences(argEmail, '@') + charOccurences(argEmail, '.') < 2)
		return false

	var atPos = argEmail.indexOf('@')
	var dotPos = argEmail.indexOf('.')

	if((atPos == 0) || (atPos == (argEmail.length - 1)))
		return false

	if((dotPos == 0) || (dotPos == (argEmail.length - 1)))
		return false
	
	var checkTLD=1;
 
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
 
	var emailPat=/^(.+)@(.+)$/;
 
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
 
 
	var validChars="\[^\\s" + specialChars + "\]";
 
 
	var quotedUser="(\"[^\"]*\")";
 
 
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
 
 
	var atom=validChars + '+';
 
	var word="(" + atom + "|" + quotedUser + ")";
 
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
 
 
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
 
 
 
	var matchArray=argEmail.match(emailPat);
 
	if (matchArray==null)
		{
		return false;
		}
	var user=matchArray[1];
	var domain=matchArray[2];
 
	for (i=0; i<user.length; i++)
		{
		if (user.charCodeAt(i)>127)
			{
			return false;
			}
		}
	for (i=0; i<domain.length; i++)
		{
		if (domain.charCodeAt(i)>127)
			{
			return false;
			}
		}
 
	if (user.match(userPat)==null)
		{
		return false;
	}
 
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null)
		{
		for (var i=1;i<=4;i++)
			{
			if (IPArray[i]>255)
				{
				return false;
				}
			}
		return true;
		}
 
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++)
		{
		if (domArr[i].search(atomPat)==-1)
			{
			return false;
			}
		}
 
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1)
		{
		return false;
		}
 
	if (len<2)
		{
		return false;
		}
 
	return true;
}

function isProperNumber(argNumber) {
	var numberValue = Number(argNumber)
	
	if (isNaN(numberValue)) 
		return false
	else
		return !isWhiteSpace(argNumber)
}

function isProperAlphabetic(argString) {
	var alphabets = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"

	for(var intI=0; intI<argString.length; intI++)
		if (alphabets.indexOf(argString.charAt(intI)) == -1)
			return false
	
	return true
}

function objectValue(argFrm, argElem) {
	var intI
	var objElem = null

	for (intI=0; intI<argFrm.length; intI++)
		if (argFrm[intI].name == argElem) 
			objElem = argFrm[intI]

	switch (objElem.type) {
		case 'text':
		case 'hidden':
		case 'password':
			return objElem.value
			break;
		
		case 'select-one':
			if (objElem.length == 0)
				return ''
			else 
				return objElem.options[objElem.selectedIndex].value
			break;
		
		case 'radio':
			for (intI=0; intI<argFrm.length; intI++)
				if (argFrm[intI].name == argElem) 
					if (argFrm[intI].checked)
						return argFrm[intI].value

			return ''
			break;
	}
}

function objectFocus(argFrm, argElem) {
	var intI
	var objElem = null
	for (intI=0; intI<argFrm.length; intI++)
		if (argFrm[intI].name == argElem) 
			objElem = argFrm[intI]
	objElem.focus();
}

function isProperZip(argZip) {
	if ((argZip.length == 5) || (argZip.length == 9))
		return isProperNumber(argZip)
	
	if (argZip.length == 10)
		return (isProperNumber(argZip.substr(0, 5)) && isProperNumber(argZip.substr(6, 4)) & (argZip.charAt(5) == '-'))
}

function isProperUSPhone (argPhone)
{
	var argPhone2 = stripCharsNotInBag(argPhone,"0123456789")
    return (isOkBag(argPhone,"01234567890 -().") && isInteger(argPhone2) && argPhone2.length==digitsInUSPhoneNumber)
}

function isProperUSSSN(argSSN) {
	var argSSN2 = stripCharsNotInBag(argSSN,"0123456789")
    return (isOkBag(argSSN,"01234567890-") && isInteger(argSSN2) && argSSN2.length==11)
}

function actionFields(argActions) {
	this.email			= (argActions.indexOf('[email]') > -1)
	this.required		= (argActions.indexOf('[req]') > -1)
	this.checkDate		= (argActions.indexOf('[date]') > -1)
	this.checkZip		= (argActions.indexOf('[zip]') > -1)
	this.checkNumber	= (argActions.indexOf('[number]') > -1)
	this.checkAlphabetic= (argActions.indexOf('[alpha]') > -1)
	this.checkUSPhone	= (argActions.indexOf('[usphone]') > -1)
	this.checkUSSSN		= (argActions.indexOf('[usssn]') > -1)

	if (argActions.indexOf('[len=') > -1) {
		this.checkLength = true

		var lenToCheck = ''
		var bolCont = true

		for (var intI=(argActions.indexOf('[len=') +  5);((intI < argActions.length) && bolCont); intI++)
			if (argActions.charAt(intI) != ']')
				lenToCheck += argActions.charAt(intI)
			else
				bolCont = false
		this.lengthToCheck = lenToCheck
	}
	else
		this.checkLength = false

	if (argActions.indexOf('[blankalert=') > -1) {
		this.blankAlert = true

		var alertString = ''
		var bolCont = true

		for (var intI=(argActions.indexOf('[blankalert=') +  12);((intI < argActions.length) && bolCont); intI++)
			if (argActions.charAt(intI) != ']')
				alertString += argActions.charAt(intI)
			else
				bolCont = false
		this.blankAlertMessage = alertString
	}
	else
		this.blankAlert = false
	
	if (argActions.indexOf('[invalidalert=') > -1) {
		this.invalidAlert = true

		var alertString = ''
		var bolCont = true

		for (var intI=(argActions.indexOf('[invalidalert=') +  14);((intI < argActions.length) && bolCont); intI++)
			if (argActions.charAt(intI) != ']')
				alertString += argActions.charAt(intI)
			else
				bolCont = false
		this.invalidAlertMessage = alertString
	}
	else
		this.invalidAlert = false

	if (argActions.indexOf('[equals=') > -1) {
		this.shouldEqual = true

		var equalsString = ''
		var bolCont = true

		for (var intI=(argActions.indexOf('[equals=') +  8);((intI < argActions.length) && bolCont); intI++)
			if (argActions.charAt(intI) != ']')
				equalsString += argActions.charAt(intI)
			else
				bolCont = false
		this.shouldEqualString = equalsString
	}
	else
		this.shouldEqual = false

}


function validateForm(argForm)
	{
	var frmElements = argForm.elements
	var elemName
	var elemObj

	submitonce(argForm);

	for (var intI=0; intI < frmElements.length; intI++) {// *
		elemObj = frmElements[intI]
		elemName = elemObj.name

		if ((elemObj.type == 'hidden') && (elemName.length > 5))
			if (elemName.substr(elemName.length - 5).toLowerCase() == '_vldt') {// **
				var objAction = new actionFields(objectValue(frmElements, elemName))
				var actElem = elemName.substr(0, elemName.length - 5)
				
				if (objAction.required) {
					if (isWhiteSpace(objectValue(frmElements, actElem))) {// ***
						alert (objAction.blankAlert?objAction.blankAlertMessage:actElem + ' cannot be left blank')
						objectFocus(frmElements, actElem);
						submitenabled(argForm);
						return false
					} // ***
				}
				
				if ((objectValue(frmElements, actElem) > '') && (!isWhiteSpace(objectValue(frmElements, actElem)))){// ***
					if (objAction.checkDate)
						if (!isProperDate(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have an invalid date')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.checkNumber)
						if (!isProperNumber(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have an invalid number')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.checkZip)
						if (!isProperZip(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have an invalid zipcode')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.checkAlphabetic)
						if (!isProperAlphabetic(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have invalid characters')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.checkUSPhone)
						if (!isProperUSPhone(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have invalid characters')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.checkUSSSN)
						if (!isProperUSSSN(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have invalid characters')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.email)
						if (!isProperEmail(objectValue(frmElements, actElem))) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' cannot have invalid characters')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****

					if (objAction.checkLength)
						if (objectValue(frmElements, actElem).length < objAction.lengthToCheck) {// ****
							alert (objAction.invalidAlert?objAction.invalidAlertMessage:actElem + ' must be at least ' + objAction.lengthToCheck + ' characters long')
							objectFocus(frmElements, actElem);
							submitenabled(argForm);
							return false
						} // ****
				} // ***
			} // **
	} // *
		
	return true
}


function submitenabled(theform)
	{
	if (document.all||document.getElementById)
		{
		for (i=0;i<theform.length;i++)
			{
			var tempobj=theform.elements[i];
			if(tempobj.type.toLowerCase()=="submit" || tempobj.type.toLowerCase()=="reset")
				tempobj.disabled=false;
			}
		}
	}


function submitonce(theform)
	{
	if (document.all||document.getElementById)
		{
		for (i=0;i<theform.length;i++)
			{
			var tempobj=theform.elements[i];
			if(tempobj.type.toLowerCase()=="submit" || tempobj.type.toLowerCase()=="reset")
				tempobj.disabled=true;
			}
		}
	}



function observeWindowLoad(handler) {
    if (window.addEventListener) { 
        window.addEventListener('load',handler,false);
    }
    else if (document.addEventListener) {
        document.addEventListener('load',handler,false);
    }
    else if (window.attachEvent) { 
        window.attachEvent('onload',handler);
    }
    else {
        if (typeof window.onload=='function') {
            var oldload=window.onload;
            window.onload = function(){
                oldload();
                handler();
            }
        } 
        else { window.onload=init; }
    }
}

