// Fix background image flickering in IE
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) { }

/* begin - Primary Navigation */
var primaryNavigation = {
  init: function() {
  	var c = this, n = $('#PrimaryNav');
    if ($.browser.msie) // iframe to fix dropdowns over select items
        $('> li', n).append('<iframe style="display: none;" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>');
	
	$('> li', n).each(function() { c.markRelationships(this); });
    $('li', n).hover(
      function() {
        $(this).addClass('over').filter('.last').addClass('lastOver').end().children('a').addClass('over');
  	    if ($.browser.msie) {
  				var h = $(this).children('ul').height();
  				var w = $(this).children('ul').width() + 1;
  				var i = $(this).children('iframe');
  				if (i.length > 0 && h != null && w != null)
  				  i.height(h).width(w).show();
		    }
      },
      function() {
        $(this).removeClass('over').removeClass('lastOver').children('a').removeClass('over');
        if ($.browser.msie)
          $(this).children('iframe').hide();
      }
    );
  },
  markRelationships: function(li) {
  	  var c = this;
  	  if ($('> ul > li > ul', li).size() > 0)
  	  	  $(li).addClass('grandparent').find('> a').addClass('grandparent');
  	  if ($('> ul', li).size() > 0)
  	  	  $(li).addClass('parent selfclear').find('> a').addClass('parent').end().find('> ul > li').each(function() { c.markRelationships(this); });
  }
};
$(function() { primaryNavigation.init(); });
/* end - Primary Navigation */


/* begin - Autoscrolling images on homepage */
$(function() {	
	$('#CustomerScroll').jcarousel({
		itemVisible: 1,
		wrap: true,
		wrapPrev: true,
		itemHeight: 69,
		itemWidth: 147,
		scrollAnimation: 0,
		animation: "fast",
		autoScroll: 5,
		noButtons: true,
		autoScrollStopOnMouseover: true,
		autoScrollResumeOnMouseout: true
    });
});	
$(function() {	
	$('#PartnerScroll').jcarousel({
		itemVisible: 1,
		wrap: true,
		wrapPrev: true,
		itemHeight: 69,
		itemWidth: 147,
		scrollAnimation: 0,
		animation: "fast",
		autoScroll: 5,
		noButtons: true,
		autoScrollStopOnMouseover: true,
		autoScrollResumeOnMouseout: true
    });
});	
/* end - Autoscrolling images on homepage */

/* begin - open new window for external links and pdfs 
	$(function() {
		$('#Wrapper a[@href^=http://]').not($('a.noPopup')).popupwindow(); // Fully qualified links
		$('#Wrapper a[@href^=https://]').popupwindow(); // Secure HTTP connection links
		$('#Wrapper a[@href$=.pdf]').popupwindow(); // PDFs by URL
		$('#Wrapper a.popup').popupwindow(); // specific links
	});
 end - open new window for external links and pdfs */


var dataKeeperFlyout = {
	init: function() {
		$('a[@href=#show]').click(function() {
			$('#DataKeeperFlyout').show();
			return false;
		});
		$('a[@href=#hide]').click(function() {
			$('#DataKeeperFlyout').hide();
			return false;
		});
	}
};
$(function() { dataKeeperFlyout.init(); });

$(function() {
  $('#Close').click( 
    function() {
      window.parent.tb_remove();
      return false;
    }
  );
});