var products = [];
products[214] = ["Running Track Suit - Red", 165, "NACA | Fitness Gear For Men & Women", "Crafted with super-soft, breathable & ultra-stretch fabric, the track suit is perfect for runs & jogs. Enabled with dry-fit technology the fabric keeps the sweat away to keep you comfortable on those long runs or warm up sessions.
Available in 4 colors, the running track suit is perfect to make a sporty fashion statement too!", ""];
products[215] = ["Running Track Suit - Dark Gray", 165, "NACA | Fitness Gear For Men & Women", "Crafted with super-soft, breathable & ultra-stretch fabric, the track suit is perfect for runs & jogs. Enabled with dry-fit technology the fabric keeps the sweat away to keep you comfortable on those long runs or warm up sessions.
Available in 4 colors, the running track suit is perfect to make a sporty fashion statement too!", ""];
products[216] = ["Running Track Suit - Black", 165, "NACA | Fitness Gear For Men & Women", "Crafted with super-soft, breathable & ultra-stretch fabric, the track suit is perfect for runs & jogs. Enabled with dry-fit technology the fabric keeps the sweat away to keep you comfortable on those long runs or warm up sessions.
Available in 4 colors, the running track suit is perfect to make a sporty fashion statement too!", ""];
products[217] = ["Running Track Suit - Light Gray", 165, "NACA | Fitness Gear For Men & Women", "Crafted with super-soft, breathable & ultra-stretch fabric, the track suit is perfect for runs & jogs. Enabled with dry-fit technology the fabric keeps the sweat away to keep you comfortable on those long runs or warm up sessions.
Available in 4 colors, the running track suit is perfect to make a sporty fashion statement too!", ""];
products[218] = ["Muscle Tee - Black & Grey", 95, "NACA | Fitness Gear For Men & Women", "These custom compression long sleeves tee's are perfect for high-intensity training including gym workouts, jogging, running & sports. They are super stretchable to enable you to enjoy extended range of motion, while the dry-fit fabric keeps you comfortable.
Oh! We forgot to mention, these are perfect to flex & pump too! ", ""];
products[219] = ["Muscle Tee - White & Grey", 95, "NACA | Fitness Gear For Men & Women", "These custom compression long sleeves tee's are perfect for high-intensity training including gym workouts, jogging, running & sports. They are super stretchable to enable you to enjoy extended range of motion, while the dry-fit fabric keeps you comfortable.
Oh! We forgot to mention, these are perfect to flex & pump too! ", ""];
products[220] = ["Sports Shorts", 105, "NACA | Fitness Gear For Men & Women", "Originally crafted for our sporty patrons, these shorts have become a super hit with gym goers & long-distance runners. Super lightweight, quick-dry enabled & breathable - these shorts personify comfort built for performance.", ""];
products[221] = ["Classic Tee", 115, "NACA | Fitness Gear For Men & Women", "The classic mens tee with a touch of fashion with the 'scoop bottom' makes it a perfect fit for the gym or a day out. Made with 95% cotton & 5% spandex, it fits snug while still offering and extended range of motion.", ""];
products[222] = ["Hooded Tank Top", 125, "NACA | Fitness Gear For Men & Women", "A unique twist to the tank top, our hooded tank tops are the trending active wear of the season amongst men. Perfect for your trip to the beach or even the gym, these tank tops add the oomph of style to your look.", ""];
products[223] = ["Spandex Track Pants", 115, "NACA | Fitness Gear For Men & Women", "Our spandex track pants are our most stretchable and comfortable offering, specially created for workout enthusiasts. They include a mix of cotton and spandex, making them breathable but still offering a snug fit.", ""];
products[224] = ["Gym Stringer - White", 75, "NACA | Fitness Gear For Men & Women", "Our hottest selling stringer for men is comfortable, allows superior range of motion while letting you show off those pumps! Perfect for gyms, long runs or lounging at the beach, these are a must have in your workout wardrobe.
Available in cool white, it's perfect for all-day wear.", ""];
products[225] = ["Yoga Set", 160, "NACA | Fitness Gear For Men & Women", "By far our hottest selling product in the women's category - our yoga set flatters the body's every curve while giving you the freedom of movement that you deserve during your workouts. The long sleeves crop top and the high waist shorts are sure to make heads turn in your yoga class or the gym - which we think is a definite plus!", ""];
products[226] = ["Knit Cross Sports Bra - Blue", 95, "NACA | Fitness Gear For Men & Women", "A sports bra engineered with our unique knit-cross back maximum balance & impact, while offering complete yet sexy coverage. Super-breathable, stretchable & quick-drying are the few reasons that make it our best seller.", ""];
products[227] = ["Knit Cross Sports Bra - Black", 95, "NACA | Fitness Gear For Men & Women", "A sports bra engineered with our unique knit-cross back maximum balance & impact, while offering complete yet sexy coverage. Super-breathable, stretchable & quick-drying are the few reasons that make it our best seller.", ""];
products[228] = ["Sling Yoga Bra - Blue", 95, "NACA | Fitness Gear For Men & Women", "Crafted to our lightest sports-bra, this is a hot favorite for women who love their yoga, aerobics & pilates. The seamless build flatters the body's curves in the best way while the super comfort fit gives the right balance to let you stretch & bend all the way!", ""];
products[229] = ["Sling Yoga Bra - Black", 95, "NACA | Fitness Gear For Men & Women", "Crafted to our lightest sports-bra, this is a hot favorite for women who love their yoga, aerobics & pilates. The seamless build flatters the body's curves in the best way while the super comfort fit gives the right balance to let you stretch & bend all the way!", ""];
products[230] = ["Sling Yoga Bra - Red", 95, "NACA | Fitness Gear For Men & Women", "Crafted to our lightest sports-bra, this is a hot favorite for women who love their yoga, aerobics & pilates. The seamless build flatters the body's curves in the best way while the super comfort fit gives the right balance to let you stretch & bend all the way!", ""];
products[231] = ["Balance Sports Bra - Black", 95, "NACA | Fitness Gear For Men & Women", "If you are looking for full coverage, ultra-high balance & sporty impact, our Balance Sports Bras tick all the boxes. Made with a mix of cotton & spandex they are both comfortable & stretchable. One reason what makes it a favorite amongst the NC+ is the unique back cut that adds oodles of style!", ""];
products[232] = ["Balance Sports Bra - Maroon", 95, "NACA | Fitness Gear For Men & Women", "If you are looking for full coverage, ultra-high balance & sporty impact, our Balance Sports Bras tick all the boxes. Made with a mix of cotton & spandex they are both comfortable & stretchable. One reason what makes it a favorite amongst the NC+ is the unique back cut that adds oodles of style!", ""];
products[233] = ["Balance Sports Bra - White", 95, "NACA | Fitness Gear For Men & Women", "If you are looking for full coverage, ultra-high balance & sporty impact, our Balance Sports Bras tick all the boxes. Made with a mix of cotton & spandex they are both comfortable & stretchable. One reason what makes it a favorite amongst the NC+ is the unique back cut that adds oodles of style!", ""];
products[234] = ["High Waist Leggings - Lavender", 125, "NACA | Fitness Gear For Men & Women", "The perfect pair or workout leggings designed to help you go the extra mile, everyday! Made with a mix of cotton & spandex, the ultra stretchable leggings fit snug to your legs, giving you the compression you need to peak perform.
Available in the sexy lavender color, it makes for a perfect fashion statement too!", ""];
products[235] = ["High Waist Leggings - Cool Blue", 125, "NACA | Fitness Gear For Men & Women", "The perfect pair or workout leggings designed to help you go the extra mile, everyday! Made with a mix of cotton & spandex, the ultra stretchable leggings fit snug to your legs, giving you the compression you need to peak perform.
Available in the cool blue color, it makes for a perfect fashion statement too!", ""];
products[236] = ["Crop Leggings", 125, "NACA | Fitness Gear For Men & Women", "Made primarily for jogs & runs, these high waist crop leggings are engineered for exceptional freedom & superior comfort fit. The V shape waistline is sure to flatter your body, making you look and above all feel your sexy self.
The little mesh touch at the bottom is the perfect addition for maximum breathability and a touch of style.", ""];
products[237] = ["Fitness Tracker", 45, "NACA | Fitness Gear For Men & Women", "Get your trainer on your wrist with our Smart Fitness Tracker that tracks your activities, longs in your progress, reminds you to keep moving & also monitor your health vitals.
We have only a limited quantity available at this special price, so don't miss out.", ""];
products[238] = ["Protein Shaker", 25, "NACA | Fitness Gear For Men & Women", "The truly advanced protein shaker - lets you get the perfect dose of your fav protein without having to use the frustrating measuring cup or spoon! BPA-Free & made with non-toxic plastic it's absolutely safe for your use.", ""];
products[239] = ["Resistance Bands", 60, "NACA | Fitness Gear For Men & Women", "The most popular at-home-workout system, these resistance bands let you enjoy a whole body workout right in the comfort of your home - no expensive equipment, no gym membership! They come in 5 intensity options so you can level up as you go!", ""];
products[240] = ["Workout Gloves", 30, "NACA | Fitness Gear For Men & Women", "These unisex lifting workout gloves are a must have for your training sessions. Their perfect palm grips prevent slips while the dry-fit material keeps your hands sweat free. So just glove up and get ready to do those extra lifts & reps today!", ""];
products[241] = ["Sweatband", 15, "NACA | Fitness Gear For Men & Women", "Tired of wiping the sweat off during your game or workout? Introducing the tie-on headband made with dry-fit material to keep the sweat away.", ""];
products[242] = ["Gym Bag", 120, "NACA | Fitness Gear For Men & Women", "Our leather gym bag is the latest addition to our accessories category. It comes in the perfect black color and gives your gym look a touch of sexy style too!", ""];
products[243] = ["Compression Foot Sleeves", 15, "NACA | Fitness Gear For Men & Women", "Proven to improve strength & support to the ankle and heal, the compression foot sleeves are engineered to reduce pain & support performance. The advanced compression technology regulates the flow of oxygen through the foot and leg reducing inflammation & chronic pain. Made with the premium lightweight breathable fabric, it is crafted for daily use.", ""];
products[244] = ["Compression Knee Sleeves", 35, "NACA | Fitness Gear For Men & Women", "Compression Knee Sleeves are a special type of performance wear that provide warmth, support, and better blood flow to your knees so you can reduce swelling and pain during or after activity, and perform at a higher level every day.", ""];
products[245] = ["Scuba High-Rise Jogger", 98, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Weightless Coverage
High Rise
", ""];
products[246] = ["Training High-Rise Crop", 88, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Our Fastest-Drying
High-Rise
Waistband drawcord keeps your leggings in place so you donât have to pull them up
Hidden pocket in the waistband has space for your card and keys
", ""];
products[247] = ["Fast and Free High-Rise Crop", 118, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Weightless Coverage
High-Rise
Two side drop-in pockets fit your phone
Five waistband pockets
The tighter waistband and continuous drawcord help keep your leggings in place so you don't have to pull them up mid-run
", ""];
products[248] = ["Base Pace High-Rise Crop", 88, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Brushed
High-Rise
Back pocket
Continuous drawcord is easy to cinch and won't get lost in the wash
No inseam for a smooth stride
", ""];
products[249] = ["Base Pace High-Rise Crop", 168, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Our Fastest Drying
Super-High Rise
Back drop-in pocket
Side pockets
Mesh fabric panels
Continuous drawcord
", ""];
products[250] = ["High-Rise Pant", 89, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga
Feels Buttery Soft and Weightless
High Rise
Hidden waistband pocket fits a card or a key, and it wonât get in your way
This collectionâs great for low-impact workouts like yoga, or whenever you want to feel really, really comfortable
", ""];
products[251] = ["Hotty Hot Low-Rise Lined Short", 58, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Lightweight
Low Rise
Built-in liner offers extra coverage
Discreet zippered pocket in seam
Secret stash pocket in the liner
Continuous drawcord
Reflective details
", ""];
products[252] = ["Hotty Hot Low-Rise Lined Short", 58, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Lightweight
Low Rise
Built-in liner offers extra coverage
Discreet zippered pocket in seam
Secret stash pocket in the liner
Continuous drawcord
Reflective details
", ""];
products[253] = ["Stretch High-Rise Jogger Full Length", 118, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Sweat-Wicking
Relaxed Fit, Straight Leg
Wear the drawcord out or hide it inside for a flat waistband
Front hand pockets with hidden zipper pocket and card sleeve
", ""];
products[254] = ["Adapted State High-Rise Jogger Crop", 118, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Quick-Drying Fabric
High Rise
Continuous drawcord
Secure zippered pockets with internal phone and coin sleeves
Zippers at the cuff make them easy to get on and off quickly
", ""];
products[255] = ["High-Rise Jogger", 79, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Light and Soft
High Rise
Front pockets with interior card sleeve
", ""];
products[256] = ["Longline Bra", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga and On the Move
Sweat-Wicking Fabric
Light Support
Moulded foam cups are lightweight and malleable
", ""];
products[257] = ["Longline Bra, Light Support", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga and On the Move
Sweat-Wicking Fabric
Light Support
Moulded foam cups are lightweight and malleable
", ""];
products[258] = ["High-Neck Longline Bra", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Abrasion-Resistant Fabric
Medium Support, BâD Cups
Pockets for optional, removable cups
", ""];
products[259] = ["Enlite Weave-Back Bra High Support", 98, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Smooth and Supportivec
High Support
Lightweight, breathable built-in cups are engineered to soften bounce
Bonded underband won't constrict, dig in, or ride up
Stitch-free hook-and-eye closure lies flat for a distraction-free fit
Back closure opens wide for easy removal
", ""];
products[260] = ["Adjustable Bra Medium Support", 58, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga and Training
Slick and Low-Friction Support
Medium Support
Pockets for optional, removable cups
Hook-and-eye closure for a customized underband fit
", ""];
products[261] = ["Tank Top", 48, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga
Light
Tight Fit, Hip Length
Added Fibre For Stretch And Shape Retention
Tight Fit Lets You Move Without Restriction
Cut For Full Range Of Movement
", ""];
products[262] = ["Cropped Tank Top", 49, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga
Feels Buttery Soft and Weightless
Light Support
Built-in shelf bra for added support and coverage
Pockets for optional, removable cups
", ""];
products[263] = ["High-Neck Tank Top", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga
Feels Buttery Soft and Weightless
Light Support
Built-in shelf bra for added support and coverage
Pockets for optional, removable cups
High neck for added coverage
", ""];
products[264] = ["Waist-Length Tank Top", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga
Feels Buttery Soft and Weightless
Light Support
Built-in shelf bra for added support and coverage
Pockets for optional, removable cups
", ""];
products[265] = ["Training Jogger", 128, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Abrasion-Resistant
Classic Tapered Fit
Waistband drawcord can be worn inside or out to give you options and reduce bulk
Secure pockets
Centre-back tape works as a locker loop
", ""];
products[266] = ["City Sweat Jogger", 118, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Soft, Stretch Fabric
Classic Tapered Fit
Waistband drawcord can be worn inside or out to give you options and reduce bulk
Secure back pocket
Hidden media and coin pockets
", ""];
products[267] = ["Four-Way Stretch Jogger", 128, "NACA | Fitness Gear For Men & Women", "
Four-Way Stretch Fabric
Wear the drawcord out or hide it inside for a flat waistband
Hidden media and coin pockets
Secure back pocket
Secure back pocket
", ""];
products[268] = ["Skinny-Fit Jogger", 128, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Everyday Performance
Skinny Fit
Wear the drawcord out or hide it inside for a flat waistband
Hidden media and coin pockets
Secure back pocket
", ""];
products[269] = ["Run State Jogger", 128, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Water-Repellent
Classic Tapered Fit
Elastic waistband with a hidden drawcord
Zippered hand pockets and an interior waistband pocket
Zippers at the cuff make them easy to get on and off quickly
", ""];
products[270] = ["Tapered Fit Jogger", 89, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Quick-Drying Fabric
Classic Tapered Fit
Secure zipperless back pocket
Reflective details
", ""];
products[271] = ["Training Shorts - Blue", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Running and Training
Lightweight
Classic Fit
Zippered pocket
", ""];
products[272] = ["Lined Short", 88, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Lightweight
Relaxed Fit
Stash your shirt in the waistband loop
Secure back pocket
Secure back pocket
", ""];
products[273] = ["Classic-Fit Short", 88, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Lightweight
Relaxed Fit
Stash your shirt in the waistband loop
Secure back pocket
Secure back pocket
", ""];
products[274] = ["Fast and Free Short ", 88, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Lightweight
Relaxed Fit
Made from sweat-wicking and quick-drying mesh fabric.
Stash your shirt in the waistband loops
", ""];
products[275] = ["Running Shorts ", 39, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Lightweight
Relaxed Fit
Secure back pocket
Stash your shirt in the waistband loops
Made from sweat-wicking and quick-drying mesh fabric
", ""];
products[276] = ["Short Sleeve Shirt", 78, "NACA | Fitness Gear For Men & Women", "
Designed for Running and Training
Seamless Construction
Slim Fit
More wearing, less washing.
", ""];
products[277] = ["Training Long Sleeve Shirt", 88, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Classic Fit
Underarm gusset for increased mobility
Locker loop for easy hanging
Quick-drying
", ""];
products[278] = ["Short Sleeve Shirt 2.0", 54, "NACA | Fitness Gear For Men & Women", "
Designed for Running and Training
Slim Fit
Designed to skim the body from chest to waist
Added elastane improves stretch and shape retention
", ""];
products[279] = ["Designed for Training", 54, "NACA | Fitness Gear For Men & Women", "
Designed for Training
Classic Fit
Underarm gusset for increased mobility
Locker loop for easy hanging
Designed with room in the chest and at the waist
", ""];
products[280] = ["Short Sleeve Shirt - Black", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Slim Fit
Reflective details
Quick-drying
Lightweight
Sweat-wicking
", ""];
products[381] = ["Short Sleeve Shirt - Petrol Purple", 39, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Slim Fit
Reflective details
Quick-drying
Lightweight
Sweat-wicking
Designed to skim the body from chest to waist
", ""];
products[382] = ["Short Sleeve Shirt - Sheer Blue", 68, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Slim Fit
Reflective details
Quick-drying
Lightweight
Sweat-wicking
Designed to skim the body from chest to waist
", ""];
products[383] = ["Basic T-Shirt 3 Pack", 138, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Super-Soft
Classic Fit
Four-way stretch
Naturally breathable
", ""];
products[384] = ["Long Sleeve Shirt 2.0", 88, "NACA | Fitness Gear For Men & Women", "
Designed for Running and Training
Slim Fit
Sweat-wicking
Four-way stretch
Designed to skim the body from chest to waist
", ""];
products[385] = ["Bag Zip Top", 78, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Water-Repellent Fabric
Adjustable shoulder strap for comfortable carrying
Zippered exterior pockets
Zippered main compartment sits close to body for added security
Zippered interior pocket
", ""];
products[386] = ["Men's Run Hat", 38, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Four-way stretch, sweat-wicking, and quick-drying
Interior front mesh fabric panel and sweatband wick sweat to help keep you dry
Reflective details
Adjustable back closure for a custom fit
", ""];
products[387] = ["Cold Terrain Run Neckwarmer", 38, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Pull it up and wear it when you need extra coverage
", ""];
products[388] = ["Reversible Mat 5mm", 88, "NACA | Fitness Gear For Men & Women", "
We designed this mat with a little extra cushion for hips, knees, and floor poses.
Top layer absorbs moisture to help you get a grip during sweaty practices
Natural rubber base gives you cushioning and a textured grip for low-sweat practices
", ""];
products[389] = ["Down Scarf", 39, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Windproof and water-repellent
A hidden pocket holds your essentials
Reflective detail
", ""];
products[390] = ["Stretching Strap", 16, "NACA | Fitness Gear For Men & Women", "
Designed for Yoga
Buckles make this strap easy to adjust so it can support you in any pose
", ""];
products[391] = ["Double Roller Mini", 38, "NACA | Fitness Gear For Men & Women", "
Designed for On the Move
Dense foam is durable and supportive
Use the exterior roller to massage your arms and legs
Pull out the interior roller to release tension in your back
To care for the roller, wipe it down after use with a natural cleanser
", ""];
products[392] = ["Cold Terrain Running Ear Warmer", 19, "NACA | Fitness Gear For Men & Women", "
Designed for Running
Four-way stretch, water-repellent tech fleece fabric is brushed for warmth
Reflective details help keep you on the radar
", ""];
products[393] = ["Yoga Mat 5mm", 138, "NACA | Fitness Gear For Men & Women", "
Let your senses guide you. The innovative 3D texture helps you feel your way around the mat and stay centred in poses without looking down.
", ""];
products[394] = ["Running Belt", 38, "NACA | Fitness Gear For Men & Women", "
This sleek run belt is lightweight, breathable, and fits all your essentials so you can go the distance.
Lightweight
Sweat-wicking
Buttery soft
Adjustable low-bounce waistband has a buckle closure to customize your fit
Zippered stretchy pocket keeps your phone close
Side drop-in pockets to stash your key, cards, and gels
", ""];
console.log(products);
var orderedItems = [];
var orderedTotQty = 0;
var maxQty = 10;
var shipRates = false;
var handling = 0;
var carturl = "cart.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($('#prow-' + itemId).length == 1) {
$('#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-"]').length > 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-price').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-"]').length == 0) {
$("#cartBox").html("
";
var total = 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) {
orderedItems[prodId] = quantity;
var sub_total = round((quantity * products[prodId][1]), 2);
total += sub_total;
cartHtml += "