Subversion Repositories SmartDukaan

Rev

Rev 3101 | Rev 3312 | 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
 
46
function trackPaymentOptionFormSubmission(){
47
	trackEventWithGA('Order', 'Payment method selected', '');
48
	return true;
49
}
50
 
51
function dispError(error){
52
	alert(error);
53
}