Rev 2235 | Rev 2652 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function(){$('#loopedSlider').loopedSlider();runEffect();$(".controls").tabs();$('#forgot_username_link').tipsy({gravity: 'w'});$("#zipcode").val($("#defaultpincode").val());updateEstimate();var prodid = $("#product_id").val();add_to_storage_set("histitems", prodid);load_history_widget();/*** 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());});$("#addcart").click(function(){jQuery.ajax({type: "POST",url: "/addtocart",data: "productid=" + $("#item_id").val(),success: function(msg) {if(msg==""){window.location = "/cart";}else{alert(msg);} }});});$("#colorselector").change(function(){var itemid = $("#colorselector option:selected").val();$('#sp').html(PARAMETERS[itemid].SP);$('#mrp').html(PARAMETERS[itemid].MRP);$('#saving').html(PARAMETERS[itemid].SAVING);$("#item_id").val(itemid);updateEstimate(itemid);return false;});$("a.colorselector").click(function() {$('.a.colorselector').addClass('deselect');$(this).addClass('deselect');var itemid = $(this).attr('itemid');$('#sp').html(" "+PARAMETERS[itemid].SP);$('#mrp').html(" "+PARAMETERS[itemid].MRP);$('#saving').html(PARAMETERS[itemid].SAVING);$("#item_id").val(itemid);return false;});$("#util_compare").click(function() {$.fn.colorbox({inline:true, href:".colorSelLightBoxColor", open:true, onComplete:function(){var posLeft = (document.documentElement.clientWidth / 2) - (parseInt($('#colorbox').css('width')) / 2);var posTop = (document.documentElement.clientHeight / 2) - (parseInt($('#colorbox').css('height')) / 2);$('#colorbox').css('top', posTop);$('#colorbox').css('left', posLeft);}});});/* This code is for compare with button */var availableNames = [];for (var k in productIdNames)availableNames.push(k);$("#mobilename").autocomplete({ autoFocus: true, minLength: 3,source: availableNames});$('#mobilename').keypress(function(e) {if(e.keyCode == 13) {return compareProducts();}});$("#compare_continue").click(function() {return compareProducts();});function compareProducts(){var productName = $("#mobilename").val();var productTwo = productIdNames[productName];if(typeof productTwo == 'undefined'){alert("Please select a valid product");return false;}var productOne = $("#catelog_id").val();window.location = "/compare-mobile-phones?p1="+productOne+"&p2="+productTwo;}});function changeSignInClass(){if(document.getElementById("signinClass").className.indexOf("signin1") > -1) {document.getElementById("signinClass").className = 'signin';} else {document.getElementById("signinClass").className = 'signin1';}}function updateEstimate(itemId) {itemId = itemId || $("#item_id").val();jQuery.ajax({type: "GET",url: "/estimate/" + $("#zipcode").val() + "_" + itemId,beforeSend: function() {$("#days").html("<img src='../images/loader_l.gif'>");},success: function(msg) {$("#shipping_time").html(msg);}});}