jQuery.noConflict();

function  moveUp(who, container, max) {
    var move;
    if (parseInt(jQuery(who).css('top')) > max){
        move=parseInt(jQuery(who).css('top')) - 8;
    }
    else move = max;
    jQuery(who).css('top', move+'px');
}
        
function  moveDown(who, container, max) {
    var move;
    if (parseInt(jQuery(who).css('top')) < max){
        move=parseInt(jQuery(who).css('top')) + 8;  
    }
    else move = max;
    jQuery(who).css('top', move+'px');
}

/**
* Barre de d�filement g�n�rale
*/
jQuery(function(){
	var gup;
    jQuery("#scrollbarup").hover(function() {
    	if (jQuery("#scrolldiv").height()>jQuery("#container").height()){
	        var top = - jQuery("#scrolldiv").height() + jQuery("#container").height();
	        gup=setInterval("moveUp('#scrolldiv', '#container', " + top + ")", 10);
        }
    },
    function(){
        clearInterval(gup);
    });
    
    var gdown; 
    jQuery("#scrollbardown").hover(function() {
        gdown=setInterval("moveDown('#scrolldiv', '#container', 0)", 10);
    },
    function(){
        clearInterval(gdown);
    });         
});

/**
* Acces rapide (affichage des mois + barres de d�filement
*/
jQuery(function(){             
    var arcalcontainer;
    
    jQuery("div.acccesrapidecalcontainer", "#accesrapideliste > li").hide();
    jQuery("div.acccesrapidecalcontainer", "#accesrapideliste > li.actif").show();
    var arcalcontainer = jQuery("div.acccesrapidecalcontainer", "#accesrapideliste > li.actif").attr("id");
    
    
    jQuery("#accesrapideliste > li").click(function(){
        jQuery("#" + arcalcontainer).hide();
        jQuery("#accesrapideliste > li.actif").removeClass("actif");
        jQuery("div.acccesrapidecalcontainer", this).show();
        arcalcontainer = jQuery("div.acccesrapidecalcontainer", this).attr("id");
        jQuery(this).addClass("actif");
    });
    
    var gcalup;
    jQuery("div.accesrapideup").hover(function(){
        var cal = jQuery("table.accesrapidecal","#" + arcalcontainer).attr("id");
        if (jQuery("#" + cal).height()>jQuery("#" + arcalcontainer).height()){
	        var top = -jQuery("#" + cal).height() + jQuery("#" + arcalcontainer).height();
	        gcalup=setInterval("moveUp('#"+cal+"', '#"+arcalcontainer+"', " + top + ")", 10);
        }
    },
    function(){
        clearInterval(gcalup);
    });
    
    var gcaldown;
    jQuery("div.accesrapidedown").hover(function() {
        var cal = jQuery("table.accesrapidecal","#" + arcalcontainer).attr("id");
        gcaldown=setInterval("moveDown('#"+cal+"', '#"+arcalcontainer+"', 0)", 10);
    },
    function(){
        clearInterval(gcaldown);
    });
});

/**
* Calendriers (filtres mois)
*/
jQuery(function(){
	var month = jQuery("#selectmonth").attr("value");
    jQuery("#cal" + month).addClass("actif");
    jQuery("#cal" + month).show();
    
    jQuery("#selectmonth").change(function(){
        month = jQuery(this).attr("value");
        jQuery("#scrolldiv > .actif").hide();
        jQuery("#cal" + month).addClass("actif");
        jQuery("#cal" + month).show();
        jQuery("#scrolldiv").css('top','0px');
    });   
});

/**
*	LIEUX HORS LES MURS
*/
jQuery(function(){
    jQuery("div.popup", "#listelieu").hide();               
    jQuery(".ullistelieu > li").hover(function(){
    	var id = jQuery(this).attr("id");
        jQuery("div.popup", "#listelieu").hide();
        jQuery("#popup" + id).show();
        jQuery("img", ".ullistelieu > li.actif").attr('src', 'fileadmin/templates/sub/images/puceOrange.gif');
        jQuery(".ullistelieu > li.actif").removeClass("actif");
        jQuery(this).addClass("actif");
        jQuery("img", this).attr('src', 'fileadmin/templates/sub/images/puceNoire.gif');
        if(jQuery.browser.msie) jQuery("#scrolldiv").hide();
    },
    function(){
    });
    jQuery("div.popup", "#listelieu").click(function(){
        jQuery(this).hide();
        if(jQuery.browser.msie) jQuery("#scrolldiv").show();
    });   
});


/**
* CHARTE UTILISATION COMMENTAIRES
*/
jQuery(function(){
	jQuery("#popupcharte").hide();
	jQuery("#lcharte").click(function(){
		jQuery("#formcommentairearea").hide();
		jQuery("#popupcharte").show();
	});
	jQuery("#closecharte").click(function(){
		jQuery("#popupcharte").hide();
		jQuery("#formcommentairearea").show();
		jQuery("#scrolldiv").css('top','0px');
	});
});

/**
* Remplacement des hr
*/
jQuery(function(){
	jQuery("hr").wrap("<div class='hr'></div>");
	jQuery(".hr").empty();
	jQuery(".hr").append("&nbsp;");
});


/*
** Google analytics
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-13195276-1);
pageTracker._trackPageview();
} catch(err) {}
*/
