/**************************************************************************  
WEB SITE:       SISTAS
FILE NAME:      SISjs.js
TITLE:          JavaScript for SISTAS Web Site
AUTHOR:         Susan Sailow
DATE CREATED:   5 Feb 2006
LEVEL:          All

DESCRIPTION:    Javascript Code for SISTAS, Vacaville, CA

MODIFICATIONS:

  DDMMYYYY   AUTHOR          PURPOSE                 DETAILS

  05Feb2006  Susan Sailow    Begin
  15Feb2006  Susan Sailow    dispBOP: Try Monster Email Redirect webmistress

**************************************************************************/

/**************************************************************************
	Variables
**************************************************************************/

	var content1 = '<B><I><FONT face="verdana, arial, helvetica" size="4" color="#CC00CC">The Journey..</FONT></I></B>';
	var content2 = '<B><I><FONT face="verdana, arial, helvetica" size="4" color="#660033">Starts here.</FONT></I></B>';
	var content3 = '<B><I><FONT face="verdana, arial, helvetica" size="4" color="#FF6600">SISTAS</FONT></I></B>';

	var index = 1;

	var layerName;	

	var NS4 = false;
	var IE4 = false;	

	var canContinue = true;
	var moveByAmount = -5; //defaults to scrolling up 
	var timeLaps = 100; // 100 milliseconds
	var to = 40; // the initial top position of the tex layer.

	var black = "#000000";
	var forestGreen = "#003333";
     	var orange = "#FF6600";   
	var lightMaroon = "#F7BDDE";
	var maroon = "#660033";
	var lightBlue = "#BDC6DE";
	var TRBlue = "#6699CC";
	var menuMouseOverColor = TRBlue;

	var dragCCBTListOut;
	var dragCCBTBoxOut;
	var drag9;

	// Determine browser

	if ( document.layers )		
	{  
		NS4 = true;			// NS 4.0 
	}
	else 	if ( document.all )	// IE 4.0 
	     	{  
			IE4 = true; 
		}

	// Initialize, based on browser

	if (NS4)
	{		 	
		layerRef = "document.layers";
		styleRef = "";		 
	}
	else
	{
		layerRef = "document.all";
		styleRef = ".style";
	}

	var doAnimation = 'Y';
  	var delay = 3000;
  	var imageNum = 0;

// Preload the Home Page Slide Show images
  	
	theImages = new Array(12);
  	
	for (i=0; i<12; i++)
  	{ theImages[i] = new Image(); }
  	
	var noImages = 5;

	theImages[0].src = "images/CV_150x200.jpg";
  	theImages[1].src = "images/EM.jpg";
  	theImages[2].src = "images/VK.jpg";
  	theImages[3].src = "images/JB.jpg";
  	theImages[4].src = "images/IMAG0032_Big4Hats.jpg";
  	theImages[4].src = "images/IMAG0134_VSSS93.jpg";
  		
/*
	theCaptions = new Array(4);
  	
	for (i=1; i<4; i++)
  	{ theCaptions[i] = new Image(); }
  	
	theCaptions[1].src = "images/SlideShowWords_SS_Unity.gif";
  	theCaptions[2].src = "images/SlideShowWords_SS_WorkIt.gif";
  	theCaptions[3].src = "images/SlideShowWords_SS_Accept.gif";
*/

var NS_LT5 = 0;

// Look for Netscape browser, with a version number less than 5

	 if ( navigator.appName == "Netscape" &&  navigator.appVersion.charAt(0) < '5' )  
       {  NS_LT5 = 1; }

// Declare and initialize pages array

	noPages = 7;
	pageArr = new Array( noPages );

	pageArr[0] = new Array('HP',   'HOME',       'index.html',     'main_r2_c1.gif', 'main_r2_c1_f2.gif', 63, 20, 2, 1);
	pageArr[1] = new Array('AU',   'ABOUT US',   'aboutus.html',   'main_r2_c3.gif', 'main_r2_c3_f2.gif', 78, 20, 1, 1);
	pageArr[2] = new Array('Cal',  'CALENDAR',   'calendar.html',  'main_r2_c4.gif', 'main_r2_c4_f2.gif', 79, 20, 2, 1);
	pageArr[3] = new Array('Prod', 'PRODUCTS',   'products.html',  'main_r2_c6.gif', 'main_r2_c6_f2.gif', 77, 20, 3, 1);
	pageArr[4] = new Array('Spon', 'SPONSORS',   'sponsors.html',  'main_r2_c9.gif', 'main_r2_c9_f2.gif', 79, 20, 1, 1);
	pageArr[5] = new Array('Res',  'RESOURCES',  'resources.html', 'main_r2_c10.gif', 'main_r2_c10_f2.gif', 84, 20, 1, 1);
	pageArr[6] = new Array('CU',   'CONTACT US', 'contactus.html', 'main_r2_c11.gif', 'main_r2_c11_f2.gif', 93, 20, 2, 1);

