-function hide_all(){
	var a
 a=document.getElementById('form_detalii_firma')
 if(a!=null)
	 a.style.display = 'none';
	 
 b=document.getElementById('form_adresa_user')
 if(b!=null)
	 b.style.display = 'none';
}
function show_div(param){
 var a
 a=document.getElementById(param)
 a.style.display = 'block';
}

function hide_div(param){
 var a
 a=document.getElementById(param)
 a.style.display = 'none';
}

function display_div(){
	var a
	a=document.getElementById('statut_juridic').selectedIndex
	
	if (a == 'Persoana fizica') {
		hide_all();
		show_div('form_adresa_user');
	}
	
	if (a == 'Persoana juridica') {
		hide_all();
		show_div('form_detalii_firma');
		show_div('form_adresa_user');
	}
		
}

function bifeaza_statut(param){
	var a
	a=document.getElementById(param)
	a.checked=true
	
}

function confirmaStergere(delUrl) {
  if (confirm("Sunteti sigur(a) ca doriti sa stergeti?")) {
    document.location = delUrl;
  }else{
  	//window.alert("Stergerea a fost anulata!");
  }
}

function toggle(id) {
  var e = document.getElementById(id);
       if(e.style.display == 'block'){
          e.style.display = 'none';
          if(id=='searchform'){
          	document.getElementById('display_searchform').innerHTML='<a href="javascript:toggle(\'searchform\');" title="[+] Afiseaza formular">[+] Afiseaza formular</a>';
          }
          
          if(id=='div_q'){
          	document.getElementById('href_q').innerHTML='[+]';
          }
       }else{
          e.style.display = 'block';
           if(id=='searchform'){
          		document.getElementById('display_searchform').innerHTML='<a href="javascript:toggle(\'searchform\');" title="[-] Ascunde formular">[-] Ascunde formular</a>';
          }
          if(id=='div_q'){
          	document.getElementById('href_q').innerHTML='[-]';
          }
       }
}

function sendToPrint(siteUrl, id_articol) {
    window.open(siteUrl + "/print.php?articleId=" + id_articol, "Printeaza", "height=800,width=800,resizable=yes,scrollbars=yes");
}

function sendArticleLinkByMail(id_articol, articleUrl) {
    window.location.href = "mailto:?subject=PortalContabilitate.ro - O pagina interesanta&body=" + articleUrl;
}

function sendArticleLinkByYM(id_articol, articleUrl) {
    window.location.href = "ymsgr:im?+&msg=" + articleUrl;
}

function sendLinkByMail(url) {
    window.location.href = "mailto:?subject=PortalContabilitate.ro - O pagina interesanta&body=" + url;
}

function sendLinkByYM(url) {
    window.location.href = "ymsgr:im?+&msg=" + url;
}

function procesare_plata(){
	var acces_dorit;
	acces_dorit=document.getElementById('acces_dorit').value;
	
	new Ajax.Updater('ajax_plata', '/inc/ajax.procesare_plata.php', {
  	method: 'get',
  	parameters: {acces_dorit: acces_dorit}
  	});

}

function procesare_plata(){
	var acces_dorit;
	acces_dorit=document.getElementById('acces_dorit').value;
	
	new Ajax.Updater('ajax_plata', '/inc/ajax.procesare_plata.php', {
  	method: 'get',
  	parameters: {acces_dorit: acces_dorit}
  	});

}

function exista_email(){
	var email;
	email=document.getElementById('email_inregistrare').value;
	
	new Ajax.Updater('verifica_existenta_email', '/inc/ajax.verifica_email.php', {
  	method: 'get',
  	parameters: {email: email}
  	});

}

function exista_username(){
	var username;
	username=document.getElementById('username').value;
	
	new Ajax.Updater('verifica_existenta_username', '/inc/ajax.verifica_username.php', {
  	method: 'get',
  	parameters: {username: username}
  	});

}

function genereaza_excel_plati(){

	new Ajax.Updater('download_excel', '/inc/adm.ajax.download_excel_plati.php', {
  	method: 'get',
  	parameters: {}
  	});

}

function procesare_abonare_nws(){
	var email;
	var sursa;
	var accept_comunicari;
	
	email=document.getElementById('email').value;
	sursa=document.getElementById('sursa').value;
	accept_comunicari=document.getElementById('accept_comunicari').value;
	
	document.getElementById('newsletterProcess').style.display='block';
	
	new Ajax.Updater('newsletterProcess', '/inc/newsletter.subscriber.ajax.php', {
  	method: 'get',
  	parameters: {email: email, sursa:sursa, accept_comunicari:accept_comunicari}
  	});

}

function procesare_abonare_nws2(){
	var email;
	var sursa;
	var accept_comunicari;
	
	email=document.getElementById('email2').value;
	sursa=document.getElementById('sursa2').value;
	accept_comunicari=document.getElementById('accept_comunicari').value;
	
	document.getElementById('PopUp').style.height='400px';
	document.getElementById('newsletterProcess2').style.display='block';
	
	new Ajax.Updater('newsletterProcess2', '/inc/newsletter.subscriber.ajax.php', {
  	method: 'get',
  	parameters: {email: email, sursa:sursa, accept_comunicari:accept_comunicari}
  	});

}

function update_detalii_autor(){
	var id_autor_fk;
	id_autor_fk=document.getElementById('id_autor_fk').value;
	document.getElementById('detalii_autor').style.backgroundColor='#FEFDE2';
	
	new Ajax.Updater('detalii_autor', '/inc/adm.ajax.detalii_autor.php', {
  	method: 'get',
  	parameters: {id_autor_fk: id_autor_fk}
  	});

}

function export_users(searchstring, id_div){
	new Ajax.Updater(id_div, '/inc/adm.ajax.download_excel_users_search.php', {
  	method: 'get',
  	parameters: {searchstring: searchstring}
  	});

}