window.onload = init;
window.onresize = init;

// rep();

function init(){}

function rep(){
        alignColumnsHeights();
        window.setTimeout('rep()', 3000);
}

function gEBI(id) {
   	if(Boolean(document.getElementById)) {
    	return document.getElementById(id);
   	} else if(Boolean(document.all)) {
      	return eval('document.all.' + id);
	}
}

function alignColumnsHeights(){
        alignHeights('left', 'middle', 'right');
}

function alignHeights(){
        var max = 0;
        for(var i = 0; i < arguments.length; i++){
                var arg = arguments[i];
                var obj = gEBI(arg);
                if(obj == null) continue;
                var height = obj.offsetHeight;
                if(height > max) max = height;
        }
        for(var i = 0; i < arguments.length; i++){
                var arg = arguments[i];
                var obj = gEBI(arg);
                if(obj == null) continue;
                obj.style.height = max;
        }
}

function max(){
        var ret = 0;
        for(var i = 0; i < arguments.length; i++){
                var arg = arguments[i];
                if(arg > ret) ret = arg;
        }
        return arg;
}

function correctPosition(){
    gEBI('floatingad').style.top = document.body.scrollTop+20;
}

function getRes () {
	return window.screen.width;
}

function getAdXPosition(){
    var position = 0;
    if(getRes()<=990)position = 985;
    if(getRes()>990)position = (getRes()-990)/2+985;
    return position;
    //setTimeout('correctPosition()', 2000);
}
var oldThemebox;
function getAnotherMonth(year, month){
    oldThemebox = $('#monththeme').html();
    monththemeshw.renderAjaxLeftbox(year, month, 'shw', {callback:setNewMonthTheme, errorHandler:setOldMonthTheme});
}

function setNewMonthTheme(result){
    $('#monththeme').html(result);
}

function setOldMonthTheme(){
    $('#monththeme').html(oldThemebox);
}

//$('a[@rel*=lightbox]').lightBox();
    var prboxvisible = false;
   var zajeti = false;
function initPressReleaseBox(){

   $('#prboxik').hover(
           function (){
               clearTimeout(zajeti);
               $('#prboxik').slideDown('slow');
           },
          function(){
               zajeti = setTimeout( function (){$('#prboxik').slideUp('slow');}, 1500);} );
   $('#pressrelbar').hover(
           function (){
               clearTimeout(zajeti);
               $('#prboxik').slideDown('slow');
           },
           function(){
               zajeti = setTimeout(function (){$('#prboxik').slideUp('slow');}, 1500);});
}