// Fix background image flickering in IE
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) { }

/* Special search behavior */
var Search = {
	prompt: "Search", // default value - should get real value from markup
	init: function() {
		Search.prompt = jQuery('#search').focus(Search.focus).blur(Search.blur).val();
	},
	focus: function() { if (this.value == Search.prompt) { this.value = ''; } },
	blur: function() { if (this.value.length == 0) { this.value = Search.prompt; } }
};
$(document).ready( Search.init );

/* begin - Navigation Primary */
var NavigationPrimary = {
  init: function() {    
		var c = this;
		var n = $('#NavigationPrimary > ul');
		
		// Use bgiframe to fix dropdowns over selects if it's available.
		$.fn.bgiframe && $('li', n).bgiframe();

		// Mark parent elements so that we can style them with CSS
		$('> li', n).each(function() { c.markParents(this); });
  	
  	// Use the hoverintent plugin if it's available
  	// if ($.fn.hoverIntent)
  	//     {
  	//   $('li', n).hoverIntent( {
  	//     sensitivity: 1,
  	//     over: this.mouseenter,
  	//     out: this.mouseleave,
  	//     timeout: 100
  	//   });
  	//     }
  	// else
  	  $('li', n).hover(this.mouseenter, this.mouseleave);
  },
  markParents: function(li) {
    var c = this;
    if ($('> ul', li).size() > 0)
	    $(li).addClass('parent').find('> a').addClass('parent').end().find('> ul li').each( function() { c.markParents(this); });
	},
	mouseenter: function() { $(this).addClass('over').children('a').addClass('over'); },
	mouseleave: function() { $(this).removeClass('over').children('a').removeClass('over'); }
};
$(function() { NavigationPrimary.init(); });
/* end - Primary Navigation */

/* Start supporting JS script for Popup Window functionality. */
$(function() {
  // Open fully qualified links, PDFs, Duet Beat Newsletters, demo links in a new browser window
  $('a[href^=http://],a[href^=https://],a[href$=.pdf],a.newsletter,area.demo,a.demo,a.webcast').popupwindow(); 
});
/* End supporting JS script for Popup Window functionality. */
    
var DD_belatedPNG;
if (DD_belatedPNG) { // Only execute for IE6
	// Selectors need to match what's in the CSS exactly
	DD_belatedPNG.fix('body.home .newsticker a.rssButton, body.home .newsticker a.blogButton, body.home .newsticker a.facebookButton');
	DD_belatedPNG.fix('body.home .newsticker a.msPartnerButton, body.home .newsticker a.twitterButton, body.home .newsticker a.youTubeButton');
}