Subversion Repositories SmartDukaan

Rev

Rev 13026 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1463 varun.gupt 1
var totalAmount = 0.00;
2
 
794 rajveer 3
$(document).ready(function(){
3830 chandransh 4
	checkIfUserHasAddress();
6561 amit.gupta 5
	if(window.location.pathname === "/cart") {
6
		changeEstimate();
7
	}
6903 anupam.sin 8
 
11865 amit.gupta 9
	if(typeof couponApplied!="undefined" && couponApplied){
10
		if ( typeof _gaq != "undefined" && _gaq != null) {
11870 amit.gupta 11
        	_gaq.push(["_trackEvent", "COUPON", "Coupon Applied", couponCode, cartItemIds]);
11865 amit.gupta 12
      	}
13
    }
6903 anupam.sin 14
	$('.wantInsurance').change( function() {
6971 anupam.sin 15
		productId = $(this).attr('productid');
6912 anupam.sin 16
		if(this.checked) {
17
			trackEventWithGA('Insurance', 'Want Insurance', productId);
18
		}
6903 anupam.sin 19
		totalPrice = $('#totalAmountColumn').text();
20
		var initialPrice = parseFloat(totalPrice.replace(/,/g, ''));
21
		var initalNetPrice = 0.0;
22
		if($('#discountedAmount').length != 0) {
23
			initalNetPrice = parseFloat($('#discountedAmount').text().replace(/,/g, ''));
24
		}
25
		var insuranceAmount = parseFloat($('#agreeInsuranceTnc_' + productId).attr('insuranceAmount'));
26
		$(this).attr('disabled', 'disabled');
27
		//The animation will be running for 1 second
28
		var interval = parseInt(1000/(insuranceAmount/4));
29
		//If insurance amount is large we need to set a minimum possible interval. 5 ms looks safe. 
30
		if(interval < 5) {
31
			interval = 5;
32
		}
33
		if(this.checked) {
34
			$('#agreeInsuranceTncDiv_' + productId).show();
35
			//Update grand total but,
36
			//Disable the checkbox so that user can't change while animation is running 
37
 
38
			displayCounter(initialPrice, initialPrice + insuranceAmount, $('#totalAmountColumn'), "increase", interval);
39
			if($('#discountedAmount').length != 0) {
40
				displayCounter(initalNetPrice, initalNetPrice + insuranceAmount, $('#discountedAmount'), "increase", interval);
41
			}
42
		}
43
		else {
44
			var previousStatus = $('#agreeInsuranceTnc_' + productId)[0].checked;
45
			$('#agreeInsuranceTnc_' + productId)[0].checked =  false;
46
			if(previousStatus === true) {
47
				$('#agreeInsuranceTnc_' + productId).trigger('change');
48
			}
49
			$('#agreeInsuranceTncDiv_' + productId).hide();
50
 
51
			//Disable the checkbox so that user can't change while animation is running 
52
			displayCounter(initialPrice, initialPrice - insuranceAmount, $('#totalAmountColumn'), "decrease", interval);
53
			if($('#discountedAmount').length != 0) {
54
				displayCounter(initalNetPrice, initalNetPrice - insuranceAmount, $('#discountedAmount'), "decrease", interval);
55
			}
56
		}
57
		$(".payable").animate({ "background-color": "orange"}, 400 );
58
		$(".payable").animate({ "background-color": "#FFC"}, 400 );
59
	});
60
 
61
	function displayCounter(start, end, jQueryDom, direction, interval) {
62
		if(direction === "increase") {
63
			if(start + 4 < end) {
64
				start = start + 4;
65
				jQueryDom.html('<img src="/images/rupee-symbol.png" alt="Rs."> ' + formatAmount(start.toFixed(2)));
66
				window.setTimeout(function() {displayCounter(start, end, jQueryDom, direction, interval);}, interval);
67
			} else {
68
				jQueryDom.html('<img src="/images/rupee-symbol.png" alt="Rs."> ' + formatAmount(end.toFixed(2)));
69
				$('.wantInsurance').removeAttr('disabled');
70
			}
71
		} else if (direction === "decrease") {
72
			if(start + 4 > end) {
73
				start = start - 4;
74
				jQueryDom.html('<img src="/images/rupee-symbol.png" alt="Rs."> ' + formatAmount(start.toFixed(2)));
75
				window.setTimeout(function() {displayCounter(start, end, jQueryDom, direction, interval);}, interval);
76
			} else {
77
				jQueryDom.html('<img src="/images/rupee-symbol.png" alt="Rs."> ' + formatAmount(end.toFixed(2)));
78
				$('.wantInsurance').removeAttr('disabled');
79
			}
80
		}
81
	}
82
 
83
	function formatAmount(amount) {
84
		var numbers = amount.toString().split('.');
85
		var beforeDecimal = parseInt(numbers[0]);
86
		var afterDecimal = numbers[1];
87
		var finalString = '';
88
		while( beforeDecimal > 0) {
89
			if($.inArray(finalString.length, [3,6,9,12]) > -1) {
90
				finalString = ',' + finalString;
91
			}
92
			var r = beforeDecimal % 10;
93
			beforeDecimal /= 10;
94
			beforeDecimal = parseInt(beforeDecimal);
95
			finalString = r.toString() + finalString;
96
		}
97
		finalString = finalString + '.' + afterDecimal;
98
		return finalString;
99
	} 
100
 
101
	$('.agreeInsuranceTnc').change(function() {
6971 anupam.sin 102
 
6903 anupam.sin 103
		$('.agreeInsuranceTnc').attr('disabled', 'disabled');
104
		$('.wantInsurance').attr('disabled', 'disabled');
6929 anupam.sin 105
		productId = $(this).attr('productid');
6912 anupam.sin 106
		if(this.checked){
107
			trackEventWithGA('Insurance', 'Agreed to Terms', productId);
108
		}
6903 anupam.sin 109
		jQuery.ajax({
110
			type: "POST",
111
			url: "/cart!insureItem",
9301 kshitij.so 112
			data: "toInsure=" + this.checked + "&productId=" + productId + "&quantity=" + $(this).attr('quantity')+"&insurerType=1",
6903 anupam.sin 113
			success: function(response){
114
				if(response === "SUCCESS") {
115
					if ($('#agreeInsuranceTnc_' + productId)[0].checked == true) {
116
						$("#insuranceMessage").html("Your product is now insured!");
117
					} else {
118
						$("#insuranceMessage").attr('style', 'color:red;border:1px solid red;box-shadow: red 0 0 30px 1px;');
119
						$("#insuranceMessage").html("Insurance removed!");
120
					}
121
					$("#insuranceMessage").fadeIn(600, function() {
122
						window.setTimeout(function() {
123
							$("#insuranceMessage").fadeOut(800, function() {
124
								$('.agreeInsuranceTnc').removeAttr('disabled');
125
								$('.wantInsurance').removeAttr('disabled');
126
								$("#insuranceMessage").removeAttr('style');
127
							});
128
						}, 1500);
129
					});
130
				} else {
131
					//If we were not able to update user's insurance preference then let's reload.
132
					location.reload();
133
 
134
					//OR ????
135
					//window.location.href = "/exception";
136
 
137
				}
138
			},
139
			error : function(){
140
				//There was an error with AJAX call and we can't be sure what happened; 
141
				//Let us reload this page and see what was persisted in cart.
142
				location.reload();
143
			}
144
		});
145
	});
146
 
9301 kshitij.so 147
$('.dataProtection').change(function() {
148
	$('.dataProtection').attr('disabled', 'disabled');
149
		productId = $(this).attr('productid');
150
		jQuery.ajax({
151
			type: "POST",
152
			url: "/cart!insureItem",
153
			data: "toInsure=" + this.checked + "&productId=" + productId + "&quantity=" + $(this).attr('quantity') +"&insurerType=2",
154
			success: function(response){
155
				if(response === "SUCCESS") {
156
					if ($('#dataProtection_' + productId)[0].checked == true) {
157
						$("#insuranceMessage").html("Free data protection enabled!");
158
					} else {
159
						$("#insuranceMessage").attr('style', 'color:red;border:1px solid red;box-shadow: red 0 0 30px 1px;');
160
						$("#insuranceMessage").html("Free data protection disabled!");
161
					}
162
					$("#insuranceMessage").fadeIn(600, function() {
163
						window.setTimeout(function() {
164
							$("#insuranceMessage").fadeOut(800, function() {
165
								$('.dataProtection').removeAttr('disabled');
166
								$("#insuranceMessage").removeAttr('style');
167
							});
168
						}, 1500);
169
					});
170
				} else {
171
					//If we were not able to update user's insurance preference then let's reload.
172
					location.reload();
173
 
174
					//OR ????
175
					//window.location.href = "/exception";
176
 
177
				}
178
			},
179
			error : function(){
180
				//There was an error with AJAX call and we can't be sure what happened; 
181
				//Let us reload this page and see what was persisted in cart.
182
				location.reload();
183
			}
184
		});
185
	});
186
 
4453 varun.gupt 187
	$('#checkout').click(function(){
6903 anupam.sin 188
		if($('input.agreeInsuranceTnc:checkbox:not(:hidden):not(:checked)').length != 0) {
6971 anupam.sin 189
			trackEventWithGA('Insurance', 'Alert for T&C', '');
6903 anupam.sin 190
			alert('Please agree to the terms and conditions to get insurance');
191
			return false;
192
		}
3830 chandransh 193
		window.location.href = "/shipping";
194
	});
195
 
6903 anupam.sin 196
	$('#cancelInsurance').click(function() {
197
		jQuery.ajax({
198
			type: "POST",
199
			url: "/shipping!cancelInsurance",
200
			success: function(msg){
201
				//If shipping-failure.vm page was sent then send the user to cart page.
202
				if (msg.replace(/^\s+|\s+$/g,'') === "0") {
203
					window.location.href = "/cart";
204
				} else {
205
					window.location.reload();
206
				}
207
			},
208
			error: function(msg){
209
				//We don't know what happened, send the user to cart page.
210
				window.location.href = "/cart";
211
			}
212
		});
213
	});
214
 
215
	$('#companyInsurance').click(function() {
216
		$('#insuranceDetailDiv').slideUp(400);
217
		$.ajax({
218
			type: "POST",
219
			url: "/shipping!storeInsuranceDetails?addressId=" + $('#addressid').val(),
220
			data: "&guardianName=Organisation&dob=Organisation",
221
			success: function(msg){
222
				;//Don't do anything.
223
			},
224
			error: function(response) {
225
				//Don't do anything.
226
			}
227
		});
228
	});
229
 
230
	$('#dob').focusin(function() {
231
		if($(this).val() === 'Example: 18/08/1986') {
232
			$(this).val('');
233
			$(this).removeAttr('style');
234
		}
235
	});
236
 
237
 
238
	function validateDob() {
239
		var dateStr = $('#dob').val();
240
		dateStrArray = dateStr.split('/');
241
		//array[0] is day, array[1] is month, array[2] is year 
242
		//Now we will interchange the first and second placed numbers so that the date is in mm/dd/yyyy format 
243
		//which will be accepted by the Date.parse() method
244
		temp = dateStrArray[0];
245
		dateStrArray[0] = dateStrArray[1];
246
		dateStrArray[1] = temp;
6930 anupam.sin 247
		var enteredDob = new Date(Date.parse(dateStrArray.join('/')));
248
		if(isNaN(enteredDob.getFullYear())) {
6971 anupam.sin 249
			showInsuranceError('Please enter date of birth in given format');
6903 anupam.sin 250
			$('#dob').attr('style', 'color:#999;');
251
			$('#dob').val('Example: 18/08/1986');
252
			return false;
253
		}
6930 anupam.sin 254
 
255
		var today = new Date();
256
		if(today.getFullYear() - enteredDob.getFullYear() < 14) {
6971 anupam.sin 257
			showInsuranceError('You need to be at least 14 years old to get Insurance');
6930 anupam.sin 258
			$('#dob').attr('style', 'color:#999;');
259
			$('#dob').val('Example: 18/08/1986');
260
			return false;
261
		}
262
		if(today.getFullYear() - enteredDob.getFullYear() > 100) {
6971 anupam.sin 263
			showInsuranceError('Sorry but this feature is only for people below 100 years of age');
6930 anupam.sin 264
			$('#dob').attr('style', 'color:#999;');
265
			$('#dob').val('Example: 18/08/1986');
266
			return false;
267
		}
268
		$('#dob').val(enteredDob.toDateString().substring(4));
6903 anupam.sin 269
		return true;
270
	}
271
 
6971 anupam.sin 272
	function showInsuranceError(msg) {
273
		$('#insDetErr').html(msg);
274
		$('#insDetErr').slideDown(300,function(){$('#shippingDetails').one('click', clickHandler);});
275
	}
276
 
277
	function clickHandler() {
278
		$('#insDetErr').slideUp(300);
279
		$('#insDetErr').html('');
280
	}
281
 
6903 anupam.sin 282
	function focusOutHandler() {
6971 anupam.sin 283
		if($('#dob').val() === '') {
284
			$('#dob').attr('style', 'color:#999;');
285
			$('#dob').val('Example: 18/08/1986');
6903 anupam.sin 286
		} else {
287
			if(validateDob()) {
6971 anupam.sin 288
				$("#dob").animate({ "background-color": "#2789C1"}, 200 );
6903 anupam.sin 289
				$("#dob").animate({ "background-color": "white"}, 200 );
290
				$('#dob').val((new Date(Date.parse(dateStrArray.join('/')))).toDateString().substring(4));
291
			}
292
		}
293
	};
294
 
295
	$('#dob').focusout(focusOutHandler);
296
 
297
	$('#submitInsuranceDetails').hover(
298
		function() {
299
			$('#dob').unbind('focusout');
300
		}, 
301
		function() {
6930 anupam.sin 302
			$('#dob').bind('focusout', focusOutHandler);
6903 anupam.sin 303
		}
304
	);
305
 
306
 
307
	$('#submitInsuranceDetails').click(function() {
308
		if($('#guardianName').val() === '') {
6971 anupam.sin 309
			showInsuranceError('Please enter the name of your Father/Husband');
6903 anupam.sin 310
			return false;
311
		}
312
		if($('#dob').val() === '' || $('#dob').val() === 'Example: 18/08/1986') {
6971 anupam.sin 313
			showInsuranceError('Please enter your date of birth');
6903 anupam.sin 314
			return false;
315
		}
316
 
317
		if(!validateDob()) {
318
			return false;
319
		}
320
 
321
		$('#thanks').fadeIn(1000);
322
		$('#insuranceDetailDiv h3').fadeOut(100);
323
		$('#insuranceDetailsForm').slideUp(100);
324
		jQuery.ajax({
325
			type: "POST",
326
			url: "/shipping!storeInsuranceDetails?addressId=" + $('#addressid').val(),
327
			data: $('#insuranceDetailsForm').serialize(),
328
			success: function(msg){
329
				window.setTimeout(function() {$('#insuranceDetailDiv').slideUp(100);}, 2000);
330
			},
331
			error: function(response) {
332
				//We dont want to bother user too much with these details.We can ignore this in case of rare failures.
333
				window.setTimeout(function() {$('#insuranceDetailDiv').slideUp(100);}, 2000);
334
			}
335
		});
336
	});
337
 
20208 aman.kumar 338
/*	$('#poplogin').click(function(){
4222 varun.gupt 339
		$.colorbox({
340
    		width: "860px",
4458 varun.gupt 341
    		height: "340px",
4222 varun.gupt 342
    		iframe: false,
343
    		href: "/login-mini",
344
 
345
    		onComplete: function(){
4372 varun.gupt 346
    			trackEventWithGA('Cart', 'Login/Register Popup', '');
4222 varun.gupt 347
    		}
348
    	});
20208 aman.kumar 349
	});*/
4222 varun.gupt 350
 
3830 chandransh 351
	$('#proceedToPay').click(function(){
6921 anupam.sin 352
		if($('#insuranceDetailsForm:visible').length == 1) {
6971 anupam.sin 353
			showInsuranceError("Please submit the insurance details first");
6912 anupam.sin 354
			return false;
355
		}
356
 
5748 anupam.sin 357
		if(($('#store-addresses').find('.default-address').attr('zone') !=  $('#zone-selector').val()) && ($("#tabSelector").val() == "HotSpot")) {
5747 anupam.sin 358
			alert("Please select one store address");
359
			return false;
360
		}
4222 varun.gupt 361
		var canProceedToPay = parseInt($('#canProceedToPay').val());
3830 chandransh 362
 
363
		if (canProceedToPay == 1)	{
364
 
365
			trackProceedToPay();
366
			$('#formProceedToPay').submit();
367
		} else	{
5040 varun.gupt 368
			var reasonActionDisability = $('#reasonActionDisability').val();
3830 chandransh 369
 
5040 varun.gupt 370
			if(reasonActionDisability.indexOf('Location not serviceable') >= 0)	{
371
				trackEventWithGA('Cart', 'Location not serviceable', $('#selectedPincode').val());
372
			}
5831 anupam.sin 373
			else if (($("#tabSelector").val() == "HotSpot")) {
374
				reasonActionDisability = 'Please enter an address which will be printed on the bill';
375
			} else {
376
				reasonActionDisability = 'Please specify a delivery address';
377
			}
5040 varun.gupt 378
			alert(reasonActionDisability);
3830 chandransh 379
		}
380
	});
4791 varun.gupt 381
 
382
	$('#viewOrders').click(function(){
383
		window.location.href = "/myaccount";
384
	});
1190 varun.gupt 385
 
3830 chandransh 386
	$('#cart .remove-quantitybttn').click(function(){
387
		var itemId = $(this).attr('id').split('_')[1];
388
		window.location.href = "/cart/"  + itemId + "?_method=delete" + "&productid=" + itemId;
1463 varun.gupt 389
	});
1981 varun.gupt 390
 
3830 chandransh 391
	$('#computeEstimate').click(function(){
392
		changeEstimate();
3941 varun.gupt 393
		$('#cartDetail').find('thead .dev-pincode').html($('#zipcode').val());
3830 chandransh 394
	});
395
 
1981 varun.gupt 396
	$('#applyCoupon').click(function(){
397
		$('#couponAction').val('applycoupon');
398
		$('#frmCouponCode').submit();
399
	});
400
 
401
	$('#removeCoupon').click(function(){
402
		$('#couponAction').val('removecoupon');
403
		$('#frmCouponCode').submit();
404
	});
3830 chandransh 405
 
406
	$('.cart-item-quantity').change(function(){
407
		var itemId = $(this).attr("id").split('_')[1];
408
		var quantity = parseInt($(this).val());
13026 amit.gupta 409
		//Quantity is now changed to 20
410
		if (quantity > 20)	{
411
			alert("You can not order more than 20 pieces of same product.");
3830 chandransh 412
			$(obj).focus();
413
		}
414
		else	{
9722 amit.gupta 415
			submit("/cart/" + itemId  + "?_method=put&productid=" + itemId + "&quantity=" + quantity, "POST", []);
3830 chandransh 416
		}
417
	});
418
 
419
	$('#submitAddress').click(function(){
6912 anupam.sin 420
		if($('#guardianName').length > 0 && $('#guardianName').val() === '') {
6971 anupam.sin 421
			showInsuranceError('Please enter the name of your Father/Husband');
6912 anupam.sin 422
			return false;
423
		}
424
		if($('#dob').length > 0 && ($('#dob').val() === '' || $('#dob').val() === 'Example: 18/08/1986')) {
6971 anupam.sin 425
			showInsuranceError('Please enter your date of birth');
6912 anupam.sin 426
			return false;
427
		}
428
 
429
		if($('#dob').length > 0) {
430
			if(!validateDob()) {
431
				return false;
432
			}
433
		}
434
 
435
 
3830 chandransh 436
		$('#frmShippingAddress').submit();
437
	});
438
 
4325 mandeep.dh 439
	$('#addAddress').live('click', function(){
3830 chandransh 440
		showAddAddressForm();
441
	});
4325 mandeep.dh 442
 
443
	$('#closeAddAddressForm').live('click', function() {
3830 chandransh 444
		showAddressList();
445
	});
446
 
447
	$('#addresses .button-address-select').click(function(){
448
		var addressId = $(this).attr('id').split('_')[1];
449
		$('#formChangeAddressTo_' + addressId).submit();
450
	});
451
 
5716 anupam.sin 452
	function checkIfUserHasAddress(){
3830 chandransh 453
		var addressEmpty = parseInt($('#addressEmpty').val());
454
 
455
		if (addressEmpty == 1)	{
456
			showAddAddressForm();
457
		}
1460 varun.gupt 458
	}
3830 chandransh 459
 
460
	function showAddAddressForm(){
5716 anupam.sin 461
		//$('#main-right-container').hide();
462
		$('#shipping-address-div').hide();
463
		$('#billing-address-div').hide();
3830 chandransh 464
		$('#frmShippingAddress').show();
465
	}
466
 
467
	function showAddressList()	{
468
		$('#frmShippingAddress').hide();
5716 anupam.sin 469
		//$('#main-right-container').show();
5831 anupam.sin 470
		if($("#tabSelector").val() == "HotSpot") {
471
			$('#billing-address-div').show();
472
		} else {
473
			$('#shipping-address-div').show();
474
		}
3830 chandransh 475
	}
476
});
794 rajveer 477
 
