Warning: Undefined array key "HTTP_ACCEPT_ENCODING" in /home/speedca/public_html/combine.php on line 86
Warning: Undefined array key "HTTP_ACCEPT_ENCODING" in /home/speedca/public_html/combine.php on line 87
Warning: Cannot modify header information - headers already sent by (output started at /home/speedca/public_html/combine.php:86) in /home/speedca/public_html/combine.php on line 114
Warning: Cannot modify header information - headers already sent by (output started at /home/speedca/public_html/combine.php:86) in /home/speedca/public_html/combine.php on line 115
$(document).ready(function () {
//
$("a[rel^='lb']").prettyPhoto({
autoplay: true,
social_tools: false,
allow_resize: false,
slideshow: false
});
$("a[rel^='prettyPhoto']").prettyPhoto({
autoplay: true,
social_tools: false,
allow_resize: false,
slideshow: false
});
//
/*
$('.social-likes').socialLikes({
counters: false,
singleTitle: 'Share it!'
});
*/
//
$.fn.powerTip.defaults.placement = 's';
$('[title]').not('.north,.south,.east,.west,.follow,.popup-tip').powerTip({ smartPlacement: true });
$('.north[title]').powerTip({
placement: 'n',
smartPlacement: true
});
$('.west[title]').powerTip({
placement: 'w',
smartPlacement: true
});
$('.east[title]').powerTip({
placement: 'e',
smartPlacement: true
});
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) == false )
$('.follow').powerTip({ followMouse: true });
$('.popup-tip').powerTip({ placement: 's', smartPlacement: true , mouseOnToPopup: true });
/*
$('[title]').on('powerTipRender', function() {
$('#powerTip').addClass('powertips');
});
*/
$( window ).resize(function() {
if($(window).width() < 657){
$('.slider-caption-outer').hide();
} else {
$('.slider-caption-outer').show();
}
});
$( window ).trigger('resize');
//
//
//if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) == true )
// $('.has-dropdown a').attr('href','#');
//
//
$('.submit').click(function(){
$('#checkout').trigger('click');
});
$('.submit').click(function(){
//console.log($(this).closest('form').attr('id'));
$(this).closest('form').submit();
});
//
$("a[href^='#']").click(function(event){
/*
event.preventDefault();
var dest = 0;
if($(this).attr('href') != '#'){
if($(this.hash).offset().top > $(document).height()-$(window).height()){
dest = $(document).height() - $(window).height();
} else {
dest = $(this.hash).offset().top - 130;
}
$('html,body').animate({scrollTop:dest}, 1000);
}
*/
});
//
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
//
$("a[href^='http://']").attr("target","_blank");
$("a[href^='https://']").attr("target","_blank");
$("a[href$='.pdf']").attr("target","_blank");
$("a[href^='http://']").click(function() {
//console.log(window.location.pathname);
_gaq.push(['_trackEvent', 'External Link', 'speedstacks.ca'+window.location.pathname, $(this).attr('href')]);
});
$("a[href$='.pdf']").click(function() {
_gaq.push(['_trackEvent', 'PDF', 'Click',$(this).attr('href')]);
});
$(".track").click(function(e) {
/*
e.preventDefault();
var href = $(this).attr("href");
var target = $(this).attr("target");
var text = $(this).text();
if(text == '')
text = $(this).children('img').attr('alt');
if(text == '')
text = $(this).children('img').attr('src');
if(text == '')
text = 'unknown';
_gaq.push(['_trackEvent', text, 'Click', href]);
setTimeout(function() {
window.open(href,(!target?"_self":target));
},300);
*/
});
//
$('form.validate').each(function() {// attach to all form elements on page
$(this).validate({// initialize plugin on each form
submitHandler : function(form) {
$('#submit').attr('disabled', 'disabled');
$('#submit').addClass('secondary');
form.submit();
},
success : function(label) {
// set as text for IE
label.removeClass("error");
}
});
});
/*
$('form.validate').validate({
submitHandler: function(form) {
$('#submit').attr('disabled', 'disabled');
$('#submit').addClass('secondary');
form.submit();
},success: function(label) {
// set as text for IE
label.removeClass("error");
}
});
*/
$('form.validate #submit').click(function(){
if( $('form.validate').valid() == false)
$('#fail-msg').show();
else
$('#fail-msg').hide();
});
$('.no-enter').bind("keyup keypress", function(e) {
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
return false;
}
});
jQuery.validator.addClassRules({
email: {
required: true,
email: true
},
num: {
required: true,
number: true
},
tel: {
required: true,
digits: true,
minlength: 10
},
zip_post: {
required: true,
zip_post: true
},
cc: {
required: true,
cc: true
}
});
jQuery.validator.addMethod("zip_post", function(value, element) {
return this.optional(element) || /\d{5}-\d{4}$|^\d{5}$|^[a-zA-Z][0-9][a-zA-Z](-| )?[0-9][a-zA-Z][0-9]$/.test(value);
});
jQuery.validator.addMethod("cc", function(value, element, param) {
if (/[^0-9-]+/.test(value)) {
return false;
}
value = value.replace(/\D/g, "");
return value.length == 16;
}, "Please enter a valid credit card number.");
$('form.validate input').blur(function(){
$('form .validate').validate();
})
$('form.noenter').bind("keypress", function(e) {
var code = e.keyCode || e.which;
//console.log(code);
if (code == 13) {
e.preventDefault();
return false;
}
});
//
var spinner = $('.spinner').spinner({
min: 0,
number: {
digits: true
},
stop: function(event, ui) {
$(this).delay(500).change();
}
});
//
$('.checked').each( function () {
//$(this).prop('checked', true);
});
//
$('.jq-hide').each( function () {
$(this).hide();
$(this).removeClass('jq-hide');
});
//
$(':input[required]').each( function () {
$(this).addClass('required');
});
//
window.dropdown = false;
$('.sub-menu').hide();
$('.dropdown').show();
$('.content,.top-bar').hover(function() {
$('.sub-menu').stop(true,true).slideUp('slow');
$('.has-dropdown').removeClass('over');
$('div').remove('.over-shim');
window.dropdown = false;
});
$('#nav ul li').hover(
function() {
var item = $(this).children('a').text();
if(item.match(/cart/gi))
item = 'cart';
if(item != undefined){
//console.log(item);
item = item.toLowerCase();
$('.has-dropdown').removeClass('over');
$('.'+item+'-d').addClass('over');
$('div').remove('.over-shim');
if($(this).attr('class').match(/has-dropdown/g)){
$('.'+item+'-d').append('');
if(!window.dropdown) {
$('.'+item).siblings().stop(true,true).hide();
$('.'+item).stop(true,true).delay(200).slideDown('slow');
window.dropdown = true;
} else {
$('.'+item).siblings().stop(true,true).hide();
$('.'+item).stop(true,true).fadeIn('slow');
$('.'+item).css("zIndex",5000);
window.dropdown = true;
}
} else {
//console.log('ud');
window.dropdown = false;
$('.sub-menu').stop(true,true).slideUp('slow');
$('.has-dropdown').removeClass('over');
$('div').remove('.over-shim');
}
}
},
function() {
}
);
//
//
$('#v_large').click(function(e) {
e.preventDefault();
$('#hold').addClass('large-12');
$('#hold').removeClass('large-8');
$('#hold').next('div').addClass('large-12');
$('#hold').next('div').removeClass('large-4');
});
$('#v_small').click(function(e) {
e.preventDefault();
$('#hold').removeClass('large-12');
$('#hold').addClass('large-8');
$('#hold').next('div').addClass('large-4');
$('#hold').next('div').removeClass('large-12');
});
//
/*
// build headings
$(".top-nav ul li").each(function() {
var link = $(this).find('a');
if(jQuery.type(link.attr("href")) != 'undefined') {
if(!$(this).text().match(/cart/i)){
$("", {
"id" : $(this).text(),
"label" : $(this).text()
}).appendTo("#nav-select");
}
}
});
// build main opts
$(".shop .sub-opts").each(function() {
var link = $(this).find('a');
if(jQuery.type(link.attr("href")) != 'undefined') {
if(!$(this).text().match(/cart/i)){
$("", {
"text" : $(this).text(),
"value" : link.attr("href")
}).appendTo("#Shop");
}
}
});
// build sub opts
$(".instructors .sub-opts ul li a").each(function() {
if($(this).hasClass("heading")) {
$("", {
"text" : $(this).text(),
"value" : $(this).attr("href")
}).appendTo("#Instructors");
} else {
$("", {
"text" : "-- "+$(this).text(),
"value" : $(this).attr("href")
}).appendTo("#Instructors");
}
});
$(".stackers .sub-opts ul li a").each(function() {
if($(this).hasClass("heading")) {
$("", {
"text" : $(this).text(),
"value" : $(this).attr("href")
}).appendTo("#Stackers");
} else {
$("", {
"text" : "-- "+$(this).text(),
"value" : $(this).attr("href")
}).appendTo("#Stackers");
}
});
$("#nav-select").change(function() {
window.location = $(this).find("option:selected").val();
});
*/
$(document).on('mouseenter', '.hlite-add:not(.row)', function() {
$(this).closest('.row').addClass('hlite-add');
});
$(document).on('mouseleave', '.hlite-add:not(.row)', function() {
$(this).closest('.row').removeClass('hlite-add');
});
$(document).on('mouseenter', '.hlite-del:not(.row)', function() {
$(this).closest('.row').addClass('hlite-del');
});
$(document).on('mouseleave', '.hlite-del:not(.row)', function() {
$(this).closest('.row').removeClass('hlite-del');
});
var table = $('.sortable').DataTable({
paging: false,
"searching": false,
"info": false,
stateSave: true
});
$(".datatable").dataTable({
paging: false,
searching: false,
info: false,
stateSave: true
});
var table = $('.searchtable').DataTable({
paging: false,
"searching": false,
"info": false,
stateSave: true
});
//
$('input,select').focus(function() {
//$('label[for="'+ $(this).attr('name') +'"]').parent().addClass('focus');
});
$('input,select').blur(function() {
//$('label[for="'+ $(this).attr('name') +'"]').parent().removeClass('focus');
});
//
$('.focus').focus();
if(window.location.pathname != '/')
var url = '/'+window.location.toString().match(/\/\/[^\/]+\/([^\.]+)/)[1];
$('.side-nav a').each(function(){
var loc = $(this).attr('href').replace('../','');
//console.log(loc);
if(url.indexOf(loc)>0 || url == loc) {
$(this).addClass('active');
}
});
(function($) {
$.fn.countTo = function(options) {
// merge the default plugin settings with the custom options
options = $.extend({}, $.fn.countTo.defaults, options || {});
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(options.speed / options.refreshInterval),
increment = (options.to - options.from) / loops;
return $(this).each(function() {
var _this = this,
loopCount = 0,
value = options.from,
interval = setInterval(updateTimer, options.refreshInterval);
function updateTimer() {
value += increment;
loopCount++;
$(_this).html(value.formatMoney(0,',','.'));
if (typeof(options.onUpdate) == 'function') {
options.onUpdate.call(_this, value);
}
if (loopCount >= loops) {
clearInterval(interval);
value = options.to;
if (typeof(options.onComplete) == 'function') {
options.onComplete.call(_this, value);
}
}
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 100, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 3, // the number of decimal places to show
onUpdate: null, // callback method for every time the element is updated,
onComplete: null // callback method for when the element finishes updating
};
})(jQuery);
});
$(window).load(function(){
$('.bxslider').bxSlider({
auto: true,
pause: 9000,
mode: 'fade',
pager: false
});
$('.bxslider').show();
$('.show-val').slideDown('slow');
/*
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) == false ) {
jQuery(function($) {
$('.num-country').countTo({
decimals: 0,
from: 10,
to: parseFloat($('.num-country').text()),
speed: 300,
refreshInterval: 50
});
});
jQuery(function($) {
$('.num-programs').countTo({
decimals: 0,
from: 10,
to: parseFloat($('.num-programs').text()),
speed: 400,
refreshInterval: 50
});
});
jQuery(function($) {
$('.num-cups').countTo({
decimals: 0,
from: 10,
to: parseFloat($('.num-cups').text()),
speed: 500,
refreshInterval: 50
});
});
}
*/
function goToByScroll(id){
// jQuery('html,body').animate({scrollTop: $("#"+id).offset().top - 160},'slow');
}
if(window.location.hash != '') {
goToByScroll(window.location.hash.substr(1));
}
//
if($('.sticky-bar').length){
var stickyNavTop = $('.sticky-bar').offset().top-10;
var stickyNav = function(){
var scrollTop = $(window).scrollTop();
if($(window).width() > 800){
if (scrollTop > stickyNavTop) {
$('.sticky-bar').addClass('sticky');
$('.sticky-bar .hold').addClass('row');
$('.sticky-bar').parent('div').removeClass('row');
$('.sticky-bar').parent('div').addClass('top');
$('.sticky-bar').parent('div').next('div').addClass('sticky-top');
} else {
$('.sticky-bar').removeClass('sticky');
$('.sticky-bar').parent('div').addClass('row');
$('.sticky-bar').parent('div').removeClass('top');
$('.sticky-bar').parent('div').next('div').removeClass('sticky-top');
}
}
};
stickyNav();
$(window).scroll(function() {
stickyNav();
});
}
//
;(function($){
//pass in just the context as a $(obj) or a settings JS object
$.fn.autogrow = function(opts) {
var that = $(this).css({overflow: 'hidden', resize: 'none'}) //prevent scrollies
, selector = that.selector
, defaults = {
context: $(document) //what to wire events to
, animate: true //if you want the size change to animate
, speed: 100 //speed of animation
, fixMinHeight: true //if you don't want the box to shrink below its initial size
, cloneClass: 'autogrowclone' //helper CSS class for clone if you need to add special rules
}
;
opts = $.isPlainObject(opts) ? opts : {context: opts ? opts : $(document)};
opts = $.extend({}, defaults, opts);
that.each(function(i, elem){
var min, clone;
elem = $(elem);
//if the element is "invisible", we get an incorrect height value
//to get correct value, clone and append to the body.
if (elem.is(':visible') || parseInt(elem.css('height'), 10) > 0) {
min = parseInt(elem.css('height'), 10) || elem.innerHeight();
} else {
clone = elem.clone()
.addClass(opts.cloneClass)
.val(elem.val())
.css({
position: 'absolute'
, visibility: 'hidden'
, display: 'block'
})
;
$('body').append(clone);
min = clone.innerHeight();
clone.remove();
}
if (opts.fixMinHeight) {
elem.data('autogrow-start-height', min); //set min height
}
elem.css('height', min);
});
opts.context
.on('keyup paste', selector, resize)
;
function resize (e){
var box = $(this)
, oldHeight = box.innerHeight()
, newHeight = this.scrollHeight
, minHeight = box.data('autogrow-start-height') || 0
, clone
;
if (oldHeight < newHeight) { //user is typing
this.scrollTop = 0; //try to reduce the top of the content hiding for a second
opts.animate ? box.stop().animate({height: newHeight}, opts.speed) : box.innerHeight(newHeight);
} else if (e.which == 8 || e.which == 46 || (e.ctrlKey && e.which == 88)) { //user is deleting, backspacing, or cutting
if (oldHeight > minHeight) { //shrink!
//this cloning part is not particularly necessary. however, it helps with animation
//since the only way to cleanly calculate where to shrink the box to is to incrementally
//reduce the height of the box until the $.innerHeight() and the scrollHeight differ.
//doing this on an exact clone to figure out the height first and then applying it to the
//actual box makes it look cleaner to the user
clone = box.clone()
.addClass(opts.cloneClass) //add clone class for extra css rules
.css({position: 'absolute', zIndex:-10}) //make "invisible"
.val(box.val()) //populate with content for consistent measuring
;
box.after(clone); //append as close to the box as possible for best CSS matching for clone
do { //reduce height until they don't match
newHeight = clone[0].scrollHeight - 1;
clone.innerHeight(newHeight);
} while (newHeight === clone[0].scrollHeight);
newHeight++; //adding one back eliminates a wiggle on deletion
clone.remove();
//if user selects all and deletes or holds down delete til beginning
//user could get here and shrink whole box
newHeight < minHeight && (newHeight = minHeight);
oldHeight > newHeight && opts.animate ? box.stop().animate({height: newHeight}, opts.speed) : box.innerHeight(newHeight);
} else { //just set to the minHeight
box.innerHeight(minHeight);
}
}
}
}
})(jQuery);
$('.grow').autogrow();
});
function ucwords (str) {
return (str + '').replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function ($1) {
return $1.toUpperCase();
});
}
Number.prototype.formatMoney = function(decPlaces, thouSeparator, decSeparator) {
var n = this,
decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces,
decSeparator = decSeparator == undefined ? "." : decSeparator,
thouSeparator = thouSeparator == undefined ? "," : thouSeparator,
sign = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(decPlaces)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return sign + (j ? i.substr(0, j) + thouSeparator : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thouSeparator) + (decPlaces ? decSeparator + Math.abs(n - i).toFixed(decPlaces).slice(2) : "");
};