Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
1950 rajveer 1
function hideSlides(){
2
	  $('.comparision-hide').each(function(){
3
		    this.style.display = 'none';
4
	  });
5
	  var styleTrack = $('.jspTrack').attr('style');
6
	  $('.jspTrackbottom').attr('style', styleTrack);
7
	  var styleDrag = $('.jspDrag').attr('style');
8
	  $('.jspDragbottom').attr('style', styleDrag);
9
}
10
 
1819 rajveer 11
function renderComparison(){
1807 rajveer 12
  var SelectID;
13
  var subtract;
14
  var check = 0;
15
  var count = $('.comparision-product-column').length;
16
  if(count < 4) {
17
    if(count == 3) {
18
      subtract = 6;
19
    } else if(count == 2) {
20
      subtract = 3;
21
    } else {
22
      subtract = 0;
23
    }
24
    var parentWidth = $('#comparision-right').width();
25
    var width = (parentWidth - subtract)/count;
26
    var newWidth = parseInt(width);
27
    $('.product-name').width(newWidth);
28
    $('.comparision-product-column').width(newWidth);
29
  }
1950 rajveer 30
 
31
  $('.ui-state-default').click(function(){
32
    var aID = $("li.ui-state-active").children('a:first').attr('href');
33
    var array = aID.split("#");
34
    var displayID = array[1];
35
    var new_aID = $(this).children('a:first').attr('href');
36
    var new_array = new_aID.split("#");
37
    var new_displayID = new_array[1];
38
    $('.'+displayID).each(function(){
39
      this.style.display = 'none';
40
      $(this).removeClass("comparision-block").addClass('comparision-hide');
41
    });
42
    if(new_displayID == 'vtab-summary') {
43
      $('#comparision-right').removeClass("product-comparision-internal").addClass('product-comparision-home');
44
      $('.scroller-columns').hide();
45
      $('#comparision-summary-content').show();
46
      $('.comparision-page-title').hide();
47
    } else {
48
      $('#comparision-right').removeClass("product-comparision-home").addClass('product-comparision-internal');
49
      $('.scroller-columns').show();
50
      $('#comparision-summary-content').hide();
51
      $('.comparision-page-title').show();
52
    }
53
    $('.comparision-page-title').html(this.title);
54
    $('.ui-state-active').removeClass("ui-tabs-selected ui-state-active");
55
    $(this).addClass("ui-tabs-selected ui-state-active");
56
    $('.'+new_displayID).each(function() {
57
      var new_count = $('.'+new_displayID).length;
58
      if(new_count !== count) {
59
        $('.comparision-product-column').each(function(){
60
          var check_childern = $(this).find('.'+new_displayID).html();
61
          if(check_childern == null && check == 0) {
62
            $(this).append("<div class='"+new_displayID+" comparision-hide comparision-empty-column'><div class='featureslisting'><ul><li class='mainFeature'>No features listed for this category.</li></ul></div></div>");
63
            check = 1;
64
          }
65
        });
66
      }
67
      $(this).removeClass("comparision-hide").addClass('comparision-block');
68
      check = 0;
69
      this.style.display = 'block';
70
    });
71
    return false;
72
  });
73
 
74
  var count_item_rows =  $('.summarypage-row').length;
75
  var total_column = $('.column-score-total').length;
76
  var cols_row = count_item_rows - total_column;
77
  $(".summary-dropdown").change(function(){
78
    var product_values = '';
79
    var item_Value = this.value;
80
    var item_data = Array();
81
    var importance_data = Array();
82
    var column_count = $('.summary-column').length;
83
 
84
    SelectID = this.id;
85
 
86
    for(i = 0; i < total_column; i++){
87
    	item_data[i] = Array();
88
      var Scores = '';
89
      var k = i + 1;
90
      var j = 0;
91
      $('.product-'+k).each(function(){
92
        var items_html = $(this).html();
93
        if(items_html !== null) {
94
          Scores += items_html+'::';
95
        }
96
        item_data[i][j] = parseFloat(items_html);
97
        j++;
98
      });
99
    }
100
    var items_total = 'itemvalue='+item_Value+'&column='+column_count+'&total='+total_column+'&data='+product_values;
5145 phani.kuma 101
 
1950 rajveer 102
var i = 0;
103
$('.summary-dropdown').each(function(){
104
    importance_data[i] = parseInt($(this).val());
105
    i++;
106
  });
5145 phani.kuma 107
 
1950 rajveer 108
var item = "";
109
for(i = 0; i < total_column; i++){
1977 rajveer 110
    var commulative_weighted_score = 0.0;
111
    var commulative_weights = 0.0;
112
 
113
 
1950 rajveer 114
    for (var j = 0; j < importance_data.length; j++){ 
115
        if(importance_data[j] == 1){
1977 rajveer 116
        	commulative_weighted_score += item_data[i][j]*55;
117
        	commulative_weights += 55;
1950 rajveer 118
        }
119
        if(importance_data[j] == 2){
1977 rajveer 120
        	commulative_weighted_score += item_data[i][j]*30;
121
        	commulative_weights += 30;        
1950 rajveer 122
        }
123
		if(importance_data[j] == 3){
1977 rajveer 124
        	commulative_weighted_score += item_data[i][j]*15;
125
        	commulative_weights += 15;
126
        }
1950 rajveer 127
     } 
1977 rajveer 128
    var weighted_score = commulative_weighted_score/commulative_weights;
1950 rajveer 129
    weighted_score = Math.round(weighted_score*Math.pow(10,1))/Math.pow(10,1);
130
 
1977 rajveer 131
    item += weighted_score + ' / 10::';
1950 rajveer 132
}
133
 
134
  var items_break = '';
135
  items_break = item.split('::');
136
  for(i = 0; i < items_break.length; i++){
137
    var incre = i+1;
138
    var class_name = '.score-total-'+incre;
139
    $(class_name).html(items_break[i]);
140
 
141
  }
142
  });
143
  $('.scroller-columns').hide();
144
  $('.comparision-page-title').hide();
145
 
146
}