Subversion Repositories SmartDukaan

Rev

Rev 11574 | Rev 11721 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11289 lgm 1
var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
2
if(document.getElementsByClassName('mobile-recharge')[0] != undefined){
3
    document.getElementsByClassName('mobile-recharge')[0].style.minHeight = pheight - 195 +'px';  
4
}
5
if(document.getElementsByClassName('dth-recharge')[0] != undefined){
6
    document.getElementsByClassName('dth-recharge')[0].style.minHeight = pheight - 195 +'px';  
7
}
8
if(document.getElementsByClassName('conf-cont')[0] != undefined){
9
    document.getElementsByClassName('conf-cont')[0].style.minHeight = pheight - 170 +'px';  
10
}
10582 lgm 11
var operatorId;
12
var circleCode;
11715 lgm 13
var isOperaMini = (navigator.userAgent.indexOf('Opera Mini') > -1);
14
if(isOperaMini){
15
  document.getElementById('operator-list').style.display = "block";
16
}
10582 lgm 17
function operator(){
18
	var number = document.getElementById('mobile-number').value;
19
	if(number.length == 10)
20
	{
11325 lgm 21
 
10582 lgm 22
		var url = base_url+'recharge/operator/'+number;
23
	    //window.location.href = a;
24
	    microAjax(url, function (res) {
11325 lgm 25
 
10582 lgm 26
	    	if(res != ''){
11325 lgm 27
 
10582 lgm 28
	    		var data = JSON.parse(res);
29
	    		var planId;
30
	    		operatorId = data.operatorId;
31
	    		circleCode = data.circleCode;
32
	    		var dropdownlistbox = document.getElementById("mobile-operator");
33
				for(var x=0;x < dropdownlistbox.length -1 ; x++)
34
				{
35
				   if(data.operatorName == dropdownlistbox.options[x].text)
36
				   {
37
				       dropdownlistbox.selectedIndex = x;
11546 lgm 38
				       document.getElementById("mobile-operator").disabled = false;
10582 lgm 39
				       var opids ='';
40
				        for(var i=0;i<plan.length;i++){
41
							if(plan[i].operatorId == operatorId){
42
								var planId = plan[i].operatorId;
43
								opids += '<option value='+plan[i].Name+'>'+plan[i].displayName+'</option>';
44
							}
45
						}
46
						if(planId == operatorId){
47
							document.getElementById('plans').style.display = 'block';
48
						}else{
49
							document.getElementById('plans').style.display = 'none';
50
						}
51
						if(special.indexOf(operatorId) != -1){
52
							document.getElementById('operatorName').innerHTML = data.operatorName;
53
							document.getElementById('special').style.display = 'block';
54
						}
55
						else{
56
							document.getElementById('special').style.display = 'none';
57
						}	      
58
				   	   	break;
59
					}
60
				}
61
			}
62
 
63
	    });
11546 lgm 64
	}else if(number.length < 10){
65
		if(document.getElementById("mobile-operator").disabled != true){
66
			document.getElementById("mobile-operator").disabled = true;
67
		}
11715 lgm 68
		if(isOperaMini){
69
			if(number ==''){    
70
				document.getElementById('error').style.display = "block";
71
				document.getElementById('error').innerHTML ='Please fill Your Mobile Number!';
72
				window.scrollTo(0,0); return false;
73
			}
74
		    if(!/^\d+$/.test(number)){
75
		        document.getElementById('error').style.display = "block";
76
				document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
77
				window.scrollTo(0,0); return false;
78
			}
79
			if(number.length != 10){    
80
				document.getElementById('error').style.display = "block";
81
				document.getElementById('error').innerHTML ='Mobile Number should be of 10 digits';
82
				window.scrollTo(0,0); return false;
83
			}
84
		}
10582 lgm 85
	}
86
}
87
 
