function show_sub (categId)
{
	//alert(categId)
	if (categId != 0)
	{
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=show_subcateg&categId="+categId,
				success: function(response) {
					//alert (response);
					//$("#loader22").hide();
					$("#subcategorie").html(response);
					
				}
			});	
	}
	else 
	{
		$("#subcategorie").html('<option value="0">Nici o subcategorie</option>');
	}
}
function vinsieu (id,evitemId) {
	//$("#loader22").show();
	//alert (evitemId);
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=vinsieu&userId="+id+"&evitemId="+evitemId,
				success: function(response) {
					//alert ('merge');
					//$("#loader22").hide();
					if (response != 0)
					{
							if (response == 1) { p = 'participant'; } else { p = 'participanti' }
						$("#participanti").html ('<strong>'+response+'</strong> '+p);
					}
					else 
					{
						mesaj ('Ati mai votat','info');
						
					}
					
				}
			});	
	

}
//######################### FOLOSIT LA TOP CAUTARI #################################
function change_top_cautari (id,tab,foto)
{
	//$("#top_cautari_holder").slideUp("fast");
	//$("#top_cautari_holder").html("");
	
			i = 0;
			while (document.getElementById("tab_top" + i) != null) {
				//document.getElementById("div_top" + i).style.display = "none";
				document.getElementById("tab_top"+i).className = "";
				i++;
			}
			//document.getElementById("div_top" + T).style.display = "block";
			document.getElementById("tab_top" + tab).className = "active";
	
	
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=change_top_cautari&scategId="+id+"&foto="+foto,
				success: function(response) {
					//alert ('merge');
					//$("#loader22").hide();
					//$("#top_cautari_holder").slideDown("slow",function() {
					
					
					$("#top_cautari_holder").html (response);												 
																	 
						//											 });
					
				}
			});	
}


//###################################### SHOW TAB FOLOSIT LA HOROSCOP SI GALERIE FOTO LA FIRME SI EVENIMENTE #############################
 function ShowTab(T)
	{
		
i = 0;
			while (document.getElementById("tab" + i) != null) {
				document.getElementById("div" + i).style.display = "none";
				document.getElementById("tab"+i).className = "";
				i++;
			}
			document.getElementById("div" + T).style.display = "block";
			document.getElementById("tab" + T).className = "active";
			
	}
 
//################## FOLOSIT LA VERIFICARE SONDAJ ####################

function check_pool ()
{
	var value = $('[name=answer]:checked').val();
	
	if (value !=undefined)
	{
		
		val = true;	
	}
	else 
	{
		alert ('Va rugam selectati un raspuns');
		val = false; 
	}
	//$('input[name=othersTransLink]:checked').val() 
	//alert (value);
	return val;
}
 
 
 
 //############################ ABONARE LA NEWSLETTER #####################
 
 function abonare ()
 {
	 var email = $("#newsletterEmail").val();
	 
	 $.ajax({
				url: '/scripts/users.php',
				type: 'POST',
				data: "action=newsletter&email="+email+"&java=1",
				success: function(response) {
					//alert (response);
					//$("#loader22").hide();
					//$("#top_cautari_holder").slideDown("slow",function() {
																		// $("#news_btn").html('<img src="/loader.gif" class="news_btn">');
						
						if (response !='Adresa de e-mail incorecta!')
						{
							$("#input_email").html('<div class="news_text" >'+response+'</div>');
							$("#news_btn").html('');
						}
						else 
						{
							$("#input_email").html('<div class="news_text" >'+response+'</div>');
							$("#input_email").fadeIn("slow").animate({opacity: 1.0}, 2000, function(){$("#input_email").html('<input class="news_input" type="text"  name="newsletterEmail" id="newsletterEmail" />');});
							
						}
						//
						
						
					
					//$("#top_cautari_holder").html (response);												 
																	 
						//											 });
					
				}
			});	
	 
	return false; 
 }
 
 //################################# FOLOSITA PENTRU AFISAREA AZI LA CINEVA ####################
 function show_cinema ()
 { 
 
 	document.getElementById("dv0").style.display = "none";
	document.getElementById("dv1").style.display = "block";
	
 	document.getElementById("tb0").className = "left pointer buton_portocaliu";
	document.getElementById("tb1").className = "left pointer buton_albastru";
 }
 
  function show_evenimente ()
 { 
 	document.getElementById("dv1").style.display = "none";
	document.getElementById("dv0").style.display = "block";
 
 	document.getElementById("tb1").className = "left pointer buton_portocaliu";
	document.getElementById("tb0").className = "left pointer buton_albastru";
 }



