  jQuery(document).ready(function() {
    // False Select Functionality
    jQuery(document).bind('click', function(e) {
      var jQueryclicked = jQuery(e.target);
      if (!jQueryclicked.parents().hasClass('activedropdown'))
        jQuery('.activedropdown').hide();
    });/*This function above checks each click on a page. If click occurred on elements outside the dropdown it hides the active select dropdown. Now this works like regular Select element. */
  
    // On click show next ul
    jQuery('.select').click(function() {
      jQuery(this).next('ul').addClass('activedropdown').toggle(); //Toggle is used because if you click the dropdown twice the list should dissapear
      return false;
    });
    // The replacement of the a tag text with with the relevant selected text, Also higlighting of the selected/hovered list item
    jQuery('.select_list li').click(function() {
      // Click event on one of the list items
      jQuery(this).siblings().removeClass('selected'); // First remove the selected class from previous selection
      jQuery(this).addClass('selected').parent().prev('.select').text(jQuery(this).text()); // Add selected class and to chosen list element and populate the a tag with text
      jQuery(this).parent().nextAll('select').find('option').val(jQuery(this).attr('id')); // Add selected li text value to the hidden select element's option value and whullah!
      jQuery(this).parent('.activedropdown').hide(); // Hide ul
    });
  
    jQuery('.select_list li').hover(// Add and remove highlight to list item with mouse pointer hover
    function() {
      jQuery(this).addClass('hover'); // Adds hover class
    },
    function() {
      jQuery(this).removeClass('hover'); // Removes hover class
    });
    // End False Select JS
  }); 
