//******************************************************************************/
//*                                                                            */
//*         Internet Computer Software - PHP / JavaScript library.             */
//*                                                                            */
//*         Program:                     DisplayProduct.                       */
//*         Programmer :                 John  S.  Parry.                      */
//*         Date :                       February 2009.                        */
//*         Language :                   PHP / MySQL.                          */
//*                                                                            */
//*         Copyright (C) 2009,   Internet Computer Software Pty Ltd.          */
//*                               PO Box 279                                   */
//*                               Sandy Bay  7006                              */
//*                               Tasmania  Australia                          */
//*                                                                            */
//******************************************************************************/
//*                                                                            */
//* This file contains the javascript functions to display a selected product. */
//*                                                                            */
//******************************************************************************/

  function RotatingImage( Directory )
    {
      var Name = new Array( ) ;
      Name[0] = "Image1.jpg" ;
      Name[1] = "Image2.jpg" ;
      Name[2] = "Image3.jpg" ;
      Name[3] = "Image4.jpg" ;
      Name[4] = "Image5.jpg" ;
      Name[5] = "Image6.jpg" ;
      var NumImages = 6 ;
      var NameEQ = "ImageCounter=" ;
      var Cookies = document.cookie.split( ';' ) ;
      if ( NumImages != 0 )
        { ImageCount = 0 ;
          for ( var Loop = 0; Loop < Cookies.length; Loop++ )
            { var Cook = Cookies[ Loop ] ;
              while ( Cook.charAt( 0 ) == ' ' )
                { Cook = Cook.substring( 1, Cook.length ) ; }
              if ( Cook.indexOf( NameEQ ) == 0 )
                { ImageCount = parseInt( Cook.substring( NameEQ.length, Cook.length ), 10 ) + 1 ; }
            }
          var date = new Date() ;
          date.setTime( date.getTime() + ( 120 * 24 * 60 * 60 * 1000 )) ;
          var Expires = "; expires=" + date.toGMTString() ;
          document.cookie = NameEQ + ImageCount + Expires + "; path=/" ;
          ImageCount = ImageCount % NumImages ;
          document.write( "<Img Src=\"" + Directory + "/" + Name[ ImageCount ] + "\" Width=\"1024\"><BR>" ) ;
        }
    }

