bigyoIze = function(){
  var ul = $(this).find('ul');
  
  if(!ul.length)
   return true;
  
  ul = ul.eq(0);
  
  if(ul.css('display') == 'none'
  || !ul.height()){
   $(this).addClass('nagyonaktiv');
   
   if(typeof ul[0]._height == 'undefined'
   || !ul[0]._height){
    ul[0]._height = ul.outerHeight();
   }
   
   ul.css({height:0,display:'block'});
ul.find('a').css({color:'#b63f1e'});
   ul.animate({height:Math.max(ul.find('li').length - 1, 1) * ul.find('li').eq(0).outerHeight(true)}, 'normal', function(){
//ul.find('li').animate({backgroundColor:'#94C0B9'}, 'normal');
ul.find('a').animate({color:'#006666'}, 'normal');
});
//   ul.animate({height:ul[0]._height});
  }else{
//ul.find('a').css({color:'#006666'}).animate({color:'#b63f1e'}, 2000);
   $(this).removeClass('nagyonaktiv');
   
   ul.animate({height:0});
//   ul.find('ul').animate({height:0});
   ul.animate({height:0}, 'normal', function(){
    $(this).css({height:0,display:'none'});
    $('ul', this).css({height:0,display:'none'});
   });
  }
  
  $(this).toggleClass('aktiv');
//  $(this).parent().toggleClass('nagyonaktiv');
  
  return false;
 };

$(function(){
 $('a[href^="http://"]:not([href^="http://www.imago"])').attr('target', '_blank');
// $('#fejlec h1').css({marginTop:-46});
 $('#fejlec').click(function(e){
  if($(e.target).attr('href'))
   return true;
  
  window.location = 'http://www.imagoegyesulet.hu/';
  
  return false;
 });
 
 $('a[rel=galeria]').colorbox({
  maxWidth : '80%',
  maxHeight : '80%',
  previous : 'előző',
  next : 'következő',
  close : 'bezárás',
  current : '{current} / {total}',
  dummy : true
 });
 
// if(!$.browser.msie)  $('#bal ul li').hover(bigyoIze);
 if($.browser.msie){
  $('#bal ul').css({marginLeft:'220px'});
  $('#bal ul').css({marginLeft:0});
  $('#bal').css({marginLeft:'-25px'});
  $('#tartalom').css({marginLeft:200,marginRight:225});
  $('#jobb').css({marginRight:42});
  $('#lablec').css({marginLeft:-16});
  $('#fejlec-email').css({marginLeft:200});
 }
 
 $('#fejlec-email').css({width:$('#fejlec-email').width(),height:$('#fejlec-email').height(),overflow:'hidden'});
 $('#fejlec-email').html(' ');
 
 $('#bal li').hover(function(){
  $(this).find('ul').eq(0).css({display:'block',position:'absolute'});
 }, function(){
  $(this).find('ul').eq(0).css({display:'none'});
 });
});

