Subversion Repositories SmartDukaan

Rev

Rev 4926 | Rev 5145 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4926 Rev 4984
Line 1... Line 1...
1
$(function(){
1
$(function(){
-
 
2
	function CollapsibleWidget(container)	{
-
 
3
		
-
 
4
		this.widgetContainer = container;
-
 
5
		this.collapsbiles = $(container).children('.common-widget-control-bar, .common-widget-content-area');
-
 
6
		this.isCollapsed = null;
-
 
7
		
-
 
8
		this.collapse = function()	{
-
 
9
			$(this.collapsbiles).each(function()	{
-
 
10
				$(this).slideUp();
-
 
11
			});
-
 
12
			this.isCollapsed = true;
-
 
13
		};
-
 
14
		
-
 
15
		this.open = function()	{
-
 
16
			$(this.collapsbiles).each(function()	{
-
 
17
				$(this).slideDown();
-
 
18
			});
-
 
19
			this.isCollapsed = false;
-
 
20
		};
-
 
21
		
-
 
22
		this.test = function()	{
-
 
23
		};
-
 
24
	}
-
 
25
	
-
 
26
	ResearchWidget.prototype = new CollapsibleWidget();
-
 
27
	ResearchWidget.prototype.constructor = CollapsibleWidget;
-
 
28
	
-
 
29
	function ResearchWidget(container)	{
-
 
30
		CollapsibleWidget.call(this, container);
-
 
31
	}
-
 
32
	
-
 
33
//	var compareListWidget = new ResearchWidget($('#myresearch'));
-
 
34
//	compareListWidget.test();
2
	
35
	
3
	function updateCompareCount()	{
36
	function updateCompareCount()	{
4
		$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length);
37
		$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length);
5
	}
38
	}
6
	
39
	
Line 27... Line 60...
27
		var widgetBox = $(this).siblings('.common-widget-content-area');
60
		var widgetBox = $(this).siblings('.common-widget-content-area');
28
		var controlBox = $(this).siblings('.common-widget-control-bar');
61
		var controlBox = $(this).siblings('.common-widget-control-bar');
29
		var controlBoxArrowImg = $(this).find('img');
62
		var controlBoxArrowImg = $(this).find('img');
30
		
63
		
31
		if (isColapsed)	{
64
		if (isColapsed)	{
-
 
65
//			compareListWidget.open();
32
			if(controlBox.length > 0)	{
66
			if(controlBox.length > 0)	{
33
				$(controlBox).slideDown('fast', function(){
67
				$(controlBox).slideDown('fast', function(){
34
					$(widgetBox).slideDown();
68
					$(widgetBox).slideDown();
35
					$(controlBoxArrowImg).attr('src', '/images/IconDownArrow_UnselectedTab.png');
69
					$(controlBoxArrowImg).attr('src', '/images/IconDownArrow_UnselectedTab.png');
36
				});
70
				});
37
			} else	{
71
			} else	{
38
				$(widgetBox).slideDown();
72
				$(widgetBox).slideDown();
39
				$(controlBoxArrowImg).attr('src', '/images/IconDownArrow_UnselectedTab.png');
73
				$(controlBoxArrowImg).attr('src', '/images/IconDownArrow_UnselectedTab.png');
40
			}
74
			}
41
		} else	{
75
		} else	{
-
 
76
//			compareListWidget.collapse();
42
			$(widgetBox).slideUp(function(){
77
			$(widgetBox).slideUp(function(){
43
				$(controlBox).slideUp('fast');
78
				$(controlBox).slideUp('fast');
44
				$(controlBoxArrowImg).attr('src', '/images/IconRightArrow_UnselectedTab.png');
79
				$(controlBoxArrowImg).attr('src', '/images/IconRightArrow_UnselectedTab.png');
45
			});
80
			});
46
		}
81
		}
Line 74... Line 109...
74
			} else	{
109
			} else	{
75
				seldata += "&p" + tot + "=" + $(this).val();
110
				seldata += "&p" + tot + "=" + $(this).val();
76
			}
111
			}
77
			tot ++;
112
			tot ++;
78
		});
113
		});
79
 
114
		
80
		if(! haveSameProductType)	{
115
		if(! haveSameProductType)	{
81
			alert("Only products of same category can be compared");
116
			alert("Only products of same category can be compared");
82
		} else if(tot > 6)	{
117
		} else if(tot > 6)	{
83
			alert("Can compare upto five products only.");
118
			alert("Can compare upto five products only.");
84
		} else if(tot > 2)	{
119
		} else if(tot > 2)	{
Line 115... Line 150...
115
							if(t === 0)	{
150
							if(t === 0)	{
116
								$("#research_default").css("display", "block");
151
								$("#research_default").css("display", "block");
117
							}
152
							}
118
						});
153
						});
119
					});
154
					});
-
 
155
					
120
					//Updating the count
156
					//Updating the count
121
					$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length - seldata.length);
157
					$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length - seldata.length);
-
 
158
					
-
 
159
					if ($('#myresearch input[type="checkbox"]').length - seldata.length <= 0)	{
-
 
160
						$("#myresearch").children(".common-widget-top-bar").trigger('click');
-
 
161
					}
122
				}
162
				}
123
			});
163
			});
124
		} else	{
164
		} else	{
125
			alert("Please select atleast one product");
165
			alert("Please select atleast one product");
126
		}
166
		}