jQuery(document).ready(function($){
$(document).on('keyup', '.iq-mobile-search-input', function(e){
if(e.keyCode===13){
window.location='/?s=' + $(this).val();
}
$('.iq-mobile-search-input').data('value', $(this).val());
});
$(document).on('mousedown', '.iq-mobile-search-button', function(e){
window.location='/?s=' + $('.iq-mobile-search-input').data('value');
});
replaceMobileSearchBar();
function replaceMobileSearchBar(){
var row=$('.fusion-mobile-menu a[title="Search"]');
row.attr('href', '#');
var searchRow=$('<div>');
var form=$('<form id="mobile-search-form" action="/" method="get" style="display:flex; align-items: center;">').appendTo(searchRow);
$('<span>').html('&nbsp;').appendTo(form);
$('<input type="search" name="s" placeholder="search" style="width:100%; vertical-align:middle; margin-left:-5px; padding-left:5px; display:inline-block; height:25px;">').addClass('iq-mobile-search-input').appendTo(form);
$('<img style="width:25px; height:25px; margin-left:5px; margin-right:20px; vertical-align:middle; background-color:#ffaacc; display:inline-block;" src="' + directory_uri.stylesheet_directory_uri + '/images/search-icon.gif">').addClass('iq-mobile-search-button').appendTo(form);
row.html(searchRow);
}});