﻿function show_film(width, height, descriere, fisier,preview,randomid)
	{
		var so = new SWFObject("/video/player.swf","mpl",width,height,"9");
		so.addParam("allowfullscreen","true");
		so.addParam("allowscriptaccess","always");
		so.addParam("wmode","opaque");
		so.addVariable("description",descriere);
		so.addVariable("file",fisier);
		so.addVariable("image",preview);
		so.addVariable("frontcolor","FFFFFF");
		so.addVariable("lightcolor","FFFFFF");
		so.addVariable("screencolor","f2f2f2");
		so.addVariable("skin","css/beelden.zip");
		so.addVariable("shuffle","true");
		so.write("mediaspace"+randomid);
	}
function popup(url) 
{
var front='/';
if((url.indexOf('htpp://')==0) || (url.indexOf('/')==0)) front='';
url = front+url;
 var width  = 475;
 var height = 500;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 //params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';
 var windowname= randomchars(30);
 var newwin=window.open(url,windowname,params);
 if (window.focus) {newwin.focus()}
 return false;
}

function randomchars(length)
{
  var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  var pass = "";
  var x;
  for(x=0;x<length;x++)
  {
    var i = Math.floor(Math.random() * 62);
    pass += chars.charAt(i);
  }
  return pass;
}

var numb = '0123456789,.';
var lwr = 'abcdefghijklmnopqrstuvwxyz';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

 function isAlpha(xStr){  
     var regEx = /^[a-zA-Z]+$/;  
     return xStr.match(regEx);  
   }  
function isNum(xStr){  
     var regEx = /^[0-9\.\,]+$/;  
     return xStr.match(regEx);  
   }  
function isAlphaNum(xStr){  
     var regEx = /^[a-zA-Z0-9\-\.\,]+$/;  
     return xStr.match(regEx);  
   }  
   
function is_cifre(idobiect)
	{
		var valoare =document.getElementById(idobiect).value;
		if(!isNum(valoare)) document.getElementById(idobiect).value = valoare.substr(0,(valoare.length-1));
	}

function proceseaza(url,idobiect)
	{
		var front='/';
		if((url.indexOf('htpp://')==0) || (url.indexOf('/')==0)) front='';
		jx.load(front+url,function(data){
			document.getElementById(idobiect).innerHTML=data;
			if(idobiect=='bottom_login')
				{
					if(data.indexOf('mesaje noi')>0)if(data.indexOf("0 mesaje noi")>0) {/*nu ai mesaje noi*/}
						else
							{
								soundManager.play('message');
							}
					if(data.indexOf('fisiere media noi')>0)if(data.indexOf("0 fisiere media noi")>0) {/*nu ai fisiere media noi*/}
						else
							{
								soundManager.play('newmedia');
							}
					if(data.indexOf('mesaje suport noi')>0)if(data.indexOf("0 mesaje suport noi")>0) {/*nu ai mesaje suport noi*/}
						else
							{
								soundManager.play('message');
							}
					if(data.indexOf('evenimente noi')>0)if(data.indexOf("0 evenimente noi")>0) {/*nu ai evenimente noi*/}
						else
							{
								soundManager.play('newevent');
							}
				}
		},'text','post');
	}

function Jump(pagina)
{
	window.location.href = pagina;
}

function change_amp(text_de_schimbat)
	{
		text_de_schimbat = text_de_schimbat.replace( new RegExp( '&amp;', "g" ), "&");
		text_de_schimbat = text_de_schimbat.replace( new RegExp( '&', "g" ), "%26");
		text_de_schimbat = text_de_schimbat.replace( new RegExp( '\"', "g" ), "%22");
		text_de_schimbat = text_de_schimbat.replace( new RegExp( "\'", "g" ), "%27");
		text_de_schimbat = text_de_schimbat.replace( new RegExp( "\\?", "g" ), "%3F");
		text_de_schimbat = text_de_schimbat.replace( new RegExp( "\\+", "g" ), "%2B");
		return text_de_schimbat;
	}

function confirm_action(mesaj,uri)
	{
		if (confirm(mesaj))
			{
				window.location.href=uri;
			}		
	}


