$.extend({
  getUrlVars: function() {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++) {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});

$(function() {
	$("#ep_menu")
		.accordion({ header: 'li.with_children', autoHeight: false, active: '.active', collapsible: true, headerSelected: "ui-icon-circle-arrow-s"})
		.bind('accordionchange', function() {$('.with_no_children').removeClass('selected_with_no_children');})
	;
});

// unique checkbox select
$('input.unique').click(function() {
	if ($(this).attr('checked') != true) {
		$(this).attr('checked', false);
	}
	else {
		var $group = $(this).attr('unique_group');
		if ($group == undefined) {
			$('input.unique').removeAttr('checked');
		}
		else
		{
			$('input.unique[unique_group="' + $group + '"]').removeAttr('checked');
		}
		$(this).attr('checked', true);
	}
});

$(".back").click(function(){
	history.back();
	return false;
});