/**************************************************************************
function dispBOP: Display Bottom of Page
**************************************************************************/

	function dispBOP( currPage, updatedDate, dispTOPLink, dispHTMLCode )
{
	var currPage;
	var dispHTMLCode;
	var dispTOPLink;
	var ending;
	var htmlCode;
	var htmlCodeA, htmlCodeB, htmlCodeC;
	var j;
	var pageID;
	var pageURL;
	var updatedDate;

// alert ('dispBOP currPage, updatedDate, dispTOPLink, dispHTMLCode = ' + currPage + ' ' + updatedDate + ' ' + dispTOPLink + ' ' + dispHTMLCode);

	htmlCode  = '<TABLE width="700" cellspacing="0" cellpadding="0" border="0"> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line and Top-of-Page Link -->

	if ( dispTOPLink == 1 )
	{  
	   htmlCode  = '<TR> <TD> &nbsp; </TD> </TR> ';
         htmlCode += '<TR> <TD align="center"> ';
         htmlCode += '<A class="LinkTOP" href="#TOP">Top of Page</A> ';
         htmlCode += '</TD> </TR>';
	   writeHTMLCode( htmlCode, dispHTMLCode );
	}

<!-- Blank line -->

	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Bottom-of-Page Graphics -->

	htmlCode  = '<TR> <TD> ';
	htmlCode += '<IMG name="main_r6_c1" src="images/main_r6_c1.gif" width="553" height="30" border="0" alt="">';
	htmlCode += '<IMG name="main_r6_c13" src="images/main_r6_c13.gif" width="147" height="30" border="0" alt="">';
	htmlCode += '</TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line -->

	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Bottom-of-Page Links -->

	htmlCode = '<TR> <TD class="Content" align="center"> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

	for (j=0; j<=(noPages-1); j=j+1)
	{
	  if ((j == (noPages-1))) 
	  {  ending = '<BR> ' } 
	  else 
	  {  ending = '&nbsp; | &nbsp; '; }
	  if ( currPage == pageArr[j][2] )
	  {  pageID = pageArr[j][0];
           htmlCode = '<A name="CurrPage" class="LinkBOPCurr"> ' + pageArr[j][1] + '</A> ' + ending;  }
	  else
	  {  if (pageArr[j][3] == 0)
	     { pageURL = currPage; }
	     else
	     { pageURL = pageArr[j][2]; }
// alert ('dispBOP: pageArr[j], pageURL = ' + pageArr[j] + ' ' + pageURL);
	     htmlCode = '<A class="LinkBOP" href="' + pageURL + '"> ' + pageArr[j][1] + '</A> ' + ending;  
	  }
	  writeHTMLCode( htmlCode, dispHTMLCode );
	}

	htmlCode = '</TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line -->

	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- SISTAS Contact Info -->

	htmlCode  = '<TR> <TD class="ContentBold11" align="center"> ';
	htmlCode += 'SISTAS &nbsp; | &nbsp; ';
	htmlCode += 'P. O. Box 2845, Vacaville, CA 95687-9998</a> &nbsp; | &nbsp; ';
	htmlCode += '707/317-9478</a> &nbsp; | &nbsp; ';
	htmlCode += '888/SISTAS-8</a> ';
	htmlCode += '</TD> </TR>';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line -->

	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- RTV Credits, Webmistress Email Link -->

	htmlCode =  '<TR> <TD class="CreditsRTV" align="center"> ';         
	htmlCode += '<table border="0" cellpadding="0" cellspacing="0" summary="RTV Image Table"> <tr> ';         
	htmlCode += '<td class="CreditsRTV"> Web Site Care by &nbsp; </td> ';         
	htmlCode += '<td> <a href="http://www.redthruviolet.com" target="_blank"> <img src="images/footer/RTV_BOP.jpg" width="120" height="20" border="0" alt="Red thru Violet"> </a> </td> ';         
	htmlCode += '<td class="CreditsRTV"> &nbsp; &nbsp; &#124; &nbsp; &nbsp;Updated ' + updatedDate + ' &nbsp; &#124; &nbsp; ';         
	htmlCode += '<A class="LinkEmail" href="mailto:webmistress@esistas.org?subject=SIS_' + pageID + '">Email Web Mistress </a></td>';
	htmlCode += '</tr> </table> ';         
	htmlCode += '</TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line -->

	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- SISTAS Credits 2006 and Beyond -->

	htmlCode  = '<TR> <TD class="CreditsSIS" align="center"> ';
	htmlCode += '&copy; Copyright 2001 and Beyond &nbsp; | &nbsp; ';
	htmlCode += 'SISTAS &nbsp; | &nbsp; ';
	htmlCode += 'All Rights Reserved';
	htmlCode += '</TD> </TR>';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line, and end of table -->

	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

      htmlCode = '</TABLE>';
      writeHTMLCode( htmlCode, dispHTMLCode );

}