88
function changeOperator(e){
11325 lgm 89
 
10582 lgm 90
	var Id = e.currentTarget.value;
91
    var opids ='';
92
    for(var i=0;i<plan.length;i++){
93
		if(plan[i].operatorId == Id){
94
			var planId = plan[i].operatorId;
95
			opids += '<option value='+plan[i].Name+'>'+plan[i].displayName+'</option>';
96
		}
97
	}
98
	if(planId == Id){
99
		document.getElementById('plans').style.display = 'block';
100
	}else{
101
		document.getElementById('plans').style.display = 'none';
102
	}
103
	document.getElementById('operator-palns').innerHTML = opids;
104
	if(special.indexOf(parseInt(Id)) != -1){
105
		var dropdownlistbox = document.getElementById("mobile-operator");
106
		var index = e.currentTarget.selectedIndex;
107
		document.getElementById('operatorName').innerHTML = dropdownlistbox.options[index].text;;
108
		document.getElementById('special').style.display = 'block';
109
	}
110
	else{
111
	document.getElementById('special').style.display = 'none';
112
	}	    
113
}
114
 
115
function topup(e){
11325 lgm 116
 
10582 lgm 117
	var Id = e.currentTarget.id;
118
	var url = base_url+'recharge/topupSpecial/'+Id+'/'+operatorId+'/'+circleCode;
119
	microAjax(url, function (res) {
11325 lgm 120
 
10582 lgm 121
	    	if(res != '')
122
	    	{
123
	    		document.getElementsByClassName('rech-cont')[0].style.display = 'none';
124
	    		document.getElementsByClassName('topup-cont')[0].style.display = 'block';
125
	    		var appenddata = document.getElementById('appendlist');
11574 lgm 126
	    		//appenddata.innerHTML= appenddata.innerHTML +  res;
127
	    		appenddata.innerHTML =  res;
10582 lgm 128
	    	}
129
		});
130
}
131
 
132
function closePlan(){
11325 lgm 133
	//
10582 lgm 134
	document.getElementsByClassName('rech-cont')[0].style.display = 'block';
135
	document.getElementsByClassName('topup-cont')[0].style.display = 'none';
136
}
137
function fillAmount(e){
11325 lgm 138
	//
10582 lgm 139
	var amount = e.currentTarget.innerHTML;
140
	document.getElementById('mobile-amount').value = amount;
141
	document.getElementsByClassName('rech-cont')[0].style.display = 'block';
142
	document.getElementsByClassName('topup-cont')[0].style.display = 'none';
143
}
144
function changeName(e){
11325 lgm 145
 
10582 lgm 146
	var id = e.currentTarget.value;
10806 lgm 147
	if(id != -1){
148
		var name = dthIdMap[id];
149
		document.getElementById('accountName').innerHTML = name;
150
	}else if(id == -1){
151
		document.getElementById('accountName').innerHTML = 'Account Number :';
152
	}
10582 lgm 153
}
154
function mobileValidation(){
11325 lgm 155
 
10582 lgm 156
	var operator = document.getElementById('mobile-operator');
157
	var number = document.getElementById('mobile-number').value;
158
	var amount = document.getElementById('mobile-amount').value;
159
	var email = document.getElementById("emailId").value;
160
	document.getElementById('operator_hidden').value = operator[operator.selectedIndex].text;
161
	email = email.trim();
162
    var atpos = email.indexOf("@");
163
    var dotpos = email.lastIndexOf(".");
164
	if(number ==''){    
165
		document.getElementById('error').style.display = "block";
166
		document.getElementById('error').innerHTML ='Please fill Your Mobile Number!';
167
		window.scrollTo(0,0); return false;
168
	}
10778 lgm 169
    if(!/^\d+$/.test(number)){
10582 lgm 170
        document.getElementById('error').style.display = "block";
171
		document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
172
		window.scrollTo(0,0); return false;
173
	}
174
	if(number.length != 10){    
175
		document.getElementById('error').style.display = "block";
176
		document.getElementById('error').innerHTML ='Mobile Number should be of 10 digits';
177
		window.scrollTo(0,0); return false;
178
	}
179
	if(operator.selectedIndex == 0){
180
		document.getElementById('error').style.display = "block";
181
        document.getElementById('error').innerHTML ='Please select your operator!';
182
        window.scrollTo(0,0); return false;
183
	}
184
	if(amount ==''){    
185
		document.getElementById('error').style.display = "block";
186
		document.getElementById('error').innerHTML ='Please fill recharge amount!';
187
		window.scrollTo(0,0); return false;
188
	}
10748 lgm 189
    if(!/^\d+$/.test(amount)){
10582 lgm 190
        document.getElementById('error').style.display = "block";
191
		document.getElementById('error').innerHTML ='Please Use numbers only!';
192
		window.scrollTo(0,0); return false;
193
	}
194
	if((parseInt(amount) < 10) || (parseInt(amount) > 1000)){
195
        document.getElementById('error').style.display = "block";
196
		document.getElementById('error').innerHTML ='Recharge amount should be between Rs. 10-1000';
197
		window.scrollTo(0,0); return false;
198
	}
199
 
200
  	if(email ==''){     
201
        document.getElementById('error').style.display = "block";
202
        document.getElementById('error').innerHTML ='Please fill email field!';
203
        window.scrollTo(0,0); return false;}
204
  	if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length)){
205
        document.getElementById('error').style.display = "block";
206
        document.getElementById('error').innerHTML ='Please fill email in correct format!';
207
        window.scrollTo(0,0); return false;
208
    }    
