Subversion Repositories SmartDukaan

Rev

Rev 7810 | Rev 7863 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7810 Rev 7853
Line 7... Line 7...
7
	    }
7
	    }
8
		trackEventWithGA('Product', 'VideoTabClicked',  $('title').text().split('|')[0].trim()  + "|" + clicked.attr("slidename"));
8
		trackEventWithGA('Product', 'VideoTabClicked',  $('title').text().split('|')[0].trim()  + "|" + clicked.attr("slidename"));
9
  		jQuery('html, body').animate({ scrollTop: scrollTo.offset().top }, 'medium');
9
  		jQuery('html, body').animate({ scrollTop: scrollTo.offset().top }, 'medium');
10
    	return false;
10
    	return false;
11
	});
11
	});
-
 
12
	
-
 
13
	var bankEle = jQuery("#bank-name");
-
 
14
	var first = true;
-
 
15
	var allBankImgs = {
-
 
16
		1:"/images/hdfc-icon.png",
-
 
17
		2:"/images/axis-icon.png",
-
 
18
	 	3:"/images/icici-icon.png",
-
 
19
	 	4:"/images/indusind-icon.png",
-
 
20
	 	5:"/images/citi-icon.png",
-
 
21
	 	6:"/images/std-chartered-icon.png",
-
 
22
	 	7:"/images/hsbc-icon.png",
-
 
23
	 	8:"/images/kotak-icon.png",
-
 
24
	 	9:"/images/sbi-icon.png",
-
 
25
	};
-
 
26
 
-
 
27
 
-
 
28
	var minEmi = 999999;
-
 
29
	jQuery.each(emiObj, function(index, opt) {
-
 
30
		if(sellingPrice >= opt.minAmount){ 
-
 
31
			if(typeof banks[opt.bankId] == "undefined") {
-
 
32
				banks[opt.bankId] = {};
-
 
33
				banks[opt.bankId].name =  opt.bankName;
-
 
34
				banks[opt.bankId].emis =  {};
-
 
35
				banks[opt.bankId].active =  true;
-
 
36
				banks[opt.bankId].img = allBankImgs[opt.bankId];
-
 
37
			}
-
 
38
			var bank = banks[opt.bankId];
-
 
39
			var bankTenure = {};
-
 
40
			bankTenure.tenureDescription = opt.tenureDescription;
-
 
41
			if (opt.chargeType == "FIXED") {	
-
 
42
				bankTenure.emiProcessingCharge = opt.chargeValue;
-
 
43
			} else {
-
 
44
				bankTenure.emiProcessingCharge = Math.ceil((opt.chargeValue * sellingPrice)/100);  
-
 
45
			}
-
 
46
			bankTenure.totalAmount = sellingPrice + bankTenure.emiProcessingCharge;  
-
 
47
			bankTenure.monthlyEmi =  Number((Math.round((bankTenure.totalAmount*100)/opt.tenure)/100).toFixed(2));
-
 
48
			if(minEmi > bankTenure.monthlyEmi){
-
 
49
				minEmi = bankTenure.monthlyEmi;
-
 
50
			}
-
 
51
			bank.emis[opt.id] = bankTenure;
-
 
52
		}
-
 
53
	});
-
 
54
	jQuery.each(banks, function(index, bank){
-
 
55
		var style = ' style="background: url(\'' + bank.img + '\') no-repeat right"';
-
 
56
		if(first){
-
 
57
			bankEle.append('<li title="' + bank.name + '"' + style +'><input type="radio" id="' + index +'" value="' + index +'" name="bankselected"' + (bank.active ? '""' : 'disabled="disabled"') + ' checked="checked"/></li>');
-
 
58
			first = false;
-
 
59
		}else {
-
 
60
			bankEle.append('<li title="' + bank.name +'"' + style +'><input type="radio" id="' + index +'" value="' + index +'" name="bankselected"' + (bank.active ? '""' : 'disabled="disabled"') + ' /></li>');
-
 
61
		}
-
 
62
	});
-
 
63
	
-
 
64
	bankEle.find("input[type='radio']").click(onBankClicked);
-
 
65
		
-
 
66
	jQuery("#emi_more").click(function(){
-
 
67
		
-
 
68
		$.colorbox({
-
 
69
			inline:true, 
-
 
70
			href:"#emiLightBox",
-
 
71
    		width:"600px",
-
 
72
    		height:"410px",
-
 
73
    		
-
 
74
    		onComplete: function(){
-
 
75
    			$('#emiLightBox').show();
-
 
76
    			bankEle.find("input[type='radio']:first").trigger('click');
-
 
77
    		},
-
 
78
    		onCleanup: function(){
-
 
79
    			$('#emiLightBox').hide();
-
 
80
    		}
-
 
81
    	});
-
 
82
    	trackEventWithGA('Product', 'Emi Know More Clicked',  $('title').text().split('|')[0].trim());
-
 
83
	});
12
 
84
 
13
	$('#loopedSlider').loopedSlider();
85
	$('#loopedSlider').loopedSlider();
14
	
86
	
15
	runEffect();
87
	runEffect();
16
	
88
	
Line 288... Line 360...
288
		$('#mrp').html(PARAMETERS[itemid].MRP);
360
		$('#mrp').html(PARAMETERS[itemid].MRP);
289
		$('#saving').html(PARAMETERS[itemid].SAVING);
361
		$('#saving').html(PARAMETERS[itemid].SAVING);
290
		$("#item_id").val(itemid);
362
		$("#item_id").val(itemid);
291
	}
363
	}
292
	updateEstimate(itemid);
364
	updateEstimate(itemid);
-
 
365
}
-
 
366
 
-
 
367
banks = {};
-
 
368
var first = true;
-
 
369
for (obj in PARAMETERS) {
-
 
370
   sellingPrice = Number(PARAMETERS[obj].SP);
-
 
371
   break;
-
 
372
}
-
 
373
 
-
 
374
function onBankClicked(){
-
 
375
	var bankId = jQuery(this).val();
-
 
376
	var bank = banks[bankId];
-
 
377
	var emiTableEle = jQuery("#emi_options");
-
 
378
	var tdHtml=[];
-
 
379
	var tenureHtml=[];
-
 
380
	tdHtml.push("<td><b>" + bank.name + "</b></td>");
-
 
381
	jQuery.each(bank.emis, function(key,val){
-
 
382
		tdHtml.push('<td><span style="font-size:11px" class="rupee-icon"><b>' + val.monthlyEmi+ '</b></span></td>');
-
 
383
		tenureHtml.push('<td><span style="font-size:11px"><b>' + val.tenureDescription + '</b></span></td>');
-
 
384
	});
-
 
385
	emiTableEle.find("td.mk_emioptions").attr("colspan", count(bank.emis));
-
 
386
	emiTableEle.find("tr.emirow").html(tdHtml.join(""));
-
 
387
	emiTableEle.find("tr.mk_tenure").html(tenureHtml.join(""));	
-
 
388
}
-
 
389
 
-
 
390
function count(obj) {
-
 
391
   var count=0;
-
 
392
   for(var prop in obj) {
-
 
393
      if (obj.hasOwnProperty(prop)) {
-
 
394
         ++count;
-
 
395
      }
-
 
396
   }
-
 
397
   return count;
293
}
398
}
294
399