
$(document).ready(function() {
	
	/* ------------------------------------------------------------- */

	// initialize scrollable  
    /*
    $("div.scrollable").scrollable({ 
	             
        vertical:true,  
        size: 1, 
        
        // items are auto-scrolled in 2 secnod interval 
        interval: 2000, 
         
        // when last item is encountered go back to first item 
        loop: true,  
         
        // make animation a little slower than the default 
        speed: 600, 
         
        // when seek starts make items little transparent 
        onBeforeSeek: function() { 
            this.getItems().fadeTo(300, 0.2);         
        }, 
         
        // when seek ends resume items to full transparency 
        onSeek: function() { 
            this.getItems().fadeTo(300, 1); 
        } 
    }); 
    */
    
    /* ---HOMEPAGE NEWS--------------------------------------------- */    
    
    // special way to calculate the expiration date of news items
    
    $('#events .listing, #news .listing, .expires').each( function() {
    	expDate = new Date($(this).attr('expiration-date'));
    	today = new Date();
    	if ((expDate - today) < 0) {
    		$(this).hide();
    	}
    }); 

    // special way to calculate the publish date of any item
    
    $('.publishes').each( function() {
        pubDate = new Date($(this).attr('publish-date'));
        today = new Date();
        if (today < pubDate) {
            $(this).hide();
        }
    });
	
	/* --- HOME PAGE EVENTS ------------------------------------------ */
	
	$('#events .listing.highlight .lang-link').click( function() {
		$('#events .listing.highlight .lang-en').toggle();
		$('#events .listing.highlight .lang-es').toggle();
		$('#events .listing.highlight .lang-link').toggle();
	});
	
	/* --------------------------------------------------------------- */
	
});
