Subversion Repositories SmartDukaan

Rev

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