Subversion Repositories SmartDukaan

Rev

Rev 3182 | Rev 4609 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3101 chandransh 1
var $items = $('#vtab>ul>li');
2
 
3
$items.click(function() {
4
    $items.removeClass('selected');
5
    $(this).addClass('selected');
6
    //alert($(this).text());
7
    trackEventWithGA('Payment Option', $(this).text(), "");
8
    var index = $items.index($(this));
9
    $('#vtab>div').hide().eq(index).show();
10
}).eq(0).click();
11
 
12
$items.hover(
13
	function () {
14
	    $(this).addClass("hover");
15
	},
16
	function () {
17
		$(this).removeClass("hover");
18
	}
19
);
20
 
21
$("input[type='radio']").click(
22
	function(){
23
		var contents = $(this).parent().contents();
3182 chandransh 24
		var payment_method = contents.get(contents.index(this) + 2);
3101 chandransh 25
		//Appending the value to differentiate between the cases of cards issued inside and out of India.
3182 chandransh 26
		var payment_method_text = $(payment_method).text() + '-' + $(this).val();
3101 chandransh 27
		trackEventWithGA('Payment Option', payment_method_text, "");
28
	}
29
);
30
 
31
function verifyPaymentModeSelectionForm(formName){
32
	var payment_option = 0;
33
	var paymentOptionInputs = $("form[name='" + formName + "'] :input[name='payment_option']");
34
	for(var i=0; i<paymentOptionInputs.length; i++)
35
		if(paymentOptionInputs[i].checked)
36
			payment_option = paymentOptionInputs[i].value; 
37
 
38
	if(payment_option == '' || payment_option <= 0){
39
		dispError("Please select a payment method.");
40
		return false;
41
	}
42
	trackPaymentOptionFormSubmission();
43
	return true;
44
}
45
 
3312 chandransh 46
function verifyCodSelectionForm(formName){
47
	var captcha_response_input = $("form[name='" + formName + "'] :input[name='recaptcha_response_field']");
48
	if(captcha_response_input.val() == ''){
49
		dispError("Please enter the characters shown.");
50
		return false;
51
	}
52
	trackPaymentOptionFormSubmission();
53
	return true;
54
}
55
 
3101 chandransh 56
function trackPaymentOptionFormSubmission(){
57
	trackEventWithGA('Order', 'Payment method selected', '');
58
	return true;
59
}
60
 
61
function dispError(error){
62
	alert(error);
63
}