209
  	if(email.length> 50){  
210
        document.getElementById('error').style.display = "block";
211
        document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
212
        window.scrollTo(0,0); return false;
213
    }
214
    if(email.indexOf(' ') != -1){  
215
        document.getElementById('error').style.display = "block";
216
        document.getElementById('error').innerHTML ='Please remove space from email field!';
217
        window.scrollTo(0,0); return false;
218
    }
10748 lgm 219
    if(email != email.trim()){  
220
        document.getElementById('error').style.display = "block";
221
        document.getElementById('error').innerHTML ='Please remove space from email field!';
222
        window.scrollTo(0,0); return false;
223
    }
10582 lgm 224
 
225
}
226
function dthValidation(){
11325 lgm 227
 
10582 lgm 228
	var operator = document.getElementById('dth-operator');
229
	var number = document.getElementById('dth-number').value;
230
	var amount = document.getElementById('dth-amount').value;
231
	var email = document.getElementById("dth-email").value;
10806 lgm 232
	var value = document.getElementById('accountName').innerHTML;
233
	value = value.split(':')[0];
10582 lgm 234
	document.getElementById('dth_hidden').value = operator[operator.selectedIndex].text;
235
	email = email.trim();
236
    var atpos = email.indexOf("@");
237
    var dotpos = email.lastIndexOf(".");
238
	if(operator.selectedIndex == 0){
239
		document.getElementById('error').style.display = "block";
240
        document.getElementById('error').innerHTML ='Please select your operator!';
241
        window.scrollTo(0,0); return false;
242
	}
243
	if(number ==''){    
244
		document.getElementById('error').style.display = "block";
10948 lgm 245
		document.getElementById('error').innerHTML ='Please enter the '+value+'!';
10582 lgm 246
		window.scrollTo(0,0); return false;
247
	}
10748 lgm 248
    if(!/^\d+$/.test(number)){
249
        document.getElementById('error').style.display = "block";
10806 lgm 250
		document.getElementById('error').innerHTML ='Please Use numbers only for '+value+' field!';
10748 lgm 251
		window.scrollTo(0,0); return false;
252
	}
10582 lgm 253
	if(amount ==''){    
254
		document.getElementById('error').style.display = "block";
255
		document.getElementById('error').innerHTML ='Please fill recharge amount!';
256
		window.scrollTo(0,0); return false;
257
	}
10748 lgm 258
    if(!/^\d+$/.test(amount)){
10582 lgm 259
        document.getElementById('error').style.display = "block";
260
		document.getElementById('error').innerHTML ='Please Use numbers only!';
261
		window.scrollTo(0,0); return false;
262
	}
263
	if((parseInt(amount) < 200) || (parseInt(amount) > 2000)){
264
        document.getElementById('error').style.display = "block";
265
		document.getElementById('error').innerHTML ='Recharge amount should be between Rs. 200-2000';
266
		window.scrollTo(0,0); return false;
267
	}
268
 
269
  	if(email ==''){     
270
        document.getElementById('error').style.display = "block";
271
        document.getElementById('error').innerHTML ='Please fill email field!';
272
        window.scrollTo(0,0); return false;}
273
  	if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length)){
274
        document.getElementById('error').style.display = "block";
275
        document.getElementById('error').innerHTML ='Please fill email in correct format!';
276
        window.scrollTo(0,0); return false;
277
    }    
