// javascripts1.2
// copyright © 1998 - 2000 BRI, ALL RIGHTS RESERVED
// LUD 05022000

// Global vars used in single session
var dlastmod = "dlm no init";
var msg = "   Somebody forgot to set the Status Scrolling message!   ";
var pos = 0;
var uEmail = "email no init";
var curDoc= "curDoc no init";
var curImgswitch=0;
// ------------------ added 7/99 -------
var curDate = new Date();  var mon = 0; var dow = 0; var dom = 69; var  Dig2Year = 0; var domEven = false;

// our dirty word list used in the FilthFilter function;
var shame = new Array("No use,No use");

// ****************************** DEFAULT INITIALIZATIONS FOR ALL bri documents ************************
{
 initDate(domEven);
}

// **** prudeNT functions ****
  function FilthFilter(formObj)
  {
    EM = "no email address";
    // Verify that no fields have those anti prude words!!!!
    for (i = 0;i < formObj.length;i++)
    {
      // check for email entry, even if it's blank!
      if  (formObj.elements[i].name == "email")
      {
        EM =  formObj.elements[i].value; 
       }
       keyword = formObj.elements[i].value; 
       keyword = keyword.toUpperCase();
       /* now search for an instance of a no-no inside the string
         convert to regular expressions later */
      no = 0;
      // now cycle through our bad word array and find out if one of 'em is there!
      for (x=0; x <= shame.length;x++)
      {
          no = keyword.indexOf(shame[x]);
          // break on first occurrance
           if (no >= 0) {break}; 
       }   
       if (no >=0)
        {
          alert("NOW THAT WASN'T VERY NICE!");
          formObj.elements[i].focus();
          return;
        }
    } // end for i =0 
    //
    // Submit form if you weren't returned to calling doc
    //
    formObj.submit()
    alert("pdxsounds will reply to "+EM+" as soon as we can")
  } // end function FilthFilter


// ********************************global var inits **********************************
 // store last mod date in global dlastmod  [1/15/99]
  function getlastmod()
  {
    dlastmod = document.lastModified;
    dlastmod=dlastmod.substring(0,8);
  }

 // store coder defined message into msg global  [1/15/99]
  function setmsg(cMsg)
  {
    msg = cMsg;
  }
 
 // store user entered Email into uEmail global  [1/15/99]
  function setuEmail(emailfrom)
   {
     uEmail = emailfrom;
   }

 // store current document in curDoc [1/26/99]
  function setCurDoc(calldoc)
   {
      curDoc=calldoc;
      //alert("Current document = "+curDoc);
   }

// initialize date global and store month,day,year into globals  [7/99]
function initDate(even)
 {
   // curDate already assigned in var declarations
   mon = curDate.getMonth();
   dow = curDate.getDay();
   dom = curDate.getDate();
   Dig2Year = curDate.getYear();
   domEven = false;
    if (dom%2 == 0)
    { 
      domEven = true;
    }
  }

//********************************************* functions *****************************************

// ************** global var handlers (not initializations) ******************
 // print uEmail
  function printuEmail()
   {
      document.writeln(Email);
    }

 // print last mod date in calling document
  function printlastmod()
   {
      //document.writeln("<BR><center><h4>Function printlastmoddate was called!</h4></center><BR>");
      document.writeln("Last Update : " +dlastmod+"<BR>");
      //document.writeln("<center><hr></center><BR>");
    }

 // ************************* fun stuff
   function scrollMsg()
   {
    window.status = msg.substring(pos, msg.length) + msg.substring(0, pos);
    if (++pos > msg.length)
      pos = 0;
    window.setTimeout("scrollMsg()", 200);
    }

// ************************date fxns
  function printdate()
    {
      //document.writeln("<BR><center><h4>Function printdate was called!</h4></center><BR>");
      document.writeln("<center>Today\'s date is "+Date()+"</center><BR>");
      //document.writeln("<center><hr></center><BR>");
     }

// ********************************global OBJECT inits
 // define a curImage Object type 2/1/99 see 5and8combo.html in bricpu
  function OBJcurImg(imgIDX,ID,URL1,URL2)
  {
    this.imgIDX = imgIDX;
    this.ID = ID;
    this.URL1=URL1;
    this.URL2=URL2;
    this.tog=0;
   // always set the toggle to 0
   // URL = current Image location - any server
  }

// ************************ image fxns 

// +++++++++++++ deprecated 7/99  USE OBJECT methods instead ++++++++++++++++++++
 // preload images into cache 1/26/99 ** setCurDoc must be called befor this fxn **
 // change passed parms to an array of objects  later  - passed parms (idir,array,asize)
 // **** WARNING **** No Checking of current valid document!! ***
  function loadimages(iHTML,idir,i1,i2,i3,i4,i5,i6,i7,i8)
   {
       switch(iHTML)
       {
        case ("left.html") : 
          this[1] = new Image();
          this[1].src = idir+"/"+i1;
          this[2] = new Image();
          this[2].src = idir+"/"+i2;
          this[3] = new Image();
          this[3].src = idir+"/"+i3;
          this[4] = new Image();
          this[4].src = idir+"/"+i4;
          this[5] = new Image();
          this[5].src = idir+"/"+i5;
          this[6] = new Image();
          this[6].src = idir+"/"+i6;
          this[7] = new Image();
          this[7].src = idir+"/"+i7;
          this[8] = new Image();
          this[8].src = idir+"/"+i8;
          //alert("Images preloading for "+curDoc+" "+iHTML+" = "+this[1].src);
          break;
         case ("precope.html") : 
          this[1] = new Image();
          this[1].src = idir+"/"+i1;
          this[2] = new Image();
          this[2].src = idir+"/"+i2;
          //alert("Images preloading for "+curDoc+" "+iHTML+" = "+this[2].src);
          break;
         case ("PPL1and2.html") : 
          this[1] = new Image();
          this[1].src = idir+"/"+i1;
          this[2] = new Image();
          this[2].src = idir+"/"+i2;
          this[3] = new Image();
          this[3].src = idir+"/"+i3;
          //alert("Images preloading for "+curDoc+" "+iHTML+" = "+this[3].src);
          break;
       } // end switch(iHTML)
   }

 function switcher (imgidx,dir,curfile,place,ext) 
  {
    // mimed state info is passed - we don't like cookies!
    document.images[imgidx].src=dir+"/"+curfile+place+"."+ext;
    // debug statements - leave here please
    // document.writeln("YOUR DATA : <BR>");
    // document.writeln("dir  = "+dir+"<BR>");
    // document.writeln("curfile = "+curfile+"<BR>");
    // document.writeln("place  = "+place+"<BR>");
    // document.writeln("ext  = "+ext+"<BR>");
   }

