
/* 

    Document   : functions.js
    Created on : 05/07/2011, 23:38:50
    Author     : @vagnermix ( Layout, Front-end e SEO ) - Conectasul Tecnologia Digital www.conectasul.com
    Description: JS - Sinduscon Joinville | Sindicato da Indústria da Construção Civil de Joinville
	
*/

/*IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/jquery.nivo.slider.js");
IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/jquery.jcarousel.min.js");
IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/jquery.easing-1.3.pack.js");
IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/jquery.fancybox-1.3.4.pack.js");
IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/jquery.mousewheel-3.0.4.pack.js");
IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/jquery.ui.totop.js");
IncludeJavaScript("http://www.sinduscon-joinville.org.br/public/scripts/form-validation.js");*/

function mycarousel_initCallback(carousel)
{
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

jQuery(document).ready(function() {

	// slide logos
	jQuery('#mycarousel').jcarousel({
		auto: 2,
		wrap: 'last',
		initCallback: mycarousel_initCallback
	});
	
	// fancybox swf
	$("#video").fancybox({
		'padding'           : 0,
		'autoScale'     	: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});

	// fancybox imgs
	$('a[rel=fancybox]').fancybox({ 
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'zoomSpeedIn': 500, 
		'zoomSpeedOut': 500,   
		'centerOnScroll': false,
		'hideOnContentClick': false,
		'overlayShow': true		
	});
	
	// fancybox imgs
	$('.fancybox').fancybox({ 
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'zoomSpeedIn': 500, 
		'zoomSpeedOut': 500,   
		'centerOnScroll': false,
		'hideOnContentClick': false,
		'overlayShow': true		
	});
	
	// target blank
	$("a[rel*=external]").attr('target','_blank');
	
	// botao topo
	$().UItoTop({ easingType: 'easeOutQuart' });
	
	// ativa nivoslider
	$(window).load(function() {
		$('#slider').nivoSlider({
			effect:'random',
			directionNav:false,
			directionNavHide:false,
			controlNav:false
		});
	});
	
	// submenu
	$('.menu li.sub').hover(
		function() {
			$(this).children('a').addClass('mouseOver');
			$(this).children('ul').show();
		},
		function() {
			$(this).children('a').removeClass('mouseOver');
			$(this).children('ul').hide();
		}
	);
	
	// abre Google maps
	$(".btn_map").fancybox({
		'width'				: '50%',
		'height'			: '50%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	// click counter
	
	$('div.boxs_publicidade a[rel=external]').click(function() {
		$.post(window.location + 'adclick.html', {url: $(this).attr('href')}, function(data, textStatus) {});
	});
	
});
