var products = [];
products[210] = ["Women's Yoga Suit
Sports Bra & Shorts", 135, "Canadian Fitness Club", "The last Yoga wear you'll ever buy, this set includes a comfortable yet sexy sports bra along with high waist shorts that provide you the necessary compression while letting you show off those perfect legs!", "", "Women's Yoga Suit Sports Bra & Shorts"];
products[211] = ["Smart Watch &
Fitness Tracker", 99, "Canadian Fitness Club", "Get on-the-go real-time daily health & fitness insights that help you understand your every move, track your progress & reach your goals, everyday.", "", "Smart Watch & Fitness Tracker"];
products[212] = ["Men's 2-in-1 Active
Training Shorts ", 65, "Canadian Fitness Club", "With a built-in mesh liner & zippered back pocket, these shorts are perfect for running, cycling & even workouts. The moisture wicking technology keeps you dry, while the mesh liner gives you athletic support & compression.", "", "Men's 2-in-1 Active Training Shorts "];
products[213] = ["Pleated Sports Skirt
For Golf / Tennis ", 65, "Canadian Fitness Club", "The perfect pleated skirt that's a combination of comfort & style - fit for any sport including Golf, Tennis, Badminton & more. Made with dry-fit polyester, satin, & cotton blend, it is cool & comfortable for all-day wear.", "", "Pleated Sports Skirt For Golf / Tennis"];
products[214] = ["Short Sleeves Dry
Fit T-Shirt ", 85, "Canadian Fitness Club", "The short sleeve tee is perfect for fitness enthusiasts who not only want an extended range of motion while working out, but enjoy the motivation of the perfect pumps that the short sleeves allow.", "", "Short Sleeves Dry Fit T-Shirt "];
products[215] = ["Training Core
Tank Top", 55, "Canadian Fitness Club", "Made with a blend of spandex & polyester, the tank tops are perfect for the gym rat in you, who wants to pump hard & build that perfect physique. The dry-fit make ensures you stay dry even after hours in the gym.", "", "Training Core Tank Top"];
products[216] = ["2-in-1
Joggers Set - Black", 125, "Canadian Fitness Club", "The perfect fleece jogger set is great for the autumn and winter season, to keep you warm yet active. It includes a comfortable zipper with tight arm cuffs along with track pants with pockets & slim fit leg opening.", "", "2-in-1 Joggers Set - Black"];
products[217] = ["2-in-1
Joggers Set - Deep Grey", 125, "Canadian Fitness Club", "The perfect fleece jogger set is great for the autumn and winter season, to keep you warm yet active. It includes a comfortable zipper with tight arm cuffs along with track pants with pockets & slim fit leg opening.", "", "2-in-1 Joggers Set - Deep Grey"];
products[217] = ["2-in-1
Joggers Set - Dark Blue ", 125, "Canadian Fitness Club", "The perfect fleece jogger set is great for the autumn and winter season, to keep you warm yet active. It includes a comfortable zipper with tight arm cuffs along with track pants with pockets & slim fit leg opening.", "", "Featured Product"];
products[219] = ["Super Stretch Trainer
T-Shirt - Black", 85, "Canadian Fitness Club", "Built with a balanced blend of spandex & polyester the super stretch t-shirt is a must have in your gym wardrobe. The natural compression boosts circulation for high-performance workouts, while the moisture wicking keeps you comfortable.", "", "Super Stretch Trainer T-Shirt - Black"];
products[220] = ["Super Stretch Trainer
T-Shirt - Blue", 85, "Canadian Fitness Club", "Built with a balanced blend of spandex & polyester the super stretch t-shirt is a must have in your gym wardrobe. The natural compression boosts circulation for high-performance workouts, while the moisture wicking keeps you comfortable. ", "", "Super Stretch Trainer T-Shirt - Blue"];
products[220] = ["Crossfit Shorts With Inner Compression Sleeve", 65, "Canadian Fitness Club", "The 2-in-1 versatile shorts are perfect for those who are looking to boost their active performance. The outer shorts are lightweight & breathable, whereas the quick-dry compression inner shorts give you the extra support.", "
", "Crossfit Shorts With Inner Compression Sleeve"];
products[221] = ["Boxing
Trainer Shorts ", 65, "Canadian Fitness Club", "These absolutely trendy shorts are great for anything fitness-related, workouts, running, cycling, & even a round of tennis! They are super comfortable to wear, and ensure you grab those eyeballs when you walk with them on too!", "", "Boxing Trainer Shorts "];
products[222] = ["Activewear
Shorts ", 65, "Canadian Fitness Club", "These absolutely trendy shorts are great for anything fitness-related, workouts, running, cycling, & even a round of tennis! They are super comfortable to wear, and ensure you grab those eyeballs when you walk with them on too!", "", "Activewear Shorts "];
products[223] = ["Compression Yoga Shorts
+ Sports Bra", 75, "Canadian Fitness Club", "The quintessential Sports Bra that offers the perfect support, optimum coverage & complete comfort during sports & workouts. Made with a mix of polyester and spandex, it offers a super stretch & sexy feel. ", "", "Compression Yoga Shorts + Sports Bra"];
products[224] = ["Hiking / Workout
Shorts - Grey", 75, "Canadian Fitness Club", "Our most popular women's shorts offer an uber comfortable loose-fit that is perfect for hiking, workout, yoga - while looking super chic to double up as lounge-wear. Made with a blend of spandex & polyester they feel super soft & silky on your skin too!", "", "Hiking / Workout Shorts - Grey"];
products[225] = ["Hiking / Workout
Shorts - Sexy Black", 75, "Canadian Fitness Club", "Our most popular women's shorts offer an uber comfortable loose-fit that is perfect for hiking, workout, yoga - while looking super chic to double up as lounge-wear. Made with a blend of spandex & polyester they feel super soft & silky on your skin too!", "", "Hiking / Workout Shorts - Sexy Black"];
products[226] = ["Hiking / Workout
Shorts - Lounge Blue", 75, "Canadian Fitness Club", "Our most popular women's shorts offer an uber comfortable loose-fit that is perfect for hiking, workout, yoga - while looking super chic to double up as lounge-wear. Made with a blend of spandex & polyester they feel super soft & silky on your skin too!", "", "Hiking / Workout Shorts - Lounge Blue"];
products[227] = ["Hiking / Workout
Shorts - Lounge Blue", 75, "Canadian Fitness Club", "The ultimate shorts includes a woven outer layer in sexy black & built in compression shorts in bright red to give you function, comfort & a dash of style too! Made with a polyester & spandex fabric blend they are super comfortable for all-day wear. ", "", "Hiking / Workout Shorts - Lounge Blue"];
products[228] = ["Zip-Up
Workout Jacket", 135, "Canadian Fitness Club", "The high stretch zip-up athletic jacket is a must have for your fitness wardrobe. The seamless design makes it comfortable while the snug fit gives your figure the sexy definition it deserves.", "", "Zip-Up Workout Jacket"];
products[229] = ["Butt-Lift
Yoga Pants - Yellow ", 125, "Canadian Fitness Club", "The must-have bottom for all your fitness needs, these butt-lift yoga pants gives you comfort & compression to perform better at your workouts while giving your sensuous figure the extra oomph too!", "", "Butt-Lift Yoga Pants - Yellow "];
products[230] = ["Butt-Lift
Yoga Pants - Purple", 125, "Canadian Fitness Club", "The must-have bottom for all your fitness needs, these butt-lift yoga pants gives you comfort & compression to perform better at your workouts while giving your sensuous figure the extra oomph too!", "", "Butt-Lift Yoga Pants - Purple"];
products[231] = ["Unisex
Workout Gloves", 55, "Canadian Fitness Club", "The perfect workout gloves that give you protection, comfort & freedom to pump that iron in the gym. These cut-gloves - leave your fingers free for better grip and flexibility, while the dry fit material ensures your palms remain dry even after extended wear.", "", "Unisex Workout Gloves"];
products[231] = ["Resistance Band
Workout Kit", 150, "Canadian Fitness Club", "Popularly known as - 'Gym In A Bag', the resistance band workout kit lets you do full body workouts for weight loss, muscle building, toning and so much more, right in the comfort of your house. ", "", "Resistance Band Workout Kit"];
products[232] = ["Compression
Foot Sleeves", 15, "Canadian Fitness Club", "Compression socks combine the stability of kinesiology taping with the performance of compression fabric. This unique design aligns with The Fascial Meridians To Provide Nerve, Muscle, Ball, Reflexology, Tendonitis, Flat Feet, Massage, & Stretch Therapy.", "", "Compression Foot Sleeves"];
products[233] = ["Compression
Foot & Ankle Sleeve", 20, "Canadian Fitness Club", "Ergonomically designed to enhance the strength of your ankles, and offering optimum support to the heels for better mobility. These one-size fits all is perfect for not just athletic activities but for all-day wear as well. ", "", "Compression Foot & Ankle Sleeve"];
products[234] = ["Compression
Elbow Brace", 35, "Canadian Fitness Club", "Compressa Elbow braces apply stable pressure across your elbow joint and are very comfortable to move around in. With our sleeves youâll be able to tackle any activity life throws your way.", "", "Compression Elbow Brace"];
console.log(products);
var orderedItems = [];
var orderedTotQty = 0;
var maxQty = 100;
var shipRates = false;
var handling = 0;
var carturl = "cart3.php";
//Funtion adds Items to Cart
var addItem = function(itemId, Qty) {
orderedTotQty = $.cookie('orderedTotQty');
if (!orderedTotQty) {
orderedTotQty = 0;
}
Qty = parseInt(Qty);
if(Qty > maxQty) {
alert("Maximum " + maxQty + " of this product can be selected in a single order");
return false;
}
var order = $.cookie('order');
if (!order) {
order = itemId + "-" + Qty;
orderedItems[itemId] = Qty;
} else {
var itemExists = false;
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (order != "") {
order += "|";
}
if (prodId == itemId) {
//alert("Product already exist in cart");
// return false;
if((quantity + Qty) > maxQty) {
alert("Maximum " + maxQty + " of this product can be selected in a single order");
return false;
}
quantity += Qty;
order += prodId + "-" + quantity;
itemExists = true;
} else {
order += prodId + "-" + quantity;
}
orderedItems[prodId] = quantity;
}
if (!itemExists) {
if (order != "") {
order += "|";
}
order += itemId + "-" + Qty;
orderedItems[itemId] = Qty;
}
}
orderedTotQty = parseInt(orderedTotQty);
orderedTotQty += Qty;
$('.cartqty').html(orderedTotQty);
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == carturl) {
showCart(false, 'add', itemId);
} else {
// $(location).attr('href', carturl);
}
};
//Funtion decrements Items to Cart
var removeItem = function(itemId, Qty) {
Qty = parseInt(Qty);
var order = $.cookie('order');
if (!order) {
orderedItems[itemId] = 0;
refreshRow(itemId);
} else {
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId == itemId) {
quantity -= Qty;
if (quantity > 0) {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
}
itemExists = true;
orderedItems[prodId] = quantity;
refreshRow(itemId);
} else {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
orderedItems[prodId] = quantity;
}
}
}
orderedTotQty -= Qty;
$('.cartqty').html(orderedTotQty);
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == carturl) {
showCart(false, 'remove', itemId);
} else {
$(location).attr('href', carturl);
}
};
//Funtion sets Item quantity on the Cart
var setItemQty = function(itemId, Qty) {
Qty = parseInt(Qty);
if(Qty > maxQty || Qty < 0) {
return false;
}
var order = $.cookie('order');
orderedTotQty = 0;
if (!order) {
orderedItems[itemId] = 0;
} else {
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId == itemId) {
quantity = Qty;
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
itemExists = true;
} else {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
}
orderedItems[prodId] = quantity;
orderedTotQty += quantity;
}
}
$('.cartqty').html(orderedTotQty);
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == carturl) {
showCart(false, 'set', itemId);
} else {
$(location).attr('href', carturl);
}
};
var removeRowItem = function(itemId) {
var order = $.cookie('order');
if (!order)
{
orderedTotQty = 0;
} else {
var items = order.split("|");
order = "";
orderedTotQty = 0;
orderedItems = null;
orderedItems = new Array();
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId == itemId) {
} else {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
orderedTotQty += quantity;
orderedItems[prodId] = quantity;
}
}
}
if($('[data-id="prow-' + itemId + '"]').length >= 1) {
$('[data-id="prow-' + itemId + '"]').remove();
}
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
showCart(false, 'removerow', itemId);
};
//Emptying the cart
var emptyCart = function() {
var order = $.cookie('order');
order = "";
orderedTotQty = 0;
orderedItems = null;
orderedItems = new Array();
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
if($('[id^="prow-"]').size() > 0) {
$('[id^="prow-"]').each(function(){
$(this).remove();
});
}
showCart(false, 'empty');
};
//Displaying the cart items & calculations
function showTotalPrice() {
var cartHtml = "";
var total = 0;
var shipping = 0;
var grand_total = 0;
var sub_total = 0;
var shippingType = '';
var order = $.cookie('order');
orderedTotQty = $.cookie('orderedTotQty');
if($('#shippingCountry').val() == '') {
shippingType = '';
} else if($('#shippingCountry').val() == 'US') {
shippingType = 'US';
} else {
shippingType = 'INTERNATIONAL';
}
if (!order) {
orderedTotQty = 0;
} else {
var items = order.split("|");
if(shipRates) {
shipping = shipRates * 1.0;
}
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId != "" && quantity > 0) {
sub_total = round((quantity * products[prodId][1]), 2);
total += (quantity * products[prodId][1]);
}
}
total = round(total, 2);
}
var snh = shipping + handling;
//if(shipping == 0) {
// snh = shipping;
//}
console.log(snh);
grand_total = total + snh;
$('.total-price').html('$' + total.toFixed(2));
$('.shipping-total').html('$' + snh.toFixed(2));
$('.grand-total').html('$' + grand_total.toFixed(2));
};
// Refresh row content with updated quantity / price for a product
function refreshRow(pid) {
pid = parseInt(pid);
quantity = orderedItems[pid];
sub_total = round((quantity * products[pid][1]), 2);
$('#prow-' + pid + ' .tot-price').html('$' + sub_total.toFixed(2) + ' USD');
$('#prow-' + pid + ' .qtybox').val(quantity);
$('#prow-' + pid + ' .dispqty').html(quantity);
}
//Displaying the cart items & calculations
function showCart(showFullCart, act, itm) {
var cartHtml = "";
var order = $.cookie('order');
orderedTotQty = $.cookie('orderedTotQty');
if (!order)
{
orderedTotQty = 0;
if($('[id^="prow-"]').size() == 0) {
$("#cartBox").html("
You have not selected any product...
  Browse Products"); } showTotalPrice(); return false; } else { var items = order.split("|"); var total = 0; var shipping = 0; var grand_total = 0; orderedTotQty = parseInt(orderedTotQty); if (typeof showFullCart === "undefined") { return false; } else if(showFullCart == false) { if ((typeof act !== "undefined") && (typeof itm !== "undefined")) { if((act == 'add' || act == 'set' || act == 'remove') && itm > 0) { refreshRow(itm); } else if(act == 'removerow' && itm > 0) { itm = parseInt(itm); } } showTotalPrice(); return false; } orderedItems = null; orderedItems = new Array(); cartHtml += "