278
  	if(email.length> 50){  
279
        document.getElementById('error').style.display = "block";
280
        document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
281
        window.scrollTo(0,0); return false;
282
    }
283
    if(email.indexOf(' ') != -1){  
284
        document.getElementById('error').style.display = "block";
285
        document.getElementById('error').innerHTML ='Please remove space from email field!';
286
        window.scrollTo(0,0); return false;
287
    }
288
 
289
}
290
 
291
function recahrgeAmount(){
11325 lgm 292
 
10582 lgm 293
	var couponCode = document.getElementById('couponCode').value;
294
	var recharge_Amount = document.getElementById('recharge_Amount').innerHTML;
295
	var rechargeOperator = document.getElementById('rechargeOperator').innerHTML;
296
	if(couponCode.length !=0){
297
		var url = base_url+'recharge/rechargeAmount/'+recharge_Amount+'/'+couponCode;
298
		microAjax(url, function (res) {
11325 lgm 299
 
10582 lgm 300
		    	if(res != '')
301
		    	{
302
		    		var data = JSON.parse(res);
303
		    		if(parseInt(data.couponAmount) == 0){
304
		    			document.getElementById('error').style.display = "block";
305
	        			document.getElementById('error').innerHTML ='Invalid Coupon Code!';
306
		    		}
307
		    		else{
308
		    			if(data.payAmount == 0){
309
		    				if(document.getElementById('captcha').style.display == 'none'){
310
		    					changeCaptcha();
311
		    				}
312
		    				//document.getElementById('amount').value = parseInt(data.payAmount);
11330 lgm 313
			    			//document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
11289 lgm 314
			    			document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
10582 lgm 315
			    			if(document.getElementById('walletAmount')){
11330 lgm 316
			    				if(parseInt(data.walletAmount) == 0){
317
			    					document.getElementById('walletAmount').style.display = 'none';
318
			    					document.getElementById('waText').style.display = 'none';
319
			    				}else{
320
			    					document.getElementById('walletAmount').innerHTML = parseInt(data.walletAmount);
321
			    				}
10582 lgm 322
			    			}
323
			    			if(document.getElementById('walletAmountLeft')){
11330 lgm 324
			    				if(parseInt(data.walletAmountLeft) == 0 || data.walletAmountLeft == undefined){
325
			    					document.getElementById('walletAmountLeft').style.display = 'none';
326
			    					document.getElementById('walText').style.display = 'none';
327
			    				}else{
328
			    					document.getElementById('walletAmountLeft').innerHTML = parseInt(data.walletAmountLeft);
329
			    				}
330
			    			}
10582 lgm 331
			    			document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
11289 lgm 332
			    			document.getElementById('payAmount').value = parseInt(data.payAmount);
10582 lgm 333
			    			document.getElementById('coupon').style.display = "none";
334
		        			document.getElementById('coupon_msg').innerHTML ='Coupon Code applied!';
335
		        			document.getElementById('submit').value ='Recharge Now';
336
		    			}else{
337
		    				//document.getElementById('amount').value = parseInt(data.payAmount);
11330 lgm 338
			    			//document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
10582 lgm 339
			    			document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
340
			    			document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
341
			    			document.getElementById('payAmount').value = parseInt(data.payAmount);
342
			    			document.getElementById('coupon').style.display = "none";
343
		        			document.getElementById('coupon_msg').innerHTML ='Coupon Code applied!';
344
		    			}
345
		    		}
346
		    	}
347
			});
348
	}
349
	else{
350
		document.getElementById('error').style.display = "block";
351
	    document.getElementById('error').innerHTML ='Please enter a Coupon Code!';
352
	}
353
}
354
 
