home *** CD-ROM | disk | FTP | other *** search
/ PCNet 2006 April / PCnet 2006-06.4.iso / shareware / nmsetup.exe / WebServer / web / _cookie_util.php < prev    next >
Encoding:
PHP Script  |  2006-05-01  |  5.8 KB  |  166 lines

  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // <!--Copyright (c) 2005 Pure Networks Inc.  All rights reserved.-->
  4. ////////////////////////////////////////////////////////////////////////////////
  5. //
  6. // Build: 3.0.6121.0 (Stable)
  7. // $Revision: #2 $
  8. //
  9. // This has to be after the body tag to create better formed HTML
  10. // default.inc requires vars set up by _cookie_util.php
  11. ?>
  12. <script type="text/javascript" language="JavaScript">
  13.     function openWindow(sUrl)
  14.     {
  15.         sWindowName = "ulwin";
  16.         sDateTime   = new Date().getTime();
  17.         sWindowName = sWindowName + sDateTime;
  18.         sUA = "<?php echo($_SERVER['HTTP_USER_AGENT']); ?>";
  19.         if (sUA.indexOf("MSIE") < 0)
  20.         {
  21.             sWindowName = window.open(sUrl, "upload_form" + sDateTime,"width=375,height=120,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no");
  22.             sWindowName.focus();
  23.         }
  24.         else
  25.         {
  26.             sWindowName = window.open(sUrl, "upload_form" + sDateTime,"width=375,height=142,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no");
  27.             sWindowName.focus();
  28.         }
  29.     }
  30.     
  31.     function openContentWindow(sUrl, bEscape)
  32.     {
  33.             re = /\+/g; 
  34.             if (bEscape)
  35.             {
  36.                 contentWindow = window.open(sUrl.replace(re,"%2B"), "content_window","");            
  37.             }
  38.             else
  39.             {
  40.                 contentWindow = window.open(sUrl, "content_window","");
  41.             }
  42.             contentWindow.focus();
  43.     }
  44.     
  45.     function openSizedWindow(sUrl, iWidth, iHeight)
  46.     {
  47.             sizedWindow = window.open(sUrl, "sizedWindow","width=" + iWidth + ",height=" + iHeight + ",scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no");
  48.             sizedWindow.focus();
  49.     }
  50.     
  51.     function openHelpWindow(sUrl)
  52.     {
  53.             helpWindow = window.open(sUrl, "help_window","");
  54.             helpWindow.focus();
  55.     }  
  56.     
  57.     function openGlossaryWindow(sUrl)
  58.     {
  59.             glossaryWindow = window.open(sUrl, "glossary_window","width=375,height=480,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no");
  60.             glossaryWindow.focus();
  61.     }  
  62.     
  63.     function openSlideshow(sUrl)
  64.     {
  65.         slideshowWin = window.open(sUrl, "slideshow","width=<?php echo($iSlideshowWidth*1.1); ?>,height=<?php echo($iSlideshowHeight*1.15); ?>,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no");
  66.         slideshowWin.focus();
  67.     }
  68.     
  69.     function gotoPage(sUrl, iMinPage, iMaxPage, iCurrentPage, sQsVarConcat)
  70.     {
  71.             pageNum = prompt ( 'Go to page:', '' );
  72.             if ((parseInt(pageNum) >= parseInt(iMinPage)) & (parseInt(pageNum) <= parseInt(iMaxPage)))
  73.             {
  74.                     pageNum = pageNum;
  75.             }
  76.             else
  77.             {
  78.                 switch (pageNum)
  79.                 {
  80.                     case 's':
  81.                         pageNum = iMinPage;
  82.                         break;
  83.                     case 'e':
  84.                         pageNum = iMaxPage;
  85.                         break;
  86.                     default:
  87.                         pageNum = iCurrentPage;
  88.                 }
  89.             }
  90.             location.href = sUrl + sQsVarConcat + 'page=' + pageNum;
  91.     }  
  92.  
  93.     function writeWATestCookie()
  94.     {   
  95.         var today = new Date();
  96.         var the_date = new Date(today.getYear() + 1900, today.getMonth(), today.getDate(), today.getHours(), today.getMinutes(), today.getSeconds()+30);
  97.         var the_cookie_date = the_date.toGMTString();
  98.         var the_cookie = "WA=enabled";
  99.         var the_cookie = the_cookie + ";expires=" + the_cookie_date;
  100.         var the_cookie = the_cookie + ";path=/";
  101.         document.cookie=the_cookie;
  102.     }
  103.     
  104.     function writeCookie()
  105.     {
  106.         var the_date = new Date("December 31, 2023");   
  107.         var the_cookie_date = the_date.toGMTString();
  108.         var the_cookie = "users_res="+ getHeightWidth();
  109.         var the_cookie = the_cookie + ";expires=" + the_cookie_date;
  110.         var the_cookie = the_cookie + ";path=/";
  111.         document.cookie=the_cookie;
  112.     }
  113.  
  114.     function writePrepCookie()
  115.     {
  116.         var the_date = new Date("December 31, 2023");   
  117.         var the_cookie_date = the_date.toGMTString();
  118.         var the_cookie = "users_res=640x480";
  119.         var the_cookie = the_cookie + ";expires=" + the_cookie_date;
  120.         var the_cookie = the_cookie + ";path=/";
  121.         document.cookie=the_cookie;
  122.     }    
  123. <?php
  124.     if ($btBrowserType == "macosxie")
  125.     {
  126. ?>
  127.         function getHeightWidth() 
  128.         {
  129.             var myWidth = 0, myHeight = 0;
  130.             myWidth = document.body.clientWidth;
  131.             myHeight = document.body.clientHeight;
  132.             return (myWidth+"x"+myHeight);
  133.         }
  134. <?php
  135.     }
  136.     else
  137.     {
  138. ?>
  139.         function getHeightWidth() 
  140.         {
  141.             var myWidth = 0, myHeight = 0;
  142.             if( typeof( window.innerWidth ) == 'number' ) 
  143.             {
  144.                 //Non-IE
  145.                 myWidth = window.innerWidth;
  146.                 myHeight = window.innerHeight;
  147.             } 
  148.             else if( document.documentElement &&
  149.             ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
  150.             {
  151.                 //IE 6+ in 'standards compliant mode'
  152.                 myWidth = document.documentElement.clientWidth;
  153.                 myHeight = document.documentElement.clientHeight;
  154.             } 
  155.             else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
  156.             {
  157.                 //IE 4 compatible
  158.                 myWidth = document.body.clientWidth;
  159.                 myHeight = document.body.clientHeight;
  160.             }
  161.             return (myWidth+"x"+myHeight);
  162.         }
  163. <?php
  164.     }
  165. ?>
  166. </script>