/**************************************************************************
function dispTOP: Display Top of Page
**************************************************************************/

	function dispTOP( currPage, dispTOPLink, dispHTMLCode )
{
	var currPage;
	var dispHTMLCode;
	var dispTOPLink;
	var ending;
	var htmlCode;
	var htmlCodeA, htmlCodeB, htmlCodeC;
	var j;
	var nullString = '';
	var pageID;
	var pageURL;
	var singleQuote = "'";

// alert ('dispTOP: currPage, dispTOPLink, dispHTMLCode = ' + currPage + ' ' + dispTOPLink + ' ' + dispHTMLCode);

	htmlCode  = '<TABLE width="700" cellspacing="0" cellpadding="0" border="0"> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Top-of-Page URL Graphic and SISTAS Acronymn Definition -->

	htmlCode  = '<TR class="ItalicBold">'; 
	htmlCode += '<TD><A href="http://www.eSISTAS.org"><IMG src="images/main_r1_c1.gif" width="180" height="32" border="0" alt=""></a></TD>';
      htmlCode += '<TD class="ContentTBLight13"> &nbsp; <u>S</u>ISTERS</TD>';
      htmlCode += '<TD class="ContentTB13"> &nbsp; <u>I</u>nfluencing</TD>';
      htmlCode += '<TD class="ContentTBDark13"> &nbsp; <u>S</u>upporting</SPAN></TD>';
      htmlCode += '<TD class="ContentEmpha13"> &nbsp; <u>T</u>ransforming</TD>';
      htmlCode += '<TD class="ContentTB13"> &nbsp; <u>A</u>ffirming</TD>';
      htmlCode += '<TD class="ContentTBLight13"> &nbsp; <u>S</u>ISTERS</TD>';
//    htmlCode += '<IMG src="images/spacer.gif" width="1" height="32" border="0" alt="">';
	htmlCode += '</TD> </TR> ';

	writeHTMLCode( htmlCode, dispHTMLCode );

      htmlCode = '</TABLE>';
      writeHTMLCode( htmlCode, dispHTMLCode );

	htmlCode  = '<TABLE width="700" cellspacing="0" cellpadding="0" border="0"> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Top-of-Page Links -->

	htmlCode = '<TR> <TD align="left">';
	writeHTMLCode( htmlCode, dispHTMLCode );

	for (j=0; j<=(noPages-1); j=j+1)
	{
        htmlCode  = '<A href="' + pageArr[j][2] + '" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_displayStatusMsg(' + singleQuote + pageArr[j][1] + singleQuote + ');MM_swapImage(' + singleQuote + pageArr[j][0] + singleQuote + ',' + singleQuote + singleQuote + ',' + singleQuote + 'images/' + pageArr[j][4] + singleQuote + ',1);return document.MM_returnValue">';
        htmlCode += '<IMG hspace="0" name="' + pageArr[j][0] + '" src="images/' + pageArr[j][3] + '" width="' + pageArr[j][5] + '" height="' + pageArr[j][6] + '" border="0" alt="' + pageArr[j][1] + '"></a>';

	  writeHTMLCode( htmlCode, dispHTMLCode );
	}

	htmlCode  = '<IMG name="main_r2_c13" src="images/main_r2_c13.gif" width="147" height="20" border="0" alt="">';
//	htmlCode += '<IMG src="images/spacer.gif" width="1" height="20" border="0" alt="">';
      htmlCode += '</TD> </TR> ';
	writeHTMLCode( htmlCode, dispHTMLCode );

<!-- Blank line, and end of table -->

//	htmlCode = '<TR> <TD> &nbsp; </TD> </TR> ';
//	writeHTMLCode( htmlCode, dispHTMLCode );

      htmlCode = '</TABLE>';
      writeHTMLCode( htmlCode, dispHTMLCode );

}

