timer_sous_menu=0;
timer_sous_menu_close=0;
id_menu=0;
selected_onglet=0;
stop_close_sous_menu=0;
$(document).ready(function(){
    initializeMenu();
 //   noel();
});
/*
$(window).resize(function() {
   noel();
});

function noel(){
  //screen.width
    offset = $('.conteneur').offset();

    largeurConteneur = $('.conteneur').width();
    $('.bouleNoel').css({
	'position':'fixed',
	'left':offset.left-$('.bouleNoel').width()
    });
    $('.noelbis').css({
	'position':'fixed',
	'left':offset.left+largeurConteneur
    });
}

*/
function initializeMenu(){
if(typeof(path)=='undefined')path='/';
    $('#navTab ul li a').mouseover(function(){
        object=$(this);
        clearTimeout(timer_sous_menu);
        clearTimeout(timer_sous_menu_close);
        closeSousMenu(null, 'onglet');
        timer_sous_menu=setTimeout(function(){
            openSousMenu(object);
        }, 50);
    }).mouseout(function(){
		object=$(this);
        clearTimeout(timer_sous_menu);
        if(stop_close_sous_menu==0)timer_sous_menu_close=setTimeout(function(){
            closeSousMenu(object);
        }, 50);
    })
    toogleChat();

   /* $('.suivi_cmd').mouseover(function(){
    	$('.suivi_cmd').attr('src','/images/display_css_01/header/bt-suivi-commande-stores-discount-on.png');
    });

    $('.suivi_cmd').mouseout(function(){
    	$('.suivi_cmd').attr('src','/images/display_css_01/header/bt-suivi-commande-stores-discount-off.png');
    });*/
}
function toogleNavImgCat(action,objectOver){
    if(action=='display'){
	img=$(objectOver).attr('catZoom');
	$('.wrapperNavCatImgZoom').stop(true,true).hide();
	$('.wrapperNavCatImgZoom').html('<img src="/'+ img +'" />').fadeIn();
    }
    else{
	$('.wrapperNavCatImgZoom').fadeOut();
    }
}

var id_last_mess_chat=0;
function reloadChat()
{
    $.post('/ajax/chat.php',{
        action:'load_message',
        lastId:id_last_mess_chat
    },function(response,status,xhr){
        if(response!=null && status=='success')
        {
            if(response.last_id) id_last_mess_chat=response.last_id;
            if(response.message)
            {
                $('#messageChat').prepend(response.message);
            }
        }
    },'json');
}
function sendChatmessage()
{
    $.post('/ajax/chat.php',{
        action:'sendMessage',
        message:$('#messageChatTextarea').val()
    });
    $('#messageChatTextarea').val('');
    reloadChat();
}
function showMessageGestion(com_ident)
{
    $.post(path+'ajax/gestionCom.php',{action:'getMessage',com_ident:com_ident},function(message,status2,xhr2){
	if(status2=='success')
	{
	    $('<div id="infoGestionCom">'+ message +'</div>').appendTo('html');
	    $('#infoGestionCom').css({
		'width':'100%',
		'font-size':'30px',
		'position':'fixed',
		'top':'200px',
		'background':'#000000',
		'opacity':'0.8',
		'margin':'0px',
		'padding':'40px 0',
		'color':'#FFFFFF',
		'text-align':'center'
	    }).hide();

	    $('#infoGestionCom').fadeIn(1500).click(function(){
		$.post(path+'ajax/gestionCom.php',{action:'updateMessageRead'},function(response,status,xhr){
		    $('#infoGestionCom').remove();
		});
	    });
	}
    })
}

function toogleChat()
{
    $('#messageChat').toggle();
    $('#writeMessageChat').toggle();
}
function niveau2(cat)
{
    $('.menu_nav_'+cat).removeClass('menu_nav_'+cat).addClass('menu_nav_'+cat+'_select');
    $('#separator_menu').addClass('menu_separator_color_'+cat);
}

