;(function($) {

  $.fn.selectify = function() {
    
    return this.each(function(){
      var $this = $(this)
        , select = $('<select class="navigator">')
      
      $this.find('a').each(function(){
        var a = $(this);
        if( a.parent('li').hasClass('current-menu-item') || a.parent('li').hasClass('current-page-ancestor') ){
					select.append('<option value="' + a.attr('href') + '" selected="selected">' + a.text()  + '</option>');        
        }
        else {
	        select.append('<option value="' + a.attr('href') + '">' + a.text()  + '</option>');
        }
      })
      
      $this.parent().html(select);
      
    });
    
  };

})(jQuery);