/**************************************************************************
function writeHTMLCode: Write the HTML code to the document
**************************************************************************/

	function writeHTMLCode( htmlCode, display )
{
	var display;

// Display code, if requested

      if ( display >= 1 )
      { alert ('writeHTMLCode: htmlCode = ' + htmlCode) } 
       
// Display object properties, if requested

      if ( display == 2 )
      {  alert ('navigator.appVersion, 1stchar =' + navigator.appVersion + navigator.appVersion.charAt(0));
         showProps(navigator, 'navigator');
// Note: NS 7.0 (and maybe IE 6.0) crashes when trying to show window property
	   showProps(window, 'window');               
         showProps(document, 'document');
/** This causes a crash of the javascript, in NS 6.1
         if (navigator.appName == "Netscape" && navigator.appVersion.charAt(0) >= '5')
         { showProps(Content, 'Content'); }
**/
         if ( NS_LT5 == 1 )
         { showProps(document.Content, 'document.Content'); }
         if (navigator.appName == "Microsoft Internet Explorer")
         { showProps(Content, 'Content'); }
      }
	 
//Write HTML code to the document (use special form for Netscape Version < 5

	if ( NS_LT5 == 1 )  
      {  window.document.Content.document.write( htmlCode); }
      else
	{  window.document.write( htmlCode); }

}

/**************************************************************************
	function changeContent:  Change the content of a layer and display it
  	Rotate layers of phrases, in a circular fashion
**************************************************************************/

function changeContent(layer)
{
	layerName = layer;
	index++;

	switch (index)
	{
		case 1:	{	layerWrite(layer, null, content1);
				break;
			}
		case 2:	{	layerWrite(layer, null, content2);
				break;
			}
		case 3:	{	layerWrite(layer, null, content3);
				index = 0;
				break;
			}
	}
	
	setTimeout( 'changeContent(layerName)', 1500 );

}

/**************************************************************************
	function layerWrite:  Open, write, and close layer, using text
**************************************************************************/

function layerWrite(id,nestref,text) 
{
	ns4 = (document.layers)?true:false
	ie4 = (document.all)?true:false

        if (ns4) 
        {
                if (nestref) var lyr = eval('document.'+nestref+'.document.'+id+'.document')
                else var lyr = document.layers[id].document
                lyr.open()
                lyr.write(text)
                lyr.close()
        }
        else if (ie4) document.all[id].innerHTML = text
}
	// Start the scrolling (either up or down)

	function startScroll(amount, theLayer)
	{
		// Stop previous direction
		stopScroll(); 

		// Initialize
		moveByAmount = amount;
		canContinue = true;
		thisLayer = theLayer;

		// Move the layer
		moveLayer();
	}

/**************************************************************************
	function stopScroll:  Stop the scrolling
**************************************************************************/ 

	function stopScroll()
	{
		canContinue = false;
	}

/**************************************************************************
	function init:  Call rotate the header
**************************************************************************/ 

	function init()		
	{
		header = new DynLayer( "headerDiv");
		rotateHeader();
	}

/**************************************************************************
	function rotateHeader:  Rotate the header
**************************************************************************/ 

	function rotateHeader()		
	{	
		setTimeout('changeContent( "headerDiv")', 1000 );
	}

//***************************************************************/
// 	function doSlideShow: Do the slide show
//***************************************************************/