function check_len(max,objid)
	{
		var textul = document.getElementById(objid).value;
		if((textul.length>max))
			{
				document.getElementById(objid).value = textul.substring(0,max);
			}
		//if(textul.indexOf('\'')>=0) document.getElementById(objid).value = textul.replace( new RegExp( '\'', "g" ), "`");
		//if(textul.indexOf("\"")>=0) document.getElementById(objid).value = textul.replace( new RegExp( "\"", "g" ), "`");
	}
function process_limbi()
	{
		document.getElementById('limbi').value='';
		for(i=document.pas1.limba.options.length-1;i>=0;i--)
			{
				var limba=document.pas1.limba;
				if(document.getElementById('limbi').value != '') document.getElementById('limbi').value=document.getElementById('limbi').value +', '+document.pas1.limba[i].value;
				else document.getElementById('limbi').value=document.pas1.limba[i].value;
			}
	}
var RecaptchaOptions = {
   theme : 'white',
   custom_translations : { instructions_visual : "Scrieti cuvintele de mai sus:"}
};

var newwindow;
function poptastic(url,name,height,width)
{
	var front='/';
	if((url.indexOf('htpp://')==0) || (url.indexOf('/')==0)) front='';
	url = front+url;
	var newwindow=window.open(url,name,'height='+height+',width='+width+',left=10,top=10,toolbar=no,menubar=no,location=yes,status=no,scrollbars=yes');
	if (window.focus) {newwindow.focus();}
}

function check_instant_message(user) {
	var url = '/check_for_im_messages.php?thisuser='+user;
	if(chkObject(false,'im_status'))
		{
		jx.load(url,function(data){
			if(data!='')
				{
					document.getElementById('im_status').innerHTML = data;
					document.getElementById('im_status').style.display="block";
					soundManager.play('chatmessage');
				}else
					{
						document.getElementById('im_status').innerHTML = "";
						document.getElementById('im_status').style.display="none";
					}
		},'text');
		}
	return true;
}

function process_page(uri,idobiect) 
{
	var front='/';
	if((uri.indexOf('htpp://')==0) || (uri.indexOf('/')==0)) front='';
	jx.load(front+uri,function(data){
		if(idobiect!='')	document.getElementById(idobiect).innerHTML=data;
		//alert(data);
		},'text','POST');
	return true;
}

function check_media_form()
	{
		if(chkObject(false,'fisierul')) {
			var fisier = ' no_file.png';
			fisier = document.getElementById("fisierul").src;
		if(fisier.indexOf('no_file.png')<=0)
			{
				document.getElementById('salveaza').innerHTML = '<input type="button" class="button2" value="Salveaza" onclick="evaluate_form_media();"/>';
			}else{document.getElementById('salveaza').innerHTML = '* butonul va aparea dupa ce ati incarcat o imagine ';}
		}
		setTimeout("check_media_form()",500);
	}

