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