Subversion Repositories SmartDukaan

Rev

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