var	timer_for_modifica='';
function check_modifica_form()
{
		
if(chkObject(false,'eu_sunt_tu'))
	{
		var OK = true;
		text = document.getElementById('eu_sunt_tu').innerHTML;
		if((document.getElementById('username_ocupat').innerHTML!="Utilizatorul exista deja")&&(document.getElementById('email').value==document.getElementById('email2').value)&&(document.getElementById('email').value!=''))
			{
				if(text.indexOf('corner2')<=0)document.getElementById('eu_sunt_tu').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('eu_sunt_tu').style.background = '#333333';OK=false;}
		text = document.getElementById('cat_de_chipes_esti').innerHTML;
		//if((document.getElementById('fisierul').src!='crop_image.php?src=images/no_avatar.png&width=50&height=50&cropPercent=4')&&(document.getElementById('fisierul').src!=''))
		//	{
				if(text.indexOf('corner2')<=0)document.getElementById('cat_de_chipes_esti').style.background = '#c1272d';
		//	}else{if(text.indexOf('corner1')<=0)document.getElementById('cat_de_chipes_esti').innerHTML = '<div style="background:#333333;height:53px;padding:3px;">Cat de chipes esti?</div><div style="with:100%;height:10px;background:transparent url(\'images/corner1_form.png\') no-repeat scroll right top;"></div>';OK=false;}
		text = document.getElementById('ai_texte').innerHTML;
		if(((document.getElementById('titlu_profil').value!='15-140 caractere')
		//||(document.getElementById('cirip').value!='')
		)&&(document.getElementById('descriere_profil').value!=''))
			{
				if(text.indexOf('corner2')<=0)document.getElementById('ai_texte').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('ai_texte').style.background = '#333333';OK=false;}
		text = document.getElementById('cand_sarbatorim_ziua_ta').innerHTML;
		if((document.getElementById('ziua').value!='')&&(document.getElementById('luna').value!='')&&(document.getElementById('anul').value!='')&&(document.getElementById('inaltimea').value!='')&&(document.getElementById('greutatea').value!=''))
			{
				if(text.indexOf('corner2')<=0)document.getElementById('cand_sarbatorim_ziua_ta').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('cand_sarbatorim_ziua_ta').style.background = '#333333';OK=false;}
		text = document.getElementById('unde_o_sarbatorim').innerHTML;
		if(((document.getElementById('tara').value!='')||(document.getElementById('alt_loc').value!=''))&&(document.getElementById('oras').value!='')&&(document.getElementById('limbi').value!=''))
			{
				if(text.indexOf('corner2')<=0)document.getElementById('unde_o_sarbatorim').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('unde_o_sarbatorim').style.background = '#33333';OK=false;}
		text = document.getElementById('urci_pana_la_mine').innerHTML;
		if((document.getElementById('disponibil').value!='')&&(document.getElementById('hiv').value!='')&&(document.getElementById('protectie').value!=''))
			{
				if(text.indexOf('corner2')<=0)document.getElementById('urci_pana_la_mine').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('urci_pana_la_mine').style.background = '#333333';OK=false;}
		text = document.getElementById('avem_pasiuni_comune').innerHTML;
		if((document.getElementById('muzica').value!="")&&(document.getElementById('hobby').value!='')&&(document.getElementById('impreuna').value!='')&&(document.getElementById('lucrezi').value!=''))
			{
				if(text.indexOf('corner2')<=0)document.getElementById('avem_pasiuni_comune').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('avem_pasiuni_comune').style.background = '#333333';OK=false;}
		text = document.getElementById('psss').innerHTML;
		if((document.getElementById('parola1').value==document.getElementById('parola2').value)
			//&&(document.getElementById('parola').value!='')
			)
			{
				if(text.indexOf('corner2')<=0)document.getElementById('psss').style.background = '#c1272d';
			}else{if(text.indexOf('corner1')<=0)document.getElementById('psss').style.background = '#333333';OK=false;}
		if(OK){document.getElementById('butoane').innerHTML='<input type="button" class="button2" value="Salveaza" onclick="save_profil_modifica();this.value=\'Se salveaza...\';" style="float:right;"/>';}
		else{document.getElementById('butoane').innerHTML='* butonul va apare cand toate casutele din dreapta sunt rosii';}
	}
		timer_for_modifica = setTimeout("check_modifica_form()",500);
}

function trimite_comentariu(totable,userid,toid,page)
	{
		var comentariu = '';
		if(chkObject(false,'comentariu')) comentariu = document.getElementById('comentariu').value;
		comentariu = comentariu.replace( new RegExp( "\\n", "g" ), "<br />");
		comentariu = change_amp(comentariu);
		if((comentariu!='')&&(totable!='')&&(userid!='')&&(toid!=''))
			{
				if(process_page('post_comment.php?totable='+totable+'&toid='+toid+'&userid='+userid+'&comentariu='+comentariu,''))
				{	
					process_page(page,'profil_comentarii');
				}
			}
	}
	
function getRadioValue(radioN)
	{
		for(i=0;i<document.formName[radioN].length;i++)
			{
				if (document.formName[radioN][i].checked == true)
				return document.formName[radioN][i].value;
			}
	}

function brtoline(text)
	{
		return text.replace( new RegExp( "<br />", "g" ), "\n");
	}
	
