var actM = null;

$(function(){
	//Required for stupid IE
	$.ajaxSetup({cache: false});

	$('div.navigation ul li:last-child').addClass('last');

	if ($('.side-navigation h3 > a').length) {
		$('div.navigation > ul > li > a').each(function() {
			if (this.pathname.toLowerCase() == $('.side-navigation h3 > a').attr('pathname').toLowerCase()) {
				$(this).addClass('selected').parent().addClass('selected');
			}
		});
	}

	$('div.side-navigation ul').find('a').each(function() {
		var pathName = this.pathname.toLowerCase();
		if (pathName.charAt(0) != '/') {
			pathName = '/' + pathName;
		}

		if (pathName == window.location.pathname.toLowerCase()) {
			$(this).addClass('selected').closest('ul').prev('a').addClass('selected noarrow');
			return false;
		}
	});

	/*if (actM) {
		$(actM).addClass('selected').parent().addClass('selected');
	}
	*/
});


function in_array (needle, haystack, argStrict) {
    // Checks if the given value exists in the array
    //
    // version: 1103.1210
    // discuss at: http://phpjs.org/functions/in_array    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: vlado houba
    // +   input by: Billy
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);    // *     returns 1: true
    // *     example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});
    // *     returns 2: false
    // *     example 3: in_array(1, ['1', '2', '3']);
    // *     returns 3: true    // *     example 3: in_array(1, ['1', '2', '3'], false);
    // *     returns 3: true
    // *     example 4: in_array(1, ['1', '2', '3'], true);
    // *     returns 4: false
    var key = '',        strict = !! argStrict;

    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {                return true;
            }
        }
    } else {
        for (key in haystack) {            if (haystack[key] == needle) {
                return true;
            }
        }
    }
    return false;
}
