

fs_original= 14;
fs_pas = 0;
fs_actual = 0;
function plus_text() {
	fs_pas+=2;
	fs_actual = fs_original + fs_pas;
	document.getElementById("continut_articol").style.fontSize = fs_actual + "px";
}
function minus_text() {
	fs_pas-=2;
	if(-fs_pas>fs_original)
	{
		fs_pas = -fs_original;
		return;
	}
	fs_actual = fs_original + fs_pas;
	document.getElementById("continut_articol").style.fontSize = fs_actual + "px";
}
function form_comentarii()
{
	nume=document.getElementById('nume').value;
	email=document.getElementById('email').value;
	comentariu=document.getElementById('comentariu').value;
	
	if (nume.length==0) 
	{
		alert ("Introduceti numele");
		return false;
	}
	if (email.length==0) 
	{
		alert ("Introduceti adresa email");
		return false;
	}
	if (comentariu.length==0) 
	{
		alert ("Introduceti comentariul");
		return false;
	}
	return true;
}
function adauga_comentariu()
{
	document.getElementById("adauga_comentariu").style.display = "";
}
function open_window(url,width,height)
{
	xpoz=Math.round((screen.width-width)/2);
	ypoz=Math.round((screen.height-height)/2);
	if (xpoz<0) xpoz=10;
	if (ypoz<0) ypoz=10;
	newWindow=window.open (url ,'gsp_window','toolbar=no,scrollbars=yes,width='+width+',height='+height+', left='+xpoz+', top='+ypoz);
	newWindow.focus();
	false;
}
function form_mail()
{
	nume=document.getElementById('nume').value;
	email_to=document.getElementById('email_to').value;
	if ((email_to.length<5) || (email_to.search('@') == -1) || (email_to.search('.') == -1)) 
	{
		alert ("Email destinatar invalid");
		return false;
	}
	else if (nume.length==0) 
	{
		alert ("Introduceti numele");
		return false;
	}
	return true;
}
function show_content(curent,total,id_caseta)
{
	for(i=1;i<=total;i++)
	{
		if(i==1) document.getElementById("clapeta_"+i+"_"+id_caseta).className = "first";
		else if(i==total) document.getElementById("clapeta_"+i+"_"+id_caseta).className = "last";
		else document.getElementById("clapeta_"+i+"_"+id_caseta).className = "";
		document.getElementById("content_"+i+"_"+id_caseta).style.display = "none";
	}
	if(curent==1 && total==1) document.getElementById("clapeta_"+curent+"_"+id_caseta).className = "first last selected";
	else if(curent==1) document.getElementById("clapeta_"+curent+"_"+id_caseta).className = "first selected";
	else if(curent==total) document.getElementById("clapeta_"+curent+"_"+id_caseta).className = "last selected";
	else document.getElementById("clapeta_"+curent+"_"+id_caseta).className = "selected";
	document.getElementById("content_"+curent+"_"+id_caseta).style.display = "";
}
function show_full_stars(i,total,b)
{
	for(j=1;j<=i;j++)
	{
		curent=1;
		if(j%2==0) curent=2;
		document.getElementById(b+"_"+j).src="/images/articol/"+curent+"_half_full_star.gif";
	}
	for(j=i+1;j<=total;j++)
	{
		curent=1;
		if(j%2==0) curent=2;
		document.getElementById(b+"_"+j).src="/images/articol/"+curent+"_half_empty_star.gif";
	}
}
function hide_full_stars(total,b)
{
	for(j=1;j<=total;j++)
	{
		curent=1;
		if(j%2==0) curent=2;
		document.getElementById(b+"_"+j).src="/images/articol/"+curent+"_half_empty_star.gif";
	}
}
function vote_article(articol,vot)
{
	url = "/index.php?section=articol&screen=votare&ajax=1&id="+articol+"&voteaza="+vot;
	new Ajax.Request(url,{onLoading: function() {$('articol_noteaza').update("Se incarca ...");},onComplete: function(resp) {$('articol_noteaza').update(resp.responseText);}});
}
var clapete=new Array();
function schimba_clapete(clapeta,valoare,id_caseta)
{
	if (clapeta==1)
	{
		$('clapeta1['+id_caseta+']').style.backgroundColor='#ffffff';
		$('clapeta2['+id_caseta+']').style.backgroundColor='#E6EBED';
		$('clapeta3['+id_caseta+']').style.backgroundColor='#E6EBED';
	}
	else if (clapeta==2)
	{
		$('clapeta1['+id_caseta+']').style.backgroundColor='#E6EBED';
		$('clapeta2['+id_caseta+']').style.backgroundColor='#ffffff';
		$('clapeta3['+id_caseta+']').style.backgroundColor='#E6EBED';
	}
	else if (clapeta==3)
	{
		$('clapeta1['+id_caseta+']').style.backgroundColor='#E6EBED';
		$('clapeta2['+id_caseta+']').style.backgroundColor='#E6EBED';
		$('clapeta3['+id_caseta+']').style.backgroundColor='#ffffff';
	}
	//alert(clapeta+'-'+valoare+'-'+id_caseta);
	$('container_blog['+id_caseta+']').innerHTML=clapete[id_caseta][valoare];
}
function open_poza(imagine,width,height,a)
{
	if(a.parentNode.tagName=="A") return false;
	xpoz=Math.round((screen.width-width)/2);
	ypoz=Math.round((screen.height-height)/2);
	if (xpoz<0) xpoz=10;
	if (ypoz<0) ypoz=10;
	newWindow=window.open('/image.php?imagine='+imagine+'&id=<?=$articol_id?>' ,'poza_window','toolbar=no,scrollbars=no,width='+width+',height='+height+', left='+xpoz+', top='+ypoz);
	newWindow.focus();
}	
/*functia de schimbare a clapetelor in cadrul clasametului din sectiunea LIVE*/
function schimba_clasament(tip)
{
	if (tip=='deplasare')
	{
		$("cl_deplasare").className = "part_3 orange_bgr";
		$("cl_acasa").className = "part_3";
		$("cl_general").className = "part_3";
		
		$("cont_general").style.display="none";
		$("cont_acasa").style.display="none";
		$("cont_deplasare").style.display="inline";
		
		$('lbl_adevar').innerHTML="&nbsp;";
	}
	else if (tip=='acasa')
	{
		$("cl_deplasare").className = "part_3";
		$("cl_acasa").className = "part_3 orange_bgr";
		$("cl_general").className = "part_3";
		
		$("cont_general").style.display="none";
		$("cont_deplasare").style.display="none";
		$("cont_acasa").style.display="inline";
		
		$('lbl_adevar').innerHTML="&nbsp;";
	}
	else
	{
		$("cl_deplasare").className = "part_3";
		$("cl_acasa").className = "part_3";
		$("cl_general").className = "part_3 orange_bgr";
		
		$("cont_deplasare").style.display="none";
		$("cont_acasa").style.display="none";
		$("cont_general").style.display="inline";
		
		$('lbl_adevar').innerHTML="+/-";
	}
	return false;
	
}
function comentariu_change()
{
	max_length = 500;
	length_val = $('comentariu').value.length;
	$('comentariu_status').value = max_length-length_val;
	if(length_val>max_length)
	{
		$('comentariu').value = $('comentariu').value.substr(0,max_length);
		$('comentariu_status').value = 0;
		$('comentariu').scrollTop = $('comentariu').scrollHeight;
	}
	if($('comentariu_status').value==0) $('comentariu_status').style.color = "red";
	else $('comentariu_status').style.color = "green";
}
