
$(document).ready(function (){
  $("#fpress").marquee();
});
//images hover
			$(document).ready(function(){
				$("img.a").hover(
				function() {
				$(this).stop().animate({"opacity": "0"}, "slow");
				},
				function() {
				$(this).stop().animate({"opacity": "1"}, "slow");
				});
			});

//scroll

		function MainTrack(){
			$("#MainTrack").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track1(){
			$("#Track1").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track2(){
			$("#Track2").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track3(){
			$("#Track3").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track4(){
			$("#Track4").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track5(){
			$("#Track5").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track6(){
			$("#Track6").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track7(){
			$("#Track7").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track8(){
			$("#Track8").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track9(){
			$("#Track9").animate({"height": "toggle"}, { duration: 1000 });
			}
		function Track10(){
			$("#Track10").animate({"height": "toggle"}, { duration: 1000 });
			}
			
		function Hide(id) {
			document.getElementById(id).style.display='none';
		}
$(function(){
	var loader=$('#loader');
	var pollcontainer=$('#pollcontainer');
	loader.fadeIn();
	//Load the poll form
	$.get('poll.php', '', function(data, status){
		pollcontainer.html(data);
		animateResults(pollcontainer);
		pollcontainer.find('#viewresult').click(function(){
			//if user wants to see result
			loader.fadeIn();
			$.get('poll.php', 'result=1', function(data,status){
				pollcontainer.fadeOut(1000, function(){
					$(this).html(data);
					animateResults(this);
				});
				loader.fadeOut();
			});
			//prevent default behavior
			return false;
		}).end()
		.find('#pollform').submit(function(){
			var selected_val=$(this).find('input[name=poll]:checked').val();
			if(selected_val!=''){
				//post data only if a value is selected
				loader.fadeIn();
				$.post('poll.php', $(this).serialize(), function(data, status){
					$('#formcontainer').fadeOut(100, function(){
						$(this).html(data);
						animateResults(this);
						loader.fadeOut();
					});
				});
			}
			//prevent form default behavior
			return false;
		});
		loader.fadeOut();
	});
	
	function animateResults(data){
		$(data).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);
							});
						});
	}
	
});
