﻿google.load("jquery", "1.4.2");
google.load("jqueryui", "1.8.7");

google.setOnLoadCallback(function() {
    $(document).ready(function() {
        init();
    });
});

var map;

function init() {
    rigNavigation();
    //$("p").click(function () { console.log($(this).html().length) });
    //$("input").click(function () { console.log($(this).attr("name")); });
}

function rigNavigation() {
	$(".navigationBar li").hover(function() { showChildren(this) }, function() { hideChildren(this) });
}

function showChildren(what) {
    var timer = 250;
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
        $(" > ul", what).height($(" > ul", what).height());
        $(" > li", what).css({'margin-top': -6});
        $(" > ul", what).show();
        $(" > ul", what).width($(" > ul", what).width());
    }
    else {
		// Allow different levels to have different effects
        if ($(" > ul", what).parents('ul').size() >= 2) {
			if (jQuery.browser.msie) { 
				$(what).children("ul").show();
			}
			else
			{
			    $(what).children("ul").show("slide", { direction: "left"}, timer);
			}
        }
        else {
			if (jQuery.browser.msie) { 
				$(what).children("ul").show();
			}
			else
			{
			    $(what).children("ul").show("slide", { direction: "left" }, timer);
			}
		}
    
    }
}

function hideChildren(what) {
	if ($(what).parents('ul').size() == 1) {
			if (jQuery.browser.msie) { 
				$(".navigationBar li").find('ul').hide();
			}
			else{
				$(".navigationBar li").find('ul').hide(100);
			}
        }
        else {
			if (jQuery.browser.msie) { 
            	$(what).find('ul:visible').hide();
			}
			else{
				$(what).find('ul:visible').hide(100);
			}
        }
}
