

$(document).ready(function(){
    $('#espace_perso a[rel=confirm]').click(function () {
 	
        var res = confirm(this.title);
        if(res) {
            $.post(this.href,{
                ajax: "1"
            }); 		
            $(this).closest('div[rel=removable]').hide('slow'); 		
        }
        return false;
 	
    });

  
    reInitArrows();
    
	
	 $('.murimage a').lightBox({
            overlayBgColor: 		'#fff',	
            fixedNavigation:true,
            imageLoading:			bu+'/img/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
            imageBtnPrev:			bu+'/img/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
            imageBtnNext:			bu+'/img/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
            imageBtnClose:			bu+'/img/lightbox/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
            imageBlank:				'/'+bu+'/img/lightbox-blank.gif'
        });
    
    $('#slider-one').movingBoxes({
        startPanel   : 1,      // start with this panel
        width        : 465,    // overall width of movingBoxes (not including navigation arrows)
        imageRatio   : 4/3,      // Image ration set to 1:1 (square image)
        wrap         : false,   // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
        buildNav     : true,   // if true, navigation links will be added
        panelType    : '> li', // selector to find the immediate ">" children "li" of "#slider-one" in this case
        fixedHeight  : true,
        reducedSize  : 0.8
    });

    $('.zone').click(function(){
        $(this).val("");
    });

    $('#contact_form input, #contact_form textarea').not("#contact_submit").click(function(){
        $(this).val("");
    });
    
    //alert($('#slider-one').movingBoxes);
   
    
});

/*
$(function() {
	// here, we allow the user to sort the items
	$('#sort_video').sortable({
		axis: "y",
		placeholder: 'ui-state-highlight'

	});
 
	// here, we reload the saved order

});
*/

function reInitArrows() {
 
}

jQuery.fn.first = function() {
    return this.eq(0)
};
jQuery.fn.last = function() {
    return this.eq(this.size() - 1)
};


function moveup(obj) {
	
    myLi = ($(obj).closest('LI'));
    previousLi = myLi.prev();
    if(!previousLi[0]) {
        return;
    }
	
    myClone = myLi.clone();
    myClone.insertBefore(previousLi);
    //	myClone.hide();
    //	myLi.hide('fast',function() {$(this).remove();reInitArrows()});
    //	myClone.show('fast');
    myLi.remove();
    reInitArrows();
    return;
	
    myClone.hide();

    previousLi.animate({
        'top':(previousLi.height()+25)+"px"
    },'normal');
    myLi.animate({
        'top':-(previousLi.height()+25)+"px"
    },'normal',function(){
        myClone.show();
        myLi.hide();
        myLi.remove();
        previousLi.css('top',0);
        reInitArrows();
    });

	
	
}

function movedown(obj) {
    //alert(obj);
    myLi = ($(obj).closest('LI'));
    nextLi = myLi.next();
	
    if(!nextLi[0]) {
        return;
    }
		
    myClone = myLi.clone();
    myClone.insertAfter(nextLi);
    //myClone.hide();
    //myLi.hide('fast',function() {$(this).remove();reInitArrows();});
    //myClone.show('fast');
    myLi.remove();
    reInitArrows();
    return;
	
    nextLi.animate({
        'top':-(nextLi.height()+25)+"px"
    },'normal');
    myLi.animate({
        'top':(nextLi.height()+25)+"px"
    },'normal',function(){
        myClone.show();
        myLi.hide();
        myLi.remove();
        nextLi.css('top',0);
        reInitArrows();
    });
	
}

function removevideo(obj) {
	
    $(obj).closest('LI').hide('fast',function() {
        $(this).remove();
        reInitArrows();
    });
	
}