355
function clearError(){
356
	if(document.getElementById('error').style.display == "block"){
357
		document.getElementById('error').style.display = "none";
358
	}
359
}
360
window.onload=function(){
361
	var value = localStorage.getItem('rechargeValue');
362
	if(parseInt(value) == 2){
363
		if(document.getElementsByClassName('mobile-recharge')[0]){
364
			document.getElementsByClassName('mobile-recharge')[0].style.display = 'none';
365
	    	document.getElementsByClassName('dth-recharge')[0].style.display = 'block';
366
	    	document.getElementsByClassName('mobile-re')[0].className = 'mobile-re';
367
	    	document.getElementsByClassName('dth-re')[0].className += ' selected';
368
		}
369
	}
370
};
371
function changePayment(e){
11325 lgm 372
 
10582 lgm 373
  var Id = e.currentTarget.id;
374
  var defaultId = defaultPayment.id;
375
  if(defaultId != Id){
11027 lgm 376
  	var title = e.currentTarget.textContent.split('+')[0];
10582 lgm 377
    document.getElementById(defaultId).className = 'card';
378
    defaultPayment.nextElementSibling.style.display = 'none';
379
    defaultPayment.children[0].innerHTML = '+';
380
    document.getElementById(Id).className += ' selected';
381
    document.getElementById(Id).children[0].innerHTML = '-';
382
    e.currentTarget.nextElementSibling.style.display = 'block';
383
    //document.getElementById(Id).style.display = 'block';
384
    defaultPayment = e.currentTarget;
11027 lgm 385
    if(typeof _gaq != "undefined" && _gaq != null)  {
386
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab clicked',title]);
387
    }
10582 lgm 388
  }
389
}
390
var previousDebit;
391
function selectDebitCard(e){
11325 lgm 392
 
10582 lgm 393
  var Id = e.currentTarget.id;
394
  if(previousDebit == undefined){
395
    document.getElementById(Id).className = 'selected';
396
  }
397
  else if(previousDebit != undefined){
398
    document.getElementById(previousDebit).className = '';
399
    document.getElementById(Id).className = 'selected'; 
400
  }
401
  document.getElementById('pay-debit').value = Id;
402
  previousDebit = Id;
11027 lgm 403
  var title = e.currentTarget.getAttribute('data-parent');
404
  title = title+'-'+Id;
405
  if(typeof _gaq != "undefined" && _gaq != null)  {
406
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
407
    }
10582 lgm 408
}
409
var previousCard;
410
function selectCard(e){
11325 lgm 411
 
10582 lgm 412
  var Id = e.currentTarget.id;
413
  if(previousCard == undefined){
414
    document.getElementById(Id).className = 'selected';
415
  }
416
  else if(previousCard != undefined){
417
    document.getElementById(previousCard).className = '';
418
    document.getElementById(Id).className = 'selected'; 
419
  }
420
  document.getElementById('pay-credit').value = Id;
421
  previousCard = Id;
11027 lgm 422
  var title = e.currentTarget.getAttribute('data-parent');
423
  title = title+'-'+Id;
424
  if(typeof _gaq != "undefined" && _gaq != null)  {
425
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
426
    }
10582 lgm 427
}
11092 lgm 428
var netBankingInfo;
11137 lgm 429
var prevClass;
10582 lgm 430
function changeNetBanking(e){
11325 lgm 431
 
10678 lgm 432
  var Id;
11131 lgm 433
  var selected;
11137 lgm 434
  var hasClass;
10678 lgm 435
  Id = e.currentTarget.value;
436
  if(Id == undefined){
11131 lgm 437
    selected = 1;
10678 lgm 438
    Id = e.currentTarget.id;
11137 lgm 439
    var dropDown = document.getElementById('net');
440
    if(dropDown.selectedIndex != 0){
441
      dropDown.selectedIndex = 0;
442
    }
10678 lgm 443
  }
11092 lgm 444
  if(netBankingInfo == undefined){
11137 lgm 445
    if((selected == 1))
11131 lgm 446
    document.getElementById(Id).className = 'selected';
10678 lgm 447
  }
11092 lgm 448
  else if(netBankingInfo != undefined){
11137 lgm 449
    if((selected == 1)) {
11131 lgm 450
      document.getElementById(Id).className = 'selected';
11137 lgm 451
      if(prevClass == 'selected'){
452
        document.getElementById(netBankingInfo).className = '';   
453
      }   
454
    }else{
455
      if(prevClass == 'selected'){
456
          document.getElementById(netBankingInfo).className = '';
457
      }  
11131 lgm 458
    }
10678 lgm 459
  }
10582 lgm 460
  document.getElementById('pay-net').value = Id;
11092 lgm 461
  netBankingInfo = Id;
11137 lgm 462
  prevClass = e.currentTarget.className;
10678 lgm 463
  var title = e.currentTarget.getAttribute('data-parent');
464
  title = title+'-'+Id;
11027 lgm 465
  if(typeof _gaq != "undefined" && _gaq != null)  {
466
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
467
    }
10582 lgm 468
}
469
function submitform(){
470
    debugger
11319 lgm 471
    if(parseInt(document.getElementById('amountPayable').value) == 0 ){
10582 lgm 472
      if(document.getElementById('captcha_response_box').value == ''){
473
        // document.forms['recharge-confirm'].submit();
474
      // }else{
475
        var bRed = document.getElementById('captcha_response_box');
476
        bRed.style.border = 'red solid 1px';
477
        bRed.style.color = 'red';
478
        bRed.value = 'Please enter the captcha' 
479
        setTimeout(function(){
480
          bRed.style.border = '';
481
          bRed.style.color = '';
482
          bRed.value = '';
483
        },3000);
484
        return false;
485
      }
486
    }
487
    var value = localStorage.getItem('rechargeValue');
488
    if(parseInt(value) == 1){
10953 lgm 489
    	if(typeof _gaq != "undefined" && _gaq != null)	{
490
			_gaq.push(['_trackEvent', 'Recharge', 'Confirm','Mobile']);
491
		}	
10582 lgm 492
    }else if(parseInt(value) == 2){
10953 lgm 493
    	if(typeof _gaq != "undefined" && _gaq != null)	{
494
			_gaq.push(['_trackEvent', 'Recharge', 'Confirm','DTH']);
495
		}
10582 lgm 496
    }
497
  }
