//ajax

function newsletter() {
	if($('#email').val()!=""){
		email=$('#email').val();
		$('#search-box2').html("<div style='height:20px;margin-right:70px;padding-top:5px' align='center'><img src='"+url_base+"css/images/loader.gif' border='0'></div>");
		$.ajax({
			url: url_base+'ajax/newsletter.php',
			type: 'GET',
			cache: false,
			dataType: 'html',
			data: '&email='+email,
			success: function(responseText){
				$('#search-box2').html(responseText);
			}
		});
	}
}

function sondaj(id, nr, j) {
	id_ales=ales=0;
	for(i=1;i<=nr;i++) {
		if($('#sondaj'+j+" .raspuns"+i).is(':checked')==true) {
			ales=1;
			id_ales=$('#sondaj'+j+" .raspuns"+i).val();
			break;
		}
	}
	if(ales==0) {
		alert('Alege o optiune!');
	}else{
		$('#sondaj'+j).html("<div style='height:170px;margin:0 auto;' align='center'><br /><br /><br /><br /><br /><img src='"+url_base+"css/images/loader2.gif' border='0'></div>");
		$.ajax({
			url: url_base+'ajax/sondaj.php',
			type: 'GET',
			cache: false,
			dataType: 'html',
			data: '&id_sondaj='+id+'&j='+j+'&rasp='+id_ales,
			success: function(responseText){
				arr=responseText.split("___");
				$('#sondaj'+j).html(arr[1]);
				vals=arr[0].split("_");
				for(i=0;i<vals.length;i++) {
					$('#sondaj'+j+" div#vote"+j+"_"+(i+1)).animate({ width: Math.round(vals[i]*1.45)+"px"}, 1000 );
				}
			}
		});
		
	}
}