Subversion Repositories SmartDukaan

Rev

Rev 1623 | Rev 1919 | 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
 
20
    $("#addcart").click(function(){
1456 varun.gupt 21
		jQuery.ajax({
22
			type: "POST",
1614 rajveer 23
			url: "/addtocart",
1456 varun.gupt 24
			data: "productid=" + $("#item_id").val(),
25
			success: function(msg)	{
26
				$("#cartItemCount").html((msg*1));
27
				window.location = "/cart";
28
			}
29
		});
30
	});
31
 
32
	$("#colorselector").change(function(){
33
		var output = "";
34
		var itemid = $("#colorselector option:selected").val();
35
 
36
		$('#sp').html(PARAMETERS[itemid].SP);
37
		$('#mrp').html(PARAMETERS[itemid].MRP);
38
		$('#saving').html(PARAMETERS[itemid].SAVING);
39
		$("#item_id").val(itemid);
40
		updateEstimate(itemid);
41
		return false;
42
	});
43
 
44
	$("a.colorselector").click(function() {
45
		$('.a.colorselector').addClass('deselect');
46
		$(this).addClass('deselect');
1567 vikas 47
		var itemid = $(this).attr('itemid');
1456 varun.gupt 48
		$('#sp').html(" "+PARAMETERS[itemid].SP);
49
		$('#mrp').html(" "+PARAMETERS[itemid].MRP);
50
		$('#saving').html(PARAMETERS[itemid].SAVING);
51
		$("#item_id").val(itemid);
52
		return false;
53
	});
54
});
55
 
56
function changeSignInClass(){
57
	if(document.getElementById("signinClass").className.indexOf("signin1") > -1)	{
58
		document.getElementById("signinClass").className = 'signin';
59
	} else	{
60
		document.getElementById("signinClass").className = 'signin1';
61
	}
62
}
63
 
64
function updateEstimate(itemId)	{
65
	itemId = itemId || $("#item_id").val();
66
 
67
	jQuery.ajax({
68
		type: "GET",
69
		url: "../estimate/" + $("#zipcode").val() + "_" + itemId,
70
		beforeSend: function()	{
71
			$("#days").html("<img src='../images/loader_l.gif'>");
72
		},
73
		success: function(msg)	{
74
			$("#shipping_time").html(msg);
75
		}
76
	});
77
}