window.addEvent('domready', init);

function swapNews(cur,max,next) {
    var items = $$('.fornews');
    var num = 0;

    items.each(function (it) {
        if (num==cur) {
            
           
            it.fade('out');
           
            
        } else if (num==next) {
           
           
            it.fade('in');
            
        }
        num++;
    });
    cur = next;
    next = cur+1;
    if (next>=max) next=0;
   
    setTimeout("swapNews("+cur+","+max+","+next+")",5000);
}

function init() {
    var b = $$('.mootabs');
    if (b.length>0) {
        myTabs1 = new mootabs('producttabs');
    }

    var items = $$('.fornews');
    var num = 0;
    items.each(function (it) {
        if (num==0) {
             it.fade('in');
        } else {
            it.fade('out');
        }
        num++;
    });
    cur = 0;
    if (num>1) {
        setTimeout("swapNews("+cur+","+num+","+(cur+1)+")",5000);
    }
    

}

window.addEvent("load",function() {

    

    h1 = $('leftblock').getSize().y;
    h2 = $('contentblock').getSize().y;
    h3 = $('rightblock').getSize().y;
    hmax = (h1>h2?(h1>h3?h1:h3):(h2>h3?h2:h3))+140;
    $('content').setStyle('height',hmax);


    $$('.phototip').each(function(element,index) {
        var content = element.get('title').split('::');
        element.store('tip:title', content[0]);
        element.store('tip:text', content[1]);
    });

    //create the tooltips
    var tipz = new Tips('.phototip',{
        className: 'tipz',
        fixed: false,
        hideDelay: 50,
        showDelay: 50
    });

  
    
});



