var domain = "http://"+window.location.hostname;
if(domain=='http://guydenoel.akimedia.eu')domain = domain+'/cms';





$(document).ready(function(){ //on attend que la page soit charg�e
	var flashFire = { movie:domain+'/files/feu_compressed.swf', width:"258", height:"231", majorversion:"7", build:"0", xi:"true", wmode:"transparent" };
    UFO.create(flashFire, "firehook");
    var flashJingle = { movie:domain+'/jingle.swf', width:"16", height:"16", majorversion:"7", build:"0", xi:"true", wmode:"transparent" };
    UFO.create(flashJingle, "speakerhook");   
	
	$("#showcase.boxsmall").awShowcase(
	{
		content_width:			484,
		content_height:			324,
		fit_to_parent:			false,
		auto:					true,
		interval:				3000,
		continuous:				true,
		loading:				true,
		tooltip_width:			200,
		tooltip_icon_width:		32,
		tooltip_icon_height:	32,
		tooltip_offsetx:		18,
		tooltip_offsety:		0,
		arrows:					false,
		buttons:				false,
		btn_numbers:			true,
		keybord_keys:			true,
		pauseonover:			true,
		stoponclick:			true,
		transition:				'fade', /* hslide/vslide/fade */
		transition_speed:		500,
		transition_delay:		300,
		show_caption:			'onhover', /* onload/onhover/show */
		thumbnails:				true,
		thumbnails_position:	'outside-last', /* outside-last/outside-first/inside-last/inside-first */
		thumbnails_direction:	'horizontal', /* vertical/horizontal */
		thumbnails_slidex:		0, /* 0 = auto / 1 = slide one thumbnail / 2 = slide two thumbnails / etc. */
		dynamic_height:			false, /* For dynamic height to work in webkit you need to set the width and height of images in the source. Usually works to only set the dimension of the first slide in the showcase. */
		speed_change:			false, /* Set to true to prevent users from swithing more then one slide at once. */
		viewline:				false /* If set to true content_width, thumbnails, transition and dynamic_height will be disabled. As for dynamic height you need to set the width and height of images in the source. */
	});
	
	$("#showcase.boxlarge").awShowcase(
	{
		content_width:			796,
		content_height:			532,
		fit_to_parent:			false,
		auto:					true,
		interval:				3000,
		continuous:				true,
		loading:				true,
		tooltip_width:			200,
		tooltip_icon_width:		32,
		tooltip_icon_height:	32,
		tooltip_offsetx:		18,
		tooltip_offsety:		0,
		arrows:					false,
		buttons:				false,
		btn_numbers:			true,
		keybord_keys:			true,
		pauseonover:			true,
		stoponclick:			true,
		transition:				'fade', /* hslide/vslide/fade */
		transition_speed:		500,
		transition_delay:		300,
		show_caption:			'onhover', /* onload/onhover/show */
		thumbnails:				true,
		thumbnails_position:	'outside-last', /* outside-last/outside-first/inside-last/inside-first */
		thumbnails_direction:	'horizontal', /* vertical/horizontal */
		thumbnails_slidex:		0, /* 0 = auto / 1 = slide one thumbnail / 2 = slide two thumbnails / etc. */
		dynamic_height:			false, /* For dynamic height to work in webkit you need to set the width and height of images in the source. Usually works to only set the dimension of the first slide in the showcase. */
		speed_change:			false, /* Set to true to prevent users from swithing more then one slide at once. */
		viewline:				false /* If set to true content_width, thumbnails, transition and dynamic_height will be disabled. As for dynamic height you need to set the width and height of images in the source. */
	});
	
	/* fancyPicture(); */

});
$(window).load(function(){//on attend que la page soit charg�e
    if($('#slider').length){
        slideContent();
    }else{
        h = $("#content_slide").height();
    
        if(h<$('#menu_slide').height()){
            h=$('#menu_slide').height();
        }
        $("#content_slide_wrap").height(h).css('opacity','1');
    }
	
});


function fancyPicture()
{
	$("a.bigpicture[rel=gallery_content]").fancybox();
}
	
function slideContent(){
    
    //-------initialisation du contenu
    if(window.location.hash != ""){
        //--------recupère l'index href
        changeContent($('#menu_slide a[href='+window.location.hash+']').index('#menu_slide a'),$('#menu_slide a[href='+window.location.hash+']'));
    }
    else{
        changeContent(0,$('#menu_slide a:first'));
    }
    
    //-------initialisation de la hauteur
    $("#menu_slide a").each(function(i,elm){
        $(elm).click(function () {
            if($(elm).attr('id')!="current_selection"){
                changeContent(i,elm);
            }
        });
    });
}

function changeHeightContent(h){
    //-------redimentionement du contenu
    var curindex = $('#current_selection').index('.elmenu a');

    $("#content_slide").height(h-15);
    
    if(h<($('#menu_slide_wrap').height()+$('#contact_guy').height())+150){
        h=$('#menu_slide_wrap').height()+$('#contact_guy').height()+150;
    }
    $("#content_slide_wrap").height(h).css('opacity','1');
   
    //--------redimentionement du menu
    var margeMenuSlide =h;
    margeMenuSlide = margeMenuSlide - $('#menu_slide ul').height() - $('#contact_guy').height();   
    
    
    $("#menu_slide ul").css('margin-bottom', margeMenuSlide+'px');
    
    $('#slider').fadeIn(300);
}

function changeContent(i,elm){
    
    //hauteur elm suivant
    h = $('li#slide_'+i).height()+15;

    //---------supprime le current
    $("#current_selection").attr('id',"");
    
    //--------applique le current sur elm clicker
    $(elm).attr('id',"current_selection");
    
    //---------calcul de la marge
    marge=0;
    for(k=0; k<i; k++){
        marge = $('li#slide_'+k).height()+15+marge;
    }
    //---------animation & redimentionement du slider
    $('#slider').fadeOut(300, function(){
        $('#slider').css({
            marginTop:'-'+marge+'px'
        });
        
        changeHeightContent(h);
        
    });
}

