ss_jQuery('a.checkSubs').click(function(e) {e.preventDefault();var checkboxes = ss_jQuery(this).parent('form').find('input[name=itemnum]:checked').length;if (checkboxes > 0) {ss_jQuery(this).parent('form').find('.oops').hide();ss_jQuery(this).parent('form').submit()}else {ss_jQuery(this).parent('form').find('.oops').show();};return false;});
ss_jQuery('a.checkVars').click(function(e) {e.preventDefault();var cansubmit = 'yes';ss_jQuery(this).parent('form').find('input.required').each(function(){if (ss_jQuery(this).val() == "" || ss_jQuery(this).val() == null) {ss_jQuery(this).addClass('field_warn'); cansubmit = 'no';};});if (cansubmit != 'no') {ss_jQuery(this).parent('form').submit()}; return false;});
function debouncer( func , timeout ) {var timeoutID , timeout = timeout || 100; return function () {var scope = this , args = arguments; clearTimeout( timeoutID ); timeoutID = setTimeout( function () {func.apply( scope , Array.prototype.slice.call( args ) );} , timeout );}}
! function(m) {
nm = {
arrow: 'yes',
more: 'yes',
morelimit: 6,
stretch: 'no',
minpercol: 15,
colwidth: 200,
padding: 15
}
navw = document.getElementById('navwidth').clientWidth;
var liwidth = 0;
$('ul#ShopSite > li').each(function() {liwidth += $(this).outerWidth();});
localStorage.setItem('navwidth',navw);
if (liwidth > navw) {localStorage.setItem('nav','mobilenav'); $('.suckertreemenu').parent().addClass('mobilenav');} else {localStorage.setItem('nav','');}
cols = Math.floor(navw/nm.colwidth);
m.fn.navMenu = function(n) {
ss_jQuery(this).children().each(function(){
var c = ss_jQuery(this).children('ul');
// has a flyout menu
if (c.length > 0) {
var offsetl = ss_jQuery(this).position();
var parenta = ss_jQuery(this).children('a');
var cas = this.getElementsByTagName('a');
var clis = ss_jQuery(this).children('ul').children('li');
if (nm.arrow = "yes") {arrow = '';} else {arrow = '';}
if (cas.length > nm.minpercol) {
var colmin = Math.ceil((cas.length)/nm.minpercol);
var colwithmax = Math.ceil((cas.length)/cols);
// multiple columns but not maxed out
if (colmin <= cols) {colcount = nm.minpercol; totalcol = colmin} else {colcount = colwithmax; totalcol = cols}
if (totalcol == cols) {appendfcontain = ' style="left: 0px; width: 100%"'; appendf = 'display: block; ';}
else if (((offsetl.left)+(parseInt(totalcol * nm.colwidth)+parseInt(nm.padding*2))) > navw) {appendfcontain = ' style="right: 0px;"'; appendf = 'width: ' + (parseInt(totalcol * nm.colwidth)+parseInt(nm.padding*2)) + 'px; '}
else {appendfcontain = ''; appendf = 'width: ' + (parseInt(totalcol * nm.colwidth)+parseInt(nm.padding*2)) + 'px; '};
var menuList = ''; var colnumcount = 1; ac = 0;
var liArr = new Array(), $liList = ss_jQuery(this).children('ul');
$liList.find('> li').each(function(){liArr.push(ss_jQuery(this).html());});
for (var i = 0; i < liArr.length; i++) {
var innercount = liArr[i].split('
').length;
// loop through li's. If li number is more than the current count, start a new bullet list and calculate the new count
if ((ac+innercount) > colcount) {menuList += ''; ac=0;}
ac=ac+innercount;
liVal = liArr[i].split('').join('');
menuList += '- ' + liVal + '
';
}
}
else {
totalcol = 1; appendfcontain = ''; appendf = 'width: ' + (parseInt(totalcol * nm.colwidth)+parseInt(nm.padding*2)) + 'px; ';
var menuList = ss_jQuery(this).children('ul').html();
}
ss_jQuery(this).addClass('flyout').html('' + parenta.html() + arrow + '');
ss_jQuery(this).hover(function(){ss_jQuery(this).addClass('active');},function(){ss_jQuery(this).removeClass('active');});
ss_jQuery(this).click(function() {if ((nav == 'mobilenav') || (liwidth > navw)) {ss_jQuery(this).toggleClass('active'); ss_jQuery(this).children('div').slideToggle()} else {location.href=ss_jQuery(this).children('a').attr('href');}});
}
})
if (ss_jQuery('div.suckertreemenu').width() > navw) {}
}
}(ss_jQuery);
ss_jQuery('a#navToggle').click(function(e){ss_jQuery('#ShopSite').slideToggle(); e.preventDefault; return false;});
ss_jQuery('ul#ShopSite').navMenu();
function menuRecheck() {if(!ss_jQuery('.suckertreemenu').parent().hasClass('mobilenav')) {rnavw = document.getElementById('navwidth').clientWidth;var rliwidth = 0;ss_jQuery('ul#ShopSite > li').each(function() {rliwidth += ss_jQuery(this).outerWidth();});localStorage.setItem('navwidth',rnavw);if (rliwidth > rnavw) {localStorage.setItem('nav','mobilenav'); ss_jQuery('.suckertreemenu').parent().addClass('mobilenav');} else {localStorage.setItem('nav',''); ss_jQuery('.suckertreemenu').parent().removeClass('mobilenav');}}}
ss_jQuery(window).resize(debouncer(function() {menuRecheck()}));
function afterLoad(type,url,cross,carousel) {
if (ss_jQuery(window).width() < 768) {
ss_jQuery('body').addClass('narrow');
ss_jQuery('ul.subflyout').each(function(){
ss_jQuery(this).parent().children('a').click(function(e){ss_jQuery(this).parent().children('ul').slideToggle(); e.preventDefault; return false;});
});
}
ss_jQuery('a.sublink').click(function(){var brdalk = ss_jQuery('h1').html(); if(ss_jQuery(location).attr('href') != "http://tug2.com"){localStorage.setItem('brda',''+brdalk+'');} localStorage.setItem('brdb',ss_jQuery(this).attr('href'))});
ss_jQuery('li.flyout li a').click(function(){var brdalk = ss_jQuery(this).closest('li.flyout').children('a').attr('title'); var brdahref = ss_jQuery(this).closest('li.flyout').children('a').attr('href'); if (brdahref == '') {brdahref = ss_jQuery(this).attr('href')}; localStorage.setItem('brda',''+brdalk+'')});
ss_jQuery('.more').each(function(){ss_jQuery(this).addClass('moreshort').append('');});
ss_jQuery('.morebutton').click(function(){ss_jQuery(this).parent().toggleClass('moreshort'); ss_jQuery(this).toggleClass('lessbutton','morebutton');});
if (type == "page" && url !="") {localStorage.setItem('brdb',url);sessionStorage.setItem('lastpage',window.location.href);}
if (carousel == "carousel") {ss_jQuery('#bxcarousel').bxSlider({ mode: "fade", tickerHover: true, autoHover: true, touchEnabled:false});}
if (cross == "crosssell") {ss_jQuery('#crossSell').bxSlider({minSlides: 3, maxSlides: 8, slideWidth: 200, slideMargin: 10, pager:false, touchEnabled:false});}
if (type == "more") {
sessionStorage.setItem('lastpage',window.location.href);}
}