function poza_feature()
{
	//var nr = Math.floor(Math.random()*2);
	//if(nr==1)
	//ia_date_poza();
	//else
	randomize();
}

function render_stele()
{
	for(var i = 1;i<=nr_stele;i++)
	 document.getElementById('stea_'+i).style.color = "green";
	if(nr_stele<5)
    
for(var i=nr_stele+1;i<=5;i++)
 document.getElementById('stea_'+i).style.color = "#999";
}


function stele(x)
{
for(var i=1;i<=x;i++)
 document.getElementById('stea_'+i).style.color = "green";

if(x<5)
for(var i=x+1;i<=5;i++)
 document.getElementById('stea_'+i).style.color = "#999";
}

function ia_date_poza()
{
  var http = getRul();
  var myurl = 'php/date_poza.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = function()
  {
   {
     if (http.readyState == 4)
	 {
     if(http.status == 200) 
	  {
 
	    var parti = new Array();
		  featuri = http.responseText.split("|");   
		  
		  document.getElementById('nume_feature_mare').innerHTML = "<a href='http://www."+featuri[0]+".deviantart.com'>"+featuri[0]+"</a>"+", "+featuri[3];
		  user_curent=featuri[0];
		  titlu_curent = featuri[3];
		  nr_stele = Math.round(featuri[4]/featuri[2]);
	      render_stele(nr_stele);
		  
		  if(featuri[5]==1)
		  document.getElementById('poza_feat').innerHTML = "<img width='600px' src='"+featuri[1]+"'/>";
		  else
		  document.getElementById('poza_feat').innerHTML = "<img width='350px' src='"+featuri[1]+"'/>";
		  		  
		  if(featuri[2]!=1)
		    document.getElementById('nr_vot').innerHTML = featuri[2]+" voturi.";
	      else
		    document.getElementById('nr_vot').innerHTML = featuri[2]+" vot.";
	  }
     } 
	 else {}
  }
 }
  http.send(null);
}

function trimite_stea(x)
{
  var http = getRul();
  var myurl = 'php/set_stea.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&nr="+x+"&user="+user_curent+"&titlu="+titlu_curent;
  http.open("GET", modurl, true);
  http.onreadystatechange = function()
  {
   {
     if (http.readyState == 4)
	 {
     if(http.status == 200) 
	  {
 
	    alert(http.responseText);
		if(http.responseText=="Multumim pentru vot.")
		{
		var nr_v = parseInt(document.getElementById('nr_vot').innerHTML)+1;	
		
		if(nr_v!=1)
		  document.getElementById('nr_vot').innerHTML = nr_v+" voturi.";
	      else
		  document.getElementById('nr_vot').innerHTML = nr_v+" vot.";	
		render_stele(nr_stele);
		}
	  }
     } 
	 else {}
  }
 }
  http.send(null);
}