/*!
 * GesWeb jquery Library for valorsa using jQuery v1.4.2
 * http://www.obtic.ch/
 *
 * Copyright (c) 2010 Obtic Sarl
 *
 * Date: 2010-05-08 (Fri, 8 May 2010)
 */
  $(function() {

    // Dechets Tooltip 
    $(".items > div > img").tooltip({
        effect: 'slide',
        slideOffset: 0,
        tip: '#gw-dechet-tooltip',
        cancelDefault:true,
        onBeforeShow:function(){
            $('#gw-dechet-tooltip').html(this.getTrigger().next().html());
        }
    });

	  // initialize scrollable
    $(".scrollable").scrollable({circular: true}).autoscroll({ autoplay: false });

    // Faq effect
    $('.gw-faq-question').click(function() {
        if ( $(this).find("div:first").hasClass("ui-icon-triangle-1-e") ) {
            $(this).find("div:first").removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s");
						$(this).addClass("gw-faq-select");
        }
        else {
            $(this).find("div:first").removeClass("ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-e");
						$(this).removeClass("gw-faq-select");
        }

        $(this).next().toggle("normal");
            return false;
    }).next().hide();

    // Add picto to link
    $('#gw-text a,#gw-connexe-block a').filter(function() {
        return this.hostname && this.hostname !== location.hostname;
    }).after(' <img src="../Themes/Content/images/external.png" alt="external link" />');   
        
    // Add picto pdf to pdf link
    $("#gw-text a[href$='.pdf'],#gw-connexe-block a[href$='.pdf']").after(' <img src="../Themes/Content/images/pdf.png" alt="fichier acrobat pdf" />');   

  });

