/* Cookie plugin */
;eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[2-9a-hj-p]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('j.5=function(8,9,2){6(e 9!=\'undefined\'){2=2||{};6(9===k){9=\'\';2.3=-1}4 3=\'\';6(2.3&&(e 2.3==\'l\'||2.3.m)){4 7;6(e 2.3==\'l\'){7=new Date();7.setTime(7.getTime()+(2.3*24*n*n*1000))}o{7=2.3}3=\'; 3=\'+7.m()}4 a=2.a?\'; a=\'+(2.a):\'\';4 b=2.b?\'; b=\'+(2.b):\'\';4 c=2.c?\'; c\':\'\';d.5=[8,\'=\',encodeURIComponent(9),3,a,b,c].join(\'\')}o{4 f=k;6(d.5&&d.5!=\'\'){4 g=d.5.split(\';\');for(4 i=0;i<g.h;i++){4 5=j.trim(g[i]);6(5.p(0,8.h+1)==(8+\'=\')){f=decodeURIComponent(5.p(8.h+1));break}}}return f}};',[],26,'||options|expires|var|cookie|if|date|name|value|path|domain|secure|document|typeof|cookieValue|cookies|length||jQuery|null|number|toUTCString|60|else|substring'.split('|'),0,{}))
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*/
;eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('m.n.F=m.n.z;m.G(m.n,{A:"B",z:9(e,f,a,h,g){6 m.n[m.n.A](e,f,a,h,g)},H:9(e,f,a,h,g){6 h*(f/=g)*f+a},B:9(e,f,a,h,g){6-h*(f/=g)*(f-2)+a},I:9(e,f,a,h,g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d)*8.w(l/g)}6-(g*8.o(2,10*(h-=1))*8.s((h*k-i)*(2*8.d)/j))+e},13:9(f,h,e,l,k){c i=1.q;c j=0;c g=l;b(h==0){6 e}b((h/=k)==1){6 e+l}b(!j){j=k*0.3}b(g<8.v(l)){g=l;c i=j/4}r{c i=j/(2*8.d)*8.w(l/g)}6 g*8.o(2,-10*h)*8.s((h*k-i)*(2*8.d)/j)+l+e},14:9(f,h,e,l,k){c i=1.q;c j=0;c g=l;b(h==0){6 e}b((h/=k/2)==2){6 e+l}b(!j){j=k*(0.3*1.5)}b(g<8.v(l)){g=l;c i=j/4}r{c i=j/(2*8.d)*8.w(l/g)}b(h<1){6-0.5*(g*8.o(2,10*(h-=1))*8.s((h*k-i)*(2*8.d)/j))+e}6 g*8.o(2,-10*(h-=1))*8.s((h*k-i)*(2*8.d)/j)*0.5+l+e},15:9(e,f,a,i,h,g){b(g==x){g=1.q}6 i*(f/=h)*f*((g+1)*f-g)+a},16:9(e,f,a,i,h,g){b(g==x){g=1.q}6 i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},17:9(e,f,a,i,h,g){b(g==x){g=1.q}b((f/=h/2)<1){6 i/2*(f*f*(((g*=(1.D))+1)*f-g))+a}6 i/2*((f-=2)*f*(((g*=(1.D))+1)*f+g)+2)+a},E:9(e,f,a,h,g){6 h-m.n.y(e,g-f,0,h,g)+a},y:9(e,f,a,h,g){b((f/=g)<(1/2.p)){6 h*(7.u*f*f)+a}r{b(f<(2/2.p)){6 h*(7.u*(f-=(1.5/2.p))*f+0.p)+a}r{b(f<(2.5/2.p)){6 h*(7.u*(f-=(2.18/2.p))*f+0.19)+a}r{6 h*(7.u*(f-=(2.1a/2.p))*f+0.1b)+a}}}},1c:9(e,f,a,h,g){b(f<g/2){6 m.n.E(e,f*2,0,h,g)*0.5+a}6 m.n.y(e,f*2-g,0,h,g)*0.5+h*0.5+a}});',62,75,'||||||return||Math|function||if|var|PI|||||||||jQuery|easing|pow|75|70158|else|sin|sqrt|5625|abs|asin|undefined|easeOutBounce|swing|def|easeOutQuad|cos|525|easeInBounce|jswing|extend|easeInQuad|easeInOutQuad|easeInCubic|easeOutCubic|easeInOutCubic|easeInQuart|easeOutQuart|easeInOutQuart|easeInQuint|easeOutQuint|easeInOutQuint|easeInSine|easeOutSine|easeInOutSine|easeInExpo|easeOutExpo|easeInOutExpo|easeInCirc|easeOutCirc||easeInOutCirc|easeInElastic|easeOutElastic|easeInOutElastic|easeInBack|easeOutBack|easeInOutBack|25|9375|625|984375|easeInOutBounce'.split('|'),0,{}));

