//----------------------------------------------------------------------------------------

// Authors : Melissa Maheux , Influenza marketing http://www.influenza.ca
// Version 1.0
// Created: April 2011

//----------------------------------------------------------------------------------------


////////////////////
// Slide show accueil
//////////////////
$(document).ready(function() {

$('#ss01') 
	.cycle({ 
		fx:      'scrollHorz', 
		speed:    2000, 
		timeout:  9000,
		pager:   '#cycleNav',
		pause:   1,
		random:  true
	});
	
});

////////////////////
// footer cycle
//////////////////
$(document).ready(function() {

$('.gallery') 
	.cycle({ 
		fx:      'scrollHorz', 
		speed:    800, 
		timeout:  0,
		pager:   '#cycleNav',
		pause:   1
	});
	
});


////////////////////
// Slide show jamesie
//////////////////
$(document).ready(function() {

$('#ss02') 
	.before('<div id="cycleNav">') 
	.cycle({ 
		fx:      'scrollHorz', 
		speed:    800, 
		timeout:  6000,
		pager:   '#cycleNav',
		pause:   1
	});
	
});


// *****************
// Tabs Jamesie et Nord du Québec
// *****************

$(function() {
	var tabContainers = $('#tabsContent > div');
	
	$('#tabsMenu a').click(function () {
	
        tabContainers.hide().filter(this.hash).show();
        $('#tabsMenu li a').removeClass('active');
        $(this).addClass('active');
        initialize();
        return false;
    }).filter('#tabsMenu a:first').click();
}); 




//////////////////
// pretty photo form
//////////////////


$(document).ready(function(){
		$("#modalForm a[rel^='prettyPhoto']").prettyPhoto({
			allowresize: true, /* true/false */
			theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			markup: '<div class="pp_pic_holder"> \
						<div class="ppt">&nbsp;</div> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<a class="pp_close" href="#">Close</a> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_loaderIcon"></div> \
									<div class="pp_fade"> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#">next</a> \
											<a class="pp_previous" href="#">previous</a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details"> \
											<div class="pp_nav"> \
												<a href="#" class="pp_arrow_previous">Previous</a> \
												<p class="currentTextHolder">0/0</p> \
												<a href="#" class="pp_arrow_next">Next</a> \
											</div> \
										</div> \
									</div> \
								</div> \
							</div> \
							</div> \
						</div> \
						<div class="pp_bottom"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
					</div> \
					<div class="pp_overlay"></div>',
			gallery_markup: '<div class="pp_gallery"> \
								<a href="#" class="pp_arrow_previous">Previous</a> \
								<div> \
									<ul> \
										{gallery} \
									</ul> \
								</div> \
								<a href="#" class="pp_arrow_next">Next</a> \
							</div>',
			image_markup: '<img id="fullResImage" src="{path}" />',
			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
			inline_markup: '<div class="pp_inline">{content}</div>',
			custom_markup: '' /* html or false to disable */
		});
		return false;
	});



// **************
// Ajout de css
// **************

$(document).ready(function() {			   
	$("div.bgEquipe:odd").addClass("bgGrey");	
	$("div.bgEscapade:odd").addClass("bgVert");
	$("div.bgEvenement:odd").addClass("bgBlue");
	$("ul.gallery:last").addClass("last");
	$("ul.fondEcran li a").attr ("target", "_blank");
	$("ul.fiche li a").attr ("target", "_blank");
	$("#content .galleryPWrapper li:first-child").addClass("first");
	$("#content #texteIntroSection p:first").addClass("intro");
	$("#content #texteIntroSection .vimeo_gallery p:first").removeClass("intro");
	$("#content #texteIntroSection blockquote p:first").removeClass("intro");
});

// **************
// Menu zoneNav class
// **************
$(function(){
	$('#zoneNav li').eq(0).addClass('propos');
	$('#zoneNav li').eq(1).addClass('trade');
	$('#zoneNav li').eq(2).addClass('media');
});



// **************
// On change filtre
// **************
$(function(){
var resultsnum = $('.resultatBox').size();
$('.numberResults').html(resultsnum);


	$('#triage select').change(function(){
		var activite = $(this).val();
		var from = $('#from').val();
		var lang = $('#lang').val();
		$('#triage').submit();
	});
	
});


//------------------------------------------------------------------------
// Watermark Formulaire Media
//------------------------------------------------------------------------
$(function() {
    // Fade out label on focus
    $("#Media .textInput").focus(function() {
        $(this).prev("label.watermark").fadeOut('fast');                                             
    });
    // If input is left blank fade in label
    $("#Media .textInput").blur(function() {
        var inputValue  = $(this).val();
        if (inputValue == "") {
            $(this).prev("label.watermark").fadeIn('fast');
        }
    });
});


//------------------------------------------------------------------------
// Watermark Formulaire Contact
//------------------------------------------------------------------------
$(function() {
    // Fade out label on focus
    $("#form_contact .textInput").focus(function() {
        $(this).prev("label.watermark").fadeOut('fast');                                             
    });
    // If input is left blank fade in label
    $("#form_contact .textInput").blur(function() {
        var inputValue  = $(this).val();
        if (inputValue == "") {
            $(this).prev("label.watermark").fadeIn('fast');
        }
    });
});
