Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
1456 varun.gupt 1
$(function(){
2
	$('#loopedSlider').loopedSlider();
3
 
4
	runEffect();
5
 
6
	$(".controls").tabs();
7
 
8
	$('#forgot_username_link').tipsy({gravity: 'w'});
9
 
10
	$("#zipcode").val($("#defaultpincode").val());
11
 
12
    updateEstimate();
13
 
1761 vikas 14
    var prodid = $("#product_id").val();
15
 
16
	add_to_storage_set("histitems", prodid);
17
 
1623 rajveer 18
    load_history_widget();
1761 vikas 19
 
1922 varun.gupt 20
    /**
21
     * Code to track user clicks on Product slides and 'Proceed to Payment' option
22
     */
23
	$('a.vt').click(function(){
24
		trackEventWithGA('Product', $(this).children('span').text(), $('title').text().split('|')[0].trim());
25
	});
26
 
1761 vikas 27
    $("#addcart").click(function(){
1456 varun.gupt 28
		jQuery.ajax({
29
			type: "POST",
1614 rajveer 30
			url: "/addtocart",
1456 varun.gupt 31
			data: "productid=" + $("#item_id").val(),
32
			success: function(msg)	{
33
				$("#cartItemCount").html((msg*1));
34
				window.location = "/cart";
35
			}
36
		});
37
	});
38
 
39
	$("#colorselector").change(function(){
40
		var output = "";
41
		var itemid = $("#colorselector option:selected").val();
42
 
43
		$('#sp').html(PARAMETERS[itemid].SP);
44
		$('#mrp').html(PARAMETERS[itemid].MRP);
45
		$('#saving').html(PARAMETERS[itemid].SAVING);
46
		$("#item_id").val(itemid);
47
		updateEstimate(itemid);
48
		return false;
49
	});
50
 
51
	$("a.colorselector").click(function() {
52
		$('.a.colorselector').addClass('deselect');
53
		$(this).addClass('deselect');
1567 vikas 54
		var itemid = $(this).attr('itemid');
1456 varun.gupt 55
		$('#sp').html(" "+PARAMETERS[itemid].SP);
56
		$('#mrp').html(" "+PARAMETERS[itemid].MRP);
57
		$('#saving').html(PARAMETERS[itemid].SAVING);
58
		$("#item_id").val(itemid);
59
		return false;
60
	});
61
});
62
 
63
function changeSignInClass(){
64
	if(document.getElementById("signinClass").className.indexOf("signin1") > -1)	{
65
		document.getElementById("signinClass").className = 'signin';
66
	} else	{
67
		document.getElementById("signinClass").className = 'signin1';
68
	}
69
}
70
 
71
function updateEstimate(itemId)	{
72
	itemId = itemId || $("#item_id").val();
73
 
74
	jQuery.ajax({
75
		type: "GET",
1919 rajveer 76
		url: "/estimate/" + $("#zipcode").val() + "_" + itemId,
1456 varun.gupt 77
		beforeSend: function()	{
78
			$("#days").html("<img src='../images/loader_l.gif'>");
79
		},
80
		success: function(msg)	{
81
			$("#shipping_time").html(msg);
82
		}
83
	});
84
}