/**
 * @author Nazin
 * @version $Id$
 */

$(document).ready(function() {
	
	$('.rotator').cycle({fx: 'fade', speed: 1000, timeout: 4000});
	
	$('#submenuInner a').mouseenter(function(e) {
		$('#submenuInner .currentArrow').hide();
		$(this).prev().show();
	}).mouseleave(function(e) {
		$('#submenuInner .currentArrow').hide();
		$('#submenuInner .activeArrow').show();
	});
	
	$('#sharer .share-print a').click(function(e) {
		e.preventDefault();
		window.print();
	});
	
	$('.poll form').submit(function(e) {
		e.preventDefault();
		
		var poll = $(this).parent();
		
		if ($('.poll form input[name=answer]:checked').val() == undefined) {
			$('.poll .errors').show();
			return;
		}
		$('.poll .errors').hide();
		$('.poll img').show();
		
		$.post($('#pollVoteId').attr('href'), {qid: $('.poll form #questionId').val(), id: $('.poll form input[name=answer]:checked').val()}, function(data) {
			poll.html(data);
		});
	});
});
