home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 June / comonline0602.iso / software / cogitum / CoTracker.exe / grab.___ < prev    next >
Encoding:
Text File  |  2001-08-08  |  20.1 KB  |  766 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Grab Image</TITLE>
  4. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows1251">
  5. <STYLE TYPE="TEXT/CSS">
  6. <!--
  7. .dialogLight  {font-family: Verdana,Arial; font-size: 8pt; font-weight: lighter}
  8. .LongButton   {font-family: Verdana,Arial; font-size: 8pt; font-weight: bold; width: 180px}
  9. .dlgButton    {font-family: Verdana,Arial; font-size: 8pt; font-weight: bold; width: 80px}
  10. .smalls       {font-family: Verdana,Arial; font-size: 80%; font-weight: bold}
  11. -->
  12. </STYLE>
  13. <OBJECT ID="Engine" CLASSID="CLSID:04AB20C2-D25A-11D3-A94C-00C0F048995B">
  14. </OBJECT>
  15. <SCRIPT LANGUAGE="javascript" SRC="lib.js"></SCRIPT>
  16. <SCRIPT LANGUAGE="javascript" defer>
  17.  
  18. var IEVersion = null;
  19. var strPath = null;
  20.  
  21.  
  22. function ReplaceCTToTop (SourceX, newCIN)
  23. {
  24.  var    CTList = SourceX.selectSingleNode("root/CTLIST");
  25.  var    child = SourceX.selectSingleNode("root\/CTLIST\/CATEGORY[@CID="+newCIN+"]");  
  26.  var    childOldFirst = CTList.firstChild; 
  27.  
  28.     if (child && (child !== childOldFirst))
  29.     {
  30.      CTList.removeChild(child);
  31.      CTList.insertBefore(child, childOldFirst);
  32.      return 1;
  33.     }        
  34.     else
  35.      return 0;
  36. }
  37.  
  38.  
  39. function SaveSource( SourceX )
  40. {
  41.     var str;
  42.  
  43.     if (IEVersion == null)
  44.     IEVersion = window.navigator.appVersion.substring(22, 25);
  45.     //if (IEVersion.charAt(0) != '5')
  46.         //return null;
  47.  
  48.        var userAgent = navigator.userAgent;
  49.     var MSIEIndex = userAgent.indexOf("MSIE");
  50.     if ((userAgent.indexOf("Win") == -1)
  51.      || (userAgent.indexOf("MSIE") == -1)
  52.      || userAgent.substring((MSIEIndex + 5),(MSIEIndex + 6)) < 5)
  53.         return null;
  54.   
  55.     // check XML base encoding         
  56.     if (SourceX.childNodes[0].attributes[1].nodeValue != "utf-8")
  57.     SourceX.childNodes[0].attributes[1].nodeValue ="utf-8";
  58.  
  59.     if (!Engine)
  60.     {
  61.      alert("Unable to load ActiveX object.");
  62.      return null;
  63.     }
  64.  
  65.     dbversion = SourceX.selectSingleNode ("root[@dbversion]");
  66.     if (dbversion == null)
  67.     {
  68.        Root = SourceX.selectSingleNode ("root");
  69.        Root.setAttribute ("dbversion", "1.0");
  70.     }
  71.  
  72.     str = Engine.commitChanges( SourceX, 1);        
  73.     return str;
  74. }
  75.  
  76.  
  77. function ResolveJavaScriptURL (szJSData, szSourceURL)
  78. {
  79.  var pos1, pos2, pos3;
  80.  var bSign = 0;
  81.  
  82.  if (top.confirm ("It is internal site script code. Do you want try to resolve this reference?") == 0)
  83.   return "";  
  84.  
  85.  pos1 = szJSData.search(/\(\'/i);
  86.  if (pos1 == -1)
  87.  {
  88.   pos1 = szJSData.search(/\(\"/i);
  89.   bSign = 1;
  90.  }
  91.  
  92.  if (pos1 == -1)
  93.   return "";
  94.  
  95.  if (bSign == 1)
  96.  {
  97.    pos2 = szJSData.search(/\",/i);
  98.    pos3 = szJSData.search(/\"\)/i);
  99.  }
  100.  else
  101.  {
  102.    pos2 = szJSData.search(/\',/i);
  103.    pos3 = szJSData.search(/\'\)/i);
  104.  }
  105.  if ((pos2 == -1) && (pos3 == -1))
  106.   return "";
  107.  if (pos3 != -1) 
  108.  {
  109.   if ((pos2 == -1) || (pos2 > pos3))
  110.    pos2 = pos3;
  111.  }
  112.  
  113.  szURL = szJSData.substring(pos1+2, pos2);
  114.  if (szURL.search(/\./) == -1)
  115.   return "";
  116.  if  (szURL.charAt(0) == '/')
  117.  {
  118.   TailPos = szSourceURL.search ('://');
  119.   szSource = szSourceURL.substring(TailPos+3, szSourceURL.length-1);  
  120.   TailPos = szSource.search("/");
  121.   if (TailPos == -1)
  122.   {
  123.    szSite = szSourceURL;
  124.    if (szSite.charAt(szSite.length-1) =='/')
  125.     szSite = szSite.substring(0,szSite.length-1);
  126.   }
  127.   else
  128.    szSite = szSource.substring(0, TailPos);
  129.  }
  130.  else
  131.  {
  132.   szSite = szSourceURL;
  133.   if (szSite.charAt(szSite.length-1) !='/')  
  134.    szSite = szSite+'/';
  135.  }
  136.  
  137.   szURL = szSite + szURL;   
  138.   return szURL;
  139. }
  140.  
  141.  
  142. //============================================================================= defer script ================================================================
  143.  
  144. Engine.HdWnd = 0;
  145.  
  146.  var    Source;
  147.  var    SourceNew;
  148.  var    bSetDefCat;
  149.  
  150.  var Image;
  151.  
  152.  var ParentWin = external.menuArguments;
  153.  var Doc = ParentWin.document;
  154.  var CurEvent = ParentWin.event;
  155.  var    CurElement = CurEvent.srcElement;
  156.  
  157.  var    IMGNode = null;
  158.  var sz_IMGNode = "";
  159.  
  160.  var    sz_IMGOriginal = "";
  161.  var    sz_URLOriginal = "";
  162.  
  163.  var    sz_IMGTitle = "";
  164.  var    sz_IMGResolved = "";
  165.  var    sz_URLResolved = "";
  166.  
  167.  var    sz_BannerName = "";
  168.  var sz_Width = "";
  169.  var sz_Height = "";
  170.  
  171.  var sz_IsMap = "false";
  172.  var    sz_UseMap = "";
  173.  var    sz_IMGMap = "";
  174.  var bInput = 0;    
  175.  
  176.  
  177.  if ((CurElement.tagName == "IMG")    && (CurElement.readyState != "complete"))
  178.  {
  179.      window.dialogHeight="0px";
  180.      window.dialogWidth="0px";
  181.  
  182.      alert ("Please wait until the Web page is downloaded completely");
  183.      window.close();
  184.  }
  185.  else
  186.  {
  187.      window.dialogHeight="0px";
  188.      window.dialogWidth="0px";
  189.     window.dialogLeft=(window.screen.width-610)/2;
  190.     window.dialogTop=(window.screen.height-350)/2;   
  191.    
  192.         
  193.     Source = new ActiveXObject("Microsoft.XMLDOM");
  194.     Source.async = false;
  195.     //Source.load(sz_DataBaseFile);        
  196.     strPath = Engine.OpenXMLBase(Source,1, 1);    
  197.     if (!strPath)    
  198.     {
  199.         ElXML = Source.createProcessingInstruction('xml', ' version="1.0" encoding="utf-8" ');                
  200.         Source.insertBefore(ElXML, null);                
  201.  
  202.         //  insert root element 
  203.         var Root = Source.createElement("root");
  204.         Root.setAttribute("dbversion","1.0");
  205.         Root.text = "\n\t";
  206.         Source.appendChild(Root);        
  207.         
  208.                 
  209.         var CtList = Source.createElement("CTLIST");
  210.         CtList.setAttribute("CurrentCategory", "0000000000000000");
  211.                 
  212.         var CtCommon = Source.createElement("CATEGORY");
  213.         CtCommon.setAttribute("CID", "0000000000000001");
  214.         CtCommon.setAttribute("Name", "Common");
  215.         CtCommon.text = "\n";
  216.                 
  217.         Root.appendChild(CtList);
  218.         CtList.appendChild(CtCommon);
  219.  
  220.         var BannerBase = Source.createElement("BANNERBASE");
  221.         BannerBase.setAttribute("OpenMode", "_blank");
  222.         BannerBase.setAttribute("SortOrder", "-@CreationDate");
  223.         if (Engine.Options == -1)
  224.         {
  225.          BannerBase.setAttribute("ShowSlots", "191");
  226.          BannerBase.setAttribute("ConfirmDelete", "0");
  227.          BannerBase.setAttribute("SmallPictures", "0");
  228.          Engine.Options = 191;
  229.         }
  230.         else
  231.         {         
  232.          BannerBase.setAttribute("ShowSlots", Engine.Options & 255);
  233.  
  234.          if (Engine.Options & 1024)
  235.           BannerBase.setAttribute("ConfirmDelete", "1");
  236.          else
  237.           BannerBase.setAttribute("ConfirmDelete", "0");
  238.  
  239.          if (Engine.Options & 2048)
  240.           BannerBase.setAttribute("SmallPictures", "1");
  241.          else
  242.           BannerBase.setAttribute("SmallPictures", "0");
  243.         }
  244.         BannerBase.text = "\n\t\t";
  245.         Root.appendChild(BannerBase);
  246.  
  247.         strPath = SaveSource(Source);
  248.     }
  249.     
  250.     
  251.     
  252.     if (CurElement.tagName == "AREA")    
  253.     {
  254.         sz_UseMap = '#' + CurElement.parentElement.name;
  255.  
  256.         for (var CurArea = CurElement.parentElement.firstChild; CurArea != null; CurArea = CurArea.nextSibling)    
  257.         {
  258.          if ((CurArea.tagName) && (CurArea.tagName == "AREA"))
  259.          {
  260.              CurArea.href = Engine.resolveDivert(CurArea.href);
  261.  
  262.             
  263.              CurArea.onbeforecopy = null;
  264.              CurArea.onbeforecut = null;
  265.              CurArea.onbeforeeditfocus = null;
  266.              CurArea.onbeforepaste = null;
  267.              CurArea.onblur = null;                          
  268.              CurArea.onhelp = null;
  269.              CurArea.onclick = null;
  270.              CurArea.ondbclick = null;
  271.              CurArea.oncopy = null;
  272.              CurArea.oncut = null;
  273.              CurArea.ondrag = null;
  274.              CurArea.ondragend = null;
  275.              CurArea.ondragleave = null;
  276.              CurArea.ondragstart = null;
  277.              CurArea.ondrop = null;
  278.              CurArea.onfocus = null;
  279.              CurArea.onlosecapture = null;
  280.              CurArea.onpaste = null;
  281.              CurArea.onpropertychange = null;
  282.              CurArea.onreadystatechange = null;
  283.              CurArea.onselectstart = null;
  284.              CurArea.onkeydown = null;
  285.              CurArea.onkeyup = null;
  286.              CurArea.onkeypress = null;
  287.              CurArea.onmouseout = null;
  288.              CurArea.onmouseover = null;
  289.              CurArea.onmousemove = null;
  290.              CurArea.onmousedown = null;
  291.              CurArea.onmouseup = null;
  292.  
  293.              CurArea.CLASS=null;
  294.          }
  295.              
  296.         }
  297.  
  298.         //sz_IMGMap = CurElement.parentElement.outerHTML;
  299.         sz_IMGMap = CurElement.parentElement.innerHTML;
  300.  
  301.         var    ar_ImageMap = new Array(Doc.images.length);
  302.         for (var i = 0; i < Doc.images.length; i++)    
  303.         {
  304.             ar_ImageMap[i] = Doc.images[i].useMap;
  305.             Doc.images[i].useMap = "";
  306.         }
  307.         CurElement = Doc.elementFromPoint(CurEvent.clientX, CurEvent.clientY);
  308.         for (var i = 0; i < Doc.images.length; i++)    
  309.         {
  310.             Doc.images[i].useMap = ar_ImageMap[i];
  311.         }
  312.     }
  313.  
  314.     if (CurElement.tagName == "IMG")    
  315.     {
  316.         IMGNode = CurElement;
  317.         sz_IMGNode = CurElement.outerHTML;
  318.  
  319.         if (CurElement.isMap)    {
  320.             sz_IsMap = "true";
  321.         }
  322.  
  323.         sz_IMGTitle = CurElement.nameProp;
  324.         sz_IMGOriginal = CurElement.href;
  325.  
  326.         if (CurElement.alt != "")
  327.             sz_BannerName = CurElement.alt;
  328.         sz_Width = CurElement.width;
  329.         sz_Height = CurElement.height;
  330.  
  331.  
  332.         Image = CurElement;
  333.     }
  334.     
  335.     
  336.     if ((CurElement.tagName == "INPUT") && (((CurElement.type).toLowerCase()) == "image"))
  337.     {
  338.       IMGNode = CurElement;
  339.       sz_IMGNode = CurElement.outerHTML;
  340.  
  341.     
  342.       sz_Width = CurElement.width;
  343.       sz_Height = CurElement.height;
  344.       sz_BannerName = CurElement.alt;
  345.       sz_IMGOriginal = CurElement.src;
  346.       bInput = 1;           
  347.     }
  348.     
  349.  
  350.     while ((CurElement.tagName != "A") && (CurElement.tagName != "BODY"))    
  351.     {
  352.         if ((CurElement.tagName == "FORM") && (bInput))
  353.          break;
  354.         CurElement = CurElement.parentElement;        
  355.     }
  356.     if (CurElement.tagName == "A")    
  357.     {
  358.         sz_URLOriginal = CurElement.href;
  359.         if (sz_BannerName == "")
  360.             sz_BannerName = CurElement.alt;
  361.     }
  362.     
  363.     if (CurElement.tagName == "FORM")    
  364.     {
  365.      switch (CurElement.action.charAt(0))
  366.      {
  367.       case '/': 
  368.         //szSite = unescape(Doc.location.href);
  369.         szSite = unescape(Engine.GetDocumentURL(Doc));
  370.         if (szSite.charAt(szSite.length-1) =='/')
  371.          szSite = szSite.substring(0,szSite.length-1);
  372.         sz_URLOriginal =szSite + CurElement.action;
  373.         break;
  374.       case 0:
  375.         //sz_URLOriginal = unescape(Doc.location.href);
  376.         sz_URLOriginal = unescape(Engine.GetDocumentURL(Doc));
  377.         break;
  378.       default:
  379.        sz_URLOriginal = CurElement.action;
  380.        break;
  381.      }
  382.     }
  383.     
  384.  
  385.     sz_IMGResolved = sz_IMGOriginal;
  386.  
  387.     if (sz_IsMap == "false")    
  388.     {       
  389.        JSPos =  sz_URLOriginal.search("javascript:");
  390.        if (JSPos == -1)
  391.         JSPos =  sz_URLOriginal.search("vbscript:");
  392.        if (JSPos != -1)
  393.        {
  394.          //szScriptData = sz_URLOriginal.substring (JSPos, sz_URLOriginal.length-1);
  395.          //sz_URLResolved = ResolveJavaScriptURL (sz_URLOriginal, unescape(Doc.location.href));
  396.          sz_URLResolved = ResolveJavaScriptURL (sz_URLOriginal, Engine.GetDocumentURL(Doc));        
  397.        }
  398.        else  
  399.          sz_URLResolved = Engine.resolveDivert(sz_URLOriginal);
  400.     }
  401.     else    
  402.     {
  403.         //Bad case - Server Side Map in use - nothing can be done
  404.         sz_URLResolved = sz_URLOriginal;
  405.     }    
  406.  
  407.     var    sz_CurrentTitle = Doc.title;     
  408.  }
  409.  
  410.  
  411. function LoadDialog()
  412. {
  413.     if (sz_UseMap == "")
  414.     {        
  415.         isMap=0;
  416.         InitDialog();
  417.     }
  418.     else
  419.     {    
  420.         isMap=1;
  421.         InitDialog();
  422.     }
  423.     window.dialogHeight="100px";
  424.     window.dialogWidth="100px";
  425.     fnResize(document, window);
  426. }
  427.  
  428. function InitList ()
  429. {   
  430.     var CTListNames = Source.selectNodes("root\/CTLIST\/CATEGORY\/@Name");
  431.     var CTListIDs =   Source.selectNodes("root\/CTLIST\/CATEGORY\/@CID");              
  432.     var    CurrentCT = Source.selectSingleNode("root\/CTLIST\/@CurrentCategory");    
  433.     var    Sel = document.all.CT_LIST;  
  434.  
  435.     if ((CTListNames == null) || (CTListIDs == null) || (CurrentCT == null) || (Sel == null))
  436.      return;
  437.     
  438.     while (Sel.options[0])
  439.      Sel.options.remove(0);
  440.  
  441.     CurID = CurrentCT.nodeValue;
  442.     if (CurID == "0000000000000000")
  443.       CurID = "0000000000000001";
  444.  
  445.          
  446.     if ((CTListNames == null) || (CTListIDs == null))
  447.      alert (" Unable to read categories data.") 
  448.     else
  449.     {  
  450.        for (i=0; i< CTListNames.length; i++)
  451.        {
  452.         var objOption= document.createElement ("OPTION");
  453.         objOption.text =  CTListNames[i].nodeValue;             
  454.         objOption.value = CTListIDs[i].nodeValue;             
  455.         Sel.options.add (objOption);   
  456.         if (objOption.value == CurID)
  457.           objOption.selected = true;
  458.         else
  459.           objOption.selected = false;
  460.        }
  461.     }
  462. }
  463.  
  464.  
  465. function InitDialog ()
  466. {
  467.     IEVersion = window.navigator.appVersion.substring(22, 25);
  468.     //if (IEVersion.charAt(0) != '5')
  469.     //{
  470.     //  alert ("This program runs under Microsoft Internet Explorer 5.0 or higher only.");
  471.     //  window.close();
  472.     //  return;
  473.     //}
  474.  
  475.     var userAgent = navigator.userAgent;
  476.     var MSIEIndex = userAgent.indexOf("MSIE");
  477.     if ((userAgent.indexOf("Win") == -1 )
  478.      || (userAgent.indexOf("MSIE") == -1)
  479.      || userAgent.substring((MSIEIndex + 5),(MSIEIndex + 6)) < 5)
  480.     {
  481.         alert ("This program runs under Microsoft Internet Explorer 5.0 or higher only.");   
  482.         window.close();
  483.         return;
  484.     }
  485.  
  486.     var    CurrentCT;
  487.  
  488.     if (Source) 
  489.     {
  490.      CurrentCT = Source.selectSingleNode("root\/CTLIST\/@CurrentCategory");        
  491.      InitList ();
  492.     }
  493.  
  494.     if (isMap == 1)    
  495.      document.all["formUrl"].outerHTML = "<p>MAP - Cannot change the URL here.";
  496.     else
  497.      document.all["formUrl"].value = sz_URLResolved;
  498.      document.all["formName"].value = sz_BannerName;
  499.  
  500.     if ((!sz_BannerName) || (sz_BannerName == ""))
  501.     {
  502.             sz_BannerName = "Untitled";
  503.     }
  504.     document.all["formName"].value = sz_BannerName;
  505.  
  506.     if (strPath)
  507.     {
  508.      document.all.item("DBName").innerText = strPath;      
  509.      document.all.item("DBName").title = strPath;      
  510.     }
  511. }
  512.  
  513. function onCancel()
  514. {    
  515.     window.close();
  516. }
  517.  
  518. function onOk()
  519. {
  520.     if (isMap == 0)
  521.         sz_URLResolved = document.all["formUrl"].value;
  522.     if (document.all["formName"].value!="")
  523.     {
  524.         if (isMap == 0)
  525.         {
  526.             if ((sz_URLResolved.search ('://') == -1) && (sz_URLResolved.search ('@') == -1) && (sz_URLResolved.length>0))
  527.             {             
  528.                 sz_URLResolved="http://"+sz_URLResolved;
  529.             }
  530.             if ((sz_URLResolved.search('@')!=-1) && (sz_URLResolved.search('mailto:') == -1))
  531.             {
  532.                 sz_URLResolved = "mailto:" + sz_URLResolved;
  533.             }            
  534.         }
  535.         sz_Categories = document.all["CT_LIST"].options[document.all["CT_LIST"].selectedIndex].value;
  536.         sz_BannerName = document.all["formName"].value;
  537.         getComment = document.all["formComment"].value;        
  538.         bSetDefCat = document.all.CheckDef.checked;
  539.         if (addBanner())
  540.         {
  541.           window.close();
  542.         }
  543.     }
  544.     else
  545.     {
  546.         alert("The category name cannot be blank.");
  547.     }
  548. }
  549.  
  550.  
  551. function onOpenXML ()
  552. {
  553.     SourceNew = new ActiveXObject("Microsoft.XMLDOM");
  554.     SourceNew.async = false;
  555.     strPath = Engine.OpenXMLBase (SourceNew, 0, 1);     
  556.     if (strPath)
  557.     {
  558.      Source = SourceNew;     
  559.      InitList ();        
  560.      document.all.item("DBName").innerText = strPath;
  561.      document.all.item("DBName").title = strPath;
  562.     }
  563. }
  564.  
  565.  
  566. function onKeyPress()
  567. {
  568.     if (event.keyCode == 27)
  569.     {
  570.         onCancel();
  571.     }
  572.     if (event.keyCode == 13)
  573.     {
  574.         onOk();
  575.     }
  576. }
  577.  
  578.  
  579. function addBanner()
  580.  var ct_cur;
  581.   
  582.    
  583.   SourceNew = new ActiveXObject("Microsoft.XMLDOM");
  584.   SourceNew.async = false;    
  585.   strPath = Engine.OpenXMLBase(SourceNew, 1, 1);    
  586.   if (strPath && (SourceNew.selectSingleNode("root\/CTLIST\/CATEGORY[@CID="+sz_Categories+"]") != null))
  587.   {
  588.     //All three parameters mustn't be empty 
  589.     if ((sz_BannerName != null) && (sz_BannerName != "") && (sz_IMGResolved != ""))    
  590.     {
  591.         var    Root = SourceNew.selectSingleNode("root");
  592.         var    BannerBase = SourceNew.selectSingleNode("root/BANNERBASE");    
  593.         if (BannerBase == null)    
  594.         {
  595.             BannerBase = Source.createElement("BANNERBASE");
  596.  
  597.             BannerBase.setAttribute("OpenMode", "_blank");
  598.             BannerBase.setAttribute("SortOrder", "-@CreationDate");
  599.             if (Engine.Options == -1)
  600.             {
  601.              BannerBase.setAttribute("ShowSlots", "191");
  602.              BannerBase.setAttribute("ConfirmDelete", "0");
  603.              BannerBase.setAttribute("SmallPictures", "0");
  604.              Engine.Options = 191;
  605.             }
  606.             else
  607.             {         
  608.              BannerBase.setAttribute("ShowSlots", Engine.Options & 255);
  609.  
  610.              if (Engine.Options & 1024)
  611.               BannerBase.setAttribute("ConfirmDelete", "1");
  612.              else
  613.               BannerBase.setAttribute("ConfirmDelete", "0");
  614.  
  615.              if (Engine.Options & 2048)
  616.               BannerBase.setAttribute("SmallPictures", "1");
  617.              else
  618.               BannerBase.setAttribute("SmallPictures", "0");
  619.             }
  620.             BannerBase.text = "\n\t\t";
  621.  
  622.             Root.appendChild(BannerBase);
  623.         }
  624.  
  625.         if (BannerBase != null)    
  626.         {
  627.             var UIN = 0;
  628.             var    UINs = SourceNew.selectNodes("root/BANNERBASE/BANNER/@UIN");
  629.             for (Index = 0; Index < UINs.length; Index++)    
  630.             {
  631.                 if (parseInt(UINs[Index].text, 10) > UIN)
  632.                     UIN = parseInt(UINs[Index].text, 10);
  633.             }
  634.             UIN++;
  635.  
  636.  
  637.               
  638.             if (IEVersion == "5.0")
  639.               // save throw IE command -> clipboard
  640.               sz_IMGResolved = Engine.saveImage (IMGNode, UIN);
  641.             else
  642.               // save throw WinInet service
  643.               sz_IMGResolved = Engine.saveImage2 (IMGNode, UIN);
  644.  
  645.             var    Banner = SourceNew.createElement("BANNER");
  646.  
  647.             var    sc_UIN = "0000000000000000" + UIN;
  648.             sc_UIN = sc_UIN.substr(sc_UIN.length - 16);
  649.             Banner.setAttribute("UIN", sc_UIN);
  650.  
  651.             if (sz_IMGMap != "")
  652.              sz_URLResolved = "";
  653.  
  654.             Banner.setAttribute("Name", sz_BannerName);
  655.             Banner.setAttribute("Image", sz_IMGResolved);
  656.             Banner.setAttribute("Width", sz_Width);
  657.             Banner.setAttribute("Height", sz_Height);
  658.             Banner.setAttribute("Url", sz_URLResolved);
  659.             Banner.setAttribute("Map", escape(sz_IMGMap));
  660.             Banner.setAttribute("IsMap", sz_IsMap);
  661.             Banner.setAttribute("Comment", getComment);
  662.             // This does not work under IE 6.0 due to changes in security model
  663.             //Banner.setAttribute("SourceUrl", unescape(Doc.location.href));
  664.             Banner.setAttribute("SourceUrl", Engine.GetDocumentURL(Doc));
  665.  
  666.  
  667.             var    sc_Time = "0000000000000000" + Date.parse(new Date());
  668.             sc_Time = sc_Time.substr(sc_Time.length - 16);
  669.             Banner.setAttribute("LastAccess", sc_Time);
  670.             Banner.setAttribute("CreationDate", sc_Time);
  671.  
  672.  
  673.             Banner.setAttribute("IMGNode", sz_IMGNode);
  674.             Banner.setAttribute("ID_CATEGORY", sz_Categories);                        
  675.  
  676.  
  677.             if (bSetDefCat) 
  678.             {              
  679.               CurrentCT = SourceNew.selectSingleNode("root\/CTLIST\/@CurrentCategory");
  680.               nSel = document.all.CT_LIST.selectedIndex
  681.               CurrentCT.nodeValue = document.all.CT_LIST.options[nSel].value;
  682.               ReplaceCTToTop (SourceNew, sz_Categories);
  683.             }
  684.              
  685.  
  686.  
  687.              Banner.text = "\n\t\t";
  688.              BannerBase.appendChild(Banner);                                                   
  689.              SaveSource (SourceNew);
  690.              Engine.UpdateData (strPath);                
  691.              return 1;
  692.             }
  693.         }            
  694.     }
  695.     else
  696.     {
  697.       alert ("Unable to save image.");      
  698.       Source = SourceNew;
  699.       if (Source)
  700.        InitList ();
  701.       return 0;
  702.     }
  703.   }    
  704.  
  705. function fnGrabOnKeyDown(event)
  706. {
  707.     switch (event.keyCode)
  708.     {
  709.         case 37:
  710.         case 39:
  711.         case 35:
  712.         case 36:
  713.             return false;
  714.     }
  715.     event.returnValue = false;
  716.     return false;
  717. }
  718.  
  719. </SCRIPT>
  720. </HEAD>
  721. <BODY bgcolor=silver onKeyDown="onKeyPress()" onload="LoadDialog()" class="dialogLight" STYLE="MARGIN:5px;" SCROLL="no">
  722. <CENTER>
  723. <FIELDSET ID="Input" STYLE="WIDTH:590px; MARGIN:0px; PADDING:0px;">
  724. <FORM id=form1 name=form1>
  725. <TABLE border=0 cellspacing=4 cellpadding=0 width="100%">
  726. <TR>
  727. <TD CLASS="smalls" WIDTH="80px">Name:</TD>
  728. <TD><input id=formName style="WIDTH: 490px"></TD>
  729. </TR>
  730. <TR>
  731. <TD CLASS="smalls" WIDTH="80px">Comment:</TD>
  732. <TD><input id=formComment style="WIDTH: 490px"></TD>
  733. </TR>
  734. <TR>
  735. <TD CLASS="smalls" WIDTH="80px">Refers to:</TD>
  736. <TD><input id=formUrl style="WIDTH: 490px"></TD>
  737. </TR>
  738. <TR>
  739. <TD CLASS="smalls" WIDTH="80px">Catalog:</TD>
  740. <TD>
  741. <TABLE border=0 cellspacing=0 cellpadding=0 width="100%">
  742. <TD><INPUT type=text maxlength=1024 onkeydown="fnGrabOnKeyDown(event)" id=DBName style="background-color:lightgrey; WIDTH: 400px"></INPUT></TD>
  743. <TD><BUTTON onClick=onOpenXML() title="Open Image Catalog" id=button0 name=button0 class="LongButton" style="HEIGHT: 25px; WIDTH: 82px; left:-50;"><IMG src="color.bmp">Open...</BUTTON></TD>
  744. </TABLE>
  745. </TD>
  746. </TR>
  747. </TABLE>
  748. <TABLE border=0 cellspacing=4 cellpadding=0 width="100%">
  749. <TR>
  750. <TD CLASS="smalls" WIDTH="80px">Category:</TD>
  751. <TD width="120px"><SELECT NAME="CT_LIST" ALIGN="left" style="FONT-SIZE: 80%; WIDTH: 120px" id=CT_LIST></SELECT></TD>
  752. <TD width="250px" CLASS="smalls" align="right">Set as default category:</TD>
  753. <TD><INPUT TYPE="checkbox" align="left" NAME="CheckDef" id=CheckDef></TD>
  754. <TD></TD>
  755. </TR>
  756. </TABLE>
  757. </FORM>
  758. </FIELDSET>
  759. </CENTER>
  760. <P ALIGN=RIGHT STYLE="WIDTH:590px; MARGIN:0px; MARGIN-TOP:5px; PADDING:0px; text-align:right">
  761. <BUTTON onClick=onOk() accesskey="O" title="Press to add this image" id=button1 name=button1 class="dlgButton" STYLE="MARGIN:0px; MARGIN-RIGHT:3px; MARGIN-BOTTOM:5px; PADDING:0px"><IMG src="color.bmp">OK</BUTTON>
  762. <BUTTON onClick=onCancel() accesskey="C" title="Cancel" id=Cancel name=Cancel class="dlgButton" STYLE="MARGIN:0px; MARGIN-LEFT:4px; MARGIN-BOTTOM:5px; PADDING:0px"><IMG src="color.bmp">Cancel</BUTTON></P>
  763. </BODY>
  764. </HTML>
  765.