1463 varun.gupt 478
function sumOfColumns(tableID, columnIndex, hasHeader)	{
479
	var tot = 0;
480
	var inc = 1;
481
	var tableElement = $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""));
482
	var tableChildren = tableElement.children("td:nth-child(" + columnIndex + ")");
483
 
484
	tableChildren.each(function() {
485
		var currentVal = document.getElementById('totalPrice' + inc).innerHTML;
486
		inc ++;
487
		var splitVal = currentVal.split("Rs.");
488
		var num = parseFloat(splitVal[1].replace(/[^\d\.-]/g,''));
489
		tot += parseFloat(num);
490
	});
491
	totalAmount = tot;
492
	var formated_value = $().number_format(tot, {
493
		numberOfDecimals:2,
494
		decimalSeparator: '.',
495
		thousandSeparator: ',',
496
		symbol: 'Rs.'
497
	});
498
	return formated_value;
794 rajveer 499
}
500
 
501
function subtractionOfColumns(tableID, columnIndex, hasHeader) {
1463 varun.gupt 502
	var tot = 0;
503
 
504
	$("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : "")).children("td:nth-child(" + columnIndex + ")").each(function(){
505
		var currentVal=$(this).html();
506
		var splitVal=currentVal.split("Rs.");
507
		var num = parseFloat(splitVal[1].replace(/[^\d\.-]/g,''));
508
		tot += parseInt(num);
509
	});
