function showCompare(i) { $.post("http://www.spep.com/istore/spep.htmldb_istore_sections.compareItems2",{sess:"32141288098429",item:i}, function(data) { if (data !== "") { /*$("#dialogCat").dialog("open"); $("#dialogCat").html(data); $("#dialogCat").dialog({ title: "Item Comparison", modal: false, close: function(event, ui) { if ( event.originalEvent && $(event.originalEvent.target).closest(".ui-dialog-titlebar-close").length ) { $("#dialogCat").dialog("option", "title", ""); showCompare("-1"); $(".compareflag").removeAttr("checked"); } });*/ $("#htmldbDialog").html(data); var w = $("#compareItemsTable").width() + 25; $("#htmldbDialog").dialog({width:w}); if (w == 25) { w = $("#compareItemsTable").width() + 25; $("#htmldbDialog").dialog({ width:w }); } $("#htmldbDialog").dialog("option","position","center"); $("#htmldbDialog").dialog("option", "title", "Item Comparison"); $("#htmldbDialog").dialog({ draggable: true, close: function(event, ui) { if ( event.originalEvent && $(event.originalEvent.target).closest(".ui-dialog-titlebar-close").length ) { $("#htmldbDialog").dialog("option", "title", ""); showCompare("-1"); $(".compareflag").removeAttr("checked"); } } }); } // end if data }); // end $post } // end function showCompare $(function() { $(".compareflag").click(function(el) { itemId=$(this).attr("itemid"); $("#catDebug").html("test"+itemId+" - "+this.checked); if (!this.checked) { itemId="-"+itemId; } showCompare(itemId); }); }); showCompare("","");