home *** CD-ROM | disk | FTP | other *** search
/ Information Operations Fundamentals 2001 February / Information_Operations_Fundamentals_Unclassified_Version_1.0_February_2001.iso / main.cfm < prev    next >
Text File  |  2001-01-03  |  6KB  |  138 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4.     <title>FSCommand Test</title>
  5. <script language="JavaScript">
  6. <!--
  7. /*
  8. WM_setCookie(), WM_readCookie(), WM_killCookie()
  9. A set of functions that eases the pain of using cookies.
  10. Source: Webmonkey Code Library
  11. (http://www.hotwired.com/webmonkey/javascript/code_library/)
  12. Author: Nadav Savio
  13. Author Email: nadav@wired.com
  14. */
  15. // This next little bit of code tests whether the user accepts cookies.
  16. var WM_acceptsCookies = false;
  17. if(document.cookie == '') {
  18.     document.cookie = 'WM_acceptsCookies=yes'; // Try to set a cookie.
  19.     if(document.cookie.indexOf('WM_acceptsCookies=yes') != -1) {
  20.     WM_acceptsCookies = true; 
  21.     }// If it succeeds, set variable
  22. } else { // there was already a cookie
  23.   WM_acceptsCookies = true;
  24. }
  25. function WM_setCookie (name, value, hours, path, domain, secure) {
  26.     if (WM_acceptsCookies) { // Don't waste your time if the browser doesn't accept cookies.
  27.     var not_NN2 = (navigator && navigator.appName 
  28.                && (navigator.appName == 'Netscape') 
  29.                && navigator.appVersion 
  30.                && (parseInt(navigator.appVersion) == 2))?false:true;
  31.  
  32.     if(hours && not_NN2) { // NN2 cannot handle Dates, so skip this part
  33.         if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
  34.         var numHours = hours;
  35.         } else if (typeof(hours) == 'number') { // calculate Date from number of hours
  36.         var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();
  37.         }
  38.     }
  39.     document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); // Set the cookie, adding any parameters that were specified.
  40.     }
  41. } // WM_setCookie
  42. function WM_readCookie(name) {
  43.     if(document.cookie == '') { // there's no cookie, so go no further
  44.     return false; 
  45.     } else { // there is a cookie
  46.     var firstChar, lastChar;
  47.     var theBigCookie = document.cookie;
  48.     firstChar = theBigCookie.indexOf(name);    // find the start of 'name'
  49.     var NN2Hack = firstChar + name.length;
  50.     if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
  51.         firstChar += name.length + 1; // skip 'name' and '='
  52.         lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
  53.         if(lastChar == -1) lastChar = theBigCookie.length;
  54.         return unescape(theBigCookie.substring(firstChar, lastChar));
  55.     } else { // If there was no cookie of that name, return false.
  56.         return false;
  57.     }
  58.     }    
  59. } // WM_readCookie
  60. function WM_killCookie(name, path, domain) {
  61.   var theValue = WM_readCookie(name); // We need the value to kill the cookie
  62.   if(theValue) {
  63.       document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
  64.   }
  65. } // WM_killCookie
  66. // -->
  67. </script>
  68. <SCRIPT LANGUAGE="JavaScript"> 
  69. //Due to an error in Netscape's handling of the "swLiveConnect" feature, the "window.open()" function does not function correctly when called via a Flash FS Command.
  70. //To refresh the showtext window, there is a frameset containing two frames. 
  71. // 
  72. //   The main frame contains the training interface.  
  73. //
  74. //   The "bounce" frame is one pixel tall and contains no images.
  75. //      This frame loads "bounce.htm" which, on loading, checks the showtext cookie for "on" status.
  76. //      If the cookie is "on", bounce.htm will open a 'showtext' window with the page indicated by the "showtextpage" cookie.
  77. //   
  78. //Summary:
  79. //To open the showtext window, Flash sends a "showtext" FS Command to set the cookies, then Flash reloads the "bounce.htm" file which interprets the cookies.
  80. <!--  
  81. function testmovie_DoFSCommand(command, args)
  82.     if (command == "showtext") {
  83.         if (args == "close") { 
  84.             WM_setCookie('ioshowtext_001','off');
  85.         } else {
  86.             WM_setCookie('ioshowtext_001','on');
  87.             WM_setCookie('ioshowtextpage_001',args);
  88.         }
  89.     }
  90.     if (command == "refreshtext") {
  91.             if ( WM_readCookie('ioshowtext_001') == 'on' ) {
  92.             WM_setCookie('ioshowtextpage_001',args);
  93.         }
  94.     }   
  95. }
  96. function openWin( windowURL, windowName, windowFeatures ) { 
  97.     return window.open( windowURL, windowName, windowFeatures ) ; 
  98.  
  99. function closeme()
  100. {
  101. // no functionality at this time...christopher mckeon, 01/03/2001
  102. }
  103. //-->
  104.  </SCRIPT>
  105.  <SCRIPT LANGUAGE="VBScript">
  106. <!-- 
  107. //  Map VB script events to the JavaScript method - Netscape will ignore this... 
  108. //  Since FSCommand fires a VB event under ActiveX, we respond here 
  109. Sub testmovie_FSCommand(ByVal command, ByVal args)
  110.   call testmovie_DoFSCommand(command, args)
  111. end sub
  112. -->
  113. </SCRIPT>
  114. </head>
  115.  
  116.  
  117.  
  118. <body onLoad="WM_setCookie('ioshowtext_001','off');closeme();">
  119. <!--a href="JavaScript: newWindow = openWin( 'index.htm', 'testwin', 'width=100,height=100,toolbar=0,location=0,directories=0,menuBar=0,status=1,scrollBars=0,resizable=0' ); newWindow.focus()">Open a test window</a><br--> 
  120. <!-- START FLASH MOVIE --> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
  121.     id=testmovie
  122.  width=750 height=550
  123.     codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=2,0,0,11">
  124.   <param name="movie" value="iobasics.swf?Date_Entered=<CFOUTPUT>#Now()#</CFOUTPUT>&Source=Travis Lynch"">
  125.   <embed src="iobasics.swf?Date_Entered=<CFOUTPUT>#Now()#</CFOUTPUT>&Source=Travis Lynch"" 
  126.     WIDTH=750 height=550 
  127.     swliveconnect=true
  128.     name="testmovie"
  129.     MAYSCRIPT 
  130.     type="application/x-shockwave-flash" 
  131.    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
  132.   </embed> 
  133. </object><!-- END FLASH MOVIE --> 
  134. </body>
  135. </html>
  136.