// Set the start & end input fields to use the jquery UI datepicker. $('#start').datepicker({ beforeShow: function(input, inst) { var widget = $(inst).datepicker('widget'); widget.css('margin-left', $(input).outerWidth() - $(input).width()); }, showOn: 'both', buttonImage: 'http://events.getcreativesanantonio.com/images/icon-calendar.gif', buttonImageOnly: true, onSelect: function(dateText, inst) { $('#start').css('color','black'); } }); $('#end').datepicker({ beforeShow: function(input, inst) { var widget = $(inst).datepicker('widget'); widget.css('margin-left', $(input).outerWidth() - $(input).width()); }, showOn: 'both', buttonImage: 'http://events.getcreativesanantonio.com/images/icon-calendar.gif', buttonImageOnly: true, onSelect: function(dateText, inst) { $('#end').css('color','black'); } }); $("#keywords").catcomplete({ source: function( request, response ) { $.ajax({ url: "http://events.getcreativesanantonio.com/search/suggest/", dataType: "jsonp", crossDomain: true, data: { term: request.term }, success: function( data ) { response( $.map( data, function( item ) { return item; })); } }); }, minLength: 2, select: function( event, ui ) { if(ui.item.href) { keywords_go( ui.item.href ); } else { keywords_go( ui.item.label, 1 ); } }, delay: 300 }); // Submit the search form with Get $('#form_search_keywords').submit(function(e){ var keywords = $('#keywords').val(); var action = $('#form_search_keywords').attr('action'); window.open(action + keywords, '_self'); e.preventDefault(); return false; }); // // Submit the search form with Get $('#form_search_dates').submit(function(e){ var dateBegin = $('#start').val(); dateBegin = $.datepicker.formatDate('yy-mm-dd', new Date(dateBegin)); var dateEnd = $('#end').val(); dateEnd = $.datepicker.formatDate('yy-mm-dd', new Date(dateEnd)); if(dateEnd == 'NaN-NaN-NaN') { dateEnd = 'none'; } if(dateBegin == 'NaN-NaN-NaN') { dateBegin = 'none'; } var action = $('#form_search_dates').attr('action'); window.open(action + dateBegin + "/" + dateEnd, '_self'); e.preventDefault(); return false; }); ;