jQuery(document).ready(function(){
  
  $('.productRow').inrow({item1:'.productDescriptionCell',item2:'.productNameCell',item3:'.productImageCell',item4: '.productPriceCell'});
  $('.categoryRow').inrow({item1:'.categoriesNameCell',item2:'.categoriesImageCell'});
  $('.categoryRow').inrow({item1:'.categoriesNameCell',item2:'.categoriesImageCell'});
  
  $('.catalog li:last').css('border-bottom','none');
  
  
  $('select:not([id])').each(function(i){
    $(this).attr('id', 'selectId'+i)
  })
  
  $('.contentBoxContents:last').css('border-bottom', 'none');
  $('.reviewsBox:last').css('border-bottom', 'none');
  
  if($("#slider img").length>1){
    jQuery('#slider').nivoSlider({pauseTime:8000, controlNavAlt:true});
  }
  
  $('.mainBanner').close();
  
/*   kol = $('.categoriesSlide > ul > li > ul > li').length;
    if (kol > 4) kol = 4;
    $('.categoriesSlide > ul > li > ul').css('width', kol * $('.categoriesSlide > ul > li > ul').width());
    $('.categoriesSlide > ul > li > ul > li').each(function(i){if(i%4==0 && i!=0)$(this).before('<li class="clear"></li>')});*/
  $('.categoriesSlide > ul > li > ul').wrapInner('<div></div>'); 
   $('.headerNavIn > ul > li > ul').wrapInner('<div></div>');  

/*     col = $('.headerNavIn > ul > li > ul > li').length;
    if (col > 3) col = 3;
    width_ul = col * $('.headerNavIn > ul > li > ul').width()+81;
    $('.headerNavIn > ul > li > ul ').css('width', width_ul);
   
    $('.headerNavIn > ul > li > ul > li > ul > li').each(function(i){if(i%3==0 && i!=0)$(this).before('<li class="clear"></li>')});*/
    
	$('ul#nav_header li li a:last').css('border-bottom', 'none');
  $('.pl_col').hover(function(){
  $(this).addClass('pl_col_hover')
  }, function(){
  $(this).removeClass('pl_col_hover')
  })
    $('.down_main').hover(function(){
  $(this).addClass('down_main_hover')
  }, function(){
  $(this).removeClass('down_main_hover')
  })
  /*tabs for product info*/
  
   var tabContainers = $('div.tabs1 > div'); 
    tabContainers.hide().filter(':first').show(); 
    
    $('div.tabs1 ul.tabNavigation a').click(function () {
        tabContainers.hide(); 
        tabContainers.filter(this.hash).show(); 
        $('div.tabs1 ul.tabNavigation a').removeClass('selected'); 
        $(this).addClass('selected'); 
        return false;
    }).filter(':first').click();
    
    jQuery('.additionalImages').jcarousel();
    jQuery('.photoPreview').jcarousel();
    
});

/*function makeInput(){
  jQuery(function(){
    $('input[type="text"]:not(.inp, .inputBorder), input[type="password"]:not(.inp, .inputBorder)').addClass('inputBorder').wrap('<span class="inputWrapRight"><span class="inputWrap"></span></span>');
  })
}
makeInput();*/


var params = {
    changedEl: ".header_currency select",
    visRows: 8,
    scrollArrows: true
}
cuSel(params);


jQuery(document).ready(function(){
  jQuery('.login').each(function(){
    box_height = 0;
    jQuery(this).find('.logBox').each(function(){
    if (jQuery(this).height() > box_height){
        box_height = jQuery(this).height();
          }
      })
      jQuery(this).find('.logBox').css({'height':box_height+'px'})
   })
})


/* tabs listing mode switch */
function initTabs()
{
	var sets = document.getElementsByTagName("ul");
	for (var i = 0; i < sets.length; i++)
	{
		if (sets[i].className.indexOf("tabset") != -1)
		{
			var tabs = [];
			var links = sets[i].getElementsByTagName("a");
			for (var j = 0; j < links.length; j++)
			{
				if (links[j].className.indexOf("tab") != -1)
				{
					tabs.push(links[j]);
					links[j].tabs = tabs;
					var c = document.getElementById(links[j].href.substr(links[j].href.indexOf("#") + 1));
					if (c) if (links[j].className.indexOf("active") != -1) c.style.display = "block";
					else c.style.display = "none";
					links[j].onclick = function ()
					{
						var c = document.getElementById(this.href.substr(this.href.indexOf("#") + 1));
						if (c)
						{
							for (var i = 0; i < this.tabs.length; i++)
							{
								var tab = document.getElementById(this.tabs[i].href.substr(this.tabs[i].href.indexOf("#") + 1));
								if (tab)
								{
									tab.style.display = "none";
								}
								this.tabs[i].className = this.tabs[i].className.replace("active", "");
							}
							this.className += " active";
							c.style.display = "block";
							return false;
						}
					}
				}
			}
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", initTabs, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initTabs);
