﻿/**
* Nalco Dropdown Javascript
*
* Purpose - Make the main navigation dropdown menu functional
* Also included is the function to allow the Nalco Company History flash to open in a new window  
*
* @created: 2/21/09
* @modified: 2/26/09
* @author: Cummings Group
**/
var nav_root = '#main_nav';
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;

$(document).ready(function() { 
                            $(nav_root + ' > li').bind('mouseover', jsddm_open);
                            $(nav_root + ' > li').bind('mouseout',  jsddm_timer);    
                            
                            // About Nalco - History pop-up
                            $('a[rel="external"]').click( function() {
                                window.open($(this).attr('href'),'mywindow','top=20,left=20,width=800,height=560,resizable,scrollbars,status=1');
                                return false;
                            });
                           });
function jsddm_open() { 
    jsddm_canceltimer();
    jsddm_close();
    ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}
function jsddm_close() {  
    if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}
function jsddm_timer() {  
    closetimer = window.setTimeout(jsddm_close, timeout);
}
function jsddm_canceltimer() {  
    if(closetimer) {  
        window.clearTimeout(closetimer);
        closetimer = null;
    }
}
document.onclick = jsddm_close;