jQuery(document).ready(function() {
	jQuery('#menu_oc > ul').superfish({
		pathClass	 : 'overideThisToUse',
		delay		 : 0,
		animation	 : {height: 'show'},
		speed		 : 'normal',
		autoArrows   : false,
		dropShadows  : false, 
		disableHI	 : false, /* set to true to disable hoverIntent detection */
		onInit		 : function(){},
		onBeforeShow : function(){
            var a = this.parent()[0];
            this.css('top', a.offsetTop + 30);
        },
		onShow		 : function(){},
		onHide		 : function(){}
	});
	
	jQuery('#menu_oc > ul').css('display', 'block');
});
 
function getURLVar(key) {
	var value = [];
	
	var query = String(document.location).split('?');
	
	if (query[1]) {
		var part = query[1].split('&');

		for (i = 0; i < part.length; i++) {
			var data = part[i].split('=');
			
			if (data[0] && data[1]) {
				value[data[0]] = data[1];
			}
		}
		
		if (value[key]) {
			return value[key];
		} else {
			return '';
		}
	}
} 

jQuery(document).ready(function() {
	route = getURLVar('route');
	
	if (!route) {
		jQuery('#dashboard').addClass('selected');
	} else {
		part = route.split('/');
		
		url = part[0];
		
		if (part[1]) {
			url += '/' + part[1];
		}
		
		jQuery('a[href*=\'' + url + '\']').parents('li[id]').addClass('selected');
	}
});