jQuery(document).ready(function(){
  
  $('.productRow').inrow({item1:'.productDescriptionCell',item2:'.productNameCell',item3:'.productImageCell', item4:'.addBlock'});
  $('.catboxBg tr').inrow({item1:'.categoriesImageCell',item2:'.categoriesNameCell'});
  $('.login').inrow({item1:'.contentBoxContents'});
  
  if($("#slider img").length>1){
    $('#slider').coinslider({navigation: true, delay: 8000, width: 710, height: 320});
  }
  
  if ( $.browser.msie && ($.browser.version == 7.0 || $.browser.version == 8.0)) {
    $('.headerBar,\
       h2,\
       .productImageCell')
          .addClass('corner')
          .append('<div class="topLeft"></div><div class="topRight"></div>');
        
    $('div.cartPriceSubTotal,\
       .infoBoxContent')
          .addClass('corner')
          .append('<div class="bottomLeft"></div><div class="bottomRight"></div>');
        
    $('h1,\
       .center_bg .contentBoxContents,\
       .productColumnSell,\
       .productRowSell,\
       .topBanner,\
       .categoryBox,\
       .paginationBox,\
       .mainContent,\
       .noItems,\
       .addBlock')
          .addClass('corner')
          .append('<div class="topLeft"></div><div class="topRight"></div><div class="bottomLeft"></div><div class="bottomRight"></div>');
        
    $('.topLeft, .topRight, .bottomLeft, .bottomRight', '.contentBoxContents h2').remove();
    $('.topLeft, .topRight', '.productRowSell .productImageCell').remove();
    $('.topLeft, .topRight', '.specials h2').remove();
    $('.topLeft, .topRight', 'h2 + .contentBoxContents').remove();
        
  }
  
});



/* 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);
