jQuery.noConflict()

jQuery(function() {
    

    /**********************************************************************
     * "Popup" de les imatges
     **********************************************************************/
    jQuery('.imatge a.ampliar').lightbox()
	jQuery('.imatge a.brcm-view-image').lightbox()

    /**********************************************************************
     * Inputs amb un value que és la descripció
     **********************************************************************/
    jQuery('input.valorEsDescripcio')
        .focus(function() {
            if (! this.getAttribute('_value')) {
                this.setAttribute('_value', this.value)
                this.value = ''
            }
        })
        .blur(function() {
            if (! this.value) {
                this.value = this.getAttribute('_value')
                this.removeAttribute('_value')
            }
        })

    /**********************************************************************
     * Accions perilloses
     **********************************************************************/
 
    jQuery('.accio_perillosa').click(function(event) {
        var seguir = confirm("N'estàs segur?")
        if (! seguir) event.preventDefault()
    })

    /**********************************************************************
     * Continguts que es carreguen en línia
     **********************************************************************/
    jQuery('a.load-inline').livequery('click', function(event) {
        var container = jQuery(this).parents('.load-inline-container')[0]
        if (! container) throw "[load-inline] No s'ha trobat el contenidor associat"
        if (! container.id) throw "[load-inline] El contenidor associat no té id"
        event.preventDefault()
        jQuery(container).load(this.href + ' #' + container.id + ' > *')
    })

    /*****************************************************************************
     * Cercador
     *****************************************************************************/
    jQuery("#cercador-general").focus(function (event) {
        jQuery(this).val("");
    });
    jQuery("#cercador-general").blur(function (event) {
        if(jQuery(this).val() == "") jQuery(this).val("escriu la teva cerca");
    });

    /****************************************************************************
     * Subscripció al newsletter/butlletí
     ****************************************************************************/
    jQuery("input#subscripcio").focus(function (event) {
        jQuery(this).val("");
    });
    jQuery("input#subscripcio").blur(function (event) {
        if (jQuery(this).val() == "") jQuery(this).val("escriu el teu email");
    });
});


