var ZjQueryScriptOutputted = false;
function initJQuery() {
// Check if the jQuery library is loaded:
if (typeof(jQuery) == 'undefined' || typeof(jQuery().jsonSuggest) == 'undefined') {
if (! ZjQueryScriptOutputted) {
// Only output the script once:
ZjQueryScriptOutputted = true;
document.write("");
document.write("");
}
setTimeout(function() {
initJQuery();
}, 50);
} else {
$(function() {
//do anything that needs to be done on document.ready
$('#ZauthDealerSearch').html('');
setTimeout( function() {
$('#authDealerSearchQuery').jsonSuggest({url:'/forhandlere/auth-ajax.php', minCharacters: 2, onSelect: goToPage, searchText: 'Søker..'});
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
input.removeClass('placeholder');
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur();
$('[placeholder]').parents('form').submit(function() {
$(this).find('[placeholder]').each(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
})
});
}, 100);
});
}
}
initJQuery();
var goToPage = function(suggest) {
window.location = suggest.url;
}