
function ShowPoll( action, pollId ) {

	var pollElement = $('#surveyContent');
	
	// Chech for selected answer
	if(action == 'answer'){
		
		for (var i=0; i < document.pollForm.answer.length; i++){
			
			if (document.pollForm.answer[i].checked) var selectedAnswer = document.pollForm.answer[i].value;
		}
		
	}
	
	//send request
	$.post("ajaxResponder.php", { polls: "1", action: action, pollId: pollId, answerId: selectedAnswer },
		  function(data){
		    pollElement.html(data);
	});
}

function ShowWeather( lid ) {
	
	var container = $('#navWeather');
	
	//send request
	$.post("ajaxResponder.php", { weather: "1", lid: lid },
		  function(data){
		    container.html(data);
		    
		   if($.browser.msie) fixPng( document.getElementById('pngWeather') );
	});
	
	$('#searchCity').hide();
}

function SearchCity() {
	
	var sValue = $('#searchCityField').val();
	var container = $('#searchCityResults');
		
	if(sValue) {
		sValue = encodeURI(sValue);
		//send request
		$.post("ajaxResponder.php", { city: sValue },
			  function(data) {
			    container.html(data);
		});
	}
}

function increaseRating( articleId ){
	
	$.post("ajaxResponder.php", { rating: articleId },
			  function(data) {
			    $('.RatingIn'+articleId).html(data);
		});
		
}

function delComment( cId , aId){
	
	var answer = confirm ("Сигурен ли си че искаш да изтриеш коментара?");

	if (answer){
		
		$.post("ajaxResponder.php", { delComment: cId, articleId: aId },
			  function(data) {
			  	
					$('#comment'+cId).css("background","#fb6c6c");
					$('#comment'+cId).slideUp(1000,function() {
					            $('#comment'+cId).remove();
          });

			});
	}
}