function save_profil_modifica()
	{
		var sex = getRadioValue('sex');
		var verify = document.getElementById('verify').value;
		//var parola_veche = document.getElementById('parola').value;
		var user = document.getElementById('username').value;
		user = change_amp(user);
		var userid = document.getElementById('userid').value;
		var avatar = document.getElementById('image_area').value;
		var email = document.getElementById('email').value;
		email = change_amp(email);
		var telefon = document.getElementById('telefon').value;
		telefon = change_amp(telefon);
		if(document.getElementById('contact_telefonic').checked){var contact_telefonic = 1;}else{var contact_telefonic=0;}
		if(document.getElementById('privat').checked){var privat = true;}else{var privat=false;}
		var titlu_profil = document.getElementById('titlu_profil').value;
		titlu_profil = change_amp(titlu_profil);
		//var cirip = document.getElementById('cirip').value;
		var descriere_profil = document.getElementById('descriere_profil').value;
		descriere_profil = descriere_profil.replace( new RegExp( "\\n", "g" ), "<br />");
		descriere_profil = change_amp(descriere_profil);
		var ziua = document.getElementById('ziua').value;
		var luna = document.getElementById('luna').value;
		var anul = document.getElementById('anul').value;
		var tara = document.getElementById('tara').value;
		var judet = document.getElementById('judet').value;
		var oras = document.getElementById('oras').value;
		var alt_loc = document.getElementById('alt_loc').value;
		alt_loc = change_amp(alt_loc);
		var inaltimea = document.getElementById('inaltimea').value;
		inaltimea = change_amp(inaltimea);
		var greutatea = document.getElementById('greutatea').value;
		greutatea = change_amp(greutatea);
		var limbi = document.getElementById('limbi').value;
		limbi = change_amp(limbi);
		var parola = document.getElementById('parola1').value;
		var disponibil = document.getElementById('disponibil').value;
		var hiv = document.getElementById('hiv').value;
		var protectie = document.getElementById('protectie').value;
		var muzica = document.getElementById('muzica').value;
		muzica = change_amp(muzica);
		var hobby = document.getElementById('hobby').value;
		hobby = change_amp(hobby);
		var impreuna = document.getElementById('impreuna').value;
		impreuna = change_amp(impreuna);
		var lucrezi = document.getElementById('lucrezi').value;
		lucrezi = change_amp(lucrezi);
		process_page('personal/save_modifica.php?lucrezi='+lucrezi+'&impreuna='+impreuna+'&hobby='+hobby+'&muzica='+muzica+'&verify='+verify+'&userid='+userid+'&user='+user+'&avatar='+avatar+'&email='+email+'&telefon='+telefon+'&contact_telefonic='+contact_telefonic+'&sex='+sex+'&titlu_profil='+titlu_profil+
		//'&cirip='+cirip+
		'&descriere_profil='+descriere_profil+'&ziua='+ziua+'&luna='+luna+'&anul='+anul+'&tara='+tara+'&judet='+judet+'&oras='+oras+'&alt_loc='+alt_loc+'&inaltimea='+inaltimea+'&greutatea='+greutatea+'&limbi='+limbi+'&parola='+parola+'&disponibil='+disponibil+'&hiv='+hiv+'&protectie='+protectie+'&privat='+privat,'arata_modifica');
		//setTimeout("process_page('personal/profil_modifica.php','profil_modifica')",1000);
	}
	
function evaluate_form_media()
	{
		var id = document.getElementById('id').value;
		var fisier = document.getElementById('image_area').value;
		if (fisier=='') fisier = document.getElementById('fisier').value;
		if(document.getElementById('poza_profil').checked){var avatar = 1;}else{var avatar=0;}
		var comentariu = document.getElementById('comentariu').value;
		comentariu = change_amp(comentariu);
		var ziua = document.getElementById('ziua').value;
		var luna = document.getElementById('luna').value;
		var anul = document.getElementById('anul').value;
		var eveniment = document.getElementById('eveniment').value;
		var userid = document.getElementById('userid').value;
		comentariu = comentariu.replace( new RegExp( "\\n", "g" ), "<br />");
		if(((id<=0)&&(fisier!=''))||(id>0))
			{
				document.getElementById('salveaza').innerHTML = 'se salveaza... ';
				process_page('personal/edit_media.php?id='+id+'&fisier='+fisier+'&avatar='+avatar+'&comentariu='+comentariu+'&ziua='+ziua+'&luna='+luna+'&anul='+anul+'&eveniment='+eveniment,'arata_media');
			}
	}
	
function participanti(eveniment_id)
	{
		if(chkObject(false,'participanti_eveniment'))
					process_page('events/participanti.php?id='+eveniment_id,'participanti_eveniment');
	}
