home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Basic / GridOne / setup.EXE / BEEGD10.CHM / scripts.js < prev    next >
Encoding:
Text File  |  2001-09-09  |  4.6 KB  |  164 lines

  1. function CopyExample(codeID)
  2. {
  3.    var appVer = IEVersion();
  4.  
  5.    if (appVer < 5)
  6.    {
  7.       alert("This feature is available in script as of Microsoft« Internet Explorer 5!");
  8.    }
  9.    else
  10.    {
  11.       window.clipboardData.setData("Text", codeID.innerText);
  12.    }
  13. }
  14.  
  15. function RunExample(FileName,MinIEVer)
  16. {
  17.    var appVer = IEVersion();
  18.    if (MinIEVer > appVer)
  19.    {
  20.       window.navigate("IEVerMsg.htm");
  21.    }
  22.    else
  23.    {
  24.        window.navigate(FileName);
  25.       return true;
  26.    }
  27. }
  28.  
  29. function IEVersion()
  30. {
  31. var appVer=navigator.appVersion, msie=appVer.indexOf("MSIE ");
  32.  
  33. return parseFloat( appVer.substring( msie+5, appVer.indexOf(";",msie)));
  34. }
  35.  
  36. //Sends XML form in mail message.
  37. function GetTitle()
  38. {
  39.     var doc, j, i, len, heading, title, tagName;
  40.     var doc = window.document.all(0).document;
  41.     
  42.     len = doc.all.length;
  43.     
  44.     for (i = 0; i < len; i++)
  45.     {
  46.     tagName = doc.all(i).tagName;
  47.     if (tagName == "TITLE")
  48.         //Get Title
  49.         {
  50.         var heading = doc.all(i);
  51.         title = heading.text;
  52.         //title = title.fromCharCode(34) + title + title.fromCharCode(34);
  53.         }
  54.     }
  55.     var re = new RegExp('\"',"g") 
  56.     title = title.replace(re,"");
  57.     var re = new RegExp("'","g")
  58.       title = title.replace(re,"-");
  59.     if (title == "")
  60.         {
  61.         title = "Documentation Feedback";
  62.         }
  63.     return title
  64. }
  65.  
  66. function ParseFileName(Filename)
  67. {
  68.   var newFileName;
  69.   var intPos = Filename.lastIndexOf("\\");
  70.   var intLen = Filename.length;
  71.   newFileName = Filename.substr(intPos + 1, intLen  - intPos)
  72.   
  73.   return(newFileName);
  74. }
  75.  
  76. function hideWindow()
  77. {    
  78.    if(feedbackarea.style.display === "none")
  79.    {
  80.        feedbackarea.style.display = "block";
  81.       document.all.feedbackarea.scrollIntoView(true);
  82.    }
  83.    else
  84.    {
  85.       feedbackarea.style.display = "none";
  86.    }
  87. }
  88.  
  89. function GetRating()
  90. {
  91.   for(var i=0;i< document.frmFeedback.rbtnRating.length;i++)
  92.   {
  93.       if(document.frmFeedback.rbtnRating(i).checked)
  94.       {
  95.         return (i+1);
  96.       }
  97.   }
  98.   return (0);
  99. }
  100.  
  101.  
  102. function fnGatherInfo()
  103. {
  104. var tTitle=GetTitle();
  105. var tLocation=ParseFileName(window.location.href);
  106. var tMailTo="mailto:BeeGrid.help.feedback@stinga.com";
  107.  
  108. var d = String.fromCharCode(34);
  109. var s = String.fromCharCode(39);
  110. var cr = String.fromCharCode(11);
  111.  
  112. var tMailContent="<A HREF=" + d + tMailTo + d + " ONCLICK=" + d + "this.href=" + s + tMailTo + "?subject=" + tTitle + " (" + tLocation + ")" + "&body=" + "<XML>" + cr + "<DocFeedback>" + cr + "<Title>" + s + " + GetTitle() + " + s + "</Title>" + cr +  "<URL>" + tLocation + "</URL>" + cr + "<UserComment>" + s + " + document.frmFeedback.txtUserComment.value + " + s + "</UserComment>" + cr + "<UserRating>" + s + " + GetRating() + " + s + "</UserRating>" + cr + "</DocFeedback>" + cr + "</XML>" + s + ";" + d + "><B>Submit feedback</B></A>";
  113.  
  114. return(tMailContent);
  115. }
  116.  
  117. function EMailStream(obj)
  118. {
  119.  
  120. var stream;
  121. tMailLocation=fnGatherInfo();
  122. pageHref=window.location.href;
  123.  
  124. if(document.body.innerHTML.search(/frmFeedback/) != -1)
  125.     {
  126.         hideWindow();
  127.     }
  128.         else
  129.     {         
  130.         stream = "<DIV ID='feedbackarea' class=clsFeedback>";
  131.         
  132.         stream = stream + "<H4>Do you have feedback about this topic?</H4>";
  133.         
  134.         stream = stream + "<P>Please, send us e-mail with your suggestions and comments about our documentation"
  135.         stream = stream + " and samples. You can do it using the form below.</P>"
  136.         
  137.         stream = stream + '<FORM NAME="frmFeedback">';
  138.         stream = stream + '<UL Type=1><LI><img style=vertical-align:bottom; src=Rank.png> Rate this topic (1-5):   ';
  139.         stream = stream + '<INPUT TYPE="radio" value="1" NAME="rbtnRating">';
  140.         stream = stream + '<INPUT TYPE="radio" value="2" NAME="rbtnRating">';
  141.         stream = stream + '<INPUT TYPE="radio" value="3" NAME="rbtnRating">';
  142.         stream = stream + '<INPUT TYPE="radio" value="4" NAME="rbtnRating">';
  143.         stream = stream + '<INPUT TYPE="radio" value="5" NAME="rbtnRating">';
  144.         stream = stream + "<LI><img style=vertical-align:bottom; src=Note.png> Enter your feedback here:";
  145.         stream = stream + '<TEXTAREA TYPE=text ACCESSKEY="M"  COLS=35 ROWS=3 NAME="txtUserComment" style="position: relative; width: 85%">';
  146.         stream = stream + '</TEXTAREA>';
  147.         stream = stream + "<LI><span onclick='hideWindow()'><img style=vertical-align:bottom; src=SendMail.png> " + tMailLocation + "</span>"
  148.         stream = stream + '</UL></FORM>';
  149.         
  150.         stream = stream + "<P>Thank you for your feedback!</P>"
  151.         
  152.         stream = stream + "<P align=right><A class=clsLink HREF=" + pageHref + ">Back to topic</A></P>";
  153.         
  154.         stream = stream + "<P> </P>";
  155.         
  156.         stream = stream + "</div>";
  157.         
  158.         obj.innerHTML = stream;
  159.         document.all.feedbackarea.scrollIntoView(true);
  160.         
  161.         return stream;
  162.     }
  163. }
  164.