var CSSUtilities = new Object();

CSSUtilities.showBlock = function(id, show, block) {

    var element = this.getObject(id);

    if( element )
        element. style.display = show ? (block ? 'block' : 'inline') : 'none';
}

CSSUtilities.getObject = function(id) {
    return document.getElementById ? document.getElementById(id) : document.all[id];
}

CSSUtilities.equalizeHeights = function(ids, alignBottom) {

    if( ids ) {
    
        var max = 0;
        
        for(var i in ids) {
        
            height = this.getObject(ids[i]).offsetHeight;
            if( height > max )
                max = height;
        }
        
        for(var i in ids) {
        
            var element = this.getObject(ids[i]);
            
            if( element.offsetHeight < max )
                if( alignBottom )
                    element.style.paddingTop = (max-element.offsetHeight)+'px';
                else    
                    element.style.paddingBottom = (max-element.offsetHeight)+'px';
        }    
    }            
}

var Utilities = new Object();

Utilities.getRelativePath = function(url, baseUrl) {

    var path = [];

    var urlParts = url.split('/');
    var baseUrlParts = baseUrl.split('/');

    var i;
    
    for(i = 0; i < Math.min(urlParts.length, baseUrlParts.length); i++ )
        if( urlParts[i] != baseUrlParts[i] )
            break;
        
    for( j = i; j < baseUrlParts.length - 1; j++ )
        path.push('..');
        
    while( i < urlParts.length )
        path.push(urlParts[i++]);
        
    return path.join('/');    
}

var URLMonitor = new Object();

URLMonitor.monitor = function(element) {

    document.getElementById('urlMonitor').src = 'statystyki_linki.php?'+element.href;
    return false;
}

URLMonitor.done = function(url) {
    document.location = url;
}

