Subversion Repositories SmartDukaan

Rev

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