Subversion Repositories SmartDukaan

Rev

Rev 11131 | Rev 11233 | 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);
277
			    			document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
278
			    			if(document.getElementById('walletAmount')){
279
			    				document.getElementById('walletAmount').innerHTML = parseInt(data.walletAmount);
280
			    			}
281
			    			if(document.getElementById('walletAmountLeft')){
282
			    				document.getElementById('walletAmountLeft').innerHTML = parseInt(data.walletAmountLeft);
283
			    			} 
284
			    			document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
285
			    			document.getElementById('payAmount').value = parseInt(data.payAmount);
286
			    			document.getElementById('coupon').style.display = "none";
287
		        			document.getElementById('coupon_msg').innerHTML ='Coupon Code applied!';
288
		        			document.getElementById('submit').value ='Recharge Now';
289
		    			}else{
290
		    				//document.getElementById('amount').value = parseInt(data.payAmount);
291
			    			document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
292
			    			document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
293
			    			document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
294
			    			document.getElementById('payAmount').value = parseInt(data.payAmount);
295
			    			document.getElementById('coupon').style.display = "none";
296
		        			document.getElementById('coupon_msg').innerHTML ='Coupon Code applied!';
297
		    			}
298
		    		}
299
		    	}
300
			});
301
	}
302
	else{
303
		document.getElementById('error').style.display = "block";
304
	    document.getElementById('error').innerHTML ='Please enter a Coupon Code!';
305
	}
306
}
307
 