// ++++++ THIS FUNCTION IS DEPRECATED 7/99
// Use this function for testing only and only for 1 image on 1 document!
  function togImg (imgidx,dir,file,place,ext,file2,place2,ext2) 
  {
    // store current Image in Global
     if (curImgswitch == 0)
     {
       curImgswitch=1;
       document.images[imgidx].src=dir+"/"+file+place+"."+ext;
     }
    else
     {
      curImgswitch=0;
      document.images[imgidx].src=dir+"/"+file2+place2+"."+ext2;
     }
  }

// Use this function for toggling images with onClick event  2/1/99
// ** warning ** ID not in use yet (see  function OBJcurImg(imgIDX,ID,URL1,URL2) )
// as of 2/16/99 we are still using the image IDX from the browser!
 function OBJtogImg (imgOBJ) 
  {
    // store current Image in Global
     if (imgOBJ.tog == 0)
     {
       imgOBJ.tog = 1;
       document.images[imgOBJ.imgIDX].src=imgOBJ.URL1;
     }
    else
     {
       imgOBJ.tog = 0;
      document.images[imgOBJ.imgIDX].src=imgOBJ.URL2;
     }
  }

// **************************** URL transfer functions

//  Use this function for temporary window re-linking
// ** warning ** This fxn will be replaced. Also use java transfer.class instead if possible
 function transfer(link,newsite)
  {
         alert("MINIMIZE OR CLOSE THE ORIGINAL WINDOW TO SEE "+newsite);
         window.open(link);
         parent.window.close();
   }


// *************************** Browser Swithcing Fxns

// This code is copyright © 1999 by BRI. All rights reserved. 
  function gB()
  {
       var aN =  navigator.appName.toString().substring(0,8).toUpperCase();
       var aV = navigator.appVersion.toString().substring(0,3).toUpperCase(); 
       // ******************************************************************
       document.writeln("Browser =  ",aN,"<br>");
       document.writeln("Version = ",aV,"<br>");
       document.writeln("<hr>");
       if (aN == "MICROSOF")
       {
         document.writeln("Microsoft Browser<br>");
         if (aV  < "4.0")
             location.href = "noframes.html";
         else
            location.href = "indexIE4.html";
       }
       else if (aN == "NETSCAPE")
       {
          document.writeln("Netscape  Browser<br>");
          if (aV  < "4.0")
            location.href = "noframes.html";
           else  
            location.href = "indexNS.html";
       }
        else
           location.href = "indexNS.html";
   }


// ***************************** Usoft browser specific functions
// This code is copyright © 1999 by BRI and 1995 by Microsoft. All rights reserved. 
// line 207 212 char 3
       function soundOne()
       {
	if (sndCtrl1.IsSoundCardEnabled()!=0)
        {
	 sndCtrl1.SelectionStart=2.994;
	 sndCtrl1.SelectionEnd=3.865;
	 sndCtrl1.run();
        }
       }

       function doFlame()
       {
	logoGif.style.visibility="visible";
	flameFilter.style.visibility="visible";
       }
	
       function startFire()
       {
	n=flameFilter.filters.item("IntelAdditive").NoiseScale;
	flameFilter.filters.item("IntelAdditive").NoiseScale=n;
       }
       
       function soundTwo()
       {
        // * activate ActionSet2 the cork popping noise
	Seq1.Item("ActionSet2").play();
	if (sndCtrl1.IsSoundCardEnabled()!=0)
        {
         // * whining phase sound
         sndCtrl1.SelectionStart=4.870;
	 sndCtrl1.SelectionEnd=6.820;
         sndCtrl1.run();
        }
       }

       function soundThree()
       {
	if (sndCtrl1.IsSoundCardEnabled()!=0)
        {
         // * cork poping sound
	 sndCtrl1.SelectionStart=9.685;
	 sndCtrl1.SelectionEnd=9.926;
	 sndCtrl1.run();
        }
       }

       function seqInit()
       {    
        Seq1.Item("ActionSet1").At(0.000,"doFlame()",1,0.050,1);
        // * Start fire. set -1 for infinate loop
        Seq1.Item("ActionSet1").At(0.000,"startFire()",-1,0.050,1);
        // * Intro sound set -1 for repeating sound, 1 for one time
        // * Also allow at least 300 (400 for web) milli seconds before engaging
        // * the first sound or you will get a runtime error!
        //Seq1.Item("ActionSet1").At(0.400,"soundOne()",1,0.050,1);
        // * Allow at least 1.5 seconds so the player can reset
        // * befor playing the second sound in the wave file.
	//Seq1.Item("ActionSet1").At(1.500,"soundTwo()",1,0.050,1);
        // * Allow another second for the third sound
	//Seq1.Item("ActionSet2").At(2.500,"soundThree()",1,0.050,1);
       }	