//############################# VOTING STAR ##########################

$(function(){
 $('.star').rating({
  callback: function(value, link){
	  
	  //var val = value.split(",");
	 // var firmaId =$("#firmaId").val();
	 //alert (firmaId);
	
   /*
   				$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=rating_firma&value="+value+"&firmaId="+firmaId,
				success: function(response) {
					//alert (response);
					if (response != 'already')
					{
						var sp = response.split (",");
						//alert (response)
							
						
						//$("#star"+val[0]).attr("checked","checked");	
						//$("#rating").html(sp[2]);
				
						
						var stars ='';
						//$('.star').rating('disable');
						for (i=1;i<=5;i++)
						{
							if (i <= sp[0])
							{
								var stars = stars + '<div class="star-rating star-rating-on" ><a href="#" ></a></div>';
							}
							else 
							{
								var stars = stars + '<div class="star-rating" ><a href="#" ></a></div>';
							}
						}
						
						$("#stars").html(stars);
						$("#nota"+firmaId).html('Nota: '+sp[0]+' din '+sp[1]+' voturi');
						
					}
					else 
					{
						//alert ('Ati mai votat');	
					}
				}
			});	
			*/
			$("#nota").val(value);
			$("#msg_error").hide(); 
   	
   
   
  }
 });
});
//################# VOTARE JOCURI ##############
$(function(){
 $('.star_joc').rating({
  callback: function(value, link){
	  
	  //var val = value.split(",");
	  var jocId =$("#jocId").val();
	// alert (jocId);
	
   
   				$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=rating_joc&value="+value+"&jocId="+jocId,
				success: function(response) {
					//alert (response);
					if (response != 'already')
					{
						var sp = response.split (",");
						//alert (response)
							
						
						//$("#star"+val[0]).attr("checked","checked");	
						//$("#rating").html(sp[2]);
				
						
						var stars ='';
						//$('.star').rating('disable');
						for (i=1;i<=5;i++)
						{
							if (i <= sp[0])
							{
								var stars = stars + '<div class="star-rating star-rating-on" ><a href="#" ></a></div>';
							}
							else 
							{
								var stars = stars + '<div class="star-rating" ><a href="#" ></a></div>';
							}
						}
						
						$("#stars").html(stars);
						//$("#nota"+firmaId).html('Nota: '+sp[0]+' din '+sp[1]+' voturi');
						mesaj ('Vot efectuat cu succes!','success');
						
					}
					else 
					{
						//alert ('Ati mai votat');	
					}
				}
			});	
   	
   
   
  }
 });
});

