Subversion Repositories SmartDukaan

Rev

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