$(document).ready(function() {
  
  if ($('.productItemNotFound').length != 0) {
	  $('#description').hide();
	
	
	} else {
	  $('.catalogueTable h4').hide();
	  $('.catalogueTable .shop-catalogue').css('border','0');
    $('.catalogueTable').css('width', '180px');
    $('.catalogueItem .shop-catalogue .image a').attr({href: "#"})

    
    // gets the name of the image displayed in order to insert the table of the same name
    // var fn = $('.catalogueItem .shop-catalogue .image a img').attr('src');
    // var dot = fn.lastIndexOf(".");
    // var table_file = "/tables" + fn.substr(0,dot) + ".htm";
    
    var fn = $('.catalogueItem .shop-catalogue .image a img').attr('src');
    var slash = fn.lastIndexOf("/");
    var dot = fn.lastIndexOf(".");
    var table_file = "/tables" + fn.substr(slash,dot-slash) + ".htm";
    
    $('#spec-table').load(table_file, function(){
       // re-align the table cells in the catalog-description
        $('#spec-table table td').each( function(i) {
            var alignment = $(this).attr('align');
            $(this).css("text-align", alignment);
        });
        
        // add a class to the column separators so that we can style them
        // $('.catalog-description table td[bgcolor]').addClass('column-separator');
        // $('.catalog-description table td[height]').removeAttr('height');
    });
	}
	
});