//################## stripslashes ########################
function stripslashes (str) {
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ates Goral (http://magnetiq.com)
    // +      fixed by: Mick@el
    // +   improved by: marrtins
    // +   bugfixed by: Onno Marsman
    // +   improved by: rezna
    // +   input by: Rick Waldron
    // +   reimplemented by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: stripslashes('Kevin\'s code');
    // *     returns 1: "Kevin's code"
    // *     example 2: stripslashes('Kevin\\\'s code');
    // *     returns 2: "Kevin\'s code"
    return (str+'').replace(/\\(.?)/g, function (s, n1) {
        switch (n1) {
            case '\\':
                return '\\';
            case '0':
                return '\0';
            case '':
                return '';
            default:
                return n1;
        }
    });
}

//############################## AFISAREA DE MESAJE IN TOP-UL PAGINII ###############################
function mesaj (mesaj,mesaj_tip)
{

		$("#mesaj_text").addClass(mesaj_tip);
		$("#mesaj_text").html (mesaj);
	$("#mesaj_sus")
	.fadeIn('slow')
	.animate({opacity: 1.0}, 3000)
	.fadeOut('slow', function() {
							  
			
	});	
	
}

//###################################### AUTOCOMPLETE ################################

function autocomplete22 ()
{

	//alert ('gica');
	var key =$("#keyword").val();
	
	reWhiteSpace = new RegExp(/^\s+$/);
	
	if (key !='' )
	{
		$("#cauta_btn").attr('disabled','');
		
		if (key.length >= 2)
		{
			$.ajax({
					url: '/ajax.php',
					type: 'POST',
					data: "action=search&key="+key,
					success: function(response) {
						if (response.length > 0)
						{
							$("#autocomplete_holder").show();
							$("#autocomplete").html(response);
							//$("#debug").html(response);
						}
						else 
						{
							$("#autocomplete_holder").hide();	
						}
					}
				});	
			
		}
		else 
		{
				$("#autocomplete_holder").hide();
		}
	}
	else 
	{
		//alert ('nu merge');
	}
}

function close_div(div)
{
	//alert('inchider');
	
	$("#"+div).slideUp('fast');
}

function clear_input (item)
{
	$("#"+item).val('');
	$("#"+item).attr('onclick','');
}	

//######################## CAUTARE ######################

function go_cauta (nr_f,nr_ev)
{
	//	alert (nr_f +' si '+ nr_ev)
	var domainname = new String(location.host); 
	var zona = $("#zona").val();
	
	var keys = $("#keyword").val();
	
	if (zona != 0)
	{
		zona ='?filtru0='+zona;
	}
	else 
	{
		zona = '';
	}
	if (parseInt (nr_f) ==0 && parseInt (nr_ev) == 0)
	{
		mesaj ('Cuvintele dupa care ati cautat nu au returnat nici un rezultat. Va rugam mai incercati','error');
		return false;
	}
	else 
	{
		
		if (parseInt (nr_f) >= parseInt (nr_ev))
		{
			window.location.href='http://'+domainname+'/cauta/'+stripslashes(keys)+'/f'+zona;	
		}
		else 
		{
			window.location.href='http://'+domainname+'/cauta/'+keys+'/e'+zona;	
		}
	}
}


//################ cautare de la recenzii ####################

function go_cauta2()
{
	var domainname = new String(location.host); 
	var keys = $("#keyword2").val();
	if (keys !='')
	{
		window.location.href='http://'+domainname+'/cauta/'+stripslashes(keys)+'/f';
	}
	else
	{
		mesaj ('Campul nu poate fi gol','info');
	}
}

//################### CLOSE MESAJ INFO ##########################
function close_mesaj (id)
{
	$.ajax({
						url: '/ajax.php',
						type: 'POST',
						data: "action=close_mesaj&id="+id,
						success: function(response) {
							if (response == '1')
							{
								$("#mesaj_info").hide();
								//$("#autocomplete").html(response);
								//$("#debug").html(response);
							}
							else 
							{
								//$("#autocomplete_holder").hide();	
							}
						}
				});	
}

//#################### CHECK USER ###################

function check_user (user)
{
	//alert (user);
	$.ajax({
		url: '/ajax.php',
		type: 'POST',
		data: "action=check_user&user="+user,
		success: function(response) {
		//alert(response);
			$("#loader").html('<img src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');
			if (response == '1')
			{	
				$("#user").removeClass('normal_border');			
				$("#user").addClass('error_border');
				//$("#user").val('');
				$("#errmsg").html('Acest utilizator mai exista in baza de date');
			}
			else 
			{
				$("#user").removeClass('error_border');
				$("#user").addClass('normal_border');
				$("#errmsg").html('');
			}
			$("#loader").html('');
		}
	});	

}
//#################### CHECK EMAIL ###################

function check_email (email)
{

	
if (email !='')
{	
	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	if(emailReg.test(email)) {
		//alert (email);
			$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=check_email&email="+email,
				success: function(response) {
				//alert(response);
					$("#loader2").html('<img src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');
					if (response == '1')
					{				
						$("#email").removeClass('normal_border');
						$("#email").addClass('error_border');
						//$("#email").val('');
						$("#errmsg2").html('Aceasta adresa de email exista deja in baza de date');
					}
					else 
					{
						$("#email").removeClass('error_border');
						$("#email").addClass('normal_border');
						$("#errmsg2").html('');
					}
					$("#loader2").html('');
				}
			});	
	}
}	
		

}

