Subversion Repositories SmartDukaan

Rev

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

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