// JavaScript Document
$(document).ready(function(){

	$("#addmail").click(function(){
	
		 $.ajax({
		   type: 'GET',
		   url: 'addmail.php?email='+ $("input#email").val(),
		   success: function(sonuc) {
			 	$('#sonuc').html(sonuc);
				$("input#email").val('');
		   }
		 });

		return false;
	});
	$("#loginBt").click(function(){
	
		 $.ajax({
		   type: 'GET',
		   url: 'tr_login.php?user='+ $("input#user").val() + '&pass='+ $("input#pass").val(),
		   success: function(sonuc) {
			 	$('#sonuc').html(sonuc);	
		   }
		 });

		return false;
	});
	

	var radioColl = $('#anketBox').find('input[type=radio]');
	var anketID = 0;
	radioColl.click(function()
	{
	  $("#oyla").attr('disabled', false);
	  anketID  = $(this).val();
	});
		
	$("#oyla").click( function (){
		$.ajax({
			type: 'GET',
			url: 'anketoyla.php?anketID='+anketID,
			success: function(sonuc) {
			$("#myanket").hide();
			$('#anketSonuc').html(sonuc);
			$("#anketBox").find('.bar').hide().end().fadeIn('slow', function()
			{
				$(this).find('.bar').each(function()
				{
					var bar_width=$(this).css('width');
					$(this).css('width', '0').animate({ width: bar_width }, 1000);
				});
			});
	   }
	 });
		return false;
	});
	
	 
	$("#viewresult").click(function ()
	{ 	
			$.ajax({
			type: 'GET',
			url: 'anketoyla.php?sonucGoster='+$(this).val(),
			success: function(sonuc) {
				$("#myanket").hide();
				$('#anketSonuc').html(sonuc);
				$("#anketBox").find('.bar').hide().end().fadeIn('slow', function()
				{
					$(this).find('.bar').each(function()
					{
						var bar_width=$(this).css('width');
						$(this).css('width', '0').animate({ width: bar_width }, 1000);
					});
				});			
			}
			});		
			return false;
	});	
});	 

function anketGoster(){
	$("#anketResult").hide();
	$("#myanket").show();
}