//###################### SLIDE DIV'S ##########################
function slide (object1, object2)
{

//alert (object);


	 if ($("#"+object1).is(":hidden")) 

	 {
	 	// $("#"+object).show();
	 	$("#"+object2).slideUp();
	 	 $("#"+object1).slideDown();

	 }
	 else 
	 {
	 	// $("#"+object).hide();
	 		$("#"+object1).slideUp();
	 	 $("#"+object2).slideDown();



	 }

}


//###################### show hide DIV'S ##########################
function showhide (object1)
{

//alert (object);


	 if ($("#"+object1).is(":hidden")) 

	 {
	 	// $("#"+object).show();
	 	
	 	 $("#"+object1).show();

	 }
	 else 
	 {
	 	// $("#"+object).hide();
	 		$("#"+object1).hide();
	 	 

	 }

}

//###################### CHAR COUNT #############################
function counter(item,caractere2)
{
	//alert(caractere);

     // get current number of characters  
     var caractere =$("#"+item).val();
     var length = $("#"+item).val().length; 
    // alert (length);
     
     //$("#counter").html(remain+' caratere ramase');
  
  
  if (length > caractere2) {
		$("#"+item).val(caractere.substring(0, caractere2));
	} else {
		$("#counter_"+item).html( parseInt(caractere2) - parseInt(length)+ ' caractere ramase');
		
		if (length > 1)
		{
			$("#funny").html('Ai luat startul pentru 10 puncte. Scrie 300 de caractere si sunt ale tale! Daca nu, ramai cu un punct din oficiu.');
		}
		
		if (length > 50)
		{
			$("#funny").html('Esti pe drumul cel bun!');
		}
		
		if (length > 150)
		{
			$("#funny").html('Hai ca se poateeeee...');
		}
		
		if (length > 250)
		{
			$("#funny").html('Inca putin...');
		}
		
		if (length > 300)
		{
			$("#funny").html('Yupiii, ai luat punctele!');
		}



		//alert ("counter_"+item);
	}
	

 
}

//##################### VOT UP ####################################
function vot_up (commentId,imagineup,imaginedown)
{
	//alert(commentId);
	
	$("#hand_up"+commentId).html('<img class=" margine_dreapta" src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');
	
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=vot_up&commentId="+commentId,
				success: function(response) {
				//alert(response);
					
					
					$("#hand_up"+commentId).html('<img class=" margine_dreapta" src="'+imagineup+'" alt="Loading" id="loading" width="16" height="16" />');
					$("#hand_down"+commentId).html('<img class=" " src="'+imaginedown+'" alt="Loading" id="loading" width="16" height="16" />');
					
					
					if (parseInt(response) >= 0 )
					{
						if (parseInt(response) == 0)
						{
							response = response;
							culoare ="verde";
						}
						else 
						{
							response = "+"+response;
							culoare ="verde";
						}
						
					}
					else 
					{
						culoare = "rosu";
					}
					
					$("#media2"+commentId).html('( <span class="'+culoare+'"><b>'+response+'</b></span> )');

					//$("#loader2").html('');
				}
			});	
	

}



//##################### VOT DOWN ####################################
function vot_down (commentId,imagineup,imaginedown)
{
	//alert(commentId);
	
	$("#hand_down"+commentId).html('<img class=" " src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');
	
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=vot_down&commentId="+commentId,
				success: function(response) {
				//alert(response);
					
					
					
					$("#hand_down"+commentId).html('<img class=" " src="'+imaginedown+'" alt="Loading" id="loading" width="16" height="16" />');
					$("#hand_up"+commentId).html('<img class=" margine_dreapta" src="'+imagineup+'" alt="Loading" id="loading" width="16" height="16" />');
					
					if (parseInt(response) >= 0 )
					{
						if (parseInt(response) == 0)
						{
							response = response;
							culoare ="verde";
						}
						else 
						{
							response = "+"+response;
							culoare ="verde";
						}					
					}
					else 
					{
						culoare = "rosu";
					}
					
					$("#media2"+commentId).html('( <span class="'+culoare+'"><b>'+response+'</b></span> )');

					//$("#loader2").html('');
				}
			});	
	

}

