Rev 13177 | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function(){jQuery('.mk_videoclick').click(function(){var clicked = jQuery(this);var scrollTo = jQuery("#recommendedvids");if(currentVideoId!=currentVideoIds[clicked.attr("slidecounter")]){scrollTo.find('li[ytid=' + currentVideoIds[clicked.attr("slidecounter")] + ']').click();}trackEventWithGA('Product', 'VideoTabClicked', $('title').text().split('|')[0].trim() + "|" + clicked.attr("slidename"));jQuery('html, body').animate({ scrollTop: scrollTo.offset().top }, 'medium');return false;});var bankEle = jQuery("#bank-name");var first = true;var allBankImgs = {1:"/images/hdfc-icon.png",2:"/images/axis-icon.png",3:"/images/icici-icon.png",4:"/images/indusind-icon.png",5:"/images/citi-icon.png",6:"/images/std-chartered-icon.png",7:"/images/hsbc-icon.png",8:"/images/kotak-icon.png",9:"/images/sbi-icon.png",};var minEmi = 999999;if(typeof EMI === "undefined"){EMI={};}EMI.lowestEmiBank = 0;jQuery.each(emiObj, function(index, opt) {if(sellingPrice >= opt.minAmount){if(typeof banks[opt.bankId] == "undefined") {banks[opt.bankId] = {};banks[opt.bankId].name = opt.bankName;banks[opt.bankId].emis = {};banks[opt.bankId].active = true;banks[opt.bankId].img = allBankImgs[opt.bankId];}var bank = banks[opt.bankId];var bankTenure = {};bankTenure.tenureDescription = opt.tenureDescription;var r = opt.interestRate/12/100;var installment = sellingPrice*r*Math.pow(1+r,opt.tenure)/(Math.pow(1+r,opt.tenure) - 1);bankTenure.monthlyEmi = (Math.round(installment*100)/100).toFixed(2);bankTenure.interestRate = opt.interestRate;bankTenure.tenure = opt.tenure;if(minEmi > installment){minEmi = installment;EMI.interestRate = r;EMI.tenure = opt.tenure;EMI.lowestEmiBank = opt.bankId;}bank.emis[opt.id] = bankTenure;}});jQuery.each(banks, function(index, bank){var style = ' style="background: url(\'' + bank.img + '\') no-repeat right"';if(first){bankEle.append('<li title="' + bank.name + '"' + style +'><input type="radio" id="' + index +'" value="' + index +'" name="bankselected"' + (bank.active ? '""' : 'disabled="disabled"') + ' checked="checked"/></li>');first = false;}else {bankEle.append('<li title="' + bank.name +'"' + style +'><input type="radio" id="' + index +'" value="' + index +'" name="bankselected"' + (bank.active ? '""' : 'disabled="disabled"') + ' /></li>');}});bankEle.find("input[type='radio']").click(onBankClicked);jQuery("#emi_more,#emi_more1").live('click',function(){$.colorbox({inline:true,href:"#emiLightBox",width:"600px",height:"410px",onComplete: function(){$('#emiLightBox').show();if(EMI.lowestEmiBank == 0) {bankEle.find("input[type='radio']:first").trigger('click');}else {bankEle.find("#" + EMI.lowestEmiBank).trigger('click');}},onCleanup: function(){$('#emiLightBox').hide();}});trackEventWithGA('Product', 'Emi Know More Clicked', $('title').text().split('|')[0].trim());});$('#loopedSlider').loopedSlider();runEffect();$(".controls").tabs();$('#forgot_username_link').tipsy({gravity: 'w'});$("#zipcode").val($("#defaultpincode").val());if(typeof Entity != 'undefined'){var select = $("#colorSelector");if(Entity.orderedItems){$.each(Entity.orderedItems, function(index, sort) {select.find('option[value="' + sort + '"]').appendTo(select);});$("#item_id").val(Entity.orderedItems[0]);onColorSelectorChange(Entity.orderedItems[0]);if(typeof deliveryEstimate != 'undefined') {$("#shipping_time").show();$("#shipping_time_1").hide();//$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");populateEstimate(deliveryEstimate);}else{updateEstimate(Entity.orderedItems[0]);}}select.find("option:eq(0)").remove();}var prodid = $("#product_id").val();add_to_storage_set("histitems", prodid);load_accessories_widget();load_most_compared_widget();// Fix to always show first image's title on page loadif ("undefined" != typeof(title_1)){$('.slides .modelName').html(title_1[0]);}function getSeletectedItemId(){return $("#item_id").val();}/*** Code to track user clicks on Product slides and 'Proceed to Payment' option*/$('a.vt').click(function(){trackEventWithGA('Product', $(this).children('span').text(), $('title').text().split('|')[0].trim());});$('#computeShippingEstimate').click(function(){updateEstimate(getSeletectedItemId());});$("#addToCart").click(function(){if($(this).attr("href")!=undefined){trackEventWithGA('Affiliate', $(this).attr("affname"), document.title);return true;}jQuery.ajax({type: "POST",url: "/addtocart",data: "productid=" + getSeletectedItemId(),success: function(msg) {if(msg == "") {trackEventWithGA('Order', 'Add to Cart', getSeletectedItemId() + '');window.location = "/cart";} else {var productDetail = $("#productDetail");var prodInfo = $(productDetail).find("span.brand").html() + $(productDetail).find("span.product-name").html();displayRelatedProducts(msg);trackEventWithGA('Order', 'OOS Lightbox', prodInfo);}}});});$("#colorSelector").change(function(){var itemid = $("#colorSelector option:selected").val();onColorSelectorChange(itemid);updateEstimate(itemid);return false;});$(".util_compare").click(function() {$.colorbox({inline:true,href:"#compareLightBox",width:"350px",height:"230px",onComplete: function(){$('#compareLightBox').show();},onCleanup: function(){$('#compareLightBox').hide();}});});$('.util_addnewresearch').click(function(){addResearch('', 'single');});$('#mobilename').keypress(function(e) {if(e.keyCode == 13) {return compareProducts($("#compare_continue").attr("producttype"));}});$("#compare_continue").click(function() {return compareProducts($(this).attr("producttype"));});$('.tooltip').click(function() {trackEventWithGA('Product', 'Helpdoc Click', $(this).attr('name'));});$('.tooltip').each(function(index) {$(this).qtip({style: { width: 300, overflow: 'auto',tip: { corner: 'topLeft' },border: { width: 2, radius: 2, color: '#DDDDDD' } },show: { when: { event: 'click' } },content: { url: "/helpdocs/" + $(this).attr('name'), title: { text: ' ', button: 'Close'} },hide: { when: { event: 'unfocus' } },position: { adjust: {screen: true} }});});function compareProducts(productType){var hyphenatedProductType = productType.replace(/ +/g, '-').toLowerCase();var productName = $("#mobilename").val();var hypenatedNameTwo = productName.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();var productTwo = productIdNames[productType][productName];if(typeof productTwo == 'undefined'){alert("Please select a valid product");return false;}var productOne = $("#catalog_id").val();var prodDetail = $("#productDetail");var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();var hyphenateNameOne = productNameOne.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();window.location = "/compare-" + hyphenatedProductType + "/"+ hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo+"&fromsrc=product_page";}$("#accessories table td div a").live('click', function() {var productId = $(this).attr('title');trackEventWithGA('Widget', 'Accessory Click', productId);});$('.nextSlide-anchorLink').live('click', function() {var nextSlideLink = $(this).attr('nextSlideId');$('a[href="' + nextSlideLink +'"]').click();return false;});$('a.compare-now').live('click', function(){var productType = $(this).attr('producttype');productType = productType.replace(/ +/g, '-').toLowerCase();var productOne = $("#catalog_id").val();var prodDetail = $("#productDetail");var productNameOne = $(prodDetail).find("span.brand").html() + " " + $(prodDetail).find("span.product-name").html();var hyphenateNameOne = productNameOne.replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();var productTwo = $(this).attr("value");var hypenatedNameTwo = $(this).attr("title").replace(/ +/g, '-').replace(/\/+/g,'-').replace(/-+/g,'-').toLowerCase();window.location = "/compare-" + productType + "/" + hyphenateNameOne + "-vs-" + hypenatedNameTwo + "?p1="+productOne+"&p2="+productTwo+"&fromsrc=most_compared_widget";});});function changeSignInClass(){if(document.getElementById("signinClass").className.indexOf("signin1") > -1) {document.getElementById("signinClass").className = 'signin';} else {document.getElementById("signinClass").className = 'signin1';}}function populateEstimate(msg) {var response = eval('(' + msg + ')');var deliveryEstimate = response['delivery_estimate'];var codDeliveryEstimate = response['cod_delivery_estimate'];var isCODAvailableForLocation = (response['is_cod_available_for_location'] === 'true');var isOTG = (response['on_time_guarantee'] === 'true');var businessDays = response['business_days'];if(deliveryEstimate == -1) {$("#shipping_time").hide();$("#shipping_time_1").show();$('#cod_know_more').hide();} else {$('#cod_know_more').hide();if($("#shipping_time").html().indexOf('after arrival')>-1){$("#shipping_time .red").html(businessDays + " Days");}else{if(isCODAvailableForLocation && (codDeliveryEstimate != deliveryEstimate)){$("#shipping_time .cod").html("Cash On Delivery orders is " + codDeliveryEstimate);$('#cod_know_more').show();}$("#shipping_time .red").html(deliveryEstimate);}}if (isCODAvailableForLocation) {$('#cod').show();} else {$('#cod').hide();}if (isOTG) {$('#otg').show();} else {$('#otg').hide();}}function updateEstimate(itemId) {itemId = itemId || $("#colorSelector option:selected").val();jQuery.ajax({type: "GET",url: "/estimate/" + $("#zipcode").val() + "_" + itemId,beforeSend: function() {$("#shipping_time").show();$("#shipping_time_1").hide();$("#shipping_time .red").html("<img src='/images/loader_l.gif'>");},success: function(msg) {populateEstimate(msg);}});}function load_most_compared_widget(){if(Entity.isComparable) {jQuery.ajax({type : "GET",url : "/most-compared-products/" + $("#product_id").val(),cache: false,success : function(html) {$("#mostcompared").html(html);// Product Title$("#mostcompared table td div a").each(function() {if($(this).attr('class') != "compare-now"){$(this).truncate({addtitle : true});}});// Product Price$("#mostcompared table td div div.price").each(function() {$(this).truncate({addtitle : true});});// Product Details$("#mostcompared table td div div.text").each(function() {$(this).truncate( {addtitle : true});});}});}}function onColorSelectorChange(itemid){$('div.shipping1').remove();$('span.mk_emi').show();$('div.shipping').show();$('#addToCart').removeAttr("href");$('#addToCart').removeAttr("affname");$("#item_id").val(itemid);if(typeof privateDeals[itemid]== "undefined") {sellingPrice = Number(PARAMETERS[itemid].SP);if($('#sp').length>0){$('#sp').html(PARAMETERS[itemid].SP);$('#mrp').html(PARAMETERS[itemid].MRP);$('#saving').html(PARAMETERS[itemid].SAVING);var exclusiveAffiliateItem;if(typeof ExclusiveAffItems != "undefined"){for(i in ExclusiveAffItems){if (ExclusiveAffItems[i].itemId==itemid){exclusiveAffiliateItem = ExclusiveAffItems[i];break;}}sellerImg = {1 : 'flipkart_logo.png',2 : 'amazon_logo.jpg',3 : 'snapdeal_logo.png'};if(typeof exclusiveAffiliateItem != "undefined"){var innerhtml = '<div class="shipping1 left"><div style="background-color: #FAFAFA;padding:4px;font-size: 14px;">Available on '+ exclusiveAffiliateItem.affiliateName+'</div><div style="padding: 10px;background-color:#FFF;padding-left: 136px;background-image: url(\'/unversioned/images/' + sellerImg[exclusiveAffiliateItem.affiliateId] + '\');background-repeat: no-repeat;background-size: 120px;color: #777777;font-size: 14px;background-position:left">'+ (typeof exclusiveAffiliateItem.offerText=="undefined"?'':exclusiveAffiliateItem.offerText) + '</div></div>';$("#addToCart").attr("href", exclusiveAffiliateItem.affiliateUrl).attr("affname", exclusiveAffiliateItem.affiliateName);$('div.shipping').hide();$('span.mk_emi').hide();$(innerhtml).insertAfter('div.shipping');}}}$('div.mk_deal').hide();$('div.mk_nodeal').show();} else {var itemp = privateDeals[itemid];sellingPrice = itemp.dealPojo.dealPrice;var installment = sellingPrice*EMI.interestRate*Math.pow(1+EMI.interestRate,EMI.tenure)/(Math.pow(1+EMI.interestRate,EMI.tenure) - 1);if(typeof itemp.mrp == "undefined" || itemp.mrp =="") itemp.mrp = itemp.sellingPricevar percentoff = Math.round((1-itemp.dealPojo.dealPrice/itemp.mrp)*100);var dealLeft = '';var dealRight = '';if(itemp.dealPojo.dealTextOption==0){dealRight = itemp.bestDealText;}else if(itemp.dealPojo.dealTextOption==1){dealLeft=itemp.bestDealText;}else {dealRight=itemp.bestDealText;dealLeft = itemp.dealPojo.dealText}var html = [];html.push('<div>');html.push('<div class="left rupeeimage"></div><span class="bold" style="text-decoration:line-through;font-size:14px;">'+ itemp.mrp +'</span>');if(itemp.mrp!=itemp.sellingPrice) {html.push('<span style="text-decoration:line-through;font-size:14px;padding-left:4px">'+ itemp.sellingPrice +'</span>');}if(typeof dealRight != "undefined" && dealRight != ''){html.push('<span style="padding-bottom:3px;padding-left:6px;text-decoration:line-through;">' + dealRight +'</span>');}html.push('</div>');html.push('<div style="font-size:14px;padding-top:3px"><b>Only for You: </b><span class="red">Rs.' + sellingPrice + '</span> (' + percentoff + '% Off)</div>');html.push('<div>');if(typeof dealLeft != "undefined" && dealLeft != ''){html.push('<span style="padding-right:10px">');html.push('<span class="red" style="font-weight:bold;padding-bottom:3px">' + dealLeft +' </span>');if($(".mk_best_deal_detail").size()>0){html.push('<a class="mk_best_deal_detail" href="javascript:void(0)" style="padding-left:2px"><img src="/images/quesmark.png" style="vertical-align: middle;"></a>');}html.push('</span>');}html.push('<span class="mk_emi" style="font-size:14px;">EMIs from <span class="red">Rs.' + Math.round(installment) +'</span> per month<a style="padding-left:2px" href="javascript:void(0)" id="emi_more1"><img style="vertical-align: middle;" src="/images/quesmark.png"></a></span>')html.push('</div>');html.push('</div>');$('div.mk_nodeal').hide();$('div.mk_deal').css("background-color","#f2ed69").html(html.join('')).show();}}banks = {};var first = true;for (obj in PARAMETERS) {sellingPrice = Number(PARAMETERS[obj].SP);break;}function onBankClicked(){var bankId = jQuery(this).val();var bank = banks[bankId];var emiTableEle = jQuery("#emi_options");var tdHtml=[];var tenureHtml=[];var percentHtml=[];tdHtml.push("<td><b>Installment<br>(Including Interest)</b></td>");percentHtml.push("<td><b>Interest Rate<br>(Annualized)</b></td>");jQuery.each(bank.emis, function(key,val){var r = val.interestRate/12/100;var installment = sellingPrice*r*Math.pow(1+r,val.tenure)/(Math.pow(1+r,val.tenure) - 1);val.monthlyEmi = (Math.round(installment*100)/100).toFixed(2);tdHtml.push('<td><span style="font-size:11px" class="rupee-icon"><b>' + val.monthlyEmi+ '</b></span></td>');tenureHtml.push('<td><span style="font-size:11px"><b>' + val.tenureDescription + '</b></span></td>');percentHtml.push('<td><span style="font-size:11px"><b>' + val.interestRate + '%</b></span></td>');});emiTableEle.find("td.mk_bankname").html(bank.name);emiTableEle.find("td.mk_emioptions").attr("colspan", count(bank.emis));emiTableEle.find("tr.emirow").html(tdHtml.join(""));emiTableEle.find("tr.mk_tenure").html(tenureHtml.join(""));emiTableEle.find("tr.mk_percent").html(percentHtml.join(""));}function count(obj) {var count=0;for(var prop in obj) {if (obj.hasOwnProperty(prop)) {++count;}}return count;}privateDeals={};if(typeof prodJson!="undefined"){for(i in prodJson.response.itemPojos){var deal = prodJson.response.itemPojos[i].dealPojo;if (typeof deal != "undefined"){privateDeals[prodJson.response.itemPojos[i].id] = prodJson.response.itemPojos[i];}}}function highlightDeal(){}