
$(".poll input.btn").live("click", function() {
	if(!$(".poll input[type=radio]").is(":checked")) return false;
	$.post("vote.php", $(".poll #voteForm").serialize()+"&ok=ok", function(data) {
		$(".poll").html(data);
		$('.progress_div .progress').each(function(){
			var bar_width=$(this).attr('width');
			$(this).animate({ 'width' : bar_width+"%" }, 1500);
		});
	});
	return false;
});
$(".poll input.results").live("click", function() {
	$.post("vote.php", $(".poll #voteForm").serialize()+"&more=more", function(data) {
		$(".poll").html(data);
		$('.progress_div .progress').each(function(){
			var bar_width=$(this).attr('width');
			$(this).animate({ 'width' : bar_width+"%" }, 1500);
		});
	});
	return false;
});
$(document).ready(function(){ 
	var fontSize = 16;
	/*superfish*/
	$("ul#menu").superfish({ 
		animation: {height:'show'}, 
		delay:0,  
		speed:200
	}); 
	
	$("#increase-font").click(function(){
		fontSize = fontSize + 2;
		fontSize = fontSize>=24 ? 24 : fontSize;
		$(".details-text").find("p,span,div").each(function(){
			$(this).attr("style", $(this).attr("style")+";font-size:"+fontSize+"px;");
		});
		return false;
	});
	
	$("#decrease-font").click(function(){
		fontSize = fontSize - 2;
		fontSize = fontSize<=12 ? 12 : fontSize;
		$(".details-text").find("p,span,div").each(function(){
			$(this).attr("style", $(this).attr("style")+";font-size:"+fontSize+"px;");
		});
		return false;
	});

	$('.progress_div .progress').each(function(){
		var bar_width=$(this).attr('width');
		$(this).css('width', "0").animate({ 'width' : bar_width+"%" }, 1500);
	});

	$(".idTabs .selected").click(function(){
		$('.progress_div .progress').each(function(){
			var bar_width=$(this).attr('width');
			$(this).css('width', "0").animate({ 'width' : bar_width+"%" }, 1500);
		});
	});

	$("ul#menu>li").hover(function(){
		$(this).find("a:first").addClass('hover');
	}, function(){
		$(this).find("a:first").removeClass('hover');
	});

	$("#slider").easySlider({
		auto: true, 
		continuous: true,
		numeric: true
	});

	$("ul.nav li").last().css('margin-left', '0');
	$("ul.newsthumb li").last().css('margin-left', '0');
	$("ul.work li:last-child").css('margin-bottom', '0');
	
	$('.adsens-slide').vTicker({ 
		speed: 800,
		pause: 4000,
		animation: 'fade',
		mousePause: true,
		showItems: 4,
		direction: 'down',
		height: 157
	});

	$('a.play').click(function(){
		var VedioUrl=$(this).attr('href');
		alert(VedioUrl);
		$('#flv_player').attr('href',VedioUrl);
		flowplayer("flv_player", "style/A6yafStyle/swf/flowplayer-3.2.3.swf");
		return false;
	});
	
/*	$('.vedio_show').click(function(){
		var VedioUrl=$(this).attr('href');
		$('#video .home_player').slideDown(500, function(){
			$('#flv_player').attr('href',VedioUrl);
			flowplayer("flv_player", "style/A6yafStyle/swf/flowplayer-3.2.3.swf");
		});
		return false;
	});*/

	/*watermarktext*/
	$("input[watermarktext]").each(function(){
		$(this).addClass("Focus");
		$(this).val($(this).attr("watermarktext"));			
		$(this).focusin(function(){
			if($(this).val()==$(this).attr("watermarktext")){
				$(this).val('');
				$(this).removeClass("Focus");
			}
			}).focusout(function(){
			if($(this).val()==''){
				$(this).val($(this).attr("watermarktext"));
				$(this).addClass("Focus");
			}	
		});
	});
});
