/*
$Id: fixes.js,v 1.1 2008/11/18 11:23:32 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*/

/*
  Position:absolute elements will not move when window is resized if a sibling contains float elements and a clear:both element
  https://bugzilla.mozilla.org/show_bug.cgi?id=442542
  FireFox 3.0+
*/
if (navigator.userAgent.toLowerCase().search(/firefox\/(3\.\d+)/i) != -1 && typeof(window.$) != 'undefined') {
  $.event.add(
    window,
    'resize',
    function() {
      var h = document.getElementById('header');
      if (!h || $(h).css('position') != 'absolute')
        return;

      document.getElementById('header').style.position = 'static';
      setTimeout(
        function() {
          document.getElementById('header').style.position = 'absolute';
        },
      20);
    }
  );
}

$(function() {
	// drop down
	$("#navigation ul li").hover(function() {
		$(this).css({ 'z-index' : 100 });
		$(this).find(".dd").show();
		$(this).find("a:eq(0)").addClass('hover');
	}, function() {
		$(this).css({ 'z-index' : 1 });
		$(this).find(".dd").hide();
		$(this).find("a:eq(0)").removeClass('hover');
	});
	
	// focus blur
	$('.blink')
		.focus(function(){
			if( $(this).val() == $(this).attr('title') ) {
				$(this).val('');
			}
		})
		.blur(function(){
			if( $(this).val() == '' ) {
				$(this).val( $(this).attr('title') );
			}
		});
	
	// home tabs
	$('.tab-head a').click(function() {
		$(this).parents('.tab-head:eq(0)').find('a').removeClass('active');
		$(this).parents('.box-tabs:eq(0)').find('.tab-body').hide();
		$($(this).attr('href')).show();
		$(this).addClass('active');
		return false;
	});
	var nav_width = 0;
	$('#navigation ul:first li').each(function() {
		nav_width += $(this).outerWidth();
	});
	$('#navigation ul:first').width(nav_width+30);
});