var menu = 0;
$(function() {
  if (location.href.search('news') > 0) {
    menu = 1;
  } else
  if (location.href.search('service') > 0) {
    menu = 2;
  } else
  if (location.href.search('clients') > 0) {
    menu = 3;
  } else
  if (location.href.search('testimonials') > 0) {
    menu = 4;
  } else
  if (location.href.search('contacts') > 0) {
    menu = 5;
  }
  if (menu > 0) {
    $('#menu'+menu).css('background-position', '0 -18px');
  }
  var i = 0;
  $('#menu-bar div.menu').each(function(){
    $(this).hover(function(){
      $(this).css('background-position', '0 -18px');
    }, function(){
      if ($(this).attr('id') != 'menu'+menu) {
        $(this).css('background-position', '0 0');
      }
    });
  });
  /*
  $('#submenu div.submenu').each(function(){
    i++;
    if (i != 2) {
    $(this).hover(function(){
      var h = $(this).height();
      $(this).css('background-position', '0 -'+h+'px');
    }, function(){
      $(this).css('background-position', '0 0');
    });
    }
  });
*/
  $('div.more').each(function(){
    $(this).hover(function(){
      $(this).css('background-position', '0 -16px');
    }, function(){
      $(this).css('background-position', '0 0');
    });
  });
})

function showImg(obj)
{
  var p = $('#'+obj);
  p.css({
    top: $(window).scrollTop() + ($(window).height()/2) - p.height()/2,
    left: $(window).scrollLeft() + ($(window).width()/2) - p.width()/2
  });
  p.toggle('slow');
  return false;
}

var current_header = 1;
function changeHeader() 
{
  if (current_header == 1) {
    $('#header2').animate({opacity: 1}, 2000);
    current_header = 2;
  } else {
    $('#header2').animate({opacity: 0}, 2000);
    current_header = 1;
  }
}
