var pathLightBox = 'fileadmin/template/commun/lightbox-plugin/images/';
var linksPagesGallery = new Array();
function extractUrlParams(){	
	var t = location.search.substring(1).split('&');
	var f = [];
	for (var i=0; i<t.length; i++){
		var x = t[ i ].split('=');
		f[x[0]]=x[1];
	}
	return f;
}

function change(who,cible,cible2){
	$('#' + cible + ' .icones a').removeClass("active");
	$('#'+cible+' div div[className!=pagination || className!=item]').css({display:"none"});
	if(who)
		who.className = 'active';
	if(cible2!=''){
		$('#'+cible2 ).css({display:"block"});
		$('#'+cible2+' div').css({display:"block"});
	}
	return false;
}
function galleryChange(select){
	if(select && select.selectedIndex>0){
		//var opt = select.options[select.selectedIndex].value;
		var opt = linksPagesGallery[select.selectedIndex-1];
		window.location=opt;
	}
	return false;
}

function galleryInitSelect(){

	var liens = $(" div.gallery a.l_gallery");
	var sel = $(" div.wtgallery_list_area select.gallery_list_select");

       	if(liens && sel && liens.length>0 && sel.length==1){
            for(;0<sel[0].options.length;)
       	        sel[0].remove(0);
       	    var y=document.createElement('option');
            y.text='Changer de page';
            try{
                sel[0].add(y,null); // standards compliant
            }
            catch(ex){
                sel[0].add(y); // IE only
            }
	    linksPagesGallery.length=liens.length;
            for(i=0;i<liens.length;i++){
		linksPagesGallery[i]=liens[i].href;
       	        var y=document.createElement('option');
		if(jQuery.browser.msie)
                	y.text=liens[i].innerText;
		else
                	y.text=liens[i].text;
		var Page = y.text.split('Page ');
               	y.value=liens[i].href;
       	        try{
                    sel[0].add(y,null); // standards compliant
               	}
       	        catch(ex){
                    sel[0].add(y); // IE only
               	}
       	    }
       }
	else{
		$(" div.wtgallery_list_area select.gallery_list_select").css({display:"none"});
	}
}

function setNewsColor(){
        var d = new Date();
        var m = d.getUTCMonth() +1;

        if(m.length==1)
            m="0"+m;

            var y = d.getFullYear().toString();
            y=y.substring(2,4);

            var j = d.getUTCDate().toString();
        if(j.length==1)
                j="0"+j;

        var da = "[" + j + "/" + m + "/" + y + "]";
        var obj = $('span.date');
	if(obj)
        for(var i=0;i<obj.length;i++){
        	if(obj[i].innerHTML==da){
       //         if(obj[i].innerHTML=='[16/02/09]' || obj[i].innerHTML=='[20/08/08]'){
                   obj[i].className='dateJ';
                }
        }
}
function galleryInitLightBox(){
	$('a[@rel*=lightbox]').lightBox({
		imageLoading:  pathLightBox + 'lightbox-ico-loading.gif',
		imageBtnClose: pathLightBox + 'lightbox-btn-close.gif',
		imageBtnPrev:  pathLightBox + 'lightbox-btn-prev.gif',
		imageBtnNext:  pathLightBox + 'lightbox-btn-next.gif'
	});
}

