Subversion Repositories SmartDukaan

Rev

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