function nu_vreau_sa_particip_la_eveniment(eveniment_id,userid)
	{
		if(process_page('events/nu_particip.php?id='+eveniment_id+'&userid='+userid,'eveniment_'+eveniment_id+'_particip'))
			{
				setTimeout("participanti("+eveniment_id+")",1000);
			}
	}
function vreau_sa_particip_la_eveniment(eveniment_id,userid)
	{
		if(process_page('events/particip.php?id='+eveniment_id+'&userid='+userid,'eveniment_'+eveniment_id+'_particip'))
		{setTimeout("participanti("+eveniment_id+")",1000);}
		
	}
function evaluate_form_evenimente(operation)
	{
		var id = document.getElementById('id').value;
		var titlu = document.getElementById('titlu').value;
		titlu = change_amp(titlu);
		var descriere = document.getElementById('descriere').value;
		descriere = descriere.replace( new RegExp( "\\n", "g" ), "<br />");
		descriere = change_amp(descriere);
		var tip = document.getElementById('tip_eveniment').value;
		tip = change_amp(tip);
		var proiectid = document.getElementById('proiectid').value;
		var ziua = document.getElementById('ziua').value;
		var luna = document.getElementById('luna').value;
		var anul = document.getElementById('anul').value;
		var ora = document.getElementById('ora').value;
		var tara = document.getElementById('tara').value;
		var judet = document.getElementById('judet').value;
		var oras = document.getElementById('oras').value;
		var adresa = document.getElementById('adresa').value;
		adresa = change_amp(adresa);
		adresa = adresa.replace( new RegExp( "\\n", "g" ), "<br />");
		var imagine = document.getElementById('image_area').value;
		var byid = document.getElementById('byid').value;
		var show_to_id = document.getElementById('show_to_id').checked;
		var public_sau_amici = getCheckedValue(document.forms['radioExampleForm'].elements['public_sau_amici']);
		if(show_to_id == true){show_to_id = 1;}else{show_to_id = 0;}
		var show_len='personal/creeaza_eveniment.php?operation='+operation+'&id='+id+'&titlu='+titlu+'&descriere='+descriere+'&tip='+tip+'&proiectid='+proiectid+'&ziua='+ziua+'&luna='+luna+'&anul='+anul+'&ora='+ora+'&tara='+tara+'&judet='+judet+'&oras='+oras+'&adresa='+adresa+'&imagine='+imagine+'&show_to_id='+show_to_id+'&public_sau_amici='+public_sau_amici+'&byid='+byid;
		
		//alert(show_len.length);
		if(process_page('personal/creeaza_eveniment.php?operation='+operation+'&id='+id+'&titlu='+titlu+'&descriere='+descriere+'&tip='+tip+'&proiectid='+proiectid+'&ziua='+ziua+'&luna='+luna+'&anul='+anul+'&ora='+ora+'&tara='+tara+'&judet='+judet+'&oras='+oras+'&adresa='+adresa+'&imagine='+imagine+'&show_to_id='+show_to_id+'&public_sau_amici='+public_sau_amici+'&byid='+byid,'arata_evenimente'))
		if(operation=="save") process_page('personal/profil_evenimente.php?tip=viitoare&mesaj=Eveniment salvat cu succes. Acesta va trebui activat de un administrator.','profil_evenimente');
	}

function delete_mesaje_suport(verify)
	{
	var total="";
	for(var i=0; i < document.formular_mesaje.id_mesaj.length; i++)
		{
			if(document.formular_mesaje.id_mesaj[i].checked)
				{
					total =document.formular_mesaje.id_mesaj[i].value;
					process_page('delete_item.php?table=raporteaza&id='+total+'&verify='+verify,'');
				}
		}
	process_page('personal/admin_suport.php?citit=0','admin_suport');
	return false;
	}

