/**
* Elgg custom profile extended to Iknow Frontpage
* 
* @package custom_index
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*
* @Modified by Mindcom Ltd for iKnow Project
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @copyright iKnow Project
* 
*/
function showLoadingImage(where,type) {
    $(where).append('<div id="loading-image"><img src="http://community.iknowfutures.eu/news/_graphics/ajax-loader'+type+'.gif" alt="Loading..." /></div>');
}
function hideLoadingImage() {
    $('#loading-image').remove();
}
function activateSubCatMenu(div,ul,padding) {
    var div = $(div), ul = $(ul), ulPadding = padding;
    var divWidth = div.width();
    div.css({overflow: 'hidden'});
    var lastLi = ul.find('li:last-child');
    div.mousemove(function(e){
        var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;	
        var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
        div.scrollLeft(left);
    });
    ul.find('a').preventDefault();
}
function activateselicon(myid) {
    $('img.subicon').each(function() {
        var cid = $(this).attr('id');
        var allbg = ""+$(this).attr('src');
        if(cid==myid) {
            $(this).attr('src',allbg.replace('passive','active'));
        } else {
            $(this).attr('src',allbg.replace('active','passive'));
        }
    });
}
