
/* Target blank */
$(function() { $("a[rel$='external']").click( function() { this.target = "_blank"; }); });

$(document).ready(function() {
	// zone recherche
	$('input#keywords').each(function() {
		var default_value = this.value;
		$(this).focus(function() {
            if(this.value == default_value) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if(this.value == '') {
                this.value = default_value;
            }
        });
	});
	
	// menu déroulant dans le header
	$('#nav-header ul li a.top').each(function() {
		$(this).click(function() {
			if ($(this).find('ul')) {
				$('#nav-header ul li a').not($(this)).removeClass('current').parent().children('ul').slideUp();
				$(this).parent().children('ul').slideToggle();
				if ($(this).hasClass('current')) {
					$(this).removeClass('current');
				} else {
					$(this).addClass('current');				
				}
			}
		});
	});
	$('li.current ul').show();
	
	// ajout/retrait de la fleche dans le sous-menu
	$('#nav-header ul li ul li a').hover(
		function() { $(this).append('<img src="/medias/images/architecture/nav-header-sub-hover.jpg" alt="" />'); },
		function() { $(this).children('img').remove(); }
	);
	
	// zone vision
	$('#slider').bxSlider({
		infiniteLoop: false,
		auto: true,
		pager: true,
		controls: false,
		captions: true,
		pagerLocation: 'top',
		pause:4000
	});	

	// zone partenaire
	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();
		});
	};	
	// zone partenaire
    $('#carousel').jcarousel({
		auto: 5,
		visible: 3,
		wrap: "last",
		initCallback: mycarousel_initCallback
	});
	
	if ($("#content-primary table").length != 0) {
		$("#content-primary table tr:even").css("background-color", "#e8e2d5");
	}
	if ($("#content-primary div#activites ul").length != 0) {
		$("#content-primary div#activites ul").css("margin", "15px 15px 0 0");
	}
	if ($("#content-primary div#nouvelles ul").length != 0) {
		$("#content-primary div#nouvelles ul").css("margin", "15px 15px 0 0");
	}
	
	$("a.colorbox").colorbox({current:"photo {current} de {total}"});
});

/*  Google Analytics  */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1432997-35']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})(); 
  

