
//<![CDATA[

// If you don't want to put nonstandard properties in your stylesheet, here's yet
// another means of activating the script. This assumes that you have at least one
// stylesheet included already in the document above this script.
// To activate, delete the CSS rules above and uncomment below (remove /* and */ ).

/*
if (document.all && /MSIE (5\.5|6)/.test(navigator.userAgent) &&
document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule)
{
document.styleSheets[0].addRule('*', 'behavior: url(iepngfix.htc)');
// Feel free to add rules for specific elements only, as above.
// You have to call this once for each selector, like so:
//document.styleSheets[0].addRule('img', 'behavior: url(iepngfix.htc)');
//document.styleSheets[0].addRule('div', 'behavior: url(iepngfix.htc)');
}
*/


// Here's another script that disables all PNGs in IE when the page is printed.
/*
if (window.attachEvent  && /MSIE (5\.5|6)/.test(navigator.userAgent))
{
function printPNGFix(disable)
{
for (var  i = 0; i < document.all.length; i++)
{
var e = document.all[i];
if (e.filters['DXImageTransform.Microsoft.AlphaImageLoader'] || e._png_print)
{
 if (disable)
 {
  e._png_print = e.style.filter;
  e.style.filter = '';
 }
 else
 {
  e.style.filter = e._png_print;
  e._png_print = '';
 }
}
}
};
window.attachEvent('onbeforeprint',  function() { printPNGFix(1) });
window.attachEvent('onafterprint',  function() { printPNGFix(0) });
}
*/

//]]>

/*
 * rDropDown
 * Adds class of 'hover' to LI onmouseover. Removes class onmouseout. Adds iFrame fix for IE
 */
 
 
function rDropDown() {
this.initialize();
}

rDropDown.prototype = {
open: false,
timeout: false,
openLi: null,
initialize: function() {
var userAgent = navigator.userAgent.toLowerCase()
if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1)
$("#TopNav > ul").addClass('macFF');

var lis = $("#TopNav > ul > li");
for (var i=0; i<lis.length; i++) {
$(lis[i]).bind('mouseover', {parentThis: this, li:lis[i]}, function(params) {
params.data.parentThis.show(params.data.li);
});
$(lis[i]).bind('mouseout', {parentThis: this, li:lis[i]}, function(params) {
params.data2 = params.data;
params.data.parentThis.timeout = setTimeout(function() {
params.data = params.data2;
params.data.parentThis.hide(params.data.li);
}, 1);
});
}
},

show: function(li) {
if (this.openLi && this.openLi != li) {
this.hide(this.openLi);
}
if(this.timeout){
clearTimeout(this.timeout);
this.timeout = false;
}
if(this.open){
return;
}
if ($(li).hasClass('hasSub')) {
$(li).addClass('hoverSub');
}
else {
$(li).addClass('hover');
}
this.openLi = li;
this.open = true;
this.iframeFix(li);
},

hide: function(li) {
if(!this.open){
return;
}
$(li).removeClass('hover');
$(li).removeClass('hoverSub');
this.open = false;
if (this.iframe) {
this.iframe.style.display = "none";
}
},
iframeFix: function(li) {
if(!document.all) {
//return;
}

var subnav = $('div.subnav', li)[0];
if (subnav) {
if (!this.iframe) {
this.iframe = document.createElement('iframe');
this.iframe.style.position = 'absolute';
this.iframe.frameBorder = 0;
this.iframe.style.filter = 'alpha(opacity=0)';
this.iframe.style.zIndex = -1;
document.body.appendChild(this.iframe);
}
this.iframe.style.display = "block";
this.iframe.style.top = $(subnav).offset().top + 'px';
this.iframe.style.left = $(subnav).offset().left + 'px';
this.iframe.style.width = $(subnav).width() + 'px';
this.iframe.style.height = $(subnav).height() + 'px';
}
}
}


/*
* onLoad functions
* Initializes our functions on page load
*/
$(document).ready(function(){
new rDropDown();
});
