2012-04-04 07:52:54 +02:00
|
|
|
|
jQuery.noConflict();
|
|
|
|
|
|
|
|
|
|
(function($) {
|
|
|
|
|
$(document).ready(function() {
|
2012-06-07 17:04:50 +02:00
|
|
|
|
|
2012-04-24 04:11:33 +02:00
|
|
|
|
/* removes text from search form on focus and replaces it on unfocus - if text is entered then it does not get replaced with default on unfocus */
|
2012-06-07 17:04:50 +02:00
|
|
|
|
$('#SearchForm_SearchForm_action_results').val('L');
|
|
|
|
|
var searchField = $('#SearchForm_SearchForm_Search');
|
|
|
|
|
var default_value = searchField.val();
|
|
|
|
|
searchField.focus(function() {
|
2012-05-09 17:16:21 +02:00
|
|
|
|
$(this).addClass('active');
|
|
|
|
|
if(searchField.val() == default_value) {
|
|
|
|
|
searchField.val('');
|
|
|
|
|
}
|
2012-06-07 17:04:50 +02:00
|
|
|
|
});
|
|
|
|
|
searchField.blur(function() {
|
2012-05-09 17:16:21 +02:00
|
|
|
|
if(searchField.val() == '') {
|
|
|
|
|
searchField.val(default_value);
|
|
|
|
|
}
|
2012-06-07 17:04:50 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!$.browser.msie || ($.browser.msie && (parseInt($.browser.version, 10) > 8))) {
|
|
|
|
|
|
|
|
|
|
var searchBarButton = $("span.search-dropdown-icon");
|
|
|
|
|
var searchBar = $('div.search-bar');
|
|
|
|
|
var menuButton = $("span.nav-open-button");
|
|
|
|
|
var menu = $('.header .primary ul');
|
|
|
|
|
var mobile = false;
|
|
|
|
|
var changed = false;
|
|
|
|
|
|
|
|
|
|
$('body').append('<div id="media-query-trigger"></div>');
|
|
|
|
|
|
|
|
|
|
function menuWidthCheck() {
|
|
|
|
|
var header_w = $('header .inner').width();
|
|
|
|
|
var elements_w = menu.width() + $('.brand').width();
|
|
|
|
|
|
|
|
|
|
if ((header_w < elements_w) || ($(window).width() <= 768)) {
|
|
|
|
|
$('body').addClass('tablet-nav');
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$('body').removeClass('tablet-nav');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mobile_old = mobile;
|
|
|
|
|
if ($('#media-query-trigger').css('visibility') == 'hidden') {
|
|
|
|
|
mobile = false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mobile = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mobile_old != mobile) {
|
|
|
|
|
changed = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
changed = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menuWidthCheck();
|
|
|
|
|
|
|
|
|
|
$(window).resize(function() {
|
|
|
|
|
menuWidthCheck();
|
|
|
|
|
|
|
|
|
|
if (!mobile) {
|
|
|
|
|
menu.show();
|
|
|
|
|
searchBar.show();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (changed) {
|
|
|
|
|
menu.hide();
|
|
|
|
|
searchBar.hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* toggle navigation and search in mobile view */
|
|
|
|
|
searchBarButton.click(function() {
|
|
|
|
|
menu.slideUp();
|
|
|
|
|
searchBar.slideToggle(200);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
menuButton.click(function() {
|
|
|
|
|
searchBar.slideUp();
|
|
|
|
|
menu.slideToggle(200);
|
|
|
|
|
});
|
|
|
|
|
}
|
2012-05-09 17:16:21 +02:00
|
|
|
|
|
2012-04-04 07:52:54 +02:00
|
|
|
|
});
|
|
|
|
|
}(jQuery));
|