jQuery.fn.Catalog_Images = function(options){
  var options = jQuery.extend({
   color_Height: 20,
   color_Width:  20,
   color_list: ["#087EDF"/*гол*/, "#354F9B"/*син*/, "#BF2646"/*крас*/, "#03A75D"/*зел*/, "#EDC407"/*желт*/, "#DCDDE7"/*мраморн*/, "#EE7C0B"/*оранж*/, "#672294"/*фиолет*/, "#FFFFFF"/*белый*/],
   color_title:["голубой"/*гол*/, "синий"/*син*/, "красный"/*крас*/, "зелёный"/*зел*/, "жёлтый"/*желт*/, "мраморный"/*мраморн*/, "оранжевый"/*оранж*/, "фиолетовый"/*фиолет*/, "белый"/*белый*/],
   images_list: ["", "", "", "", "", "", "", "", ""],
   default_index: 0,
   images_href: "/",
   stand_name: "",
   stand_code: "",
   stand_cost: "",
   item_br: "<br />",
   hv_menu: 0 /*0 = horizontal*/
   },options);
/*
кр   191  38  70		=	#BF2646
жел  237   196   7		=	#EDC407
зел  3   167   93		=	#03A75D
син  53  79  155		=	#354F9B
гол   8   126  223		=	#087EDF
фиол  103   34   148	=	#672294
оранж  238   124  11	=	#EE7C0B
мрамор  220  221  231	=	#DCDDE7
*/
   return this.each(function(event) {
       var isIE = true; /*Проверка на msIE*/
       isIE = jQuery.browser.msie;
       var Block_class = "catalog_images-image";
       var Menu_class  = "catalog_images-menu";
       var Menu_item_class = "catalog_images-menu_item";
       var Menu_help = "<p style=\"text-align:center;\"><b><span style=\"border-bottom: 1px dotted #666; cursor: help;\" title=\"Нажмите на квадратик с интересующим вас цветом\">Выберите (нажмите)</span> цвет стенда</b></p>";
       var S = "td";
       var T = this;
      jQuery(T).html("<center><div class=\""+Block_class+"\"></div>"+options.item_br+Menu_help+"<table align=\"center\" border=\"0\"><tbody><tr align=\"center\" class=\""+Menu_class+"\"></tr></tbody></table></center>");
       var Block = jQuery(T).children("center").children("."+Block_class);
       var Menu  = jQuery(T).children("center").children("table").children("tbody").children("."+Menu_class);
       var span_style = "width:"+options.color_Width+"px; height="+options.color_Height+"px; line-height: "+options.color_Height+"px; ";

       jQuery(T).css("position","relative");

       /*Сделать проверку на равное кол-во элементов цветов и картинок*/

       Block.css({"display":"block"});
       Menu.css({"margin":"0 auto"}).addClass("no_selection");
       if(options.item_br == "") Menu.css({"float":"left", "position":"absolute","top":"0","right":"0"});


       jQuery.each(options.images_list, function(i){
           AddImage(i);
           AddMenuItem(i);
       });
       var Menu_item  = Menu.children(S);
       var Image_item = Block.children("div");

       /*onStartup ++*/
       jQuery(Image_item[options.default_index]).show();
       jQuery(Menu.children(S)[options.default_index]).addClass(Menu_item_class+"-active");
       jQuery(T).append("<br />");
       /*onStartup --*/
       Menu_item.click(function(){
         Menu_item.removeClass(Menu_item_class+"-active");
         jQuery(this).addClass(Menu_item_class+"-active");
         N = jQuery(this).attr("n");
         Image_item.hide();
         jQuery(Image_item[N]).show();
       });

       Menu_item.hover(function(){
         jQuery(this).switchClass(Menu_item_class, Menu_item_class+"-hover",0);
       },function(){
         jQuery(this).switchClass(Menu_item_class+"-hover",Menu_item_class,0);
       });


       function AddImage(i){
         Block.append("<div><img src=\""+options.images_href+options.images_list[i]+"\" /><p>"+options.stand_name+"<br />Код: "+options.stand_code+" ("+options.color_title[i]+")<br />Цена: "+options.stand_cost+"</p></div>");
         Block.children("div:last").hide();
       }
       function AddMenuItem(i){
         hv = (options.hv_menu == 0 )? "" : "<br />";
         Menu.append("<"+S+" n=\""+i+"\" style=\""+span_style+" background-color: "+options.color_list[i]+"; \" class=\""+Menu_item_class+"\" title=\""+options.color_title[i]+"\">&nbsp;</"+S+">"+hv);
       }
   });
   };
