$(function() {
	$(".iframe").fancybox({titleShow:false,type:"ajax",autoDimensions:true,width:400,scrolling:"no"});
	$("a.fancybox").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});
	
	$("a.fancyvideo").click(function() {
		$.fancybox({
			'speedIn':	600, 
			'speedOut':	200, 
			'autoscale': false,
			'overlayShow':	false,
			'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1',
			'type': 'swf',
			'swf': {
				'wmode': 'transparent',
				'allowfullscreen': 'true'
			}
		});
		return false;
	});	
	
	if($(".accordion").length > 0) $(".accordion").accordion({autoHeight : false});
	$(".slidedown h4").click(function () {
		$(this).toggleClass("active");
		$(this).next().slideToggle();
		return false;
	});
	
	$(".faq_vote").click(function(el) {
		var idFaq = $(this).attr("id").substr(5);
		$.post(ROOT+"assets/php/ajax.php",{action:"like",faq_id:idFaq}, function(data) {
			if(data == "true") $("#nbr_vote_"+idFaq).html( Number($("#nbr_vote_"+idFaq).html()) + 1 );
		});
		return false;
	});
});