function doSlideShow()
{
//	var update = new Array();
//	var modifydate;
//	update = document.lastModified.split (" ");
//	modifydate = update[0];
//	alert ("update, modifydate = " + update + " " + modifydate);

//	var updatedDateArray = new Array();
//	updatedDateArray = document.lastModified.split(" ");
//	alert ("updatedDateArray = " + updatedDateArray);
//	var uDString;
//	uDString = "Updated " + updatedDateArray[1] +  ' ' +
//                  updatedDateArray[2] + ' ' + updatedDateArray[3];
//	alert ("uDString = " + uDString);
//	document.write(uDString);

//	updatedDate = new Date(document.lastModified);
//	theMonth = updatedDate.getMonth() + 1;
//	theDay = updatedDate.getDate();
//	theFullYear = updatedDate.getFullYear();
//	theYear = updatedDate.getYear();
//	alert ("y, fy = " + theYear + " " + theFullYear);
//	alert ("updatedDate = " + updatedDate);
//	alert ("m, d, y = " + theMonth + " " + theDay + " " + theYear);
	
	var doAnimation = 'Y';

	if (doAnimation == 'Y')
	{ 
         if (NS4)
	   { 
		document.HPSlideShow.src = theImages[imageNum].src;
//		document.HPCaption.src   = theCaptions[imageNum].src; 
	   }
 	   else
	   { 
		document.SlideShow.src = theImages[imageNum].src; 
//		document.Caption.src   = theCaptions[imageNum].src; 
	   }

	   imageNum++;
         if (imageNum >= noImages)
         { imageNum = 0 }

	   setTimeout('doSlideShow()', delay);
	}

	else

	{ void stop() }
}

/**************************************************************************
function showProps: Display the values of all properties of an object,
                    25 (or countCutoff) at a time
**************************************************************************/

	function showProps( obj, objName, countCutoff )
	{
	  var result = "";
        var count = 0;
        var countTot = 0;

	if ( ( countCutoff >= 1 ) && ( countCutoff <= 25 ) )
 		{ countCutoff = countCutoff; }
      else
		{ countCutoff = 25; }

        result += 'OBJECT ' + objName + ', every ' + 
                  countCutoff + ' properties, of length = ' + obj.length + "\n";

        for (var i in obj)
        {  result += countTot + ": " + objName + "." + i + " = " + obj[i] + "\n";
           count++;
           countTot++;
           if (count == countCutoff)
           {  alert (result);
              result = "";
              count = 0;
           }
        }

	  alert (result);
	}

/**************************************************************************
function displayObjProps: Display Object Properties
**************************************************************************/

	function displayObjProps( nav, win, doc, Con2, misc )
	{
	 if ( (nav == 0) && (win == 0) && (doc == 0) && (Con2 == 0) && (misc == 0) )
	 { return; }

// Display object properties, as requested
       if ( nav == 1 )
       {  
            alert ('NS_LT5 =' + NS_LT5 + "\n"  + 'navigator.appName =' + navigator.appName);
		alert ('navigator.appVersion, 1stchar =' + navigator.appVersion + ',' + navigator.appVersion.charAt(0));
		showProps(navigator, 'navigator', 20);
       }
       if ( win == 1 )
       {
		showProps(window, 'window', 20);               
       }
       if ( doc == 1 )
       {
		showProps(document, 'document', 20);
       }
       if ( Con2 == 1 )
       {
/** This causes a crash of the javascript, in NS 6.1
**/
          if (navigator.appName == "Netscape" && navigator.appVersion.charAt(0) >= '5')
          { showProps(Content2, 'Content2'); }
          if ( NS_LT5 == 1 )
          { showProps(document.Content2, 'document.Content2'); }
          if (navigator.appName == "Microsoft Internet Explorer")
          { showProps(Content2, 'Content2'); }
       }
       if ( misc == 1 )
       {
		showProps(document.childNodes, 'document.childNodes', 10);
		showProps(document.body, 'document.body', 10);
		showProps(document.images, 'document.images', 15);
		showProps(document.documentElement, 'document.documentElement', 20);
       }
}

/**************************************************************************
functions from Macromedia
**************************************************************************/

function MM_displayStatusMsg(msgStr)  
{ //v3.0
	status=msgStr; document.MM_returnValue = true;
}

function MM_findObj(n, d) 
{ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() 
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() 
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
