var Site = {
  Common: {
    init: function(e) {
      $('body').addClass('js');
    },
    /* Label propagator */
    accessibleInputValues: function(e) {
      labeltxt = $(e).prev().html();
      if ($(e).val() == '') $(e).val(labeltxt);
      $(e)
        .focusin(function() {
          labeltxt = $(e).prev().html();
          if ($(this).val() == labeltxt) $(e).val('');
        }).focusout(function() {
          labeltxt = $(e).prev().html();
          if ($(e).val() == '') $(e).val(labeltxt);
        });
    },
    firstChild: function(e) {
      $(e + ":first-child").addClass('first-child');
    },
    customScroll: function(e) {
      if (typeof $.fn.jScrollPane != 'undefined') {
        $(e).jScrollPane({showArrows:true, scrollbarWidth:11, scrollbarMargin:12});
      }
    },
    customHorizScroll: function(e) {
      if (typeof $.fn.jScrollHorizontalPane != 'undefined') {
        $(e).jScrollHorizontalPane({showArrows:true, scrollbarHeight:11, scrollbarMargin:0});
      }
    },
  
    oddtablerows: function(e) {
      $(e + '> tbody > tr:nth-child(even)').addClass('odd');
    },
    fourtablerows: function(e) {
      $(e + '> tbody > tr:nth-child(4n+1)').addClass('n1');
      $(e + '> tbody > tr:nth-child(4n+2)').addClass('n2');
      $(e + '> tbody > tr:nth-child(4n+3)').addClass('n3');
      $(e + '> tbody > tr:nth-child(4n)').addClass('n4');
    },
    productsComparison: function(e) {
      $(e + ' .rowheads tbody tr:nth-child(odd)').addClass('odd');
      $(e + ' .rowheads tbody tr:last-child').addClass('last');
      $(e + ' .comparison thead th:nth-child(odd)').addClass('odd');
      $(e + ' .comparison tbody tr:nth-child(odd)').addClass('odd');
      $(e + ' .comparison tbody tr:last-child').addClass('last');
      $(e + ' .comparison tbody td:nth-child(odd)').addClass('odd');
    },
    ie6pngFix: function() {
      if (typeof DD_belatedPNG != 'undefined') {
        DD_belatedPNG.fix('#header .site-name');
      }
    }
  }
};

$(document).ready(function() {
	
	// set the height for the custom scrollbar element
	$('#scroll_news-short').height(234);
	$('#scroll_home-features').height(414);
	
  Site.Common.init();  
  Site.Common.accessibleInputValues('#cse-search-box input.text');
  Site.Common.accessibleInputValues('#newsletter input.text');
  Site.Common.firstChild('#sidenavigation ul#special_products li');
  Site.Common.firstChild('#footer .menu li');
  Site.Common.firstChild('#content .standout_offers .offer');
  Site.Common.oddtablerows('.guide table');
  Site.Common.fourtablerows('.products-paralel table');
  Site.Common.productsComparison('.products-comparison');
  Site.Common.customScroll('.scrollable');
  Site.Common.customHorizScroll('.horizscrollable');
  Site.Common.ie6pngFix();
});