function validate_form_mesaje(operatie,tip) {
	// Checking if at least one period button is selected. Or not. 
	var total="";
	for(var i=0; i < document.formular_mesaje.id_mesaj.length; i++)
		{
			if(document.formular_mesaje.id_mesaj[i].checked) total +=document.formular_mesaje.id_mesaj[i].value + "x";
		}
	if(total=="") {}
		else 
			{
				if(tip == 'primite') status_user = 'receiver';
				if(tip == 'trimise') status_user = 'sender';
				//alert('personal/operatii_mesaje.php?operatie='+operatie+'&checkboxes='+total);
				if(process_page('personal/operatii_mesaje.php?operatie='+operatie+'&user_status='+status_user+'&checkboxes='+total,''))
					{
					 process_page('personal/profil_mesaje.php?tip='+tip,'profil_mesaje');
					}
			}
	return false;
}

function validate_form_comentarii(operatie,tip,religie,verify,userid,valoare) {
	// Checking if at least one period button is selected. Or not. 
	var total="";
	valoare = change_amp(valoare);
	for(var i=0; i < document.formular_comentarii.id_comentarii.length; i++)
		{
			if(document.formular_comentarii.id_comentarii[i].checked)
				{
					total =document.formular_comentarii.id_comentarii[i].value;
					if(operatie=='sterge') process_page('delete_by_user.php?table=comentarii&id='+total+'&verify='+verify+'&userid='+userid,'arata_comentarii');
					if(operatie=='publica') process_page('aproba_by_user.php?table=comentarii&id='+total+'&verify='+verify+'&userid='+userid+'&valoare='+valoare,'arata_comentarii');
				}
		}
	process_page('personal/profil_comentarii.php?tip='+tip+'&religie_id='+religie,'profil_comentarii');
	return false;
}

function validate_form_media(operatie,tip,verify,userid) {
	// Checking if at least one period button is selected. Or not. 
	var entry_id=0;
	for(var i=0; i < document.formular_media.id_media.length; i++)
		{
			if(document.formular_media.id_media[i].checked)
				{
					entry_id=document.formular_media.id_media[i].value;
					if(operatie = 'sterge')	process_page('delete_by_user.php?table=profil_media&id='+entry_id+'&verify='+verify+'&userid='+userid,'');
				}
		}
	
	setTimeout("process_page('personal/profil_media.php?tip="+tip+"','profil_media')",2000);
	return false;
}

function sterge_this(page1,returnpage1,page2, returnpage2)
	{
		if(process_page(page1,returnpage1))
			process_page(page2,returnpage2);
	}

function post_raspuns(userid) {

	var mesaj = document.getElementById('raspuns').value;
	mesaj = mesaj.replace( new RegExp( "\\n", "g" ), "<br />");
	mesaj = change_amp(mesaj);
	//alert(mesaj);
	//alert(userid);
	if(mesaj!="")
	{
		process_page('personal/trimite_mesaj.php?mesaj='+mesaj+'&userid='+userid,'');
		process_page('personal/profil_mesaje.php?tip=trimise','');
		document.getElementById('arata_mesajul').innerHTML='';
	
		if(chkObject(false,'buton_mesaj'))document.getElementById('buton_mesaj').value='Mesaj';
		if(chkObject(false,'profil_mesaje'))process_page('personal/profil_mesaje.php?tip=primite','profil_mesaje');
	}
	return false;
}

function close_mesaj()
	{
		document.getElementById('arata_mesajul').innerHTML = '';
	}

function evaluate_form_drepturi()
	{
		var lider_de_opinie = document.getElementById('lider_de_opinie').checked;
		var power_user = document.getElementById('power_user').checked;
		var colaborator_religie = document.getElementById('colaborator_religie').checked;
		var colaborator_hiv = document.getElementById('colaborator_hiv').checked;
		var membru_comunitatea_hiv = document.getElementById('membru_comunitatea_hiv').checked;
		var colaborator_news = document.getElementById('colaborator_news').checked;
		var medic = document.getElementById('medic').checked;
		var psiholog = document.getElementById('psiholog').checked;
		var administrator = document.getElementById('administrator').checked;
		var judet = document.getElementById('judet').value;
		var userid = document.getElementById('userid').value;
		var status = '';
		if(lider_de_opinie==true){status='8';}
		if(power_user==true){status=status+'3';}
		if(colaborator_religie==true){status=status+'6';}
		if(colaborator_hiv==true){status=status+'5';}
		if(membru_comunitatea_hiv==true){status=status+'4';}
		if(colaborator_news==true){status=status+'7';}
		if(medic==true){status=status+'2';}
		if(psiholog==true){status=status+'9a';}
		if(administrator==true){status='1';}//asta trebuie sa fie ultimul, pentru ca adminul sa aiba un singurl nivel
		process_page('personal/admin_drepturi.php?page=set&status='+status+'&judet='+judet+'&userid='+userid,'drepturi');
	}
	