/* ToggleVal 3.0 */
;eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(5($){$.l.e=5(2){4(!2||t 2==\'G\'){2=$.r({},$.l.e.B,2)}E 4(t 2==\'J\'&&2.I()==\'g\'){s g=m}b 0.H(5(){4(g){$(0).u(\'v.8\').u(\'F.8\').M(\'1\');b a}s 1=\'\';P(2.z){i\'f\':4($(0).9(\'f\')){1=$(0).9(\'f\');$(0).3(1)}j;i\'k\':4($(0).9(\'c\')){1=$(\'k[q="\'+$(0).9(\'c\')+\'"]\').o();$(0).3(1)}j;i\'N\':1=2.o;$(0).3(1);j;C:1=$(0).3()}$(0).d(\'8\').6(\'1\',1);4(2.x==m&&$(0).9(\'c\')){$(\'k[q="\'+$(0).9(\'c\')+\'"]\').L()}$(0).y(\'v.8\',5(){4($(0).3()==$(0).6(\'1\')){$(0).3(\'\')}$(0).d(2.h)}).y(\'F.8\',5(){4($(0).3()==\'\'&&!2.p){$(0).3($(0).6(\'1\'))}$(0).D(2.h);4($(0).3()!=\'\'&&$(0).3()!=$(0).6(\'1\')){$(0).d(2.n)}E{$(0).D(2.n)}})})};$.l.e.B={h:\'A-Q\',n:\'A-w\',z:\'C\',o:K,x:a,p:a};$.r($.O[\':\'],{8:5(7){b $(7).6(\'1\')||a},w:5(7){4($(7).6(\'1\')&&$(7).3()!=$(7).6(\'1\')){b m}b a}})})(R);',54,54,'this|defText|theOptions|val|if|function|data|elem|toggleval|attr|false|return|id|addClass|toggleVal|title|destroy|focusClass|case|break|label|fn|true|changedClass|text|sticky|for|extend|var|typeof|unbind|focus|changed|removeLabels|bind|populateFrom|tv|defaults|default|removeClass|else|blur|object|each|toLowerCase|string|null|remove|removeData|custom|expr|switch|focused|jQuery'.split('|'),0,{}))



/* ABOURDIER 2009 */

/* TOGGLEVAL ON INPUTS */
myToggleVal = function(elt) {
	jQuery(elt).toggleVal();
}



/* FUNCTIONS ON ALL PAGES */
function myInitPages() {
	if (jQuery('#cvText').size() > 0) {
		jQuery('#content').animate({opacity: 1},600);
		jQuery('#loader').hide();
	}
	else {
		jQuery('#loader').hide();
		//jQuery('#jobList').animate({opacity: 1},600);
	}
	myToggleVal('.swapValue');
}

function myTransitions(url) {
	if (jQuery('#cvText').size() > 0) {
		jQuery('#loader').show();
		jQuery('#content').fadeOut(600, function () { document.location.href = url; });
	} else {
		jQuery('#loader').show();
		//jQuery('#jobList').fadeOut(600, function () { document.location.href = url; });
		document.location.href = url;
	}
}

/* PAGES TRANSITIONS */
function pageTransitions(elt) {
	if (elt == '.projectSelects') {
		jQuery(elt).change(function(){
			var url = jQuery(this).val();
			myTransitions(url);
			return false;
		});
	} else {
		jQuery(elt).click(function(){
			var url = jQuery(this).attr('href');
            myTransitions(url);
			return false;
		});
	}
}

/* callbacks pour modifier titles des prev/next � la vol�e dans le carousel
function onBefore() {
    jQuery('.next').attr('title',jQuery(this).next().children().children('h2').text());
	//alert(jQuery(this).children().children('h2').text());
}
function onAfter() {
    jQuery('.next').attr('title',jQuery(this).next().children().children('h2').text());
    jQuery('.prev').attr('title',jQuery(this).prev().children().children('h2').text());
	//alert(newTitle);
} */

// CAROUSELS
function homeCarousel() {
	var pictures = [],
		picture = '',
		slideIndex = 0;
	
   	if (jQuery('#jobList > li').size() > 1) {
		$('#jobList').find( 'img' ).each( function() {
			pictures.push({
				image: $( this ).attr( 'src' ),
				currentIndex: slideIndex
			});
			slideIndex++;
		});
		$('#content').prepend('<div class="jobDetails"><div class="jobDetailsIns"></div></div>');
		$.supersized({
			// Functionality
			slideshow               :   1,			// Slideshow on/off
			autoplay				:	1,			// Slideshow starts playing automatically
			start_slide             :   1,			// Start slide (0 is random)
			stop_loop				:	0,			// Pauses slideshow on last slide
			random					: 	0,			// Randomize slide order (Ignores start slide)
			slide_interval          :   3000,		// Length between transitions
			transition              :   6, 			// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
			transition_speed		:	1000,		// Speed of transition
			new_window				:	0,			// Image links open in new window/tab
			pause_hover             :   0,			// Pause slideshow on hover
			keyboard_nav            :   1,			// Keyboard navigation on/off
			performance				:	1,			// 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
			image_protect			:	1,			// Disables image dragging and right click with Javascript
			// Size & Position						   
			min_width		        :   0,			// Min width /Users/contact/Sites/www/aurorebourdier/blog/themes/abourdier09/js/global.jsallowed (in pixels)
			min_height		        :   0,			// Min height allowed (in pixels)
			vertical_center         :   1,			// Vertically center background
			horizontal_center       :   1,			// Horizontally center background
			fit_always				:	0,			// Image will never exceed browser width or height (Ignores min. dimensions)
			fit_portrait         	:   1,			// Portrait images will not exceed browser height
			fit_landscape			:   0,			// Landscape images will not exceed browser width
			// Components							
			slide_links				:	false,	// Individual links for each slide (Options: false, 'num', 'name', 'blank')
			thumb_links				:	0,			// Individual thumb links for each slide
			thumbnail_navigation    :   0,			// Thumbnail navigation
			slides 					:  	pictures
			
		});
		//$('#jobList .jobDetails').eq(0).prependTo('#content');
		$('#supersized li').not(':first').css('visibility','hidden');
		
		jQuery('.next,.prev').each(function() {
			jQuery(this).hover(
				function() { 
					jQuery(this).addClass('hover'); 
					//$.vegas('pause');
				},
				function() {
					jQuery(this).removeClass('hover');
					//$.vegas('slideshow');
				}
			);
		});
	} else { 
		jQuery('.next,.prev').hide();
		picture = $('#jobList img').attr('src');
		$.supersized({
			new_window				:	0,			// Image links open in new window/tab
			image_protect			:	1,			// Disables image dragging and right click with Javascript
			// Size & Position						   
			min_width		        :   0,			// Min width allowed (in pixels)
			min_height		        :   0,			// Min height allowed (in pixels)
			vertical_center         :   1,			// Vertically center background
			horizontal_center       :   1,			// Horizontally center background
			fit_always				:	0,			// Image will never exceed browser width or height (Ignores min. dimensions)
			fit_portrait         	:   1,			// Portrait images will not exceed browser height
			fit_landscape			:   0,			// Landscape images will not exceed browser width
			slides  :  	[ {image : picture} ]
		});
		$('.jobDetails').prependTo('#content');
	}
		
	$('#jobList').hide();
	myInitPages();
}

jQuery(window).bind("load", function() {
  homeCarousel();
});

/* Only initialize functions for all pages if needed */
jQuery(document).ready(function() {
	jQuery('#jobList').css('opacity',0);
	jQuery('#loader').show();
	jQuery('body').addClass('hasJS');
    jQuery('a[rel="external"]').click( function() {
        window.open( jQuery(this).attr('href') );
        return false;
    });
    jQuery('a#nlLink').click(function() {
    	jQuery('#nlPopup').toggle();
    	jQuery(this).addClass('active');
    	return false;
    });
    jQuery('#nlPopup .close').click(function () {
    	jQuery('#nlPopup').hide();
    	jQuery('a#nlLink').removeClass('active');
    });
    jQuery('#p404 a').click(function () {
    	window.history.back();
    	return false;
    });

	pageTransitions('.ajaxLink');
	pageTransitions('.projectSelects');

});














//END
