home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 June / maximum-cd-1999-06.iso / Fireworks 2 / data1.cab / Program_Files / Settings / HTML_Code / FrontPage / slices.htt < prev   
Encoding:
Text File  |  1999-03-01  |  30.1 KB  |  964 lines

  1. // Fireworks Microsoft FrontPage HTML & JavaScript for sliced output & behaviors.
  2. // Version 2.0 10FEB99
  3.  
  4. // To export HTML without comments change the value of variable doComments to "false".
  5. var doComments=true;
  6.  
  7. // When doComments is set to "true" the WRITE_HTML_COMMENT and WRITE_JS_COMMENT functions
  8. // include HTML and JavaScript comments in the exported file.
  9. function WRITE_HTML_COMMENT(str) {
  10.     if (doComments) WRITE_HTML("<!--"+str+"-->\n");
  11. }
  12.  
  13. function WRITE_JS_COMMENT(str) {
  14.     if (doComments) WRITE_HTML("/* "+str+" */\n");
  15. }
  16.  
  17. // Write general comments for copying and pasting Fireworks-generated code into existing HTML documents.
  18. WRITE_HTML_COMMENT("To put this html into an existing HTML document, you must copy ");
  19. WRITE_HTML_COMMENT("and paste the table into a specific location.");
  20. WRITE_HTML("\n");
  21.  
  22. WRITE_HTML("<html>\n");
  23. WRITE_HTML("\n");
  24.  
  25. WRITE_HTML("<head>\n");
  26. WRITE_HTML("\n");
  27.  
  28. // Use Base Name from export dialog as document title.
  29. WRITE_HTML("<title>", exportDoc.filename, "</title>\n");
  30. WRITE_HTML("\n");
  31.  
  32. // Write Meta tags.
  33. WRITE_HTML("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
  34. var charSet = App.getPref("HtmlCharSet");
  35. if (charSet == "") charSet = "iso-8859-1";
  36. WRITE_HTML(charSet + "\">\n"); 
  37. WRITE_HTML("<meta name=\"description\" content=\"Fireworks Splice HTML\">\n");
  38. WRITE_HTML("\n");
  39.  
  40. // Write HTML target and date created.
  41. var d = new Date();
  42. WRITE_HTML("<!-- Fireworks 2.0  Microsoft FrontPage target.  \n    Created ", d, " -->\n");
  43. WRITE_HTML("\n")
  44.  
  45. // Close head tag.
  46. WRITE_HTML("</head>\n");
  47. WRITE_HTML("\n");
  48.  
  49. // Begin body tag. Set background color to Fireworks document canvas color.
  50. WRITE_HTML("<body bgcolor=\"#", exportDoc.backgroundColor, "\">\n\n");
  51.  
  52. // Copying and pasting from the Fireworks-generated HTML file into an existing FrontPage 
  53. // document while in Normal view can cause a loss of functionality. To help the user avoid this,
  54. // write this instructional text to display at the top of the document when viewed in FrontPage or in a browser.
  55. WRITE_HTML("<p>To place this Fireworks output in an existing HTML page, switch to the "); 
  56. WRITE_HTML("HTML view and copy the HTML and JavaScript code beginning with the line:</p>\n");
  57. WRITE_HTML("<p>[!------------ BEGIN COPYING THE TABLE HERE ---------------]</p>\n");
  58. WRITE_HTML("<p>and continuing to the line:</p>\n");
  59. WRITE_HTML("<p>[!------------ STOP COPYING THE TABLE HERE ---------------]</p>\n");
  60. WRITE_HTML("<p>Paste the code into the body of your destination document in the HTML view.</p>\n");
  61. WRITE_HTML("<p>Note: This document and the destination document must be in the same folder.</p>\n");
  62. WRITE_HTML("<p> If you do not want to place this Fireworks output in an existing HTML page, delete this text.</p>\n");
  63. WRITE_HTML("\n");
  64.  
  65.  
  66. // Write comment for start of table copy/paste section.
  67. WRITE_HTML_COMMENT("The following section is an HTML table which reassembles the sliced image in a browser.");
  68. WRITE_HTML_COMMENT("Copy the table section including the opening and closing table tags, and paste the data where");
  69. WRITE_HTML_COMMENT("you want the reassembled image to appear in the destination document. ");
  70. WRITE_HTML("\n");
  71. WRITE_HTML_COMMENT("------------------------ BEGIN COPYING THE TABLE HERE --------------------------");
  72. WRITE_HTML("\n");
  73.  
  74. // The FrontPage webbot command "HTMLMarkup" specifies that code within it
  75. // will not be changed when the file is opened or saved in FrontPage. 
  76. // Write the JavaScript inside this webbot tag to avoid any loss of functionality.
  77. write("<!--webbot bot=\"HTMLMarkup\" startspan -->\n");
  78. WRITE_HTML("\n");
  79.  
  80. // To export HTML without comments change the value of variable doComments to "false".
  81. var doComments=true;
  82.  
  83. // When doComments is set to "true" the WRITE_HTML_COMMENT and WRITE_JS_COMMENT functions
  84. // include HTML and JavaScript in the exported file.
  85. function WRITE_HTML_COMMENT(str) {
  86.     if (doComments) WRITE_HTML("<!--"+str+"-->\n");
  87. }
  88.  
  89. function WRITE_JS_COMMENT(str) {
  90.     if (doComments) WRITE_HTML("/* "+str+" */\n");
  91. }
  92.     
  93. // Declare variables for processing Behaviors.    
  94. var kActionStatusMessage = 1;
  95. var kActionSwapImage = 2;
  96. var kActionRadioGroup = 3;
  97.  
  98. var kEventMouseOver = 0;
  99. var kEventOnClick = 1;
  100. var kEventMouseOut = 2;
  101.  
  102. var hasGroup = false;
  103. var hasDownGroup = false;
  104. var hasStatusMessage = false;
  105. var hasStatusHotspot = false;
  106. var hasSwap = false;
  107.  
  108. function CellName(row, col) {
  109.     var cellName = "N" + exportDoc.imagename + "_" + (row+1) + "_" + (col+1);
  110.     var curSlice = slices[row][col];
  111.     if (curSlice && curSlice.getFrameFileName(0)) {
  112.         cellName = curSlice.getFrameFileName(0).toString();
  113.         curSlice.setFrameFileName(0, cellName);
  114.         // remove illegal characters
  115.         cellName = cellName.replace(/\W/g, "");
  116.         // if it starts with a number, add N to the front.
  117.         if (cellName == "") cellName = "N" + exportDoc.imagename + "_" + (row+1) + "_" + (col+1);
  118.         if (cellName.search(/\d/) == 0) {
  119.             cellName = "N"+cellName;
  120.         }
  121.     }
  122.     return(cellName);
  123. }
  124.  
  125. // Determine and process Behaviors in the document.
  126. function ProcessBehavior(theCurBehaviors, displayStatusMessage) {
  127.     
  128.     // Declare variable for processing Behaviors.
  129.     var gotJavascript = false;
  130.  
  131.     var overStat = false;
  132.     var hitStat = false;
  133.     var outStat = false;
  134.     var curRestore = false;
  135.     var numRestore = 0;
  136.     var eraseStatOnRestore = false;
  137.  
  138.     var groupName = false;
  139.     
  140.     // Determine if this set of Behaviors includes a toggle group name.
  141.     for (var i=0; i<theCurBehaviors.numberOfBehaviors; i++) {
  142.         var curBehavior = theCurBehaviors[i];
  143.         if (curBehavior.action == kActionRadioGroup) {
  144.             groupName = curBehavior.groupName;
  145.         }
  146.     }
  147.     var swapImageOver = "";
  148.     var swapImageClick = "";
  149.     var swapImageOut = "";
  150.  
  151.     // Translate Behaviors into JavaScript.
  152.     for (var i=0; i<theCurBehaviors.numberOfBehaviors; i++) {
  153.         var curBehavior = theCurBehaviors[i];
  154.         var curSwap = "";  
  155.         curRestore = false;
  156.         var swapRow = 0;
  157.         var swapCol = 0;
  158.         var swapFrame = 0; 
  159.         
  160.         // Translate Swap Image Behaviors into JavaScript.
  161.         if (curBehavior.action == kActionSwapImage) {
  162.             gotJavascript = true;
  163.             curRestore = curBehavior.restoreOnMouseout;
  164.             swapRow = curBehavior.targetRowNum;
  165.             swapCol = curBehavior.targetColumnNum;
  166.             swapFrame = curBehavior.targetFrameNum; 
  167.             var fileName;
  168.             if (curBehavior.hasHref) {
  169.                 fileName = curBehavior.href;
  170.             } else {
  171.                 fileName = slices.imagesDirPath + slices[swapRow][swapCol].getFrameFileName(swapFrame) + slices[swapRow][swapCol].imageSuffix;
  172.             }
  173.             
  174.             var cellName = CellName(swapRow,swapCol);
  175.  
  176.             curSwap += "'" +cellName +"','";
  177.             curSwap += fileName +"'";
  178.             if (curBehavior.event == kEventOnClick) {
  179.                 /* Need click file */
  180.                 if (slices[swapRow][swapCol].getFrameFileName(3) && swapFrame == 2) {
  181.                     fileName = slices.imagesDirPath + slices[swapRow][swapCol].getFrameFileName(3) + slices[swapRow][swapCol].imageSuffix;
  182.                 }
  183.                 curSwap += ",'" + fileName + "'";
  184.             }
  185.         }
  186.         
  187.         // Translate Status Bar Message Behavior into JavaScript.
  188.         if (curBehavior.action == kActionStatusMessage) {
  189.             gotJavascript = true;
  190.             var statMsg = curBehavior.statusText;
  191.             var curStat = "";
  192.             curStat = displayStatusMessage+"('" + statMsg + "');";
  193.             if (curBehavior.restoreOnMouseout) eraseStatOnRestore=true;
  194.  
  195.             if (curBehavior.event == kEventMouseOver) {
  196.                 javaOver += curStat;
  197.                 overStat = true;
  198.             }    
  199.             if (curBehavior.event == kEventOnClick) {
  200.                 javaClick += curStat;
  201.                 hitStat = true;
  202.             }    
  203.             if (curBehavior.event == kEventMouseOut) {
  204.                 javaOut += curStat;
  205.                 outStat = true;
  206.             }
  207.             continue;
  208.         }
  209.                 
  210.         if (groupName) {        
  211.             // If swap images are part of a group, translate swap image behaviors into JavaScript.
  212.             if (curBehavior.event == kEventMouseOver) {
  213.                 if (curSwap) {
  214.                     if (swapImageOver) swapImageOver += ",";
  215.                     swapImageOver += curSwap;
  216.                 }
  217.             }
  218.             if (curBehavior.event == kEventMouseOut) {
  219.                 if (curSwap) {
  220.                     if (swapImageOut) swapImageOut += ",";
  221.                     swapImageOut += curSwap;
  222.                 }
  223.             }
  224.             if (curBehavior.event == kEventOnClick) {
  225.                 if (curSwap) {
  226.                     tag = ");"; 
  227.                     javaClick += "GrpDown('" + groupName + "'," + curSwap + tag;
  228.                 }
  229.             }
  230.             if (curRestore) numRestore++;
  231.         } else {
  232.  
  233.             // If swap images are not part of a group, translate swap image behaviors into JavaScript.
  234.             if (curBehavior.event == kEventMouseOver) {
  235.                 if (curSwap) {
  236.                     javaOver += "di20(" + curSwap + ");";
  237.                 }
  238.             }    
  239.             if (curBehavior.event == kEventOnClick) {
  240.                 if (curSwap) {
  241.                     javaClick += "di20(" + curSwap + ");";
  242.                 }
  243.             }    
  244.             if (curBehavior.event == kEventMouseOut) {
  245.                 if (curSwap) {
  246.                     javaOut += "di20(" + curSwap + ");";
  247.                 }
  248.             }
  249.             var origFileName = slices[swapRow][swapCol].getFrameFileName(0);
  250.             if (curRestore) {
  251.                 javaOut += "di20('" + CellName(swapRow,swapCol) + "','";
  252.                 javaOut += slices.imagesDirPath + origFileName + slices[swapRow][swapCol].imageSuffix + "');"
  253.             }
  254.         }        
  255.     }
  256.  
  257.     // Final processing for swap images and toggle groups.
  258.     if (groupName) {
  259.         if (swapImageOver) {
  260.             tag = ");"; 
  261.             javaOver += "GrpSwap('" + groupName + "'," + swapImageOver + tag;
  262.         }    
  263.         if (swapImageOut) {
  264.             tag = ");"; 
  265.             javaOut += "GrpSwap('" + groupName + "'," + swapImageOut + tag;
  266.         }
  267.         if (numRestore >= 1) {
  268.             javaOut += "GrpRestore('" + groupName + "');" ;
  269.         }    
  270.     }
  271.     
  272.     // Erase status bar message onMouseOut.
  273.     if (eraseStatOnRestore) {
  274.         javaOut += displayStatusMessage+"(' ');" ;
  275.         outStat = true;
  276.     }
  277.     
  278.     // Status bar messages require a return value in Netscape. 
  279.     // Put return at end of JavaScript.
  280.     var ret = "return document.MM_returnValue";
  281.     if (overStat) javaOver += ret;
  282.     if (outStat) javaOut += ret;
  283.     if (hitStat) javaClick += ret;
  284.     return(gotJavascript);
  285. }
  286.  
  287. // Begin Script. Hide Script from non-javascript-enabled browsers.
  288. WRITE_HTML("<script language=\"JavaScript\">\n");
  289. WRITE_HTML("<!-- hide this script from non-javascript-enabled browsers\n");
  290. WRITE_HTML("\n");
  291.  
  292. // Find and declare all images used in Behaviors.
  293. WRITE_HTML("if (document.images) {\n")
  294.  
  295.     function DoFile(curBeh) {
  296.         var swapRow = curBeh.targetRowNum;
  297.         var swapCol = curBeh.targetColumnNum;
  298.         var swapFrame = curBeh.targetFrameNum; 
  299.         var fileName = slices[swapRow][swapCol].getFrameFileName(0);
  300.         if (curBeh.hasTargetFrame && swapFrame > 0) {
  301.             var frame = swapFrame + 1;
  302.             fileName = fileName + "_F" + frame;
  303.             slices[swapRow][swapCol].setFrameFileName(swapFrame, fileName);
  304.             slices[swapRow][swapCol].isSwapped = true;
  305.         } 
  306.     }
  307.  
  308.     // Build a list of toggle groups in array groups.
  309.     var groups = new Array;
  310.     function AddGroup(name) {
  311.         var i;
  312.         for (i=0; i<groups.length; i++) {
  313.             if (groups[i] == name) return;
  314.         }
  315.         groups[i] = name;
  316.     }
  317.  
  318.     // Examine all behaviors to determine what groups and actions are present. 
  319.     // Determine which files to pre-cache.
  320.     for (var curRow = 0; curRow < slices.numRows; curRow++) {
  321.         for (var curCol = 0; curCol < slices.numColumns; curCol++) {
  322.             if (slices[curRow][curCol].skipCell) continue;
  323.             if (slices[curRow][curCol].behaviors.numberOfBehaviors > 0) {
  324.                 var behaviors = slices[curRow][curCol].behaviors;
  325.                 for (var i=0; i<behaviors.numberOfBehaviors; i++) {
  326.                     var curBehavior = behaviors[i];
  327.                     if (curBehavior.action == kActionSwapImage) {
  328.                         DoFile(curBehavior);
  329.                         hasSwap = true;
  330.                     }
  331.                     if (curBehavior.action == kActionStatusMessage) {
  332.                         hasStatusMessage = true;
  333.                         if (slices[curRow][curCol].hasImagemap) {
  334.                             hasStatusHotspot = true;
  335.                         }
  336.                     }
  337.                     if (curBehavior.action == kActionRadioGroup) {
  338.                         hasGroup=true;
  339.                         AddGroup(curBehavior.groupName);
  340.                     }
  341.                 }
  342.             }
  343.             var imagemap = slices[curRow][curCol].imagemap;
  344.             for (var j=0; j < imagemap.numberOfURLs; j++) {
  345.                 var curImagemap = imagemap[j];
  346.                 var behaviors = curImagemap.behaviors;
  347.                 for (var i=0; i<behaviors.numberOfBehaviors; i++) {
  348.                     var curBehavior = behaviors[i];
  349.                     if (curBehavior.action == kActionSwapImage) {
  350.                         DoFile(curBehavior);
  351.                         hasSwap = true;
  352.                     }
  353.                     if (curBehavior.action == kActionStatusMessage) {
  354.                         hasStatusHotspot = true;
  355.                     }
  356.                     if (curBehavior.action == kActionRadioGroup) {
  357.                         hasGroup = true;
  358.                         if (curBehavior.event == kEventOnClick) {
  359.                             hasDownGroup = true;
  360.                         }
  361.                         AddGroup(curBehavior.groupName);
  362.                     }
  363.                 }
  364.             }
  365.         }
  366.     }
  367.     
  368.     // Write precache function.
  369.     for (var curRow = 0; curRow < slices.numRows; curRow++) {
  370.         for (var curCol = 0; curCol < slices.numColumns; curCol++) {
  371.             if (slices[curRow][curCol].skipCell) continue;
  372.             var cellName = CellName(curRow,curCol);
  373.             var curFile = slices[curRow][curCol].getFrameFileName(0);
  374.             for (var curFrame = 0; curFrame < exportDoc.numFrames; curFrame++) {                
  375.                 var curFile = slices[curRow][curCol].getFrameFileName(curFrame);
  376.                 if (!curFile) continue;
  377.                 if (curFrame == 0 && !slices[curRow][curCol].isSwapped) continue;
  378.                 // Declare and name each image and specify width and height. Ex: I_02_02_F2= new Image(47, 16);
  379.                 WRITE_HTML(cellName, "_F", curFrame+1, 
  380.                     " = new Image(", slices[curRow][curCol].width, "," , slices[curRow][curCol].height,"); ");
  381.                 // Write image source. Ex: I_02_02_F2.src = "File_02_02_F2.gif";
  382.                 WRITE_HTML(cellName, "_F", curFrame+1, 
  383.                     ".src = \"", slices.imagesDirPath, curFile, slices[curRow][curCol].imageSuffix,"\";\n");
  384.             }
  385.         }
  386.     }        
  387. WRITE_HTML("}\n");
  388. WRITE_HTML("\n");
  389.  
  390.  
  391. /*--------------------------  JavaScript functions used in the HTML -----------------*/
  392.  
  393. /* Function dm executes status bar messages. */
  394. function dm(msgStr) {
  395.     window.status = msgStr;
  396.     document.MM_returnValue = true;
  397. }
  398.  
  399. /* Function dmim executes browser detection when image map hotspots have status bar messages. */
  400. function dmim(msgStr) {
  401.   document.MM_returnValue = false;
  402.   var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";
  403.   if (showMsg) {
  404.      window.status = msgStr;
  405.      document.MM_returnValue = true;
  406.   }
  407. }
  408.  
  409. /* Function di20 executes image swaps. */
  410. function di20(id,newSrc){
  411.     var theImage = FWFindImage(document, id, 0);
  412.     if (theImage) theImage.src=newSrc;
  413. }
  414.  
  415. /* Function FWFindImage locates an image which may be in a CSS layer. This allows the user
  416.    to move images between layers in an html editor without breaking behaviors. */
  417. function FWFindImage(doc, name, j)
  418. {
  419.     var theImage=false;
  420.     if (doc.images) {
  421.         theImage = doc.images[name];
  422.     }
  423.     if (theImage) return theImage;
  424.     if (doc.layers) {
  425.         for (j=0; j<doc.layers.length; j++) {
  426.             theImage = FWFindImage(doc.layers[j].document, name, 0);
  427.             if (theImage) return(theImage);
  428.         }
  429.     }
  430.     return(false);
  431. }
  432.  
  433. /* Function setCookie creates a browser cookie for tracking and setting button states. */  
  434. function setCookie(name, value) {
  435.    document.cookie = name + "=" + escape(value)
  436. }
  437.  
  438. /* Function getCookie reads a browser cookie for setting button states. */  
  439. function getCookie(Name) {
  440.     var search = Name + "="
  441.     var retVal = "";
  442.     if (document.cookie.length > 0) { // if there are any cookies
  443.          offset = document.cookie.indexOf(search);
  444.          if (offset != -1) { // if cookie exists 
  445.              // set index of beginning of value
  446.              end = document.cookie.indexOf(";", offset) 
  447.              // set index of end of cookie value
  448.              offset += search.length 
  449.              if (end == -1) 
  450.                 end = document.cookie.length;
  451.              retVal = unescape(document.cookie.substring(offset, end)) ;
  452.          } 
  453.     }
  454.     return(retVal);
  455. }
  456.  
  457. /* Function InitGrp checks for a cookie for the current toggle group and uses that information
  458.    to set the current down button state. */  
  459. function InitGrp(grp) {
  460.     var cmd = false; if (getCookie) cmd = getCookie(grp);
  461.     if (cmd) {
  462.         eval("GrpDown("+cmd+")");
  463.         eval("GrpRestore("+cmd+")");
  464.     }
  465. }
  466.  
  467. /* Function FindGroup locates toggle group information in the current document and
  468.    creates it if it has not already been declared. */
  469. function FindGroup(grp, imageName) {
  470.     var img = FWFindImage(document, imageName, 0);
  471.     if (!img) return(false);
  472.     var docGroup = eval("document.FWG_"+grp);
  473.     if (!docGroup) {
  474.         docGroup = new Object;
  475.         eval("document.FWG_"+grp+" = docGroup");
  476.         docGroup.theImages = new Array;
  477.     }
  478.     if (img) {
  479.         var i;
  480.         for (i=0; i<docGroup.theImages.length; i++) {
  481.             if (docGroup.theImages[i] == img) break;
  482.         }
  483.         docGroup.theImages[i] = img; 
  484.         if (!img.atRestSrc) {
  485.             img.atRestSrc = img.src;
  486.             img.initialSrc = img.src;
  487.         }
  488.     }
  489.     return(docGroup);
  490. }
  491.  
  492. /* Function GrpDown sets appropriate image to the down state. */
  493. function GrpDown(grp,imageName,downSrc,downOver){
  494.     if(!downOver) downOver = downSrc;
  495.     var cmd = "'" + grp + "','" + imageName    + "','" + downSrc + "','" + downOver + "'";
  496.     setCookie(grp, cmd);
  497.     var docGroup = FindGroup(grp, imageName, false);
  498.     if (!docGroup || !downSrc) return;
  499.     obj = FWFindImage(document,imageName,0);
  500.     var theImages = docGroup.theImages;
  501.     if (theImages) {
  502.         for (i=0; i<theImages.length; i++) {
  503.             var curImg = theImages[i];
  504.             if (curImg && curImg != obj) {
  505.                 curImg.atRestSrc = curImg.initialSrc;
  506.                 curImg.isDown = false; obj.downOver = false
  507.                 curImg.src = curImg.initialSrc;
  508.             }
  509.         }
  510.     }
  511.     obj.atRestSrc = downSrc; obj.downOver = downOver
  512.     obj.src = downOver; obj.isDown = true;
  513. }
  514.  
  515. /* Function GrpSwap swaps one or more images and restores all other images in the group
  516.    to their default state. */
  517. function GrpSwap(grp){
  518.     var i,j=0,newSrc,objName;
  519.     var docGroup = false;
  520.     for (i=1; i < (GrpSwap.arguments.length-1); i+=2) {
  521.         objName = GrpSwap.arguments[i];
  522.         newSrc = GrpSwap.arguments[i+1];
  523.         docGroup = FindGroup(grp, objName);
  524.         if (!docGroup) continue;
  525.         obj = FWFindImage(document,objName,0);
  526.         if (!obj) continue;
  527.         if (obj.isDown) {
  528.             if (obj.downOver) { 
  529.                 obj.src = obj.downOver;
  530.             }
  531.         } else {
  532.             obj.src = newSrc;
  533.             obj.atRestSrc = obj.initialSrc;
  534.         }
  535.         obj.skipMe = true;
  536.         j++;
  537.     }
  538.     if (!docGroup) return;
  539.     theImages = docGroup.theImages;
  540.     if (theImages) {
  541.         for (i=0; i<theImages.length; i++) {
  542.             var curImg = theImages[i];
  543.             if (curImg.atRestSrc && !curImg.skipMe) {
  544.                 curImg.src = curImg.atRestSrc;
  545.             }
  546.             curImg.skipMe = false;
  547.         }
  548.     }
  549. }
  550.  
  551. /* Function GrpRestore sets all images in the group to their default states. */
  552. function GrpRestore(grp){
  553.     var docGroup = eval("document.FWG_"+grp);if (!docGroup) return;
  554.     theImages = docGroup.theImages;
  555.     if (theImages) {
  556.         for (i=0; i<theImages.length; i++) {
  557.             var curImg = theImages[i];
  558.             if (curImg.atRestSrc) {
  559.                 curImg.src = curImg.atRestSrc;
  560.             }
  561.         }
  562.     }
  563. }
  564.  
  565. /*----------------- END JavaScript functions used in the HTML -----------------*/
  566.  
  567. // Write out only the JavaScript functions needed for the HTML.
  568.  
  569. // Write function dm if document includes status bar messages.
  570. if (hasStatusMessage) {
  571.     WRITE_JS_COMMENT("functions that displays status bar message.")
  572.     WRITE_HTML(dm);
  573.     WRITE_HTML("\n");
  574. }
  575.  
  576. // Write function dmim if document includes image map hotspots with status bar messages.
  577. if (hasStatusHotspot) {
  578.     WRITE_HTML(dmim);
  579.     WRITE_HTML("\n");
  580. }
  581.  
  582. // Write function di20 if document includes swap image behaviors.
  583. if (hasSwap) {
  584.     WRITE_JS_COMMENT("function that swaps images")
  585.     WRITE_HTML(di20);
  586.     WRITE_HTML("\n");
  587. }
  588.  
  589. // Write FWFindImage if document includes toggle group or swap image behaviors so
  590. // that images may be moved between CSS layers in an HTML editor.
  591. if (hasSwap || hasGroup) {
  592.     WRITE_HTML(FWFindImage);
  593.     WRITE_HTML("\n");
  594. }
  595.  
  596. // Write the following functions for toggle group behaviors and tracking.
  597. if (hasGroup) {
  598.     WRITE_HTML(setCookie);
  599.     WRITE_HTML(getCookie);
  600.     WRITE_HTML(InitGrp);
  601.     WRITE_HTML(FindGroup);
  602.     WRITE_HTML(GrpDown);
  603.     WRITE_HTML(GrpSwap);
  604.     WRITE_HTML(GrpRestore);
  605. }
  606.  
  607. // Stop hiding script from non-javascript-enabled browsers. End script.
  608. WRITE_HTML("// stop hiding -->\n");
  609. WRITE_HTML("\n");
  610. WRITE_HTML("</script>\n");
  611. WRITE_HTML("\n");
  612.  
  613. // Close FrontPage webbot tag.
  614. write("<!--webbot bot=\"HTMLMarkup\" endspan -->\n");
  615. WRITE_HTML("\n");
  616.  
  617. WRITE_HTML_COMMENT(" Image with table ");
  618. WRITE_HTML("\n");
  619.  
  620. // Begin table.
  621. WRITE_HTML( "<table ");
  622.  
  623. // If the Fireworks document's canvas is not transparent and the Include undefined slices checkbox
  624. // is off, give the table a background color based on the FIreworks document's canvas color.
  625. if (!exportDoc.backgroundIsTransparent && slices.doSkipUndefined) {
  626.     WRITE_HTML("bgcolor=\"#", exportDoc.backgroundColor, "\"");
  627. WRITE_HTML("border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"",
  628.         exportDoc.width, "\">\n");
  629.         
  630.         
  631.     var hasImageMap = false;
  632.     var curCol;
  633.     var curRow;
  634.     var downIndex = 0;
  635.     
  636. // If shims have been specified, write shim row.    
  637.     if (slices.doShimEdges) {
  638.         WRITE_HTML("  <tr>");
  639.         WRITE_HTML_COMMENT(" spacing row, 1 height. ");
  640.         for (curCol = 0; curCol < slices.numColumns; curCol++) {
  641.             WRITE_HTML("   <td><img src=\"", slices.shimPath, "\" width=\"", 
  642.                 slices[0][curCol].cellWidth, "\" height=\"1\" border=\"0\"></td>\n"); 
  643.         }
  644.         WRITE_HTML("   <td><img src=\"", slices.shimPath, "\" width=\"1", 
  645.             "\" height=\"1\" border=\"0\"></td>\n"); 
  646.         WRITE_HTML("  </tr>\n");
  647.         WRITE_HTML("\n");
  648.     }
  649.  
  650. // Write table rows.
  651.     for (curRow = 0; curRow < slices.numRows; curRow++) {
  652.         WRITE_HTML("  <tr>");
  653.         WRITE_HTML_COMMENT(" row "+(curRow+1)+" ");
  654.         for (curCol = 0; curCol < slices.numColumns; curCol++) {
  655.             var curSlice = slices[curRow][curCol];
  656.             if (curSlice.skipCell) continue; 
  657.  
  658.             // Write rowspan and colspan if necessary. Ex: rowspan="1" colspan="3"
  659.             WRITE_HTML("   <td");
  660.             if (curSlice.rowSpan > 1) {
  661.                 WRITE_HTML(" rowspan=\"", curSlice.rowSpan,"\"");
  662.             }
  663.             if (curSlice.columnSpan>1) {
  664.                 WRITE_HTML(" colspan=\"", curSlice.columnSpan, "\"");
  665.             }
  666.             WRITE_HTML(">");
  667.  
  668.             // Write HTML text from slices set to "Text (No Image)"
  669.             if (!curSlice.hasImage) {
  670.                 // no image, just dump out html text.
  671.                 WRITE_HTML(curSlice.htmlText, "</td>\n");
  672.                 continue;
  673.             }
  674.  
  675.             // If current slice is not defined by a slice object and Export Undefined
  676.             // Slices is not checked, don't output an image and if Shims are specified 
  677.             // place a shim image in the current cell.
  678.             if (curSlice.isUndefined && slices.doSkipUndefined) {
  679.                 if (slices.doShimInternal || slices.doShimEdges) {
  680.                     WRITE_HTML("<img src=\"",
  681.                         slices.shimPath, "\" width=\"", curSlice.width, "\" height=\"", 
  682.                         curSlice.height, "\" border=\"0\">"); 
  683.                 }
  684.                 WRITE_HTML("</td>\n");
  685.                 // Tell Fireworks to not write the image file. Setting the filename to "" forces 
  686.                 // Fireworks to not generate the image.
  687.                 var q;
  688.                 for (q=0; q<exportDoc.numFrames; q++) {
  689.                     curSlice.setFrameFileName(q, "");
  690.                 }    
  691.                 continue;
  692.             }
  693.  
  694.             // Write link if slice has URL attached.
  695.             var href = "href=\"#\"";
  696.             var hasHref = curSlice.hasHref;
  697.             var abortHref = false;
  698.             if (curSlice.hasHref) {
  699.                 href = "href=\"";
  700.                 href += curSlice.href;
  701.                 href += "\"";
  702.                 if (curSlice.hasTargetText) {
  703.                     href += " target=\"";
  704.                     href += curSlice.targetText;
  705.                     href += "\"";
  706.                 }
  707.                 
  708.                 // If exporting demo HTML, ignore the URL and replace with none.
  709.                 if (slices.doDemoHTML && curSlice.getFrameFileName(2)) {
  710.                     hasHref = false;
  711.                     href = "href= \"#\"";
  712.                 }
  713.             }
  714.  
  715.             // Initialize variables for rollover and swap image behaviors.
  716.             var javaOver = "";
  717.             var javaOut = "";
  718.             var javaClick = "";
  719.             var cellName = CellName(curRow, curCol);
  720.             var anchorTagOpen = false;
  721.  
  722.             // If the slice has image map hotspots and has a url attached to it,
  723.             // ignore the url here and move it into the image map.
  724.             if (curSlice.hasImage && curSlice.hasImagemap) {
  725.                 abortHref = true;  // we will put the href in the imagemaps.
  726.             }
  727.  
  728.             // Write rollover and swap image events.
  729.             if (!abortHref) {
  730.                 var behaviors = curSlice.behaviors;
  731.                 var gotJavascript = ProcessBehavior(behaviors, "dm");
  732.  
  733.                 if ( gotJavascript || curSlice.hasHref) {
  734.                       WRITE_HTML("<a ");
  735.                     anchorTagOpen = true;
  736.                     WRITE_HTML(href);
  737.  
  738.                     if (javaOut != "") {
  739.                         WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
  740.                     }
  741.                     if (javaOver != "") {
  742.                         WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
  743.                     }
  744.                     if (javaClick != "") {
  745.                         WRITE_HTML(" onClick=\"", javaClick, "\" ");
  746.                     }
  747.                     WRITE_HTML(">");
  748.                 }
  749.             }
  750.  
  751.             // Place image.
  752.             if (curSlice.hasImage) {
  753.                 var imageName = curSlice.getFrameFileName(0); 
  754.                 var altText = "";
  755.                 if (curSlice.hasAltText) {
  756.                     altText = curSlice.altText;
  757.                 } else {
  758.                     altText = exportDoc.altText;
  759.                 }
  760.  
  761.                 // Assemble info for image tag.
  762.                 // Ex: <img name="N_03_02" src="File_03_02.gif" width="79" height="71" border="0"
  763.                 WRITE_HTML("<img name=\"", cellName, "\" src=\"",
  764.                     slices.imagesDirPath, imageName, curSlice.imageSuffix, "\" width=\"",
  765.                     curSlice.width,"\" height=\"", curSlice.height, "\" border=\"0\"");
  766.  
  767.                 // Write image map name.
  768.                 // Ex: usemap="#base_r1_c2"
  769.                 if (curSlice.hasImagemap) {                         
  770.                     WRITE_HTML(" usemap=\"#", imageName, "\""); 
  771.                     hasImageMap = true;
  772.                 }
  773.                 
  774.                 // Write alt text.
  775.                 if (altText != "") {
  776.                     WRITE_HTML(" alt=\"", altText, "\"");
  777.                 }
  778.                 WRITE_HTML(">");    
  779.             }
  780.  
  781.             if (anchorTagOpen) {
  782.                 WRITE_HTML("</a>");    
  783.             }
  784.             WRITE_HTML("</td>\n");    
  785.         }
  786.         
  787.         // Place shim in rightmost column of table.
  788.         if (slices.doShimEdges) {
  789.             /* Write the 1 pixel transparent shim. */
  790.             WRITE_HTML("   <td><img src=\"",
  791.                 slices.shimPath, "\" width=\"1\" height=\"", 
  792.                 slices[curRow][0].cellHeight, "\" border=\"0\"></td>\n"); 
  793.         }
  794.         WRITE_HTML("  </tr>\n");
  795.         WRITE_HTML("\n");
  796.     }        
  797.  
  798.     // Close table.
  799.     WRITE_HTML("</table>\n");
  800.     WRITE_HTML("\n");
  801.     
  802.      // Write the image map inside of a HTMLMarkup webbot to allow
  803.      // rollovers and status bar messages attached to hotspots without
  804.      // having FrontPage write over them.
  805.      if (hasImageMap) {
  806.         write("<!--webbot bot=\"HTMLMarkup\" startspan -->\n");
  807.     }
  808.  
  809.     // Traverse all slices and generate any image maps needed.
  810.     for (curRow = 0; curRow < slices.numRows; curRow++) {
  811.         for (curCol = 0; curCol < slices.numColumns; curCol++) {
  812.             var curSlice = slices[curRow][curCol];
  813.             if (curSlice.skipCell) continue; 
  814.             if (curSlice.hasImagemap) {
  815.             
  816.                 // Write the image map.
  817.                 write("\n<!--webbot bot=\"ImageMap\" default=\"", curSlice.href,"\" -->\n");
  818.                 WRITE_HTML("\n<map name=\"", curSlice.getFrameFileName(0), "\">\n");
  819.  
  820.                 var i = 0;
  821.                 var imagemap = curSlice.imagemap;
  822.                 while (i < imagemap.numberOfURLs) {
  823.                     var curImagemap = imagemap[i];
  824.  
  825.                     var behaviors = curImagemap.behaviors;
  826.  
  827.                     if (behaviors.numberOfBehaviors==0) {
  828.                         behaviors = curSlice.behaviors;
  829.                     }
  830.                      var javaOver = "";
  831.                     var javaOut = "";
  832.                     var javaClick = "";
  833.                     var gotJavascript = ProcessBehavior(behaviors, "dmim");
  834.     
  835.                     // Write the area tag with shape definitions.
  836.                     WRITE_HTML("<area shape=\"");
  837.                     WRITE_HTML(curImagemap.shape); // Shapes are rect poly and circle
  838.                     WRITE_HTML("\" coords=\"");
  839.                     for (var j=0; j<curImagemap.numCoords; j++) {
  840.                         if (j>0) WRITE_HTML(",");
  841.                         // polygon has n coords.
  842.                         // rect has 2 coords, topLeft, and botomRight.
  843.                         // Circle has one coord, center; plus radius.
  844.                         WRITE_HTML((curImagemap.xCoord(j)-curSlice.left), ",", (curImagemap.yCoord(j)-curSlice.top)); 
  845.                     }
  846.                     if (curImagemap.shape == "circle") {
  847.                         // Write the radius for circle hotspots.
  848.                         WRITE_HTML(", ", curImagemap.radius);
  849.                     }
  850.                     WRITE_HTML("\"");
  851.                     var href = " href=\"#\"";
  852.                     if (curImagemap.hasHref) {
  853.                         href = " href=\"";
  854.                         href += curImagemap.href;
  855.                         href += "\"";
  856.                         if (curImagemap.hasTargetText) {
  857.                             href += " target=\"";
  858.                             href += curImagemap.targetText;
  859.                             href += "\"";
  860.                         }
  861.                     }
  862.  
  863.                     WRITE_HTML(href);
  864.                     
  865.                     // Write alt text for hotspot.
  866.                     var altText = "";
  867.                     if (curImagemap.hasAltText) {
  868.                         altText = curImagemap.altText;
  869.                     } else {
  870.                         altText = exportDoc.altText;
  871.                     }
  872.  
  873.                     if (altText!="") {
  874.                         WRITE_HTML(" title=\"", altText, "\"");
  875.                         WRITE_HTML(" alt=\"", altText, "\"");
  876.                     }
  877.  
  878.                     // Write rollover and swap image behaviors.
  879.                     if (javaOut != "") {
  880.                         WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
  881.                     }
  882.                     if (javaOver != "") {
  883.                         WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
  884.                     }
  885.                     if (javaClick != "") {
  886.                         WRITE_HTML(" onClick=\"", javaClick, "\" ");
  887.                     }
  888.  
  889.                     WRITE_HTML(" >\n");
  890.                     i++;
  891.                 } 
  892.                 behaviors = slices[curRow][curCol].behaviors;
  893.                  var javaOver = "";
  894.                 var javaOut = "";
  895.                 var javaClick = "";
  896.                 var gotJavascript = ProcessBehavior(behaviors,"dmim");
  897.                 
  898.                 // If the current slice had a URL attached, it was moved and written here.
  899.                 if (gotJavascript || curSlice.hasHref) {
  900.                     WRITE_HTML("<area shape=\"rect\" coords=\"0,0, ", curSlice.width, ",", curSlice.height, "\" ");
  901.                     var href="#";
  902.                     if (curSlice.hasHref) {
  903.                         href = curSlice.href;
  904.                     }
  905.                     WRITE_HTML("href=\"", href, "\"");
  906.  
  907.                     if (curSlice.hasTargetText) {
  908.                         WRITE_HTML("\n  target=\"", slices[curRow][curCol].targetText, "\"");
  909.                     }
  910.                     if (javaOut != "") {
  911.                         WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
  912.                     }
  913.                     if (javaOver != "") {
  914.                         WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
  915.                     }
  916.                     if (javaClick != "") {
  917.                         WRITE_HTML(" onClick=\"", javaClick, "\" ");
  918.                     }
  919.                     var altText = "";
  920.                     if (curSlice.hasAltText) {
  921.                         altText = curSlice.altText;
  922.                     } else {
  923.                         altText = exportDoc.altText;
  924.                     }
  925.                     if (altText!="") {
  926.                         WRITE_HTML(" title=\"", altText, "\"");
  927.                         WRITE_HTML(" alt=\"", altText, "\"");
  928.                     }
  929.                     WRITE_HTML(">\n");
  930.                 }    
  931.  
  932.                 WRITE_HTML("</map>\n")
  933.                 WRITE_HTML("\n");
  934.             }
  935.         }
  936.     }
  937.     
  938. WRITE_HTML("\n");
  939.  
  940.      // Close HTMLMarkup webbot.
  941.      if (hasImageMap) {
  942.         write("<!--webbot bot=\"HTMLMarkup\" endspan -->\n");
  943.     }
  944.  
  945. // End table copy/paste section.
  946. WRITE_HTML("\n");
  947. WRITE_HTML_COMMENT("   This table was automatically created with Macromedia Fireworks 2.0   ");
  948. WRITE_HTML_COMMENT("   http://www.macromedia.com   ");
  949. WRITE_HTML("\n");
  950.  
  951. WRITE_HTML_COMMENT("------------------------- STOP COPYING THE TABLE HERE -------------------------");
  952.  
  953. WRITE_HTML("\n");
  954. WRITE_HTML("</body>\n");
  955.  
  956. WRITE_HTML("\n");
  957. WRITE_HTML("</html>\n");
  958. WRITE_HTML("\n");
  959.  
  960.  
  961.  
  962.  
  963.