| 12694 |
anikendra |
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 |
}
|
|
|
11 |
var operatorId;
|
|
|
12 |
var circleCode;
|
|
|
13 |
var isOperaMini = (navigator.userAgent.indexOf('Opera Mini') > -1);
|
|
|
14 |
if(isOperaMini){
|
|
|
15 |
document.getElementById('operator-list').style.display = "block";
|
|
|
16 |
}
|
|
|
17 |
function operator(){
|
|
|
18 |
var number = document.getElementById('mobile-number').value;
|
|
|
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 |
}
|
|
|
25 |
if(number.length == 10)
|
|
|
26 |
{
|
|
|
27 |
|
|
|
28 |
var url = base_url+'recharge/operator/'+number;
|
|
|
29 |
//window.location.href = a;
|
|
|
30 |
microAjax(url, function (res) {
|
|
|
31 |
|
|
|
32 |
if(res != ''){
|
|
|
33 |
|
|
|
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;
|
|
|
44 |
document.getElementById("mobile-operator").disabled = false;
|
|
|
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 |
});
|
|
|
70 |
}else if(number.length < 10){
|
|
|
71 |
if(document.getElementById("mobile-operator").disabled != true){
|
|
|
72 |
document.getElementById("mobile-operator").disabled = true;
|
|
|
73 |
}
|
|
|
74 |
var isOperaMini = (navigator.userAgent.indexOf('Opera Mini') > -1);
|
|
|
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 |
}
|
|
|
92 |
}
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
function changeOperator(e){
|
|
|
96 |
|
|
|
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){
|
|
|
123 |
|
|
|
124 |
var Id = e.currentTarget.id;
|
|
|
125 |
var url = base_url+'recharge/topupSpecial/'+Id+'/'+operatorId+'/'+circleCode;
|
|
|
126 |
microAjax(url, function (res) {
|
|
|
127 |
|
|
|
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');
|
|
|
133 |
//appenddata.innerHTML= appenddata.innerHTML + res;
|
|
|
134 |
appenddata.innerHTML = res;
|
|
|
135 |
}
|
|
|
136 |
});
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
function closePlan(){
|
|
|
140 |
//
|
|
|
141 |
document.getElementsByClassName('rech-cont')[0].style.display = 'block';
|
|
|
142 |
document.getElementsByClassName('topup-cont')[0].style.display = 'none';
|
|
|
143 |
}
|
|
|
144 |
function fillAmount(e){
|
|
|
145 |
//
|
|
|
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){
|
|
|
152 |
|
|
|
153 |
var id = e.currentTarget.value;
|
|
|
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 |
}
|
|
|
160 |
}
|
|
|
161 |
function mobileValidation(){
|
|
|
162 |
|
|
|
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(".");
|
|
|
171 |
number = number.trim();
|
|
|
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 |
}
|
|
|
177 |
if(!/^\d+$/.test(number)){
|
|
|
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 |
}
|
|
|
197 |
if(!/^\d+$/.test(amount)){
|
|
|
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 |
}
|
|
|
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 |
}
|
|
|
232 |
|
|
|
233 |
}
|
|
|
234 |
function dthValidation(){
|
|
|
235 |
|
|
|
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;
|
|
|
240 |
var value = document.getElementById('accountName').innerHTML;
|
|
|
241 |
value = value.split(':')[0];
|
|
|
242 |
document.getElementById('dth_hidden').value = operator[operator.selectedIndex].text;
|
|
|
243 |
email = email.trim();
|
|
|
244 |
var atpos = email.indexOf("@");
|
|
|
245 |
var dotpos = email.lastIndexOf(".");
|
|
|
246 |
number = number.trim();
|
|
|
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";
|
|
|
254 |
document.getElementById('error').innerHTML ='Please enter the '+value+'!';
|
|
|
255 |
window.scrollTo(0,0); return false;
|
|
|
256 |
}
|
|
|
257 |
if(!/^\d+$/.test(number)){
|
|
|
258 |
document.getElementById('error').style.display = "block";
|
|
|
259 |
document.getElementById('error').innerHTML ='Please Use numbers only for '+value+' field!';
|
|
|
260 |
window.scrollTo(0,0); return false;
|
|
|
261 |
}
|
|
|
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 |
}
|
|
|
267 |
if(!/^\d+$/.test(amount)){
|
|
|
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(){
|
|
|
301 |
|
|
|
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) {
|
|
|
308 |
|
|
|
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);
|
|
|
322 |
//document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
|
|
|
323 |
document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
|
|
|
324 |
if(document.getElementById('walletAmount')){
|
|
|
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 |
}
|
|
|
331 |
}
|
|
|
332 |
if(document.getElementById('walletAmountLeft')){
|
|
|
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 |
}
|
|
|
340 |
document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
|
|
|
341 |
document.getElementById('payAmount').value = parseInt(data.payAmount);
|
|
|
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);
|
|
|
347 |
//document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
|
|
|
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){
|
|
|
381 |
|
|
|
382 |
var Id = e.currentTarget.id;
|
|
|
383 |
var defaultId = defaultPayment.id;
|
|
|
384 |
if(defaultId != Id){
|
|
|
385 |
var title = e.currentTarget.textContent.split('+')[0];
|
|
|
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;
|
|
|
394 |
/*if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
395 |
_gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab clicked',title]);
|
|
|
396 |
}*/
|
|
|
397 |
ga('send', 'event', 'Payment Option', 'Payment option tab clicked', title);
|
|
|
398 |
}
|
|
|
399 |
}
|
|
|
400 |
var previousDebit;
|
|
|
401 |
function selectDebitCard(e){
|
|
|
402 |
|
|
|
403 |
var Id = e.currentTarget.id;
|
|
|
404 |
if(previousDebit == undefined){
|
|
|
405 |
document.getElementById(Id).className = 'selected';
|
|
|
406 |
}
|
|
|
407 |
else if(previousDebit != undefined){
|
|
|
408 |
document.getElementById(previousDebit).className = '';
|
|
|
409 |
document.getElementById(Id).className = 'selected';
|
|
|
410 |
}
|
|
|
411 |
document.getElementById('pay-debit').value = Id;
|
|
|
412 |
previousDebit = Id;
|
|
|
413 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
414 |
title = title+'-'+Id;
|
|
|
415 |
/*
|
|
|
416 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
417 |
_gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
|
|
|
418 |
}
|
|
|
419 |
*/
|
|
|
420 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payoption selected', title);
|
|
|
421 |
}
|
|
|
422 |
var previousCard;
|
|
|
423 |
function selectCard(e){
|
|
|
424 |
|
|
|
425 |
var Id = e.currentTarget.id;
|
|
|
426 |
if(previousCard == undefined){
|
|
|
427 |
document.getElementById(Id).className = 'selected';
|
|
|
428 |
}
|
|
|
429 |
else if(previousCard != undefined){
|
|
|
430 |
document.getElementById(previousCard).className = '';
|
|
|
431 |
document.getElementById(Id).className = 'selected';
|
|
|
432 |
}
|
|
|
433 |
document.getElementById('pay-credit').value = Id;
|
|
|
434 |
previousCard = Id;
|
|
|
435 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
436 |
title = title+'-'+Id;
|
|
|
437 |
/*
|
|
|
438 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
439 |
_gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
|
|
|
440 |
}
|
|
|
441 |
*/
|
|
|
442 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payoption selected', title);
|
|
|
443 |
}
|
|
|
444 |
var netBankingInfo;
|
|
|
445 |
var prevClass;
|
|
|
446 |
function changeNetBanking(e){
|
|
|
447 |
|
|
|
448 |
var Id;
|
|
|
449 |
var selected;
|
|
|
450 |
var hasClass;
|
|
|
451 |
Id = e.currentTarget.value;
|
|
|
452 |
if(Id == undefined){
|
|
|
453 |
selected = 1;
|
|
|
454 |
Id = e.currentTarget.id;
|
|
|
455 |
var dropDown = document.getElementById('net');
|
|
|
456 |
if(dropDown.selectedIndex != 0){
|
|
|
457 |
dropDown.selectedIndex = 0;
|
|
|
458 |
}
|
|
|
459 |
}
|
|
|
460 |
if(netBankingInfo == undefined){
|
|
|
461 |
if((selected == 1))
|
|
|
462 |
document.getElementById(Id).className = 'selected';
|
|
|
463 |
}
|
|
|
464 |
else if(netBankingInfo != undefined){
|
|
|
465 |
if((selected == 1)) {
|
|
|
466 |
document.getElementById(Id).className = 'selected';
|
|
|
467 |
if(prevClass == 'selected'){
|
|
|
468 |
document.getElementById(netBankingInfo).className = '';
|
|
|
469 |
}
|
|
|
470 |
}else{
|
|
|
471 |
if(prevClass == 'selected'){
|
|
|
472 |
document.getElementById(netBankingInfo).className = '';
|
|
|
473 |
}
|
|
|
474 |
}
|
|
|
475 |
}
|
|
|
476 |
document.getElementById('pay-net').value = Id;
|
|
|
477 |
netBankingInfo = Id;
|
|
|
478 |
prevClass = e.currentTarget.className;
|
|
|
479 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
480 |
title = title+'-'+Id;
|
|
|
481 |
/*
|
|
|
482 |
if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
483 |
_gaq.push(['_trackEvent', 'Payment Option', 'Payment option tab-payoption selected',title]);
|
|
|
484 |
}
|
|
|
485 |
*/
|
|
|
486 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payoption selected', title);
|
|
|
487 |
}
|
|
|
488 |
function submitform(){
|
|
|
489 |
if(parseInt(document.getElementById('amountPayable').value) == 0 ){
|
|
|
490 |
if(document.getElementById('captcha_response_box').value == ''){
|
|
|
491 |
// document.forms['recharge-confirm'].submit();
|
|
|
492 |
// }else{
|
|
|
493 |
var bRed = document.getElementById('captcha_response_box');
|
|
|
494 |
bRed.style.border = 'red solid 1px';
|
|
|
495 |
bRed.style.color = 'red';
|
|
|
496 |
bRed.value = 'Please enter the captcha'
|
|
|
497 |
setTimeout(function(){
|
|
|
498 |
bRed.style.border = '';
|
|
|
499 |
bRed.style.color = '';
|
|
|
500 |
bRed.value = '';
|
|
|
501 |
},3000);
|
|
|
502 |
return false;
|
|
|
503 |
}
|
|
|
504 |
}
|
|
|
505 |
var value = localStorage.getItem('rechargeValue');
|
|
|
506 |
if(parseInt(value) == 1){
|
|
|
507 |
/*if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
508 |
_gaq.push(['_trackEvent', 'Recharge', 'Confirm','Mobile']);
|
|
|
509 |
}*/
|
|
|
510 |
ga('send', 'event', 'Recharge', 'Confirm', 'Mobile');
|
|
|
511 |
}else if(parseInt(value) == 2){
|
|
|
512 |
/*if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
513 |
_gaq.push(['_trackEvent', 'Recharge', 'Confirm','DTH']);
|
|
|
514 |
}*/
|
|
|
515 |
ga('send', 'event', 'Recharge', 'Confirm', 'DTH');
|
|
|
516 |
}
|
|
|
517 |
}
|
|
|
518 |
function addressValidation(e){
|
|
|
519 |
|
|
|
520 |
var Id = e.currentTarget.id;
|
|
|
521 |
if(Id == 'creditcard'){
|
|
|
522 |
if(previousCard == undefined){
|
|
|
523 |
document.getElementById('error').style.display = "block";
|
|
|
524 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
525 |
window.scrollTo(0,0); return false;
|
|
|
526 |
}
|
|
|
527 |
}else if(Id == 'debitcard'){
|
|
|
528 |
if(previousDebit == undefined){
|
|
|
529 |
document.getElementById('error').style.display = "block";
|
|
|
530 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
531 |
window.scrollTo(0,0); return false;
|
|
|
532 |
}
|
|
|
533 |
}else if(Id == 'netbanking'){
|
|
|
534 |
var payOption = document.getElementById('pay-net').value;
|
|
|
535 |
if(payOption == undefined || payOption ==""){
|
|
|
536 |
document.getElementById('error').style.display = "block";
|
|
|
537 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
538 |
window.scrollTo(0,0); return false;
|
|
|
539 |
}
|
|
|
540 |
}
|
|
|
541 |
if(document.getElementById('ccAddress')){
|
|
|
542 |
var error = Id+'error';
|
|
|
543 |
var fname = document.getElementById(Id).name.value;
|
|
|
544 |
var street1 = document.getElementById(Id).line1.value;
|
|
|
545 |
var street2 = document.getElementById(Id).line2.value;
|
|
|
546 |
var city = document.getElementById(Id).city.value;
|
|
|
547 |
var state = document.getElementById(Id).state.value;
|
|
|
548 |
var zipcode = document.getElementById(Id).pincode.value;
|
|
|
549 |
var phone = document.getElementById(Id).phone.value;
|
|
|
550 |
if(fname =='')
|
|
|
551 |
{
|
|
|
552 |
document.getElementById('error').style.display = "block";
|
|
|
553 |
document.getElementById('error').innerHTML ='Please fill name field!';
|
|
|
554 |
window.scrollTo(0,0); return false;}
|
|
|
555 |
if(!removeScript(fname))
|
|
|
556 |
{
|
|
|
557 |
document.getElementById('error').style.display = "block";
|
|
|
558 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
559 |
window.scrollTo(0,0); return false;}
|
|
|
560 |
if(fname.length> 50)
|
|
|
561 |
{
|
|
|
562 |
document.getElementById('error').style.display = "block";
|
|
|
563 |
document.getElementById('error').innerHTML ='Please Enter Less Than 50 Characters in name field!';
|
|
|
564 |
window.scrollTo(0,0); return false;}
|
|
|
565 |
if(fname !== fname.trim())
|
|
|
566 |
{
|
|
|
567 |
document.getElementById('error').style.display = "block";
|
|
|
568 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
|
|
|
569 |
window.scrollTo(0,0); return false;}
|
|
|
570 |
if(fname !== fname.replace(/\s+/g, ' '))
|
|
|
571 |
{
|
|
|
572 |
document.getElementById('error').style.display = "block";
|
|
|
573 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
|
|
|
574 |
window.scrollTo(0,0); return false;}
|
|
|
575 |
if(street1 =='')
|
|
|
576 |
{
|
|
|
577 |
document.getElementById('error').style.display = "block";
|
|
|
578 |
document.getElementById('error').innerHTML ='Please fill address field!';
|
|
|
579 |
window.scrollTo(0,0); return false;}
|
|
|
580 |
if(street1 != street1.trim())
|
|
|
581 |
{
|
|
|
582 |
document.getElementById('error').style.display = "block";
|
|
|
583 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
584 |
window.scrollTo(0,0); return false;}
|
|
|
585 |
if(street1 != street1.replace(/\s+/g, ' '))
|
|
|
586 |
{
|
|
|
587 |
document.getElementById('error').style.display = "block";
|
|
|
588 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
589 |
window.scrollTo(0,0); return false;}
|
|
|
590 |
if(!removeScript(street1))
|
|
|
591 |
{
|
|
|
592 |
document.getElementById('error').style.display = "block";
|
|
|
593 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
594 |
window.scrollTo(0,0); return false;}
|
|
|
595 |
if(street2 != street2.trim())
|
|
|
596 |
{
|
|
|
597 |
document.getElementById('error').style.display = "block";
|
|
|
598 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
599 |
window.scrollTo(0,0); return false;}
|
|
|
600 |
if(street2 != street2.replace(/\s+/g, ' '))
|
|
|
601 |
{
|
|
|
602 |
document.getElementById('error').style.display = "block";
|
|
|
603 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
604 |
window.scrollTo(0,0); return false;}
|
|
|
605 |
if(!removeScript(street2))
|
|
|
606 |
{
|
|
|
607 |
document.getElementById('error').style.display = "block";
|
|
|
608 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
609 |
window.scrollTo(0,0); return false;}
|
|
|
610 |
if(state == -1)
|
|
|
611 |
{
|
|
|
612 |
document.getElementById('error').style.display = "block";
|
|
|
613 |
document.getElementById('error').innerHTML ='Please fill state field!';
|
|
|
614 |
window.scrollTo(0,0); return false;}
|
|
|
615 |
if(!removeScript(state))
|
|
|
616 |
{
|
|
|
617 |
document.getElementById('error').style.display = "block";
|
|
|
618 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
619 |
window.scrollTo(0,0); return false;}
|
|
|
620 |
if(city =='')
|
|
|
621 |
{
|
|
|
622 |
document.getElementById('error').style.display = "block";
|
|
|
623 |
document.getElementById('error').innerHTML ='Please fill City field!';
|
|
|
624 |
window.scrollTo(0,0); return false;}
|
|
|
625 |
if(!removeScript(city))
|
|
|
626 |
{
|
|
|
627 |
document.getElementById('error').style.display = "block";
|
|
|
628 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
629 |
window.scrollTo(0,0); return false;}
|
|
|
630 |
if(city != city.trim())
|
|
|
631 |
{
|
|
|
632 |
document.getElementById('error').style.display = "block";
|
|
|
633 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
|
|
|
634 |
window.scrollTo(0,0); return false;}
|
|
|
635 |
if(city != city.replace(/\s+/g, ' '))
|
|
|
636 |
{
|
|
|
637 |
document.getElementById('error').style.display = "block";
|
|
|
638 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
|
|
|
639 |
window.scrollTo(0,0); return false;}
|
|
|
640 |
if(zipcode =='')
|
|
|
641 |
{
|
|
|
642 |
document.getElementById('error').style.display = "block";
|
|
|
643 |
document.getElementById('error').innerHTML ='Please fill pincode field!';
|
|
|
644 |
window.scrollTo(0,0); return false;}
|
|
|
645 |
if(zipcode.length !=6)
|
|
|
646 |
{
|
|
|
647 |
document.getElementById('error').style.display = "block";
|
|
|
648 |
document.getElementById('error').innerHTML ='Pincode should be 6 digits long';
|
|
|
649 |
window.scrollTo(0,0); return false;}
|
|
|
650 |
if(!/^\d+$/.test(zipcode))
|
|
|
651 |
{
|
|
|
652 |
document.getElementById('error').style.display = "block";
|
|
|
653 |
document.getElementById('error').innerHTML ='Please Use numbers only for pincode!';
|
|
|
654 |
window.scrollTo(0,0); return false;}
|
|
|
655 |
if(zipcode != zipcode.trim())
|
|
|
656 |
{
|
|
|
657 |
document.getElementById('error').style.display = "block";
|
|
|
658 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
|
|
|
659 |
window.scrollTo(0,0); return false;}
|
|
|
660 |
if(zipcode != zipcode.replace(/\s+/g, ' '))
|
|
|
661 |
{
|
|
|
662 |
document.getElementById('error').style.display = "block";
|
|
|
663 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
|
|
|
664 |
window.scrollTo(0,0); return false;}
|
|
|
665 |
if(phone =='')
|
|
|
666 |
{
|
|
|
667 |
document.getElementById('error').style.display = "block";
|
|
|
668 |
document.getElementById('error').innerHTML ='Please fill phone number field!';
|
|
|
669 |
window.scrollTo(0,0); return false;}
|
|
|
670 |
if(!/^\d+$/.test(phone)){
|
|
|
671 |
document.getElementById('error').style.display = "block";
|
|
|
672 |
document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
|
|
|
673 |
window.scrollTo(0,0); return false;}
|
|
|
674 |
if(phone.length != 10)
|
|
|
675 |
{ document.getElementById('error').style.display = "block";
|
|
|
676 |
document.getElementById('error').innerHTML ='Mobile number should be of 10 digits!';
|
|
|
677 |
window.scrollTo(0,0); return false;}
|
|
|
678 |
if(phone != phone.trim())
|
|
|
679 |
{
|
|
|
680 |
document.getElementById('error').style.display = "block";
|
|
|
681 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
|
|
|
682 |
window.scrollTo(0,0); return false;}
|
|
|
683 |
if(phone != phone.replace(/\s+/g, ' '))
|
|
|
684 |
{
|
|
|
685 |
document.getElementById('error').style.display = "block";
|
|
|
686 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
|
|
|
687 |
window.scrollTo(0,0); return false;}
|
|
|
688 |
}
|
|
|
689 |
if(document.getElementById('ccPhone')){
|
|
|
690 |
var phone = document.getElementById(Id).phone.value;
|
|
|
691 |
phone = phone.trim();
|
|
|
692 |
if(phone =='')
|
|
|
693 |
{
|
|
|
694 |
document.getElementById('error').style.display = "block";
|
|
|
695 |
document.getElementById('error').innerHTML ='Please fill phone number field!';
|
|
|
696 |
window.scrollTo(0,0); return false;
|
|
|
697 |
}
|
|
|
698 |
if(!/^\d+$/.test(phone)){
|
|
|
699 |
document.getElementById('error').style.display = "block";
|
|
|
700 |
document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
|
|
|
701 |
window.scrollTo(0,0); return false;
|
|
|
702 |
}
|
|
|
703 |
if(phone.length != 10){
|
|
|
704 |
document.getElementById('error').style.display = "block";
|
|
|
705 |
document.getElementById('error').innerHTML ='Mobile number should be of 10 digits!';
|
|
|
706 |
window.scrollTo(0,0); return false;
|
|
|
707 |
}
|
|
|
708 |
if(phone != phone.replace(/\s+/g, ' '))
|
|
|
709 |
{
|
|
|
710 |
document.getElementById('error').style.display = "block";
|
|
|
711 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
|
|
|
712 |
window.scrollTo(0,0); return false;
|
|
|
713 |
}
|
|
|
714 |
}
|
|
|
715 |
var value = localStorage.getItem('rechargeValue');
|
|
|
716 |
if(parseInt(value) == 1){
|
|
|
717 |
/*if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
718 |
_gaq.push(['_trackEvent', 'Recharge', 'Pay Now','Mobile']);
|
|
|
719 |
}*/
|
|
|
720 |
ga('send', 'event', 'Recharge', 'Pay Now', 'Mobile');
|
|
|
721 |
}else if(parseInt(value) == 2){
|
|
|
722 |
/*if(typeof _gaq != "undefined" && _gaq != null) {
|
|
|
723 |
_gaq.push(['_trackEvent', 'Recharge', 'Pay Now','DTH']);
|
|
|
724 |
}*/
|
|
|
725 |
ga('send', 'event', 'Recharge', 'Pay Now', 'DTH');
|
|
|
726 |
}
|
|
|
727 |
}
|
|
|
728 |
var url;
|
|
|
729 |
url = document.URL;
|
|
|
730 |
if(url.indexOf('recharge-result') != -1){
|
|
|
731 |
// if(orderConfirmation != undefined){
|
|
|
732 |
// var amount = parseFloat(orderConfirmation['response'].totalAmount).toFixed(2);
|
|
|
733 |
// var orderId = orderConfirmation['response'].rechargeDisplayId;
|
|
|
734 |
// var deviceNumber = orderConfirmation['response'].rechargeDeviceNumber;
|
|
|
735 |
// _gaq.push(['_addTrans',
|
|
|
736 |
// orderId, // Transaction ID. Required.
|
|
|
737 |
// 'Saholic', // Affiliation or store name.
|
|
|
738 |
// amount, // Grand Total.
|
|
|
739 |
// '0', // Shipping.
|
|
|
740 |
// '0', // Tax.
|
|
|
741 |
// "",
|
|
|
742 |
// "",
|
|
|
743 |
// "India"
|
|
|
744 |
// ]);
|
|
|
745 |
// _gaq.push(['_addItem',
|
|
|
746 |
// orderId, // Transaction ID. Required.
|
|
|
747 |
// deviceNumber, // SKU/code.
|
|
|
748 |
// orderConfirmation['response'].rechargeProvider, // Product name. Required.
|
|
|
749 |
// 'Digital', // Category or variation.
|
|
|
750 |
// amount, // Unit price.
|
|
|
751 |
// '1' // Quantity.
|
|
|
752 |
// ]);
|
|
|
753 |
// _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
|
|
|
754 |
// }
|
|
|
755 |
}
|