/*
function cssmenuhover()
{
	var lis = document.getElementById("mainmenu").getElementsByTagName("LI");
	for (var i=0;i<lis.length;i++)	{
    if (lis[i].className.search(/parent/i) > -1) {
      lis[i].onmouseover=function(){this.className+=" hilite"; this.getElementsByTagName("LI")[0].style.display = 'inline';}
      lis[i].onmouseout=function() {this.className=this.className.replace(new RegExp(" hilite\\b"), "");}
		}
	}
}
if (window.attachEvent)
	window.attachEvent("onload", cssmenuhover);
*/
$(document).ready(function() {
  $('#leftcol').find('a.sublevel').parents('div').each(function(){
    $(this).addClass('sublevel');
    $(this).css('background', '#172a84');
    $(this).css('padding-top', '5px');
    $(this).css('padding-bottom', '10px');
    $(this).css('padding-left', '15px');
    $(this).find('img').remove();
  });
/*  $('#leftcol').find('a.sublevel:first').parents('div').each(function(){
    $(this).css('padding-top', '15px');
  });
  $('#leftcol').find('a.sublevel:last').parents('div').each(function(){
    $(this).css('padding-bottom', '15px');
  });*/
  $('#leftcol').find('a.mainlevel').each(function(){
    $(this).wrap('<div class="mainlevel"></div>');
    var par = $(this).parents('div.mainlevel');
    $(par).css('padding-top', '10px');
    $(par).css('padding-bottom', '10px');
  });
  
  $('div.moduletable-left').css('background', '');
  $('div.moduletable-left').css('padding-top', '0');
  $('div.moduletable-left').css('padding-bottom', '0');
  $('div.moduletable-left').css('padding-left', '0');
  
  $('#leftcol div.moduletable-left').find('div.sublevel').mouseover(function(){
    $(this).addClass('mover');
//    $(this).css('background', '#0093d7');
  }).mouseout(function(){
    $(this).removeClass('mover');
//    $(this).css('background', '#172a84');
  });
  $('#leftcol div.moduletable-left').find('div.mainlevel').mouseover(function(){
    $(this).addClass('mover');
    $(this).css('background', '#0093d7');
  }).mouseout(function(){
    $(this).removeClass('mover');
    $(this).css('background', '');
  });


  $('div.infob-col div.infob-head').each(function(){
    $(this).mouseover(function(){
      $(this).addClass('mover');
    })
    .mouseout(function(){
      $(this).removeClass('mover');
    }).click(function(){
      for(i=1; i<=3; i++) {
        $('span#infob'+i+'-txt').css('display', 'none');
        $('div#infob'+i+'infob'+i).css('display', 'none');
      }
      idd = this.id;
      $('span#'+idd+'-txt').css('display', 'block');
      
      h = $('div.infob-body').height() + 15*2 + 15*2 + 3;
      h = 148;
      
      bl = $('div#'+idd+idd);
      $(bl).css('display', 'block');
      $(bl).css('margin-top', '-'+h+'px');
      if (navigator.appName == 'Opera') {
        $(bl).find('div.infob-col-active').css('height', '160px');
      } else {
        $(bl).find('div.infob-col-active').css('height', (h-30-10)+'px');
      }
    });
  });

  $('.moduletable-menu ul.menu li.parent ul').each(function(){
    w = $(this).parents('li.parent').width();
    $(this).css('margin-left', '-'+w+'px');
    
    w = $(this).width() - 20;
    if (navigator.appName != 'Opera') {
      $(this).append('<li class="child-last"><div style="float: left; width: 10px;"><img src="/images/menutop_cor_l.png" border="0" style="float: left; width: 10px;" /></div><div style="float: right; width: 10px;"><img src="/images/menutop_cor_r.png" border="0" style="float: right; width: 10px;" /></div><div class="clr" style="position: absolute; width: '+w+'px;"></div></li>');
//      $(this).append('<li class="child-last"><img src="/images/menutop_cor_l.png" border="0" style="float: left; width: 10px;" /><img src="/images/menutop_cor_r.png" border="0" style="float: right; width: 10px;" /><div class="clr" style="position: absolute; width: '+w+'px;"></div></li>');
    }
  });

  $('div.moduletable-menu ul.menu li.parent').mouseover(function(){
    if (navigator.appName == 'Opera') {
      mnu = $(this).find('ul');

      w = $(this).width();
//alert('w='+w);
      $(mnu).width('200px');
      $(mnu).css('margin-left', '-120px');
//      $(mnu).find('li.child-last div.clr').width('190px');
    }

    $(this).addClass('hilite');
  }).mouseleave(function(){ 
    $(this).removeClass('hilite'); 
  });
  
  $('div.infob-col div#infob2').click();
});