function chkObject(inParent,theVal) 
	{
		if(inParent)
			{
				if (window.opener.document.getElementById(theVal) != null) 
					{
						return true;
					}else 
						{
							return false;
						}
			}else
				{
					if (document.getElementById(theVal) != null) 
						{
							return true;
						}else
							{
								return false;
							}
				}
	}

function send_friend_request(userid,toid)
	{
		var tip1 = document.getElementById('favorit_si_amic').checked;
		var tip2 = document.getElementById('favorit').checked;
		var tip3 = document.getElementById('blocat').checked;
		process_page('personal/alege_favorit.php?amic='+tip1+'&favorit='+tip2+'&blocat='+tip3+'&userid='+userid+'&toid='+toid,'arata_mesajul');
	}

	
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function addOption_all_list(selectbox)
	{
		if(document.pas1.limba_sursa) removeAllOptions(document.pas1.limba_sursa);
		addOption(document.pas1.limba_sursa, "Albaneza","Albaneza");
		addOption(document.pas1.limba_sursa, "Araba","Araba");
		addOption(document.pas1.limba_sursa, "Aromana","Aromana");
		addOption(document.pas1.limba_sursa, "Bulgara","Bulgara");
		addOption(document.pas1.limba_sursa, "Catalana","Catalana");
		addOption(document.pas1.limba_sursa, "Chineza","Chineza");
		addOption(document.pas1.limba_sursa, "Daneza","Daneza");
		addOption(document.pas1.limba_sursa, "Ebraica","Ebraica");
		addOption(document.pas1.limba_sursa, "Engleza","Engleza");
		addOption(document.pas1.limba_sursa, "Esperanto","Esperanto");
		addOption(document.pas1.limba_sursa, "Estona","Estona");
		addOption(document.pas1.limba_sursa, "Finlandeza","Finlandeza");
		addOption(document.pas1.limba_sursa, "Franceza","Franceza");
		addOption(document.pas1.limba_sursa, "Germana","Germana");
		addOption(document.pas1.limba_sursa, "Greaca","Greaca");
		addOption(document.pas1.limba_sursa, "Islandeza","Islandeza");
		addOption(document.pas1.limba_sursa, "Italiana","Italiana");
		addOption(document.pas1.limba_sursa, "Japoneza","Japoneza");
		addOption(document.pas1.limba_sursa, "Maghiara","Maghiara");
		addOption(document.pas1.limba_sursa, "Norvegiana","Norvegiana");
		addOption(document.pas1.limba_sursa, "Olandeza","Olandeza");
		addOption(document.pas1.limba_sursa, "Poloneza","Poloneza");
		addOption(document.pas1.limba_sursa, "Portugheza","Portugheza");
		addOption(document.pas1.limba_sursa, "Romana","Romana");
		addOption(document.pas1.limba_sursa, "Rromani","Rromani");
		addOption(document.pas1.limba_sursa, "Rusa","Rusa");
		addOption(document.pas1.limba_sursa, "Sarba","Sarba");
		addOption(document.pas1.limba_sursa, "Slovaca","Slovaca");
		addOption(document.pas1.limba_sursa, "Slovena","Slovena");
		addOption(document.pas1.limba_sursa, "Spaniola","Spaniola");
		addOption(document.pas1.limba_sursa, "Suedeza","Suedeza");
		addOption(document.pas1.limba_sursa, "Thai","Thai");
		addOption(document.pas1.limba_sursa, "Turca","Turca");
		addOption(document.pas1.limba_sursa, "Ucraineana","Ucraineana");
}

function addOption(selectbox,text,value )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}

function removeOption(listbox,i)
	{
		listbox.remove(i);
	}

function remove_dest()
	{
		for(i=document.pas1.limba.options.length-1;i>=0;i--)
			{
				var limba=document.pas1.limba;
				if(document.pas1.limba[i].selected)
					{
						removeOption(limba,i);
					}
			}
	}