308
function clearError(){
309
	if(document.getElementById('error').style.display == "block"){
310
		document.getElementById('error').style.display = "none";
311
	}
312
}
313
window.onload=function(){
314
	var value = localStorage.getItem('rechargeValue');
315
	if(parseInt(value) == 2){
316
		if(document.getElementsByClassName('mobile-recharge')[0]){
317
			document.getElementsByClassName('mobile-recharge')[0].style.display = 'none';
318
	    	document.getElementsByClassName('dth-recharge')[0].style.display = 'block';
319
	    	document.getElementsByClassName('mobile-re')[0].className = 'mobile-re';
320
	    	document.getElementsByClassName('dth-re')[0].className += ' selected';
321
		}
322
	}
323
};
324
function changePayment(e){
325
  debugger;
326
  var Id = e.currentTarget.id;
327
  var defaultId = defaultPayment.id;
328
  if(defaultId != Id){
11027 lgm 329
  	var title = e.currentTarget.textContent.split('+')[0];
10582 lgm 330
    document.getElementById(defaultId).className = 'card';
331
    defaultPayment.nextElementSibling.style.display = 'none';
332
    defaultPayment.children[0].innerHTML = '+';
333
    document.getElementById(Id).className += ' selected';
334
    document.getElementById(Id).children[0].innerHTML = '-';
335
    e.currentTarget.nextElementSibling.style.display = 'block';
336
    //document.getElementById(Id).style.display = 'block';
337
    defaultPayment = e.currentTarget;
11027 lgm 338
    if(typeof _gaq != "undefined" && _gaq != null)  {
339
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab clicked',title]);
340
    }
10582 lgm 341
  }
342
}
343
var previousDebit;
344
function selectDebitCard(e){
345
  debugger;
346
  var Id = e.currentTarget.id;
347
  if(previousDebit == undefined){
348
    document.getElementById(Id).className = 'selected';
349
  }
350
  else if(previousDebit != undefined){
351
    document.getElementById(previousDebit).className = '';
352
    document.getElementById(Id).className = 'selected'; 
353
  }
354
  document.getElementById('pay-debit').value = Id;
355
  previousDebit = Id;
11027 lgm 356
  var title = e.currentTarget.getAttribute('data-parent');
357
  title = title+'-'+Id;
358
  if(typeof _gaq != "undefined" && _gaq != null)  {
359
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
360
    }
10582 lgm 361
}
362
var previousCard;
363
function selectCard(e){
364
  debugger;
365
  var Id = e.currentTarget.id;
366
  if(previousCard == undefined){
367
    document.getElementById(Id).className = 'selected';
368
  }
369
  else if(previousCard != undefined){
370
    document.getElementById(previousCard).className = '';
371
    document.getElementById(Id).className = 'selected'; 
372
  }
373
  document.getElementById('pay-credit').value = Id;
374
  previousCard = Id;
11027 lgm 375
  var title = e.currentTarget.getAttribute('data-parent');
376
  title = title+'-'+Id;
377
  if(typeof _gaq != "undefined" && _gaq != null)  {
378
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
379
    }
10582 lgm 380
}
11092 lgm 381
var netBankingInfo;
11137 lgm 382
var prevClass;
10582 lgm 383
function changeNetBanking(e){
384
  debugger;
10678 lgm 385
  var Id;
11131 lgm 386
  var selected;
11137 lgm 387
  var hasClass;
10678 lgm 388
  Id = e.currentTarget.value;
389
  if(Id == undefined){
11131 lgm 390
    selected = 1;
10678 lgm 391
    Id = e.currentTarget.id;
11137 lgm 392
    var dropDown = document.getElementById('net');
393
    if(dropDown.selectedIndex != 0){
394
      dropDown.selectedIndex = 0;
395
    }
10678 lgm 396
  }
11092 lgm 397
  if(netBankingInfo == undefined){
11137 lgm 398
    if((selected == 1))
11131 lgm 399
    document.getElementById(Id).className = 'selected';
10678 lgm 400
  }
11092 lgm 401
  else if(netBankingInfo != undefined){
11137 lgm 402
    if((selected == 1)) {
11131 lgm 403
      document.getElementById(Id).className = 'selected';
11137 lgm 404
      if(prevClass == 'selected'){
405
        document.getElementById(netBankingInfo).className = '';   
406
      }   
407
    }else{
408
      if(prevClass == 'selected'){
409
          document.getElementById(netBankingInfo).className = '';
410
      }  
11131 lgm 411
    }
10678 lgm 412
  }
10582 lgm 413
  document.getElementById('pay-net').value = Id;
11092 lgm 414
  netBankingInfo = Id;
11137 lgm 415
  prevClass = e.currentTarget.className;
10678 lgm 416
  var title = e.currentTarget.getAttribute('data-parent');
417
  title = title+'-'+Id;
11027 lgm 418
  if(typeof _gaq != "undefined" && _gaq != null)  {
419
      _gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
420
    }
10582 lgm 421
}
422
function submitform(){
423
    debugger
424
    if(parseInt(document.getElementById('payAmount').value) == 0 ){
425
      if(document.getElementById('captcha_response_box').value == ''){
426
        // document.forms['recharge-confirm'].submit();
427
      // }else{
428
        var bRed = document.getElementById('captcha_response_box');
429
        bRed.style.border = 'red solid 1px';
430
        bRed.style.color = 'red';
431
        bRed.value = 'Please enter the captcha' 
432
        setTimeout(function(){
433
          bRed.style.border = '';
434
          bRed.style.color = '';
435
          bRed.value = '';
436
        },3000);
437
        return false;
438
      }
439
    }
440
    var value = localStorage.getItem('rechargeValue');
441
    if(parseInt(value) == 1){
10953 lgm 442
    	if(typeof _gaq != "undefined" && _gaq != null)	{
443
			_gaq.push(['_trackEvent', 'Recharge', 'Confirm','Mobile']);
444
		}	
10582 lgm 445
    }else if(parseInt(value) == 2){
10953 lgm 446
    	if(typeof _gaq != "undefined" && _gaq != null)	{
447
			_gaq.push(['_trackEvent', 'Recharge', 'Confirm','DTH']);
448
		}
10582 lgm 449
    }
450
  }
