-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_partener').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_partener').value;
	
	new Ajax.Updater('verifica_existenta_username', '/inc/ajax.verifica_username.php', {
  	method: 'get',
  	parameters: {username: username}
  	});

}

function parola_identica(){
	var parola1;
	var parola2;
	parola1=document.getElementById('parola1_partener').value;
	parola2=document.getElementById('parola2_partener').value;
	
	new Ajax.Updater('verifica_parole_identice', '/inc/ajax.verifica_parola.php', {
  	method: 'get',
  	parameters: {parola1: parola1, parola2: parola2}
  	});

}

function checkall(){
	for(i=0; i<document.formDrepturi.elements.length; i++)
	{
	if(document.formDrepturi.elements[i].type=="checkbox")
	{
	document.formDrepturi.elements[i].checked=true;
	}
	}
}


function uncheckall(){
	for(i=0; i<document.formDrepturi.elements.length; i++)
	{
	if(document.formDrepturi.elements[i].type=="checkbox")
	{
	document.formDrepturi.elements[i].checked=false;
	}
	}
}



function changeStatusCateg(param_inital,param){
	var myRegExp=param+"_";	
	
	for(i=0; i<document.formDrepturi.elements.length; i++){
		
		if( (document.formDrepturi.elements[i].type=="checkbox") && (document.formDrepturi.elements[i].id.search(myRegExp)!=-1)){
			if(document.getElementById(param_inital).checked==true){
				document.formDrepturi.elements[i].checked=false;
				document.formDrepturi.elements[i].disabled=true;
			}else{
				document.formDrepturi.elements[i].checked=false;
				document.formDrepturi.elements[i].disabled=false;
			}
			
		}else{
			// DEBUG
			// alert(document.formDrepturi.elements[i].type+' Nu gasesc '+myRegExp+' in '+document.formDrepturi.elements[i].id);
		}
	}
}

function toggle_categ(trigger,id) {
  var e = document.getElementById(id);
  var f = document.getElementById(trigger);
       if(e.style.display == 'block'){
          e.style.display = 'none';
          if(f.innerHTML=='<img src="images/admin/minus.png" align="absmiddle">'){
          	f.innerHTML='<img src="images/admin/plus.png" align="absmiddle">';
          }else{
			 /*f.innerHTML='<img src="images/admin/minus.png" align="absmiddle">';*/
          }
          
       }else{
          e.style.display = 'block';
          if(f.innerHTML=='<img src="images/admin/plus.png" align="absmiddle">'){
          	f.innerHTML='<img src="images/admin/minus.png" align="absmiddle">';
          }else{
          	/*f.innerHTML='<img src="images/admin/minus.png" align="absmiddle">';*/
          }
       }
}


function recuperare_admin(){
	var adresa_email;
	adresa_email=document.getElementById('adresa_email').value;
	
	new Ajax.Updater('process_recover', '/inc/ajax.recuperare_admin.php', {
  	method: 'get',
  	parameters: {adresa_email: adresa_email}
  	});

}

function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