//##################### TRIMITE RASPUNS ####################################
function trimite_raspuns (commentId,userId)
{
	var raspuns = $("#raspuns"+commentId).val();
	var url = $("#url").val();
	
	if (raspuns == '' )
	{
		$("#rerr"+commentId).html('<div class="error">Campul raspuns trebuie completat</div>');
	}
	else 
	{
	
		$("#trimite_btn"+commentId).html('<img class=" " src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');
		$.ajax({
					url: '/ajax.php',
					type: 'POST',
					data: "action=trimite_raspuns&commentId="+commentId+"&raspuns="+raspuns,
					success: function(response) {
					//alert(url);
	
						//$("#trimite_btn"+commentId).html('<input type="text" name="trimite" value="trimite">');
						if (userId == 6 )
						{
							
							$("#rasp"+commentId).html('<div class="clear"></div><div class="border">Raspunsul a fost adaugat. Daca doriti sa fiti recunoscut ca autor al acestuia va rugam sa va <a class="albastru" href="#"  alt="Intrare in cont" onclick="tb_show(\'Login\',\'/popup.php?act=log_in&height=480&width=680&modal=true\'); return false;">logati</a> sau sa va <a class="albastru" href="#"  alt="Inregistrare" onclick="tb_show(\'Cont nou\',\'/popup.php?act=cont_nou&height=480&width=680&modal=true\'); return false;">inregistrati</a>.</div>');	
						}
						else 
						{
							window.location.href=url;
						}
					}
				});	
			
	
	}
}

//##################### TRIMTE RECENZIE ########################
function trimite_recenzie(userId)
{
	
	var recenzie = $("#descriere").val();
	var itemId = $("#itemId").val();
	var itemTip = $("#itemTip").val();
	var titlu = $("#titlu").val();
	var url = $("#url").val();
	var nota = $("#nota").val();
	var hasError = false;
	
	if (nota == 0)
	{
		hasError = true;
		$("#msg_error").html('<div>Trebuie sa acordati o nota</div>');
		
		//alert ('nota 0');
	}
	else 
	{
		
	}
	if (titlu == '')
	{
		hasError = true;
		$("#msg_error").append('<div>Campul titlu trebuie completat </div>');
		
		
		
		$("#titlu").removeClass('normal_border');
		$("#titlu").addClass('error_border');
		//$("#titlu").addClass ('error_border');
	}
	else 
	{
		if (  parseFloat(titlu.length) < 5 )
		{
			$("#msg_error").append('<div>Campul titlu trebuie sa contina minim 5 caractere </div>');
			hasError = true;
		}
		else 
		{
			$("#titlu").addClass('normal_border');
			$("#titlu").removeClass('error_border');
		}
	}
	if (recenzie == '')
	{
		hasError = true;
		$("#msg_error").append('<div>Campul recenzie trebuie completat</div>');
		
		
		$("#descriere").removeClass('normal_border');
		$("#descriere").addClass('error_border');

	}
	else 
	{
		if (  parseFloat(recenzie.length) < 5 )
		{
			$("#msg_error").append('<div>Campul recenzie trebuie sa contina minim 5 caractere </div>');
			hasError = true;
		}
		else 
		{
			$("#descriere").addClass('normal_border');
			$("#descriere").removeClass('error_border');
		}
	
	}
	
	
	
	
	if (hasError == false )
	{
	//alert ("action=trimite_recenzie&comment="+recenzie+"&itemId="+itemId+"&titlu="+titlu+"&nota="+nota+"&itemTip="+itemTip);
	
	$("#btn_trimite_holder").html('<img class=" " src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');

		$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=trimite_recenzie&comment="+recenzie+"&itemId="+itemId+"&titlu="+titlu+"&nota="+nota+"&itemTip="+itemTip,
				success: function(response) {
				//alert(response);
				
					if (userId == 6 )
					{
						
						$("#recenzie_box_holder").html('<div class="clear"></div><div class="border">Recenzia a fost adaugata. Daca doriti sa fiti recunoscut ca autor al acesteia va rugam sa va <a class="albastru" href="#"  alt="Intrare in cont" onclick="tb_show(\'Login\',\'/popup.php?act=log_in&height=480&width=680&modal=true\'); return false;">logati</a> sau sa va <a href="#" class="albastru  alt="Inregistrare" onclick="tb_show(\'Cont nou\',\'/popup.php?act=cont_nou&height=480&width=680&modal=true\'); return false;">inregistrati</a>.</div>');	
					}
					else 
					{
						
						window.location.href=url;
					}
					
					//$("#trimite_btn"+commentId).html('<input type="text" name="trimite" value="trimite">');
				}
			});	
	}
	else 
	{
		$("#msg_error").fadeIn("slow");
	}
}