498
 function addressValidation(e){
11325 lgm 499
 
10582 lgm 500
 	var Id = e.currentTarget.id;
501
 	if(Id == 'creditcard'){
502
 		if(previousCard == undefined){
503
 			document.getElementById('error').style.display = "block";
504
	        document.getElementById('error').innerHTML ='Please select payment method!';
505
	        window.scrollTo(0,0); return false;
506
 		}
507
 	}else if(Id == 'debitcard'){
508
 		if(previousDebit == undefined){
509
 			document.getElementById('error').style.display = "block";
510
	        document.getElementById('error').innerHTML ='Please select payment method!';
511
	        window.scrollTo(0,0); return false;
512
 		}
513
 	}else if(Id == 'netbanking'){
514
 		var payOption = document.getElementById('pay-net').value;
515
 		if(payOption == undefined || payOption ==""){
516
 			document.getElementById('error').style.display = "block";
517
	        document.getElementById('error').innerHTML ='Please select payment method!';
518
	        window.scrollTo(0,0); return false;
519
 		}
520
 	}
521
 	if(document.getElementById('ccAddress')){
522
 	  var error = Id+'error';
523
 	  var fname = document.getElementById(Id).name.value;
524
	  var street1 = document.getElementById(Id).line1.value;
525
	  var street2 = document.getElementById(Id).line2.value;
526
	  var city = document.getElementById(Id).city.value;
527
	  var state = document.getElementById(Id).state.value;
528
	  var zipcode = document.getElementById(Id).pincode.value; 
529
	  var phone = document.getElementById(Id).phone.value;
10742 lgm 530
  if(fname =='')
10678 lgm 531
      {   
532
        document.getElementById('error').style.display = "block";
533
        document.getElementById('error').innerHTML ='Please fill name field!';
534
        window.scrollTo(0,0); return false;}
10742 lgm 535
  if(!removeScript(fname))
536
      {   
537
        document.getElementById('error').style.display = "block";
538
        document.getElementById('error').innerHTML ='Please remove script tags!';
539
        window.scrollTo(0,0); return false;}  
540
  if(fname.length> 50)
541
      {   
542
        document.getElementById('error').style.display = "block";
543
        document.getElementById('error').innerHTML ='Please Enter Less Than 50 Characters in name field!';
544
        window.scrollTo(0,0); return false;}
545
  if(fname !== fname.trim())
546
      {   
547
        document.getElementById('error').style.display = "block";
548
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
549
        window.scrollTo(0,0); return false;}
550
  if(fname !== fname.replace(/\s+/g, ' '))
551
      {   
552
        document.getElementById('error').style.display = "block";
553
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
554
        window.scrollTo(0,0); return false;}
555
  if(street1 =='')
556
      {   
557
        document.getElementById('error').style.display = "block";
558
        document.getElementById('error').innerHTML ='Please fill address field!';
559
        window.scrollTo(0,0); return false;}
560
  if(street1 != street1.trim())
561
      {   
562
        document.getElementById('error').style.display = "block";
563
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
564
        window.scrollTo(0,0); return false;}
565
  if(street1 != street1.replace(/\s+/g, ' '))
566
      {   
567
        document.getElementById('error').style.display = "block";
568
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
569
        window.scrollTo(0,0); return false;}
570
  if(!removeScript(street1))
571
      {   
572
        document.getElementById('error').style.display = "block";
573
        document.getElementById('error').innerHTML ='Please remove script tags!';
574
        window.scrollTo(0,0); return false;}
575
  if(street2 != street2.trim())
576
      {   
577
        document.getElementById('error').style.display = "block";
578
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
579
        window.scrollTo(0,0); return false;}
580
  if(street2 != street2.replace(/\s+/g, ' '))
581
      {   
582
        document.getElementById('error').style.display = "block";
583
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
584
        window.scrollTo(0,0); return false;}
585
  if(!removeScript(street2))
586
      {   
587
        document.getElementById('error').style.display = "block";
588
        document.getElementById('error').innerHTML ='Please remove script tags!';
589
        window.scrollTo(0,0); return false;}
590
  if(state == -1)
591
      {   
592
        document.getElementById('error').style.display = "block";
593
        document.getElementById('error').innerHTML ='Please fill state field!';
594
        window.scrollTo(0,0); return false;}
595
  if(!removeScript(state))
596
      {   
597
        document.getElementById('error').style.display = "block";
598
        document.getElementById('error').innerHTML ='Please remove script tags!';
599
        window.scrollTo(0,0); return false;}
600
  if(city =='')
601
      {   
602
        document.getElementById('error').style.display = "block";
603
        document.getElementById('error').innerHTML ='Please fill City field!';
604
        window.scrollTo(0,0); return false;}
605
  if(!removeScript(city))
606
      {   
607
        document.getElementById('error').style.display = "block";
608
        document.getElementById('error').innerHTML ='Please remove script tags!';
609
        window.scrollTo(0,0); return false;}
610
  if(city != city.trim())
611
      {   
612
        document.getElementById('error').style.display = "block";
613
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
614
        window.scrollTo(0,0); return false;}
615
  if(city != city.replace(/\s+/g, ' '))
616
      {   
617
        document.getElementById('error').style.display = "block";
618
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
619
        window.scrollTo(0,0); return false;}
620
  if(zipcode =='')
621
      {   
622
        document.getElementById('error').style.display = "block";
623
        document.getElementById('error').innerHTML ='Please fill pincode field!';
624
        window.scrollTo(0,0); return false;}
625
  if(zipcode.length !=6)
626
      {   
627
        document.getElementById('error').style.display = "block";
628
        document.getElementById('error').innerHTML ='Pincode should be 6 digits long';
629
        window.scrollTo(0,0); return false;}
10779 lgm 630
  if(!/^\d+$/.test(zipcode))
10742 lgm 631
      {   
632
        document.getElementById('error').style.display = "block";
633
        document.getElementById('error').innerHTML ='Please Use numbers only for pincode!';
634
        window.scrollTo(0,0); return false;}
635
  if(zipcode != zipcode.trim())
636
      {   
637
        document.getElementById('error').style.display = "block";
638
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
639
        window.scrollTo(0,0); return false;}
640
  if(zipcode != zipcode.replace(/\s+/g, ' '))
641
      {   
642
        document.getElementById('error').style.display = "block";
643
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
644
        window.scrollTo(0,0); return false;}
645
  if(phone =='')
646
      {   
647
        document.getElementById('error').style.display = "block";
648
        document.getElementById('error').innerHTML ='Please fill phone number field!';
649
        window.scrollTo(0,0); return false;}
10778 lgm 650
  if(!/^\d+$/.test(phone)){
10779 lgm 651
  		  document.getElementById('error').style.display = "block";
10742 lgm 652
          document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
653
          window.scrollTo(0,0); return false;}
654
  if(phone.length != 10)
655
        {    document.getElementById('error').style.display = "block";
656
          document.getElementById('error').innerHTML ='Mobile number should be of 10 digits!';
657
          window.scrollTo(0,0); return false;}
658
  if(phone != phone.trim())
659
      {   
660
        document.getElementById('error').style.display = "block";
661
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
662
        window.scrollTo(0,0); return false;}
663
  if(phone != phone.replace(/\s+/g, ' '))
664
      {   
665
        document.getElementById('error').style.display = "block";
666
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
667
        window.scrollTo(0,0); return false;}	 
10678 lgm 668
	}
10582 lgm 669
	var value = localStorage.getItem('rechargeValue');
670
    if(parseInt(value) == 1){
10953 lgm 671
    	if(typeof _gaq != "undefined" && _gaq != null)	{
672
			_gaq.push(['_trackEvent', 'Recharge', 'Pay Now','Mobile']);
673
		}
10582 lgm 674
    }else if(parseInt(value) == 2){
10953 lgm 675
    	if(typeof _gaq != "undefined" && _gaq != null)	{
676
			_gaq.push(['_trackEvent', 'Recharge', 'Pay Now','DTH']);
677
		}
10582 lgm 678
    }
679
 }
680
 var url;
681
 url = document.URL;
682
 if(url.indexOf('recharge-result') != -1){
683
 	if(orderConfirmation != undefined){
684
 		var amount = parseFloat(orderConfirmation['response'].totalAmount).toFixed(2);
685
 		var orderId = orderConfirmation['response'].rechargeDisplayId;
686
 		var deviceNumber = orderConfirmation['response'].rechargeDeviceNumber;
10953 lgm 687
 		_gaq.push(['_addTrans',
688
			orderId,                     // Transaction ID. Required.
689
			'shop2020',   // Affiliation or store name.
690
			amount,               // Grand Total.
691
			'0',                  // Shipping.
692
			'0',                     // Tax.
693
			"",
694
			"",
695
			"India"
696
		]);
697
		_gaq.push(['_addItem',
698
			orderId,                     // Transaction ID. Required.
699
			orderConfirmation['response'].rechargeProvider,    // Product name. Required.
700
			deviceNumber,                 // SKU/code.
701
			'Digital',         // Category or variation.
702
			amount,                 // Unit price.
703
			'1'                   // Quantity.
704
		]);
705
		 _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
10582 lgm 706
 	}
707
 }