510
 
511
	var formated_value = $().number_format(tot, {
512
		numberOfDecimals: 2,
513
		decimalSeparator: '.',
514
		thousandSeparator: ',',
515
		symbol: 'Rs.'
516
	});
517
	return formated_value;
794 rajveer 518
}
519
 
1463 varun.gupt 520
function changeEstimate(item_id)	{
521
	if(item_id == null )	{
3830 chandransh 522
		$("#cartDetail tbody tr").each(function(index, item){
523
			var itemId = $(item).attr("id");
9714 amit.gupta 524
			if(itemId.length != "0") changeEstimate(itemId);
3830 chandransh 525
		});
526
 
1463 varun.gupt 527
	} else	{
528
		jQuery.ajax({
529
			type: "GET",
530
			url: "/estimate/" + $("#zipcode").val() + "_" + item_id,
531
			beforeSend: function(){
7893 rajveer 532
				$("#img" + "_" + item_id).html("<img src='/images/loader_l.gif'>").show();
6561 amit.gupta 533
				$("#block" + "_" + item_id).hide();
534
				$("#serv_" + item_id).hide();
1463 varun.gupt 535
			},
3830 chandransh 536
			success: function(data){
7893 rajveer 537
				$("#img" + "_" + item_id).html("<img src='/images/loader_l.gif'>").hide();
3830 chandransh 538
				var response = eval('(' + data + ')');
7795 rajveer 539
				var deliveryEstimate = response['delivery_estimate'];
6561 amit.gupta 540
				var otg= response['on_time_guarantee'];
7872 rajveer 541
				var codDeliveryEstimate = response['cod_delivery_estimate'];
7849 rajveer 542
				var isCODAvailableForLocation = (response['is_cod_available_for_location'] === 'true');
3830 chandransh 543
 
544
				if(deliveryEstimate == -1)	{
6561 amit.gupta 545
					$("#serv_" + item_id).show();
546
					return;
7791 rajveer 547
				} else	{
548
					$("#days_" + item_id).html(deliveryEstimate);
7878 rajveer 549
					$("#show_cod_" + item_id).hide();
7877 rajveer 550
					if(isCODAvailableForLocation && (deliveryEstimate != codDeliveryEstimate)){
7872 rajveer 551
						$("#coddays_" + item_id).html(codDeliveryEstimate);
7878 rajveer 552
						$("#show_cod_" + item_id).show();	
7872 rajveer 553
					}	
3830 chandransh 554
				}
6561 amit.gupta 555
				if(otg == "true")	{
556
					$("#otg_" + item_id).show();
557
				} else {
558
					$("#otg_" + item_id).hide();
559
				}
560
				$("#block" + "_" + item_id).show();
1463 varun.gupt 561
			}
562
		});
563
	}
9722 amit.gupta 564
}
565
 
566
function submit(action, method, values) {
567
    var form = $('<form/>', {
568
        action: action,
569
        method: method
570
    });
571
    $.each(values, function() {
572
        form.append($('<input/>', {
573
            type: 'hidden',
574
            name: this.name,
575
            value: this.value
576
        }));    
577
    });
578
    form.appendTo('body').submit();
1463 varun.gupt 579
}