function toggle_navigation(anchor) {
	var original_id = anchor.id;
	anchor.id = 'toggle_navigation';
	if($('#toggle_navigation').hasClass('expanded')) {
		$('#toggle_navigation').removeClass('expanded');
		$('#toggle_navigation').next().hide();
	} else {
		$('#toggle_navigation').addClass('expanded');
		$('#toggle_navigation').next().show();
	}
	anchor.id = original_id;
	return false;
}

function isCapslock(e){
	e = (e) ? e : window.event;

	var charCode = false;
	if (e.which) {
		charCode = e.which;
	} else if (e.keyCode) {
		charCode = e.keyCode;
	}

	var shifton = false;
	if (e.shiftKey) {
		shifton = e.shiftKey;
	} else if (e.modifiers) {
		shifton = !!(e.modifiers & 4);
	}

	if (charCode >= 97 && charCode <= 122 && shifton) {
		return true;
	}

	if (charCode >= 65 && charCode <= 90 && !shifton) {
		return true;
	}

	return false;
}

function preload(arrayOfImages) {
    $(arrayOfImages).each(function(){
        $('<img/>')[0].src = this;
    });
}

function reset_session_variable(variable) {
	$.getJSON(base_url + 'reset_session_variable.html?variable=' + urlencode(variable), function(j){});
}

/* Usage:

preload([
    'img/imageName.jpg',
    'img/anotherOne.jpg',
    'img/blahblahblah.jpg'
]);
*/