function show_user_recenzii(limit,userId)
{
	////alert (limit);
	$("#more").fadeOut("fast");
	$("#more").html('<img class=" " src="/js/thickbox/ajax-loader2.gif" alt="Loading" id="loading" width="16" height="16" />');
	
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=show_user_recenzii&limit="+limit+"&userId="+userId,
				success: function(response) {
				//alert(response);
					//$("#show_user_recenzii").append(function () { response });
					$("#show_user_recenzii")
					.hide()
					.append(response)
					.fadeIn("slow");
						
				if (response != '')
				{	
					$("#more").fadeIn("fast");
					$("#more").html('<button class="border padding_mare orange pointer" style="width:100%"  onclick="show_user_recenzii('+(limit+3)+','+userId+');"><b>Mai mult</b></button>');
				}
				else 
				{
					$("#more").html('');
				}
					
				
				}
			});	

}


//######################### CUMPARA PREMIU #######################
function cumpara_premiu (userId,premiuId)
{
	//alert (userId+' '+premiuId);
	
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=cumpara_premiu&premiuId="+premiuId+"&userId="+userId,
				success: function(response2) {
				//alert(response);
					//$("#show_user_recenzii").append(function () { response });
						
				if (response2 == 1)
				{	
					mesaj ('Premiul a fost cumparat cu succes','success');
				}
				else if (response2 == 2) 
				{
					mesaj ('Nu mai aveti suficient credit pentru a cumpara acest produs','error');
				}
					
				
				
				else 
				{
					mesaj ('S-a produs o eroare. Va rugam mai incercati.','error');
				}
				
			}
			
		});	

}

//############################# STERGERE COMENTARII ######################
function delete_comm (cId)
{
//alert(cId);

var answer = confirm ("Piticule sigur stergi comentariul asta zapacit?");
if (answer)
{

	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=sterge_comentariu&cId="+cId,
				success: function(response2) {
				//alert(response2);
					//$("#show_user_recenzii").append(function () { response });
						
				if (response2 == 1)
				{
					//alert(cId);	
					mesaj ('Comentariu sters','success');
					
					$("#x"+cId).fadeOut('slow');
				}
				
				
				else 
				{
					mesaj ('S-a produs o eroare. Va rugam mai incercati.','error');
				}
				
			}
			
		});	

}

}


function vot_miss (id)
{
	//alert('x');
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=vot_miss&missId="+id,
				success: function(response) {
					//alert ('merge');
					//alert (response);
					//$("#loader22").hide();
					if (response != 0)
					{
						//alert (response);
							if (response == 1) { p = 'vot'; } else { p = 'voturi' }
							$("#nr_v"+id).html (response+' '+p);
						mesaj ('Multumim pentru vot','success');

					}
					else 
					{
						mesaj ('Puteti vota o singura data','info');
						
					}
					
				}
			});	
	


}

function vot_concurs (id,nume_concurs)
{
	//alert(id);
	
	$.ajax({
				url: '/ajax.php',
				type: 'POST',
				data: "action=vot_concurs&picId="+id+"&nume_concurs="+nume_concurs,
				success: function(response) {
					//alert ('merge');
				//	alert (response);
					//$("#loader22").hide();
					if (response != 0)
					{
						//alert (response);
							if (response == 1) { p = 'vot'; } else { p = 'voturi' }
							$("#nr_v"+id).html (response+' '+p);
						mesaj ('Multumim pentru vot','success');

					}
					else 
					{
						mesaj ('Puteti vota o singura data','info');
						
					}
					
				}
			});	
	


}