function openSousMenu(object)
{
    //alert(path);
    clearTimeout(timer_sous_menu_close);
    aClass=$(object).parent().attr('class').split(' ');
    id_menu=aClass[0].substring(9);
    $(object).parent().addClass('select_onglet_'+id_menu);
    selected_onglet=$(object);
    idLoadMenu=selected_onglet.attr('class').substr(15);
    $('#load_content_menu').load('/ajax/navMenu.php',{
        action : 'loadMenu',
        idMenu :idLoadMenu
    },function(xhr,status){
        if(status=='success')
        {
            $(this).show();
        }
    }).mouseleave(function(){
        selected_onglet.parent().removeClass('select_onglet_'+id_menu);
        stop_close_sous_menu=0;
        closeSousMenu(object);
    }).mouseenter(function(){
        stop_close_sous_menu=1;
    });
}
function closeSousMenu(object,type)
{
    if(typeof(type)=='undefined' && stop_close_sous_menu==0)
    {
        aClass=$(object).parent().attr('class').split(' ');
        id_menu_close=aClass[0].substring(9);
        object.parent().removeClass('select_onglet_'+id_menu_close);
        $('#load_content_menu').hide();
    }
    else if(type=='onglet')
    {
        if(selected_onglet!='0') selected_onglet.parent().removeClass('select_onglet_'+id_menu);
    }
}
function RedirectLink(lien_page)
{
    window.location = lien_page;
}
function ReloadPage()
{
    location.reload();
}
function createXhrObject()
{
    if (window.XMLHttpRequest)
        return new XMLHttpRequest();
    if (window.ActiveXObject)
    {
        var names = [
        "Msxml2.XMLHTTP.6.0",
        "Msxml2.XMLHTTP.3.0",
        "Msxml2.XMLHTTP",
        "Microsoft.XMLHTTP"
        ];
        for(var i in names)
        {
            try{
                return new ActiveXObject(names[i]);
            }
            catch(e){}
        }
    }
    window.alert("Votre navigateur ne prend pas en charge l'objet XMLHTTPRequest.");
    return null; // non supporté
}
function AjaxRequest(url_traitement,param)
{
    var xhr=createXhrObject();
    xhr.open( "POST", url_traitement,  false);
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xhr.send(param);
    if(xhr.readyState  == 4)
    {
        if(xhr.status  == 200)
        {
            response=xhr.responseText;
            return response;
        }
        else
        {
            response=xhr.status;
            return response;
        }
    }
}
function returnAjaxResponse(path,data)
{
    window.open (path+'ajax_response.php?data='+data, 'reponse de ajax', config='height=500, width=400, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
}
var last_id_dev_com=0;
function verifNewCommandeCom(user_com)
{
    $.post('/ajax/gestionCom.php',{
        action:'loadNewCommande',
        user_ident:user_com,
        last_id:last_id_dev_com
    },function(response, status, xhr){
        if(status=='success')
        {
            last_id_dev_com=response.last_id;
            if(response.message)
            {
                $('#listNewClient').prepend(response.message);
                $('.infoBoxNewDev').hide().fadeIn(1000);
            }
            $('.infoBoxNewDev').click(function(){
                $(this).slideUp();
                $.post('/ajax/gestionCom.php',{
                    action:'readDevisAssoc',
                    id:$(this).attr('id')
                });
            });
        }
    },'json');
}

function ControlCase(id_box, id_box_verif, valeur_box, val_error,jquery_verif)
{
    if(document.getElementById(id_box_verif).value!=valeur_box || $('#'+id_box).val()=="")
    {
        document.getElementById(id_box).style.backgroundColor="#FFA0A0";
        document.getElementById(id_box).style.color="red";
        if($('#'+id_box).val()=="")
        {
            if(jquery_verif==false)
            {
                $('#'+id_box).hide();
                $('#'+id_box).fadeIn("slow");
                $('#'+id_box).val(val_error);
            }
        }
    }
    else
    {
        if(jquery_verif==true)
        {
            $('#'+id_box).hide();
            $('#'+id_box).fadeIn("slow");
            document.getElementById(id_box).style.backgroundColor="#D6ECA6";
            document.getElementById(id_box).style.color="#000000";
        }
        else
        {
            document.getElementById(id_box).style.backgroundColor="#FFFFFF";
            document.getElementById(id_box).style.color="#000000";
        }
    }
}
function VerifDataField(id_field,value_error,border)
{
    $('#'+id_field).hide();
    $('#'+id_field).fadeIn("slow");
    if(value_error==null)value_error='Veuillez remplir ce champ';
    if(document.getElementById(id_field)!=null)
    {
        if(document.getElementById(id_field).value=="")
        {
            document.getElementById(id_field).style.backgroundColor="#FFA0A0";
            document.getElementById(id_field).style.color="red";
            document.getElementById(id_field).value=value_error;
        }
        else
        {
            document.getElementById(id_field).style.border=border;
            document.getElementById(id_field).style.backgroundColor="#FFFFFF";
            document.getElementById(id_field).style.color="#000000";
        }
    }
    else
    {
        alert('Field inconnu');
    }
}
function addListenerPopinNotice(selector,title,contentLink){
    $(selector).click(function(){
	$('<div class="popinNotice"></div>').appendTo('body').html('<div class="titlePopin">'+ title +'</div><div class="wrapperPopinNotice">'+contentLink+'</div>').css({
	    'position':'absolute',
	    'top':$(selector).offset().top,
	    'left':$(selector).offset().left-($(this).width()/2),
	    //'padding':'20px',
	    'background-color':'#FFFFFF',
	    'border':'1px solid #CCCCCC'
	}).mouseleave(function(){
	    $('.popinNotice').fadeOut(function(){
		$(this).remove();
	    });
	});
    });
}
function VerifDataFieldOnKey(id_field)
{
    if(document.getElementById(id_field)!=null)
    {
        if(document.getElementById(id_field).value!="")
        {
            document.getElementById(id_field).style.backgroundColor="#D6ECA6";
            document.getElementById(id_field).style.color="#000000";
        }
        else
        {
            document.getElementById(id_field).style.backgroundColor="#FFA0A0";
        }
    }
}
function VerifDataFieldFocus(id_field)
{
    if(document.getElementById(id_field)!=null)
    {
        document.getElementById(id_field).style.backgroundColor="#D6ECA6";
        document.getElementById(id_field).style.color="#000000";
    }
}
function recherche(path)
{
    $('#form_recherche').submit();
}
function verif() {
    var recherche = document.getElementById('Mot').value;
    var mot = recherche.split(' ');
    if(mot.length == 4){
        recherche = recherche.substring(0, (recherche.length-1));
        document.getElementById('Mot').value = recherche;
        alert("3 mots maximum !");
    }
}
function ChangeClass(id,classname)
{
    $('#'+id).toggleClass(classname);
}
function AddClass(id,classname)
{
    $('#'+id).addClass(classname);
}
function RemoveClass(id,classname)
{
    $('#'+id).removeClass(classname);
}
function RollOver(id,src_image)
{
    $('#'+id).attr("src",src_image);
}
function ChangeBorderColor(id,color)
{
    $('#'+id).css("borderColor",color);
}
function ShowInfo(id)
{
    $('#'+id).fadeIn("fast");
}
function HiddenInfo(id)
{
    $('#'+id).fadeOut("fast");
}
function BtnClick(id)
{
    $('#'+id).css('border-style','inset');
}
function BtnUnClick(id)
{
    $('#'+id).css('border-style','outset');
}
function autoRoll(image_id,src_image)
{
    old_image=$('#'+image_id).attr("src");
    $('#'+image_id).attr("src",src_image);
    $('#'+image_id).bind('mouseout',function(){
        $('#'+image_id).attr("src",old_image);
    });
}
function autoChangeBorder(object,color)
{
    last_border=$(object).css('border-color');
    $(object).css('border-color',color).mouseout(function(){
        $(this).css('border-color',last_border);
    });
}
function autoShow(id_over,id_show)
{
    $('#'+id_over).bind('mouseout',function(){
        $('#'+id_show).hide();
    });
    $('#'+id_show).show();
}
function SplitNumber(number)
{
    unit_number=parseInt(number);
    decimal_number=Math.round(((parseFloat(number)*100)-(unit_number*100)));
    if(decimal_number=='')decimal_number="00";
    else if(decimal_number.length==1)decimal_number+"0";
    else if(decimal_number.length<10)"0"+decimal_number;
    return new Array(unit_number, decimal_number);
}
function oRegionPose(aParamsDefine){
    
    var aParams={
	returnSelector:'',
	callback:'',
	page:'',
	loadSelector:''
    }
    
    var elm=this;
    var region_find=null;
    var infoHtml=null;
    var isRegionDefinePose=false;
    
    this.initialize=function(){
	if(typeof(google)!='undefined' && google.loader.ClientLocation)
	{
	    if(typeof(aParamsDefine)!='undefined'){
		for (var inc in aParamsDefine){
		    aParams[inc]=aParamsDefine[inc];
		}
	    }
	    
	    region_find = google.loader.ClientLocation.address.region;
	    $.post('/ajax/regionPose.php',{action:'getInfRegion',region:region_find,page:aParams.page},function(response,status,xhr){
		if(status=='success'){
		    if(response.status){
			infoHtml=response.htmlInfo;
			landingHtml=response.landingHtml;
			isRegionDefinePose=true;
			if(aParams.callback!='')aParams.callback.call();
			if(aParams.loadSelector!=''){
			    $(aParams.loadSelector).html(response.loadInfo).show();
			}
		    }
		}
	    },'json');
	}
    }
    
    this.isRegionPose=function(){
	return isRegionDefinePose;
    }
    
    this.getHtmlInfo=function(){
	return infoHtml;
    }
    
    this.getLandingInfo=function(){
	return infoHtml;
    }
    
    elm.initialize();
}
var konami_code='122|115|113|100';
var tab_konami=konami_code.split('|');
var code_stroke='';
function detect_key(event)
{
    var keycode;
    var valid=true;
    if (window.event) keycode = window.event.keyCode;
    else keycode = event.which;
    code_stroke=code_stroke+keycode+"|";

    tab_stroke=code_stroke.split('|');
    for(id in tab_konami)
    {
        if(tab_stroke[id])
        {
            if(tab_stroke[id] != tab_konami[id])
            {
                valid=false;
                code_stroke='';
                return false;
                break;
            }
        }
        else
        {
            valid=false;
        }
    }
    if(valid==true)easter_egg();
}

function animBackColor(id, color, time)
{
    $("#"+ id).animate({
        backgroundColor : color
    }, time );
}
function easter_egg()
{
    code_stroke='';
    var monCalque=document.createElement('div');
    monCalque.innerHTML='HAHA essaye de me cliquer dessus';
    document.write('Tu a reussi le super test du konami code t\'est trop baleze')
}
function getPageSize()
{
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY)
    {
        xScroll = window.innerWidth + window.scrollMaxX;
        yScroll = window.innerHeight + window.scrollMaxY;
    }
    else if (document.body.scrollHeight > document.body.offsetHeight)
    {
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    }
    else
    {
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    var windowWidth, windowHeight;
    if (self.innerHeight)
    {
        if(document.documentElement.clientWidth)
        {
            windowWidth = document.documentElement.clientWidth;
        }
        else
        {
            windowWidth = self.innerWidth;
        }
        windowHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight)
    {
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    if(yScroll < windowHeight)
    {
        pageHeight = windowHeight;
    }
    else
    {
        pageHeight = yScroll;
    }
    if(xScroll < windowWidth)
    {
        pageWidth = xScroll;
    }
    else
    {
        pageWidth = windowWidth;
    }
    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
    return arrayPageSize;
}
/* fonction qui retourne les valeur du scroll actuel de la page*/
function getPageScroll()
{
    var xScroll, yScroll;
    if (self.pageYOffset)
    {
        yScroll = self.pageYOffset;
        xScroll = self.pageXOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop)
    {
        yScroll = document.documentElement.scrollTop;
        xScroll = document.documentElement.scrollLeft;
    }
    else if (document.body)
    {
        yScroll = document.body.scrollTop;
        xScroll = document.body.scrollLeft;
    }
    arrayPageScroll = new Array(xScroll,yScroll)
    return arrayPageScroll;
}
function lightBox(texte,width_box,height_box, idTitle,closeImg)
{
    if(typeof(width_box)=='undefined')
    {
        width_box='300';
    }
    if(typeof(height_box)=='undefined')
    {
        height_box='300';
    }
    if(typeof(idTitle)=='undefined')
    {
        idTitle= 'lightBox';
    }
    if(typeof(closeImg)=='undefined')
    {
	closeImg='';
    }
    else closeImg='<div class="tRight"><img class="pointer" src=\"/images/rideaux/picto/bt-fermer-pop-up-rideaux.png\" alt=\"\" /></div>';
    /*     *  on créer  2 div. Une div qui sera en noir fond transparent pour centrer la lightbox
     *  puis une autre box qui contiendra les element html a afficher en lightbox */
    action_click='closeLightBox(\'' + idTitle + '\');';
    $('body').append('<div onclick="closeLightBox(\'' + idTitle + '\')" id="' + idTitle + 'Shadow"></div>');
    $('body').append('<div onclick="'+ action_click +'" id="' + idTitle + '" style="height:'+ height_box +';width:'+ width_box +'px;"><div class="wrapperLight" >'+texte+'</div>'+closeImg+'</div>');
    /*     *on va récupérer les dimensions de la page chargé au moment de l'appel     */
    var aPageSize=getPageSize();
    //on va récupérer les valeurs des ascenseurs
    var aScrollSize=getPageScroll();
    $('#'+ idTitle +'Shadow').css({
        'background-color' : '#000000',
        'width' : aPageSize[2]+'px',
        'height' : aPageSize[1]+'px',
        'top' : '0px',
        'left' : '0px',
        'opacity' : '0.6',
        'position' : 'absolute',
        'z-index' : '99'
    });

    posi_left_light=Math.floor((aPageSize[2]-width_box)/2)+aScrollSize[0];
    posi_top_light= Math.floor((aPageSize[3]-height_box)/2)+aScrollSize[1]-150;
    if(posi_left_light<0)posi_left_light=0;
    if(posi_top_light<0)posi_top_light=0;
    $('#'+idTitle).css({
        'height':height_box+'px',
        'width':width_box+'px',
        'background-color' : '#EEEEEE',
        'left' : posi_left_light+'px',
        'top' : posi_top_light+'px',
        'position' : 'absolute',
        'display' : 'none',
        'z-index': '100'
    }).fadeIn();
}
/**
 *  Author : Neoxen <br />Ouvre une lightbox avec le contenu entrer
 *  @param content contenu de la lightbox
 *  @param disabled_close si mis a true alors on affiche le bouton pour fermer
 */
function lightBox2(content,disabled_close,timer_close)
{
    closeLightBox2('direct');
    // dimensions de la page internet
    var aPageSize=getPageSize();
    //on va récupérer les valeurs des ascenseurs
    var aScrollSize=getPageScroll();

    if(typeof(timer_close)=='undefined')timer_close='no-timer';
    //puis on affiche la shadow box
    $('<div id="lightBoxShadow"></div>').appendTo('body').css({
	'width':aPageSize[2],
	'height':aPageSize[3]
    });
    // et son contenu

    $('<div id="lightBox"></div>').appendTo('body').html(content);


    if(typeof(disabled_close)=='undefined' || disabled_close==true)
    {
	$('#lightBox').wrapInner('<div id="wrapperLightBox" />');
	$('#wrapperLightBox').before('<div id="closeImgLightBox"><img src="/images/rideaux/picto/bt-fermer-pop-up-rideaux.png"></div>');
	$('#closeImgLightBox img').one('click',function(){
	    closeLightBox2();
	});
    }

    top_light=((aPageSize[3]/2)-($('#lightBox').height()/2) - (typeof(disabled_close)=='undefined' || disabled_close==false ? 30 : 0) );
    top_light=top_light+aScrollSize[1];
    left_light=((aPageSize[2]/2)-($('#lightBox').width()/2));
    if(top_light<0)top_light=0;
    if(left_light<0)left_light=0;
    top_light=top_light+aScrollSize[1];
    if(timer_close=='no-timer')
    {
	$('#lightBox').css({
		"left":left_light+"px",
		"top":top_light+"px"
	}).hide().fadeIn();
    }
    else
    {
	$('#lightBox').css({
	    "left":left_light+"px",
	    "top":top_light+"px"
	}).hide().fadeIn().delay(timer_close).fadeOut('fast',function(){
	    closeLightBox();
	});
    }
}
function closeLightBox(id)
{
    $('#'+ id +'Shadow').remove();
    $('#'+id).remove();
}
function closeLightBox2(type)
{
    if(typeof(type)!='undefined')
    {
	if(type=='direct')
	{
	    $('#lightBoxShadow').remove();
	    $('#lightBox').remove();
	}
    }
    else
    {
	$('#lightBoxShadow').fadeOut(function(){
	    $(this).remove();
	});

	$('#lightBox').fadeOut(function(){
	    $(this).remove();
	});

    }
}
function imgLight(img_src)
{
    $('#shadow_lightImg').remove();
    $('#lightImg').remove();
    aPageSize=getPageSize();
    aPageScroll=getPageScroll();
    $('<div id="shadow_lightImg"></div>').appendTo('body').css({
        'position':'absolute',
        'width':aPageSize[0]+'px',
        'height':aPageSize[1]+'px',
        'top':'0px',
        'left':'0px',
        'opacity':'0.6',
        'background-color':'#000000',
        'z-index':'99'
    });
    $('<div id="lightImg"></div>').appendTo('body').css({
        'position':'absolute'
    });
    var img = new Image();
    $(img).load(function(){
        $(this).show();
        $('#lightImg').html('');
        $('#lightImg').append(this);
        $('#lightImg').prepend("<div class=\"tRight\" style=\"margin-bottom:3px\"><img src=\"/images/rideaux/picto/bt-fermer-pop-up-rideaux.png\" alt=\"\" /></div>");
        width_img=$(this).width()+20;
        height_img=$(this).height()+20;
        $('#lightImg').css({
            'top':(aPageSize[3]/2)-(height_img/2)+aPageScroll[1],
            'left':(aPageSize[2]/2)-(width_img/2)+aPageScroll[0],
            'background-color':'#FFFFFF',
            'padding':'10px',
            'z-index':'100'
        });
    }).attr('src', img_src);
    $('#shadow_lightImg, #lightImg').one('click',function(){
        $('#shadow_lightImg').remove();
        $('#lightImg').remove();
    });
}
function toogleChangeLinkTab(object, bg_color, color_txt)
{
    $(this).css({
        'color':color_txt,
        'background-color':bg_color
    });
}
function infoBox(id,texte,width)
{
    if(typeof(width)=='undefined')width='200';
    $('body').append('<div id="infoBoxJs" style="width:'+ width +'px;padding:10px;position:absolute;background-color:#FFFFFF;border:2px solid #0daadd">'+ texte +'</div>');
    $('#'+id).bind({
        mousemove:function(e){
            $('#infoBoxJs').css({
                'top' : e.pageY+15,
                'left' : e.pageX+15
            });
        },
        mouseout:function(){
            $('#infoBoxJs').remove();
        }
    });
}
function infobulle(object,texte,className)
{
    if(typeof(className)=='undefined')className='';
    $('body').append('<div id="infoBoxJs" class="infobulle_class '+ className +'"><span class="classic">'+ texte +'</span></div>');
    $(object).bind({
        mousemove:function(e){
            $('#infoBoxJs').css({
                'top' : e.pageY+15,
                'left' : e.pageX+15
            });
        },
        mouseout:function(){
            $('#infoBoxJs').remove();
        }
    });
}

/**AJAX LOADING**/
function ajaxLoading(selecteur,width,height)
{
    if(typeof(width)=='undefined') width_box_load=$(selecteur).width();
    else width_box_load=width;
    if(typeof(height)=='undefined') height_box_load=$(selecteur).height();
    else height_box_load=height;
    //le  64 correspond a la  moitier de l'image et le 13 a la moitier du font-size
    margin_top_img=(height_box_load/2)-(64+13);
    $(selecteur).prepend('<div id="ajax_loading_box"><img id="ajax_loading_img" src="/images/rideaux/loading/ajax_loading2.gif">Chargement ...</div>');
    $('#ajax_loading_box').css({
        'width':width_box_load+'px',
        'height':height_box_load+'px',
        'position':'absolute',
        'background-color':'#D0D0D0',
        'opacity':'0.8',
        'color':"#de3545",
        "text-align":"center",
        "font-size":"26px",
        "z-index":"100"
    });
    $('#ajax_loading_img').css({
        "display":"block",
        "margin":margin_top_img+"px auto 0 auto",
        "width":"128px"
    });
}
function closeAjaxLoading()
{
    $('#ajax_loading_box').fadeOut().remove();
}
/****/

/*** DEBUT oForm.js *****/
var tabBackFillInput_oForm= new Array();
var tabBackNumInput_oForm= new Array();
var tabBackMailInput_oForm=new Array();
function VerifIsFillInput(input_id,default_txt,verif_type)
{
    //si le verif_type n'est pas dÃ©fini on le suposse au focus
    if(typeof(verif_type)=='undefined')
    {
        // au focus  on doit sauvegarder le background si c'est la premiere fois que l'ont clic et remettre le background par dÃ©faut si on est rouge ou vert
        // puis on definit un evenement au on mouse blur pour dire de metre en rouge ou vert
        if(tabBackFillInput_oForm[input_id]==null)tabBackFillInput_oForm[input_id]=$('#'+input_id).css('background-color');
        else $('#'+input_id).animate({
            'background-color':tabBackFillInput_oForm[input_id]
            });
        if($('#'+input_id).val()==default_txt)$('#'+input_id).val('');
    }
    else
    {
        //au blur on colorise en rouge ou en vert selon que le champ est rempli ou non
        if($('#'+input_id).val()=='' || $('#'+input_id).val()==default_txt)
        {
            $('#'+input_id).animate({
                'background-color':'#FF9695'
            });
            $('#'+input_id).val(default_txt);
        }
        else
        {
            $('#'+input_id).animate({
                "background-color":'#ADFF2F'
            },200);
            $('#'+input_id).animate({
                'background-color':tabBackFillInput_oForm[input_id]
                },1000);
        }
    }
}
function VerifIsNumInput(input_id,default_txt,verif_type)
{
    //si le verif_type n'est pas dÃ©fini on le suposse au focus
    if(typeof(verif_type)=='undefined')
    {
        // au focus  on doit sauvegarder le background si c'est la premiere fois que l'ont clic et remettre le background par dÃ©faut si on est rouge ou vert
        // puis on definit un evenement au on mouse blur pour dire de metre en rouge ou vert
        if(tabBackNumInput_oForm[input_id]==null)tabBackNumInput_oForm[input_id]=$('#'+input_id).css('background-color');
        else $('#'+input_id).animate({
            'background-color':tabBackNumInput_oForm[input_id]
            });
        if($('#'+input_id).val()==default_txt)$('#'+input_id).val('');
    }
    else
    {
        //au blur on colorise en rouge ou en vert selon que le champ est rempli ou non
        if($('#'+input_id).val()=='' || isNaN($('#'+input_id).val()) )
        {
            $('#'+input_id).animate({
                'background-color':'#FF9695'
            });
            $('#'+input_id).val(default_txt);
        }
        else
        {
            $('#'+input_id).animate({
                "background-color":'#ADFF2F'
            },200);
            $('#'+input_id).animate({
                'background-color':tabBackNumInput_oForm[input_id]
                },1000);
        }
    }
}
function VerifIsMailInput(input_id,default_txt,verif_type)
{

    //si le verif_type n'est pas dÃ©fini on le suposse au focus
    if(typeof(verif_type)=='undefined')
    {
	// au focus  on doit sauvegarder le background si c'est la premiere fois que l'ont clic et remettre le background par dÃ©faut si on est rouge ou vert
	// puis on definit un evenement au on mouse blur pour dire de metre en rouge ou vert
	if(tabBackMailInput_oForm[input_id]==null)tabBackMailInput_oForm[input_id]=$('#'+input_id).css('background-color');
	else $('#'+input_id).animate({'background-color':tabBackMailInput_oForm[input_id]});
	if($('#'+input_id).val()==default_txt)$('#'+input_id).val('');
    }
    else
    {
	//au blur on colorise en rouge ou en vert selon que le champ est rempli ou non et que le mail est valide
	var regex_mail = /^[a-z0-9.%_-]+@[a-z0-9.-_]+(.)*$/i;
	var verification = regex_mail.exec($('#'+input_id).val());

	if( verification==null )
	{
	    $('#'+input_id).animate({'background-color':'#FF9695'});
	    $('#'+input_id).val(default_txt);
	}
	else
	{
	    $('#'+input_id).animate({"background-color":'#ADFF2F'},200);
	    $('#'+input_id).animate({'background-color':tabBackMailInput_oForm[input_id]},1000);
	}
    }
}
function oForm_Qte(id,sens)
{
    if(sens=='down')
    {
        if($('#'+id).val()>1)$('#'+id).val( parseInt($('#'+id).val(),10)-1 );
    }
    else $('#'+id).val( parseInt($('#'+id).val(),10)+1 );
}
/*** FIN oForm.js *****/

// genere un uniqid
function uniqid()
{
    var newDate = new Date;
    return newDate.getTime();
}

/**
 * @name dialogBox
 * @author Neoxen
 * @category Phenix plugin
 * @copyright (&copy;) Phenix
 * @param  aParamsDefine array of params (format {param:value,param2:value2} )
 * <ul>
 *	<li>(boolean)disabled_close | false => define if the dialog box have click button </li>
 *	<li>(string)close_txt | image avec une croix => define close text with closeDialogBox class for bind element  </li>
 *	<li>(int)timer_close | 0 => define wait timer before closinf dialogBox </li>
 *	<li>(string)ajaxPage | null => allow to load ajax page in dialogBox </li>
 *	<li>(hexadecimal)backgroundShadow | #000000 => define background color of shadow box </li>
 *	<li>(float)backgroundOpacity | 0.7 => define opacity of shadowBox </li>
 *	<li>(string)boxId | uniqId => define id of box </li>
 *	<li>(string)content | Aucun contenu => define content of dialogBox </li>
 * </ul>
 */
function dialogBox(aParamsDefine){

    var elm=this;
    var config={
	disabled_close:false,
	close_txt:'<img class="defaultCloseDialogBox" src="/images/close.png" alt="fermer">',
	idClose:null,
	timer_close:0,
	callback:null,
	loadCallback:null,
	top:0,
	left:0,
	activeOverflow:false,
	widthBox:0,
	heightBox:0,
	widthPage:0,
	heightPage:0,
	widthScreen:0,
	heightScreen:0,
	leftScroll:0,
	topScrool:0,
	ajaxPage:null,
	ajaxParams:null,
	backgroundShadow:'#000000',
	backgroundOpacity:0.7,
	boxId:null,
	content:'<div style="background-color:#FFFFFF;color:#BB0000;font-weight:bold;font-size:20px;padding:20px;">Aucun contenu</div>'
    }

    if(typeof(aParamsDefine)!='undefined')
    {
	for(var inc_param=0 in  aParamsDefine)
	{
	    config[inc_param]=aParamsDefine[inc_param];
	}
    }

    this.init=function(){
	if(config.boxId==null)config.boxId='dialogBox_'+uniqid();
	dimPage=getPageSize();
	scrollSize=getPageScroll();
	config.widthPage=dimPage[0];
	config.heightPage=dimPage[1];
	config.widthScreen=dimPage[2];
	config.heightScreen=dimPage[3];
	config.widthScroll=scrollSize[0];
	config.heightScroll=scrollSize[1];
    }

    this.create=function(){
	$('<div id="shadow_'+ config.boxId +'"></div>').appendTo('body').css({
	    'width':config.widthPage,
	    'height':config.heightPage,
	    'position':'absolute',
	    'background-color':config.backgroundShadow,
	    'top':0,
	    'left':0
	}).hide().fadeTo('normal',config.backgroundOpacity);
	if(config.ajaxPage!=null && config.ajaxPage!='')
	{
	    $('<div id="'+config.boxId+'" class="dialogBox"></div>').load('ajax/'+config.ajaxPage,config.ajaxParams,function(){
		if(config.disabled_close===false){
		    if(config.idClose==null)config.idClose='close_'+config.boxId;
		    $(this).prepend('<div id="'+ config.idClose +'">'+config.close_txt+'</div>');
		    $(this).hide();
		}
		elm.replaceBox();
	    }).appendTo('body');

	}
	else
	{
	    $('<div id="'+config.boxId+'" class="dialogBox"></div>').appendTo('body').html(config.content).hide();
	    if(config.disabled_close===false){
		if(config.idClose==null)config.idClose='close_'+config.boxId;
		$('#'+config.boxId).prepend('<div id="'+ config.idClose +'">'+config.close_txt+'</div>');
	    }
	    elm.replaceBox();
	}
    }

    this.replaceBox=function(){
	config.widthBox=$('#'+config.boxId).width();
	config.heightBox=$('#'+config.boxId).height();

	if(config.widthBox+50>config.widthScreen)
	{
	    config.widthBox=config.widthScreen-50;
	    config.activeOverflow=true;
	    $('#'+config.boxId).css({
		'width':config.widthBox
	    });
	}
	if(config.heightBox+50>config.heightScreen)
	{
	    config.heightBox=config.heightScreen-50;
	    config.activeOverflow=true;
	    $('#'+config.boxId).css({
		'height':config.heightBox
	    });
	}


	config.left=((config.widthScreen-config.widthBox)/2)+config.widthScroll;
	config.top=((config.heightScreen-config.heightBox)/2)+config.heightScroll;

	if(config.activeOverflow===true)
	{
	    $('#'+config.boxId).wrapInner('<div style="overflow:auto;width:'+ config.widthBox +'px;height:'+ config.heightBox +'px" />');
	}
	$('#'+config.boxId).css({
	    'left':config.left,
	    'top':config.top
	}).fadeIn();

	elm.defineOption();
    }

    this.defineOption=function() {
	if(config.loadCallback!=null)config.loadCallback.call();

	if(config.disabled_close===false){
	    $('#'+config.idClose).bind('click',function(){
		elm.close();
	    });
	}
	if(config.timer_close>0)
	{
	    setTimeout(function(){
		elm.close();
	    },config.timer_close);
	}
    }

    this.close=function(){

	$('#shadow_'+config.boxId).fadeOut("normal",function(){
	    $(this).remove();
	});
	$('#'+config.boxId).fadeOut("normal",function(){
	    $(this).remove();
	    if(config.callback!=null) config.callback.call();
	});
    }

    this.getBoxId=function(){
	return config.boxId;
    }

    elm.init();
    elm.create();
}

/**
 *version clean de la dialog box (revu par neoxen)
 */
function oDialogBox2(aParamsDefine){
    
    var elm=this;
    var config={
	disabled_close:false,
	close_txt:'<img class="defaultCloseDialogBox" src="/images/close.png" alt="fermer">',
	idClose:null,
	timer_close:0,
	closeByClick:false,
	callback:null,
	loadCallback:null,
	top:0,
	left:0,
	topGap:0,
	leftGap:0,
	topBg:0,
	leftBg:0,
	activeOverflow:false,
	widthBox:0,
	heightBox:0,
	widthPage:0,
	heightPage:0,
	widthScreen:0,
	heightScreen:0,
	leftScroll:0,
	topScrool:0,
	ajaxPage:null,
	ajax:null,
	ajaxParams:null,
	noBackground:false,
	backgroundShadow:'#000000',
	backgroundOpacity:0.7,
	boxId:null,
	selector:'body',
	content:'<div style="background-color:#FFFFFF;color:#BB0000;font-weight:bold;font-size:20px;padding:20px;">Aucun contenu</div>',
	fixedBox:false,
	withLoading:true,
	widthMarginRedim:50,// margin top and bottom around dialog box (if dialog box  is superior then dialog box will be redim
	heightMarginRedim:50,// margin left and right around dialog box (if dialog box  is superior then dialog box will be redim
	resizeBox:null,//{sel:null, w:null, h:null}
	button:null//{close:{value:null, click:null}, custom:{value:null, click:null}}
	
    }
    if(typeof(aParamsDefine)!='undefined')
    {
	for(var inc_param=0 in  aParamsDefine)
	{
	    config[inc_param]=aParamsDefine[inc_param];
	}
    }
    
    this.init=function(){
	if(config.boxId==null)config.boxId='dialogBox_'+uniqid();
	if(config.idClose==null)config.idClose='close_'+config.boxId;
	if(config.ajax!=null)config.ajaxPage=config.ajax;
	if(config.selector=='body')
	{
	    dimPage=getPageSize();
	    scrollSize=getPageScroll();
	    config.widthPage=dimPage[0];
	    config.heightPage=dimPage[1];
	    config.widthScreen=dimPage[2];
	    config.heightScreen=dimPage[3];
	    config.widthScroll=scrollSize[0];
	    config.heightScroll=scrollSize[1];
	}
	else
	{
	    selector_width=$(config.selector).outerWidth();
	    selector_height=$(config.selector).outerHeight();
	    offset=$(config.selector).offset();
	    config.widthPage=selector_width;
	    config.heightPage=selector_height;
	    config.widthScreen=selector_width;
	    config.heightScreen=selector_height;
	    config.widthScroll=offset.left;
	    config.heightScroll=offset.top;
	    config.topBg=offset.top;
	    config.leftBg=offset.left;
	}
    }
    
    this.create=function(){
	if(!config.noBackground)
	{
	    $('<div id="shadow_'+ config.boxId +'"></div>').appendTo('body').css({
		'width':config.widthPage,
		'height':config.heightPage,
		'position':'absolute',
		'background-color':config.backgroundShadow,
		'top':config.topBg,
		'left':config.leftBg
	    }).hide().fadeTo('normal',config.backgroundOpacity);
	}
	if(config.ajaxPage!=null && config.ajaxPage!='')
	{
	    if(config.withLoading==true) loadingBox();
	    $('<div id="'+config.boxId+'" class="dialogBox"></div>').load('ajax/'+config.ajaxPage,config.ajaxParams,function(){
		if(config.withLoading==true)closeLoadingBox();
		if(config.disabled_close===false && config.close_txt!=null){
		    $(this).prepend('<div id="'+ config.idClose +'">'+config.close_txt+'</div>');
		}
		$(this).hide();
		elm.replaceBox();
	    }).appendTo('body');
	    
	}
	else
	{
	    $('<div id="'+config.boxId+'" class="dialogBox"></div>').appendTo('body').html(config.content).hide();
	    if(config.disabled_close===false && config.close_txt!=null){
		$('#'+config.boxId).prepend('<div id="'+ config.idClose +'">'+config.close_txt+'</div>');
	    }
	    elm.replaceBox();
	}
    }
    
    this.replaceBox=function(){
	// Buttons
	if(config.button)
	{
	    if($('#buttonBox').length!=0)
		$('#buttonBox').remove();
	    $('#'+config.boxId).append('<div id="buttonBox" class="tRight"></div>');
	    if(config.button.close)
	    {
		$('#buttonBox').append('<button onclick="'+(config.button.close.click ? config.button.close.click : 'closeDialogBox(\''+config.boxId+'\');')+'">'+config.button.close.value+'</button>');
	    }
	    if(config.button.custom)
	    {
		$('#buttonBox').append('<button '+(config.button.custom.click ? 'onclick="'+config.button.custom.click+'"' : null)+'>'+config.button.custom.value+'</button>');
	    }
	}
	// Personnalise redim without css
	if(config.resizeBox){
	    $(config.resizeBox.sel).width(config.resizeBox.w).height(config.resizeBox.h);
	}
	
	config.widthBox=$('#'+config.boxId).width();
	config.heightBox=$('#'+config.boxId).height();
	if(config.widthBox+config.widthMarginRedim>config.widthScreen)
	{
	    config.widthBox=config.widthScreen-config.widthMarginRedim;
	    config.activeOverflow=true;
	    $('#'+config.boxId).css({
		'width':config.widthBox
	    });
	}
	if(config.heightBox+config.heightMarginRedim>config.heightScreen)
	{
	    config.heightBox=config.heightScreen-config.heightMarginRedim;
	    config.activeOverflow=true;
	    $('#'+config.boxId).css({
		'height':config.heightBox
	    });
	}
	
	config.left=((config.widthScreen-config.widthBox)/2)+(config.fixedBox==true ? 0 : config.widthScroll)+config.leftGap;
	config.top=((config.heightScreen-config.heightBox)/2)+(config.fixedBox==true ? 0 : config.heightScroll)+config.topGap;
	
	if(config.fixedBox==true)$('#'+config.boxId).css('position','fixed');
	
	if(config.activeOverflow===true) $('#'+config.boxId).wrapInner('<div style="overflow:auto;width:'+ (config.widthBox+20) +'px;height:'+ config.heightBox +'px" />');
	$('#'+config.boxId).css({
	    'left':config.left,
	    'top':config.top
	}).fadeIn();
	
	elm.defineOption();
    }
    
    this.defineOption=function() {
	if(config.loadCallback!=null)config.loadCallback.call();
	
	$('#'+config.boxId).one('closeDial',elm.close);
	
	if(config.disabled_close===false){
	    $('#'+config.idClose).one('click',elm.close);
	}
	if(config.closeByClick==true)$(document).one('click',function(){
	    elm.close();
		// ne pas oublier de debinder lorsque l'element est supprimer pour eviter les conflit
	});
	if(config.timer_close>0)
	{
	    setTimeout(function(){
		elm.close();
	    },config.timer_close);
	}
    }
    
    this.close=function(){
	//console.log(config.boxId);
	$('#shadow_'+config.boxId).fadeOut("normal",function(){
	    $(this).remove();
	});
	$('#'+config.boxId).fadeOut("normal",function(){
	    $(this).remove();
	    if(config.callback!=null) config.callback.call();
	});
    }
    
    this.getBoxId=function(){
	return config.boxId;
    }
    
    if($('#'+config.boxId).length<=0)
    {
	elm.init();
	elm.create();
	elm.getBoxId();
    }
}


/*** DEBUT jquery.lightbox-0.3.js *****/
/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.3.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.3
 * @date October 12, 2007
 * @category jQuery plugin
 * @copyright (c) 2007 Leandro Vieira Pinho (leandrovieira.com)
 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias
(function($) {
    /** * $ is an alias to jQuery object	 */
    $.fn.lightBox = function(settings) {
        // Settings to configure the jQuery lightBox plugin how you like
        settings = jQuery.extend({
            // Configuration related to overlay
            overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
            overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
            // Configuration related to images
            imageLoading:			path+'images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
            imageBtnPrev:			path+'images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
            imageBtnNext:			path+'images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
            imageBtnClose:			path+'images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
            // Configuration related to container image box
            containerBorderSize:	10,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
            containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
            // Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
            txtImage:				'Image',	// (string) Specify text "Image"
            txtOf:					'de',		// (string) Specify text "of"
            // Don´t alter these variables in any way
            imageArray:				[],
            activeImage:			0
        },settings);
        // Caching the jQuery object with all elements matched
        var jQueryMatchedObj = this; // This, in this context, refer to jQuery object
        /**
		 * Initializing the plugin calling the start function
		 *
		 * @return boolean false
		 */
        function _initialize() {
            _start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked
            return false; // Avoid the browser following the link
        }
        /** * Start the jQuery lightBox plugin
		 *
		 * @param object objClicked The object (link) whick the user have clicked
		 * @param object jQueryMatchedObj The jQuery object with all elements matched	 */
        function _start(objClicked,jQueryMatchedObj) {
            // Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
            //			$('embed, object, select').hide();
            // Call the function to create the markup structure; style some elements; assign events in some elements.
            _set_interface();
            // Unset total images in imageArray
            settings.imageArray.length = 0;
            // Unset image active information
            settings.activeImage = 0;
            // We have an image set? Or just an image? Let´s see it.
            if ( jQueryMatchedObj.length == 1 ) {
                // Add an Array, with href and title atributes, inside the Array that storage the images references
                settings.imageArray.push(new Array(jQueryMatchedObj.attr('href'),jQueryMatchedObj.attr('title')));
            } else {
                // Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references
                for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
                    settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));
                }
            }
            // In some cases IE get the full path and in another get just the relative path. So, use match to verify is better instead the operator !=
            while ( !settings.imageArray[settings.activeImage][0].match(objClicked.getAttribute('href')) ) {
                settings.activeImage++;
            }
            // Call the function that prepares image exibition
            _set_image_to_view();
        }
        /*** Create the jQuery lightBox plugin interface
		 * The HTML markup will be like that:
			<div id="jquery-overlay"></div>
			<div id="jquery-lightbox">
				<div id="lightbox-container-image-box">
					<div id="lightbox-container-image">
						<img src="../fotos/XX.jpg" id="lightbox-image">
						<div id="lightbox-nav">
							<a href="#" id="lightbox-nav-btnPrev"></a>
							<a href="#" id="lightbox-nav-btnNext"></a>
						</div>
						<div id="lightbox-loading">
							<a href="#" id="lightbox-loading-link">
								<img src="../images/lightbox-ico-loading.gif">
							</a>
						</div>
					</div>
				</div>
				<div id="lightbox-container-image-data-box">
					<div id="lightbox-container-image-data">
						<div id="lightbox-image-details">
							<span id="lightbox-image-details-caption"></span>
							<span id="lightbox-image-details-currentNumber"></span>
						</div>
						<div id="lightbox-secNav">
							<a href="#" id="lightbox-secNav-btnClose">
								<img src="../images/lightbox-btn-close.gif">
							</a>
						</div>
					</div>
				</div>
			</div>
		 **/
        function _set_interface() {
            // Apply the HTML markup into body tag
            $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');
            // Get page sizes
            var arrPageSizes = ___getPageSize();
            // Style overlay and show it
            $('#jquery-overlay').css({
                backgroundColor:	settings.overlayBgColor,
                opacity:			settings.overlayOpacity,
                width:				arrPageSizes[0],
                height:				arrPageSizes[1]
            }).fadeIn();
            // Get page scroll
            var arrPageScroll = ___getPageScroll();
            // Calculate top and left offset for the jquery-lightbox div object and show it
            $('#jquery-lightbox').css({
                top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
                left:	arrPageScroll[0]
            }).show();
            // Assigning click events in elements to close overlay
            $('#jquery-overlay,#jquery-lightbox').click(function() {
                _finish();
            });
            // Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects
            $('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
                _finish();
                return false;
            });
            // If window was resized, calculate the new overlay dimensions
            $(window).resize(function() {
                // Get page sizes
                var arrPageSizes = ___getPageSize();
                // Style overlay and show it
                $('#jquery-overlay').css({
                    width:		arrPageSizes[0],
                    height:		arrPageSizes[1]
                });
                // Get page scroll
                var arrPageScroll = ___getPageScroll();
                // Calculate top and left offset for the jquery-lightbox div object and show it
                $('#jquery-lightbox').css({
                    top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
                    left:	arrPageScroll[0]
                });
            });
        }
        /**		 * Prepares image exibition; doing a image´s preloader to calculate it´s size
		 *		 */
        function _set_image_to_view() { // show the loading
            // Show the loading
            $('#lightbox-loading').show();
            // Hide some elements
            $('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
            // Image preload process
            var objImagePreloader = new Image();
            objImagePreloader.onload = function() {
                $('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);
                // Perfomance an effect in the image container resizing it
                _resize_container_image_box(objImagePreloader.width,objImagePreloader.height);
                //	clear onLoad, IE behaves irratically with animated gifs otherwise
                objImagePreloader.onload=function(){};
            }
            objImagePreloader.src = settings.imageArray[settings.activeImage][0];
        };
        /**
		 * Perfomance an effect in the image container resizing it
		 *
		 * @param integer intImageWidth The image´s width that will be showed
		 * @param integer intImageHeight The image´s height that will be showed
		 */
        function _resize_container_image_box(intImageWidth,intImageHeight) {
            // Get current width and height
            var intCurrentWidth = $('#lightbox-container-image-box').width();
            var intCurrentHeight = $('#lightbox-container-image-box').height();
            // Get the width and height of the selected image plus the padding
            var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the image´s width and the left and right padding value
            var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the image´s height and the left and right padding value
            // Diferences
            var intDiffW = intCurrentWidth - intWidth;
            var intDiffH = intCurrentHeight - intHeight;
            // Perfomance the effect
            $('#lightbox-container-image-box').animate({
                width: intWidth,
                height: intHeight
            },settings.containerResizeSpeed,function() {
                _show_image();
            });
            if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) {
                if ( $.browser.msie ) {
                    ___pause(250);
                } else {
                    ___pause(100);
                }
            }
            $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({
                height: intImageHeight + (settings.containerBorderSize * 2)
            });
            $('#lightbox-container-image-data-box').css({
                width: intImageWidth
            });
        };
        /*** Show the prepared image **/
        function _show_image() {
            $('#lightbox-loading').hide();
            $('#lightbox-image').fadeIn(function() {
                _show_image_data();
                _set_navigation();
            });
            _preload_neighbor_images();
        };
        /** * Show the image information */
        function _show_image_data() {
            $('#lightbox-container-image-data-box').slideDown('fast');
            $('#lightbox-image-details-caption').hide();
            if ( settings.imageArray[settings.activeImage][1] ) {
                $('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();
            }
            // If we have a image set, display 'Image X of X'
            if ( settings.imageArray.length > 1 ) {
                $('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();
            }
        }
        /*** Display the button navigations * */
        function _set_navigation() {
            $('#lightbox-nav').show();
            // Show the prev button, if not the first image in set
            if ( settings.activeImage != 0 ) {
                // Show the images button for Next buttons
                $('#lightbox-nav-btnPrev').unbind().hover(function() {
                    $(this).css({
                        'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat'
                    });
                },function() {
                    $(this).css({
                        'background' : 'transparent url(___just-anything-here.gif) no-repeat'
                    });
                }).show().bind('click',function() {
                    settings.activeImage = settings.activeImage - 1;
                    _set_image_to_view();
                    return false;
                });
            }
            // Show the next button, if not the last image in set
            if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
                // Show the images button for Next buttons
                $('#lightbox-nav-btnNext').unbind().hover(function() {
                    $(this).css({
                        'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat'
                    });
                },function() {
                    $(this).css({
                        'background' : 'transparent url(___just-anything-here.gif) no-repeat'
                    });
                }).show().bind('click',function() {
                    settings.activeImage = settings.activeImage + 1;
                    _set_image_to_view();
                    return false;
                });
            }
        }
        /** * Preload prev and next images being showed	 * */
        function _preload_neighbor_images() {
            if ( (settings.imageArray.length -1) > settings.activeImage ) {
                objNext = new Image();
                objNext.src = settings.imageArray[settings.activeImage + 1][0];
            }
            if ( settings.activeImage > 0 ) {
                objPrev = new Image();
                objPrev.src = settings.imageArray[settings.activeImage -1][0];
            }
        }
        /*** Remove jQuery lightBox plugin HTML markup **/
        function _finish() {
            $('#jquery-lightbox').remove();
            $('#jquery-overlay').fadeOut(function() {
                $('#jquery-overlay').remove();
            });
        // Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
        //			$('embed, object, select').show();
        }
        /** / THIRD FUNCTION
		 * getPageSize() by quirksmode.com
		 * @return Array Return an array with page width, height and window width, height*/
        function ___getPageSize() {
            var xScroll, yScroll;
            if (window.innerHeight && window.scrollMaxY) {
                xScroll = window.innerWidth + window.scrollMaxX;
                yScroll = window.innerHeight + window.scrollMaxY;
            } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
            } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
            }
            var windowWidth, windowHeight;
            if (self.innerHeight) {	// all except Explorer
                if(document.documentElement.clientWidth){
                    windowWidth = document.documentElement.clientWidth;
                } else {
                    windowWidth = self.innerWidth;
                }
                windowHeight = self.innerHeight;
            } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
            } else if (document.body) { // other Explorers
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
            }
            // for small pages with total height less then height of the viewport
            if(yScroll < windowHeight){
                pageHeight = windowHeight;
            } else {
                pageHeight = yScroll;
            }
            // for small pages with total width less then width of the viewport
            if(xScroll < windowWidth){
                pageWidth = xScroll;
            } else {
                pageWidth = windowWidth;
            }
            arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
            return arrayPageSize;
        };
        /** / THIRD FUNCTION * getPageScroll() by quirksmode.com
		 * * @return Array Return an array with x,y page scroll values. */
        function ___getPageScroll() {
            var xScroll, yScroll;
            if (self.pageYOffset) {
                yScroll = self.pageYOffset;
                xScroll = self.pageXOffset;
            } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
                yScroll = document.documentElement.scrollTop;
                xScroll = document.documentElement.scrollLeft;
            } else if (document.body) {// all other Explorers
                yScroll = document.body.scrollTop;
                xScroll = document.body.scrollLeft;
            }
            arrayPageScroll = new Array(xScroll,yScroll)
            return arrayPageScroll;
        };
        /** * Stop the code execution from a escified time in milisecond */
        function ___pause(ms) {
            var date = new Date();
            curDate = null;
            do {
                var curDate = new Date();
            }
            while ( curDate - date < ms);
        };
        // Return the jQuery object for chaining
        return this.click(_initialize);
    };
})(jQuery); // Call and execute the function immediately passing the jQuery object
/*** FIN jquery.lightbox-0.3.js *****/


