var J$ = jQuery.noConflict();
var ie = (document.all) ? true : false;

J$(document).ready(function () {
    initNavigation();
});

function initNavigation() {
    J$('.main-nav li').hover(function () {
        ul = J$(this).children('ul');
        ul.css({ left: J$(this).position().left });
        J$(this).addClass('hover');
        ul.showContent('slow');
        if (J$.browser.msie && J$.browser.version.substring(0, 1) === '6') {
            hideSelects('hide');
        }
    },
	function () {
	    J$(this).removeClass('hover');
	    ul = J$(this).children('ul');
	    ul.hideContent('fast');
	    setTimeout(function () { Cufon.refresh('ul.navigation > li > a') }, 10);
	    if (J$.browser.msie && J$.browser.version.substring(0, 1) === '6') {
	        hideSelects('visible');
	    }
	});
}

function hideSelects(action) {
    if (action != 'visible') { action = 'hidden'; }
    if (navigator.appName.indexOf("MSIE")) {
        for (var S = 0; S < document.forms.length; S++) {
            for (var R = 0; R < document.forms[S].length; R++) {
                if (document.forms[S].elements[R].options) {
                    document.forms[S].elements[R].style.visibility = action;
                }
            }
        }
    }
}
