// Pixelsilk Website Navigation Menu Plugin
// v 3.3
/*
Options that can be passed to the plugin:
fadeInTime
fadeOutTime
menuWidth: (int) width of the submenu container element
containerElement: (string) theme element to check width against
containerWidth: (int) width to use instead of containerElement's; overrides
menuElement: (string) submenu container element to look for
subIndicatorClass: (string) class name of floating submenu arrow indicator
rightArrow: (html) HTML to render the "submenu" arrow indicator
*/
;jQuery.fn.navMenu = function(options) {
var defaults = {
fadeInTime: 200, // in milliseconds
fadeOutTime: 300, // in milliseconds
menuWidth: 250,
containerElement: "#theme",
containerWidth: 0,
menuElement: "ul",
subIndicatorClass: "menu-sub-indicator",
rightArrow: " ยป"
}
var settings = $.extend({}, defaults, options);
var obj = $(this);
$(obj).find('li ul li:has(ul) > a').prepend('' + settings.rightArrow + '');
var pos;
var menuWidth = settings.menuWidth;
var containerWidth = $(settings.containerElement).width();
if ( settings.containerWidth > 0 ) {
containerWidth = settings.containerWidth;
}
$(obj).find('li ' + settings.menuElement + ' li ' + settings.menuElement).each(function() {
pos = $(this).parent().parent().parent().position().left;
if (containerWidth - pos < (menuWidth * 2)) {
$(this).css('left', '-' + menuWidth + 'px');
}
});
$(obj).find('li ' + settings.menuElement).attr('fadeState', 'none');
$(obj).find('li').hover(
function() {
var fadeElement = $(this).find(settings.menuElement).eq(0);
if($(fadeElement).attr('fadeState') == 'fadeOut'){
$(fadeElement).stop(true,true);
$(fadeElement).attr('fadeState','none');
}
if($(fadeElement).attr('fadeState') == 'none'){
$(fadeElement).attr('fadeState','fadeIn');
$(fadeElement).fadeIn(settings.fadeInTime,function(){
$(this).attr('fadeState', 'none');
});
}
if ( !$(this).hasClass("current") ) {
$(this).addClass("currentFade");
}
},
function() {
var fadeElement = $(this).find(settings.menuElement).eq(0);
if($(fadeElement).attr('fadeState') == 'fadeIn'){
$(fadeElement).stop(true,true);
$(fadeElement).attr('fadeState','none');
}
if($(fadeElement).attr('fadeState') == 'none'){
$(fadeElement).attr('fadeState','fadeOut');
$(fadeElement).fadeOut(settings.fadeOutTime, function() {
$(this).attr('fadeState', 'none');
});
}
if ( !$(this).hasClass("current") ) {
$(this).removeClass("currentFade");
}
}
);
$(obj).find('li ul:empty').css('visibility', 'hidden');
};;
// Definition List Slider - 2011 - Smart Solutions
// Allows you to slide / toggle Definitions for Definition lists when the keywords is clicked.
var slideUpSpeed = 200;
var slideDownSpeed = 200;
$(document).ready(function() {
var elem = $('.dl-slide');
elem.each(function() {
$(this).find('dd').hide();
$(this).find('dt').prepend('');
$(this).find('dt').click(function() {
if (!$(this).hasClass('current')) {
elem.find('dt.current').removeClass('current').next('dd').slideUp(slideUpSpeed);
$(this).addClass('current').next('dd').slideDown(slideDownSpeed);
} else {
elem.find('dt').removeClass('current').next('dd').slideUp(slideUpSpeed);
}
});
});
});/* ### Pixelsilk Selector
', // The default content for the modal if none is found or passed to the plugin.
fadeInSpeed: 500, // Fade in speed.
fadeOutSpeed: 500, // Fade out speed.
closeButtonHTML: 'X', // The default close button HTML content.
offsetTop: 100, // Amount, in pixels, to offset from the top of the window.
bodyOverlayOpacity: 0.45, // Overall Modal BG transparency.
modalBorderOpacity: 0.45, // "border" around Modal BG transparency.
modalBorder: '10px', // In pixels. This can also be done in CSS but the option is here as well.
callBackOnOpen: null, // Callback function upon open of modal.
callbackOnClose: null // Callback function upon close of modal.
};
var options = $.extend(defaults, options);
return this.each(function() {
var anchor = $(this).attr('href');
function showModal() {
// Open Callback function:
fnCallBackOnOpen();
// Create the modal HTML:
if ( !$("div."+options.modalContainerClass).length ) {
$('body').append('
');
}
var mainModal = $('.'+options.modalWrapperClass);
var modal = $('.'+options.modalContainerClass);
var modalBG = $('.boxModalBG');
var modalContentBG = $('.modalContentBG');
modalBG.css({'opacity':options.bodyOverlayOpacity});
modalContentBG.css({'opacity':options.modalBorderOpacity});
mainModal
.hide()
.css({'margin-top':Number(options.offsetTop+$(window).scrollTop())});
modal.hide();
modal.css({'height':'100%'});
var contentArea = modal.find('.modalContent');
if (options.contentType == 'iframe') {
// create iFrame with link's href as src:
contentArea.html('');
if (options.contentSource != '') {
contentArea.find('iframe').attr('src', options.contentSource);
} else
contentArea.find('iframe').attr('src', anchor);
} else if (options.contentType == 'html') {
// stuff the 'content' into the content area:
contentArea.html(options.content);
} else if (options.contentType == 'ajax') {
// do sweet ajax:
if (options.contentSource != '') {
contentArea.load(options.contentSource);
} else {
contentArea.load(anchor);
}
} else if (options.contentType == 'image') {
contentArea.append('', function() {
});
}
if (options.contentType == 'iframe' && options.iframeScrollX) {
contentArea.find('iframe').css({'overflow-x':'auto'});
} else if (options.contentType == 'iframe' && !options.iframeScrollX){
contentArea.find('iframe').css({'overflow-x':'hidden'});
}
if (options.contentType == 'iframe' && options.iframeScrollY) {
contentArea.find('iframe').css({'overflow-y':'auto'});
} else if (options.contentType == 'iframe' && !options.iframeScrollY){
contentArea.find('iframe').css({'overflow-y':'hidden'});
}
if (options.showCloseButton) {
mainModal.append('
'+options.closeButtonHTML+'
');
}
// Apply styles to the modal:
if (options.modalBorder != '') {
contentArea.css({'margin':options.modalBorder});
}
// resize modal:
mainModal.animate({'width':options.modalWidth});
if (options.modalHeight != '') {
mainModal.animate({'height':options.modalHeight});
}
// resize modal inside content area:
// top and bottom padding:
var cPaddingY = Number(contentArea.css('padding-top').replace('px',''));
cPaddingY += Number(contentArea.css('padding-top').replace('px',''));
// top and bottom margin:
var cMarginY = Number(contentArea.css('margin-top').replace('px',''));
cMarginY += Number(contentArea.css('margin-bottom').replace('px',''));
// fix the 'marginFix' for chrome:
var marginFix = $('.marginFix');
var fixedMargins;
if (marginFix.size() >0 ){
fixedMargins = marginFix.size()+marginFix.height();
//alert(fixedMargins);
}
// Apply the final height to the contentArea:
contentArea.height(Number(options.modalHeight-cPaddingY-cMarginY-fixedMargins));
// start the animating:
modal.fadeIn(options.fadeInSpeed, function() {
mainModal.fadeIn(options.fadeInSpeed, function() {
mainModal.find('.'+options.closeButtonClass).fadeIn();
});
});
if (options.closeOnBGClick) {
$(modalBG).click(function() {
removeModal(options.fadeOutSpeed);
});
}
$('.'+options.closeButtonClass).click(function() {
removeModal(options.fadeOutSpeed);
});
if (options.closeOnEscapeKey) {
$(window).keyup(function(e) {
if (e.keyCode == 27) {
removeModal(75);
}
});
}
if (options.keepInView) {
$(window).scroll(function() {
mainModal.css({'margin-top':Number(options.offsetTop+$(window).scrollTop())});
});
}
function removeModal(speed) {
var fadeOutSpeed;
if (!speed || speed == null || speed == undefined || speed == '') {
fadeOutSpeed = 50;
} else {
fadeOutSpeed = speed;
}
mainModal.fadeOut(fadeOutSpeed, function() {
modal.fadeOut(fadeOutSpeed, function() {
modal.remove(); // Remove Modal.
fnCallBackOnClose(); // Close Callback fucntion.
});
});
return false;
}
}
if (options.loadMethod == 'onclick') {
$(this).click(function() {
showModal();
return false;
});
} else if (options.loadMethod == 'onload') {
showModal();
}
// Callback function: run on Modal Open:
function fnCallBackOnOpen() {
if (options.callBackOnOpen) {
eval(options.callBackOnOpen);
}
}
// Callback function: run on Modal Close:
function fnCallBackOnClose() {
if (options.callbackOnClose) {
eval(options.callbackOnClose);
}
}
});
};// Custom scripts for this site
;$(document).ready(function() {
var body = $('body');
var theme = $('#theme');
body.addClass('js-on');
// Selects text in Search Box when focused:
$('input[type=text].clearText').each(function() {
var txtSearchText = $(this).val();
$(this).focus(function() {
if ($(this).val() == txtSearchText) {
$(this).val('');
}
});
$(this).blur(function() {
if ($(this).val() == '') {
$(this).val(txtSearchText);
}
});
if ($(this).hasClass('validate')) {
$(this).parent().parent().submit(function() {
//alert($(this).find('input[type=text]').val()+'|'+txtSearchText);
if ($(this).find('input[type=text]').val() == txtSearchText) {
alert('Please enter a valid search term')
return false;
}
});
}
});
$('.surname').click(function(){
if(!($('.surnameBox').length)){
$('#SurName2').show().wrap('');
var surval = $('#SurName2').val();
$('.surnameBox').prepend('
The below field must be blank in order for the form to pass validation. Currently it contains: '+ surval +'
');
}
});
$('.listItems.downloads li:last').css({'border':'0'});
$('#nav').find("ul>li:contains('Clearance')").addClass('sale');
// MD Only //
$('#nav').find("ul>li:contains('Contact Us')").addClass('contact');
// Site Navigation / dropdowns:
pixelsilk2.renderSkin({skin: '[' + '[MenuCategories]' + ']', path: ''}, function(html) {
$("#nav").after('');
$('#subNavigation').html(html);
pixelsilk2.renderSkin({skin: '[' + '[Menu1]' + ']', path: ''}, function(html) {
$('#subNavigation').append(html);
var sections = $("#subNavigation ol > li > span");
var sections2 = $('#subNavigation > div');
for (i = 0; i < sections2.length; i++) {
sections.push(sections2[i]);
}
var topElements = $("#nav>ul>li");
for (z = 0; z < sections.length; z++) {
var li = topElements[z+1]; // "Home" is hard-coded and not in the queue
var lihtml = li.innerHTML;
li.innerHTML = lihtml + sections[z].innerHTML;
}
$("#nav").navMenu({
menuWidth: 200,
containerElement: "#nav",
menuElement: "ul",
rightArrow: ' »'
});
$('#nav ul li').hover(function(){
$(this).addClass('over');
}, function(){
$(this).removeClass('over');
});
//$("#subNavigation").remove();
// Remove the bottom border on all last items in ULs:
$('nav#nav').find('ul').each(function() {
$(this).find('li:last-child').css({'border-bottom':'0'});
});
/*
var w = 0;
$('#nav>ul>li').each(function() {
w += $(this).outerWidth();
});
$('#nav').css({'text-align':'center'})
$('#nav>ul').css({
'width':w,
'margin':'0 auto'
});
*/
});
});
if ($('#slides').size()>0 && $('#slides li').size() >1) {
$('#slides').parent().append('');
$('ul#slides').cycle({
timeout: 8000,
speed: 500,
prev: '#arrowLeft',
next: '#arrowRight'
});
}
$('.categoryList ul:empty').remove();
$('.categoryList ul li:first-child').css({'border-top':'0'});
// Load footer links dynamically:
var footerLinks = $('#footerLinks');
if (footerLinks) {
pixelsilk2.renderSkin({skin: '['+'[FooterMenu]'+']', path:''}, function(html) {
footerLinks.html(html);
});
}
// MiniCart: load via JavaScript to bypass Pixelsilk Edge caching:
/*pixelsilk2.renderSkin({skin:'['+'[StoreMiniCart]'+']',path:''},function(html) {
$('#storeMiniCart').html(html);
});*/
pixelsilk2.ajaxPost("/api2/renderSkin", {skin:"["+"[StoreMiniCart]"+"]", path:""}, function(html) {
$('#storeMiniCart').append(html);
});
});
var product_sidebar_appended = false;
$(window).load(function() {
// Hides list item images if no src is defined:
$('img.listItemImage').each(function() {
var srcFirstChar = $(this).attr('src').substr(0,1);
if (srcFirstChar == '?' || $(this).attr('src') == '/' || $(this).attr('src') == '') {
$(this).hide();
//$(this).replaceWith('');
}
});
$('nav#nav>ul>li>a').each(function() {
if ($(this).attr('href').indexOf('javascript') >-1) {
$(this)
.attr('href', 'javascript:void(0);')
.css({'cursor':'default'});
}
});
});
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};/*
* jQuery replaceText - v1.1 - 11/21/2009
* http://benalman.com/projects/jquery-replacetext-plugin/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){$.fn.replaceText=function(b,a,c){return this.each(function(){var f=this.firstChild,g,e,d=[];if(f){do{if(f.nodeType===3){g=f.nodeValue;e=g.replace(b,a);if(e!==g){if(!c&&/