// picGalery.js
// ------------------------------------------------------------------
//
// utility: the script set is used to display random pictures
//          on the webpages. the utility maintains a list of 
//          pictures to be displayed. new pictures are added
//          to the list using picAddList() function. this 
//          is called only in the current page and a complete 
//          list of pictures built for the entire website. a 
//          random pictuer is picked from the list and displayed 
//          using picShow() function. this can be called anywhere
//          in the website, where a picture is to be shown. 
//
// note:    the script has been written for 25 pictures. if more than
//          25 pictures are to be listed, then modify the value of
//          variable max_pic appropriately.
//
// copyright:  this script is free and can be copied and altered,
//             for unique individual requirement. www.pwdu.org
//
// ------------------------------------------------------------------

  var max_pic, cur_pic, pic_arr, pic_ctr;
  
  max_pic = 22;                  // maximum number pictures in list.
  cur_pic = 0;                   // temporary picture counter.
  pic_ctr = 0                    // picture counter, used in functions.
  pic_arr = new Array(max_pic);  // array of picture lists. this holds
                                 // the list of image urls for IMG tag.
 
  // initialize the picture list with empty entries.
  for(cur_pic=0; cur_pic<=max_pic; cur_pic++) {
      pic_arr[cur_pic] = "";
  }
  cur_pic = 0;
  
  
  function picAddList(sPicUrl) {
  // function to add a new picture to the list.
  
      pic_ctr++;
      pic_arr[pic_ctr] = sPicUrl;
  }
  
  function picShow() {
  // randomly select a picture from the list and output
  // the IMG tag, to the browser.
  
      var sImg;
      
      sImg = "";
      sImg = sImg + "<a href='/pictures/pictures.asp'>" ;
      sImg = sImg + "<img src='" ;
      sImg = sImg + pic_arr[parseInt((max_pic * Math.random()) + 1)];
      sImg = sImg + "' alt='";
      sImg = sImg + pic_arr[parseInt((max_pic * Math.random()) + 1)];
      sImg = sImg + "' border='0'>";
      sImg = sImg + "</a>" ;
      document.write(sImg);
  }
  
  
  // add pictures to the list. to add a new picture to the 
  // list simply copy+paste the line and modify appropriately.
  //     picAddList("pictureurl");
  //

  picAddList("/pictures/ch1.jpg");
  picAddList("/pictures/ch2.jpg");
  picAddList("/pictures/ch3.jpg");
  picAddList("/pictures/ch4.jpg");
  picAddList("/pictures/dischild.jpg");
  picAddList("/pictures/3056906_160.jpg");
  picAddList("/pictures/3056922_160.jpg");
  picAddList("/pictures/4111706_160.jpg");
  //picAddList("/pictures/4111722_160.jpg");
  //picAddList("/pictures/4111738_160.jpg");
  picAddList("/pictures/4116314_160.jpg");
  picAddList("/pictures/4116330_160.jpg");
  picAddList("/pictures/4116346_160.jpg");
  picAddList("/pictures/ch1.jpg");
  picAddList("/pictures/ch2.jpg");
  picAddList("/pictures/ch3.jpg");
  picAddList("/pictures/ch4.jpg");
  picAddList("/pictures/dischild.jpg");
  picAddList("/pictures/3056906_160.jpg");
  picAddList("/pictures/3056922_160.jpg");
  picAddList("/pictures/4111706_160.jpg");
  //picAddList("/pictures/4111722_160.jpg");
  //picAddList("/pictures/4111738_160.jpg");
  picAddList("/pictures/4116314_160.jpg");
  picAddList("/pictures/4116330_160.jpg");
  picAddList("/pictures/4116346_160.jpg");