/*** DEBUT jquery_plugin.js *****/
/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */
(function(jQuery){
    // We override the animation for all of these color styles
    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
        jQuery.fx.step[attr] = function(fx){
            if ( fx.state == 0 ) {
                fx.start = getColor( fx.elem, attr );
                fx.end = getRGB( fx.end );
            }
            fx.elem.style[attr] = "rgb(" + [
            Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
            Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
            Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
            ].join(",") + ")";
        }
    });
    // Color Conversion functions from highlightFade
    // By Blair Mitchelmore
    // http://jquery.offput.ca/highlightFade/
    // Parse strings looking for color tuples [255,255,255]
    function getRGB(color) {
        var result;
        // Check if we're already dealing with an array of colors
        if ( color && color.constructor == Array && color.length == 3 )
            return color;
        // Look for rgb(num,num,num)
        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
        // Look for rgb(num%,num%,num%)
        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
        // Look for #a0b1c2
        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
        // Look for #fff
        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
        // Otherwise, we're most likely dealing with a named color
        return colors[jQuery.trim(color).toLowerCase()];
    }
    function getColor(elem, attr) {
        var color;
        do {
            color = jQuery.curCSS(elem, attr);
            // Keep going until we find an element that has color, or we hit the body
            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
                break;
            attr = "backgroundColor";
        } while ( elem = elem.parentNode );
        return getRGB(color);
    };
    // Some named colors to work with
    // From Interface by Stefan Petre
    // http://interface.eyecon.ro/
    var colors = {
        aqua:[0,255,255],
        azure:[240,255,255],
        beige:[245,245,220],
        black:[0,0,0],
        blue:[0,0,255],
        brown:[165,42,42],
        cyan:[0,255,255],
        darkblue:[0,0,139],
        darkcyan:[0,139,139],
        darkgrey:[169,169,169],
        darkgreen:[0,100,0],
        darkkhaki:[189,183,107],
        darkmagenta:[139,0,139],
        darkolivegreen:[85,107,47],
        darkorange:[255,140,0],
        darkorchid:[153,50,204],
        darkred:[139,0,0],
        darksalmon:[233,150,122],
        darkviolet:[148,0,211],
        fuchsia:[255,0,255],
        gold:[255,215,0],
        green:[0,128,0],
        indigo:[75,0,130],
        khaki:[240,230,140],
        lightblue:[173,216,230],
        lightcyan:[224,255,255],
        lightgreen:[144,238,144],
        lightgrey:[211,211,211],
        lightpink:[255,182,193],
        lightyellow:[255,255,224],
        lime:[0,255,0],
        magenta:[255,0,255],
        maroon:[128,0,0],
        navy:[0,0,128],
        olive:[128,128,0],
        orange:[255,165,0],
        pink:[255,192,203],
        purple:[128,0,128],
        violet:[128,0,128],
        red:[255,0,0],
        silver:[192,192,192],
        white:[255,255,255],
        yellow:[255,255,0]
    };
})(jQuery);

/*** FIN jquery_plugin.js *****/