function addOption_list()
	{
		for(i=document.pas1.limba_sursa.options.length-1;i>=0;i--)
			{
				var limba_sursa=document.pas1.limba_sursa;
				if(document.pas1.limba_sursa[i].selected)
					{
						addOption(document.pas1.limba, document.pas1.limba_sursa[i].value, document.pas1.limba_sursa[i].value);
						removeOption(limba_sursa,i);
					}
			}
	}
function addBackOption_list()
	{
		for(i=document.pas1.limba.options.length-1;i>=0;i--)
			{
				var limba=document.pas1.limba;
				if(document.pas1.limba[i].selected)
					{
						addOption(document.pas1.limba_sursa, document.pas1.limba[i].value, document.pas1.limba[i].value);
						removeOption(limba,i);
					}
			}
	}

function move_all_Option(selectbox)
	{
		for(i=document.pas1.limba_sursa.options.length-1;i>=0;i--)
			{
				var limba_sursa=document.pas1.limba_sursa;
				addOption(document.pas1.limba, document.pas1.limba_sursa[i].value, document.pas1.limba_sursa[i].value);
			}
		removeAllOptions(document.pas1.limba_sursa);
	}

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function check_creeaza_evenimente()
	{
	if(chkObject(false,'completat'))
		if((document.getElementById('titlu').value!="Titlul evenimenului - Maxim 30 caractere")&&(document.getElementById('descriere').value!="Descrierea evenimenului - Maxim 1000 caractere")&&(document.getElementById('tip_eveniment').value!="")&&(document.getElementById('ziua').value!="")&&(document.getElementById('luna').value!="")&&(document.getElementById('anul').value!="")&&(document.getElementById('tara').value!="")&&(document.getElementById('judet').value!="")&&(document.getElementById('oras').value!="")&&(document.getElementById('adresa').value!="Adresa"))
			{
				document.getElementById('completat').innerHTML = '<input name="Button1" type="button" value="Vizualizeaza" onclick="evaluate_form_evenimente(\'preview\');" class="button2" />';
			}else{document.getElementById('completat').innerHTML = '* butonul va aparea dupa ce tot formularul este completat';}
	}

function change_orase(container,judet)
	{
		document.getElementById(container).innerHTML ='<select id="oras" name="oras" onchange="this.style.color=\'#333333\'" style="color:#999999;width:170px;" ><option value="'+orase[judet]+'" selected="selected">'+orase[judet]+'</option><option value="Alt oras">Altul</option></select>';
	}
var orase=new Array();
orase['']='Alegeti Judetul';
orase['Altul']='Strainatate';
orase['Alba']='Alba Iulia';
orase['Arad']='Arad';
orase['Arges']='Pitesti';
orase['Bacau']='Bacau';
orase['Bihor']='Oradea';
orase['Bistrita-Nasaud']='Bistrita';
orase['Botosani']='Botosani';
orase['Brasov']='Brasov';
orase['Braila']='Braila';
orase['Buzau']='Buzau';
orase['Caras-Severin']='Resita';
orase['Calarasi']='Calarasi';
orase['Cluj']='Cluj Napoca';
orase['Constanta']='Constanta';
orase['Covasna']='Sfantu Gheorghe';
orase['Dambovita']='Targoviste';
orase['Dolj']='Craiova';
orase['Galati']='Galati';
orase['Giurgiu']='Giurgiu';
orase['Gorj']='Targu Jiu';
orase['Harghita']='Miercurea Ciuc';
orase['Hunedoara']='Deva';
orase['Ialomita']='Slobozia';
orase['Iasi']='Iasi';
orase['Ilfov']='Bucuresti';
orase['Maramures']='Baia Mare';
orase['Mehedinti']='Drobeta Turnu Severin';
orase['Mures']='Targu Mures';
orase['Neamt']='Piatra Neamt';
orase['Olt']='Slatina';
orase['Prahova']='Ploiesti';
orase['Satu Mare']='Satu Mare';
orase['Salaj']='Zalau';
orase['Sibiu']='Sibiu';
orase['Suceava']='Suceava';
orase['Teleorman']='Alexandria';
orase['Timis']='Timisoara';
orase['Tulcea']='Tulcea';
orase['Vaslui']='Vaslui';
orase['Valcea']='Ramnicu Valcea';
orase['Vrancea']='Focsani';