451
 function addressValidation(e){
452
 	debugger;
453
 	var Id = e.currentTarget.id;
454
 	if(Id == 'creditcard'){
455
 		if(previousCard == undefined){
456
 			document.getElementById('error').style.display = "block";
457
	        document.getElementById('error').innerHTML ='Please select payment method!';
458
	        window.scrollTo(0,0); return false;
459
 		}
460
 	}else if(Id == 'debitcard'){
461
 		if(previousDebit == undefined){
462
 			document.getElementById('error').style.display = "block";
463
	        document.getElementById('error').innerHTML ='Please select payment method!';
464
	        window.scrollTo(0,0); return false;
465
 		}
466
 	}else if(Id == 'netbanking'){
467
 		var payOption = document.getElementById('pay-net').value;
468
 		if(payOption == undefined || payOption ==""){
469
 			document.getElementById('error').style.display = "block";
470
	        document.getElementById('error').innerHTML ='Please select payment method!';
471
	        window.scrollTo(0,0); return false;
472
 		}
473
 	}
474
 	if(document.getElementById('ccAddress')){
475
 	  var error = Id+'error';
476
 	  var fname = document.getElementById(Id).name.value;
477
	  var street1 = document.getElementById(Id).line1.value;
478
	  var street2 = document.getElementById(Id).line2.value;
479
	  var city = document.getElementById(Id).city.value;
480
	  var state = document.getElementById(Id).state.value;
481
	  var zipcode = document.getElementById(Id).pincode.value; 
482
	  var phone = document.getElementById(Id).phone.value;
10742 lgm 483
  if(fname =='')
10678 lgm 484
      {   
485
        document.getElementById('error').style.display = "block";
486
        document.getElementById('error').innerHTML ='Please fill name field!';
487
        window.scrollTo(0,0); return false;}
10742 lgm 488
  if(!removeScript(fname))
489
      {   
490
        document.getElementById('error').style.display = "block";
491
        document.getElementById('error').innerHTML ='Please remove script tags!';
492
        window.scrollTo(0,0); return false;}  
493
  if(fname.length> 50)
494
      {   
495
        document.getElementById('error').style.display = "block";
496
        document.getElementById('error').innerHTML ='Please Enter Less Than 50 Characters in name field!';
497
        window.scrollTo(0,0); return false;}
498
  if(fname !== fname.trim())
499
      {   
500
        document.getElementById('error').style.display = "block";
501
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
502
        window.scrollTo(0,0); return false;}
503
  if(fname !== fname.replace(/\s+/g, ' '))
504
      {   
505
        document.getElementById('error').style.display = "block";
506
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
507
        window.scrollTo(0,0); return false;}
508
  if(street1 =='')
509
      {   
510
        document.getElementById('error').style.display = "block";
511
        document.getElementById('error').innerHTML ='Please fill address field!';
512
        window.scrollTo(0,0); return false;}
513
  if(street1 != street1.trim())
514
      {   
515
        document.getElementById('error').style.display = "block";
516
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
517
        window.scrollTo(0,0); return false;}
518
  if(street1 != street1.replace(/\s+/g, ' '))
519
      {   
520
        document.getElementById('error').style.display = "block";
521
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
522
        window.scrollTo(0,0); return false;}
523
  if(!removeScript(street1))
524
      {   
525
        document.getElementById('error').style.display = "block";
526
        document.getElementById('error').innerHTML ='Please remove script tags!';
527
        window.scrollTo(0,0); return false;}
528
  if(street2 != street2.trim())
529
      {   
530
        document.getElementById('error').style.display = "block";
531
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
532
        window.scrollTo(0,0); return false;}
533
  if(street2 != street2.replace(/\s+/g, ' '))
534
      {   
535
        document.getElementById('error').style.display = "block";
536
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
537
        window.scrollTo(0,0); return false;}
538
  if(!removeScript(street2))
539
      {   
540
        document.getElementById('error').style.display = "block";
541
        document.getElementById('error').innerHTML ='Please remove script tags!';
542
        window.scrollTo(0,0); return false;}
543
  if(state == -1)
544
      {   
545
        document.getElementById('error').style.display = "block";
546
        document.getElementById('error').innerHTML ='Please fill state field!';
547
        window.scrollTo(0,0); return false;}
548
  if(!removeScript(state))
549
      {   
550
        document.getElementById('error').style.display = "block";
551
        document.getElementById('error').innerHTML ='Please remove script tags!';
552
        window.scrollTo(0,0); return false;}
553
  if(city =='')
554
      {   
555
        document.getElementById('error').style.display = "block";
556
        document.getElementById('error').innerHTML ='Please fill City field!';
557
        window.scrollTo(0,0); return false;}
558
  if(!removeScript(city))
559
      {   
560
        document.getElementById('error').style.display = "block";
561
        document.getElementById('error').innerHTML ='Please remove script tags!';
562
        window.scrollTo(0,0); return false;}
563
  if(city != city.trim())
564
      {   
565
        document.getElementById('error').style.display = "block";
566
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
567
        window.scrollTo(0,0); return false;}
568
  if(city != city.replace(/\s+/g, ' '))
569
      {   
570
        document.getElementById('error').style.display = "block";
571
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
572
        window.scrollTo(0,0); return false;}
573
  if(zipcode =='')
574
      {   
575
        document.getElementById('error').style.display = "block";
576
        document.getElementById('error').innerHTML ='Please fill pincode field!';
577
        window.scrollTo(0,0); return false;}
578
  if(zipcode.length !=6)
579
      {   
580
        document.getElementById('error').style.display = "block";
581
        document.getElementById('error').innerHTML ='Pincode should be 6 digits long';
582
        window.scrollTo(0,0); return false;}
10779 lgm 583
  if(!/^\d+$/.test(zipcode))
10742 lgm 584
      {   
585
        document.getElementById('error').style.display = "block";
586
        document.getElementById('error').innerHTML ='Please Use numbers only for pincode!';
587
        window.scrollTo(0,0); return false;}
588
  if(zipcode != zipcode.trim())
589
      {   
590
        document.getElementById('error').style.display = "block";
591
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
592
        window.scrollTo(0,0); return false;}
593
  if(zipcode != zipcode.replace(/\s+/g, ' '))
594
      {   
595
        document.getElementById('error').style.display = "block";
596
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
597
        window.scrollTo(0,0); return false;}
598
  if(phone =='')
599
      {   
600
        document.getElementById('error').style.display = "block";
601
        document.getElementById('error').innerHTML ='Please fill phone number field!';
602
        window.scrollTo(0,0); return false;}
10778 lgm 603
  if(!/^\d+$/.test(phone)){
10779 lgm 604
  		  document.getElementById('error').style.display = "block";
10742 lgm 605
          document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
606
          window.scrollTo(0,0); return false;}
607
  if(phone.length != 10)
608
        {    document.getElementById('error').style.display = "block";
609
          document.getElementById('error').innerHTML ='Mobile number should be of 10 digits!';
610
          window.scrollTo(0,0); return false;}
611
  if(phone != phone.trim())
612
      {   
613
        document.getElementById('error').style.display = "block";
614
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
615
        window.scrollTo(0,0); return false;}
616
  if(phone != phone.replace(/\s+/g, ' '))
617
      {   
618
        document.getElementById('error').style.display = "block";
619
        document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
620
        window.scrollTo(0,0); return false;}	 
10678 lgm 621
	}
10582 lgm 622
	var value = localStorage.getItem('rechargeValue');
623
    if(parseInt(value) == 1){
10953 lgm 624
    	if(typeof _gaq != "undefined" && _gaq != null)	{
625
			_gaq.push(['_trackEvent', 'Recharge', 'Pay Now','Mobile']);
626
		}
10582 lgm 627
    }else if(parseInt(value) == 2){
10953 lgm 628
    	if(typeof _gaq != "undefined" && _gaq != null)	{
629
			_gaq.push(['_trackEvent', 'Recharge', 'Pay Now','DTH']);
630
		}
10582 lgm 631
    }
632
 }
633
 var url;
634
 url = document.URL;
635
 if(url.indexOf('recharge-result') != -1){
636
 	if(orderConfirmation != undefined){
637
 		var amount = parseFloat(orderConfirmation['response'].totalAmount).toFixed(2);
638
 		var orderId = orderConfirmation['response'].rechargeDisplayId;
639
 		var deviceNumber = orderConfirmation['response'].rechargeDeviceNumber;
10953 lgm 640
 		_gaq.push(['_addTrans',
641
			orderId,                     // Transaction ID. Required.
642
			'shop2020',   // Affiliation or store name.
643
			amount,               // Grand Total.
644
			'0',                  // Shipping.
645
			'0',                     // Tax.
646
			"",
647
			"",
648
			"India"
649
		]);
650
		_gaq.push(['_addItem',
651
			orderId,                     // Transaction ID. Required.
652
			orderConfirmation['response'].rechargeProvider,    // Product name. Required.
653
			deviceNumber,                 // SKU/code.
654
			'Digital',         // Category or variation.
655
			amount,                 // Unit price.
656
			'1'                   // Quantity.
657
		]);
658
		 _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
10582 lgm 659
 	}
660
 }