// $History: Library.js $
// 
// *****************  Version 3  *****************
// User: Ultraman     Date: 3/25/00    Time: 2:37p
// Updated in $/Web/coccc
// - Added scrolling functions to Library.js
// 
// *****************  Version 2  *****************
// User: Ultraman     Date: 3/25/00    Time: 2:33p
// Updated in $/Web/coccc
// - Added Library.js and common.css
// 
// *****************  Version 1  *****************
// User: Ultraman     Date: 3/25/00    Time: 2:23p
// Created in $/Web/coccc

function openFullScreen(url)
{ 
   //Check browser 
   var isNav = (navigator.appName == "Netscape")?1:0; 
   var isIE = (navigator.appName.indexOf("Microsoft")!= -1)?1:0; 

   //Check Platform 
   var isMac=(navigator.platform.indexOf("Mac")>-1)?1:0; 
   var isWin=(navigator.platform.indexOf("Win")>-1)?1:0; 

   //Set global window options 
   var opts = "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizeable=no,copyhistory=no,menubar=no" 

   //Set platform and browser specific options 
   if (isNav) 
   { 
      //Navigator windows have outerWidth and outerHeight properties 
      //use these to set window size to the available screen height and width 
      opts = opts+",outerWidth=" + screen.availWidth + ",outerHeight=" + screen.availHeight + ",screenX=0,screenY=0"; 
   } 
   else if (isIE)
   { 
      //IE has a "full-screen" option which can be used by placing "fullscreen=yes" here 
      opts = opts+",left=0,top=0"; 

      //To size the window (rather than open in fullscreen mode) we need to know the padding 
      //i.e. the space taken by the title bar and window edges. These values are subtracted 
      //from the available screen width and height (different for Macs). If the new window 
      //is opened with toolbars, status bar, etc. the values here should be changed to 
      //compensate for the new features. 
      if (isMac)
      { 
         //this uses a value of 13 for the extra width and 32 for the extra height 
         opts = opts+",width="+(screen.availWidth - 13)+",height="+(screen.availHeight - 32); 
      }
      else if (isWin)
      { 
         //this uses a value of 12 for the extra width and 25 for the extra height 
         opts = opts+",width="+(screen.availWidth - 12)+",height="+(screen.availHeight - 25); 
      }
      else
      { 
         opts = opts+",width="+screen.availWidth+",height="+screen.availHeight; 
      } 
   }
   else
   { 
      return; 
   } 

   //Open a new window 
   var newWin = window.open(url,"newwindow",opts); 
   newWin.focus(); 
   //Move to 0,0 (javascript 1.2) 
   if (parseInt(navigator.appVersion) >= 4)
   { 
      newWin.moveTo(0,0); 
   } 
} 

function showPDFLink( strHTML, strTitle )
{
   document.write("<IMG width=\"18\" height=\"18\" border=\"0\" SRC=\"images/pdf.gif\"> ");
   document.write("<A HREF=\"" + strHTML + "\" target=\"_blank\" onMouseOver=\"window.status='" + strTitle + "';return true\"");
   document.write("onMouseOut=\"window.status='';return true\">");
   document.write(strTitle + "</A>");
}

function showDOCLink( strHTML, strTitle )
{
   document.write("<IMG width=\"18\" height=\"18\" border=\"0\" SRC=\"images/worddoc.png\"> ");
   document.write("<A HREF=\"" + strHTML + "\" target=\"_blank\" onMouseOver=\"window.status='" + strTitle + "';return true\"");
   document.write("onMouseOut=\"window.status='';return true\">");
   document.write(strTitle + "</A>");
}

function showXLSLink( strHTML, strTitle )
{
   document.write("<IMG width=\"18\" height=\"18\" border=\"0\" SRC=\"images/xls.gif\"> ");
   document.write("<A HREF=\"" + strHTML + "\" target=\"_blank\" onMouseOver=\"window.status='" + strTitle + "';return true\"");
   document.write("onMouseOut=\"window.status='';return true\">");
   document.write(strTitle + "</A>");
}

function showNewsletterQuickButton( strHTML, strTitle, blnNewDoc )
{
   if( blnNewDoc ) {
      document.write("<IMG width=\"19\" height=\"18\" border=\"0\" SRC=\"images/newdoc.gif\" alt=\"New\" text=\"New\"> ");
   } else {
      document.write("<IMG width=\"19\" height=\"18\" border=\"0\" SRC=\"images/doc.gif\"> ");
   }
   document.write("<A HREF=\"" + strHTML + "\" target=\"_blank\" onMouseOver=\"window.status='" + strTitle + "';return true\"");
   document.write("onMouseOut=\"window.status='';return true\">");
   document.write( strTitle + "</A>");
}

function showNewsletterButton( strHTML, strLongTitle, strShortTitle )
{
   document.write("<A HREF=\"" + strHTML + "\" target=\"_blank\" onMouseOver=\"window.status='" + strLongTitle + "';return true\"");
   document.write("onMouseOut=\"window.status='';return true\"><FONT SIZE=\"4\" FACE=\"arial\">" + strShortTitle + "</FONT></A>");
}

function postMemberName( strName, strEmail, strTitle )
{
   document.write("<TR><TD class='box' width='500'>");
   document.write("<b>&nbsp;" + strTitle + "</b></TD>");
   document.write("<TD class='box'>&nbsp;" + strName + "</TD>");
   document.write("<TD class='box'>&nbsp;");
   showHyperlinkName( strEmail, strEmail );
   document.write("</TD></TR>");
}

function postMemberNameScrolling( strName, strEmail, strTitle )
{
   document.write("<TR><TD class='box'>");
   document.write("<b>&nbsp;" + strTitle + "</b></TD>");
   document.write("<TD class='box'>&nbsp;" + strName + "</TD>");
   document.write("<TD class='box'>&nbsp;");
   showHyperlinkNameScrolling( strEmail, strEmail );
   document.write("</TD></TR>");
}

function showHyperlinkName( strName, strEmail )
{
   if( strEmail.length > 0 )
   {
      document.write("<img border='0' width='18' height='13' src='images/email18x13.gif'>&nbsp;<A HREF=\"MAILTO:" + strEmail + "?subject=COCCC General Inquiries\" title=\"Send E-mail to " + strName + "\" onMouseOver=\"window.status='Send E-mail to "
        + strName + "';return true\" onMouseOut=\"window.status='';return true\">");
   }
   document.write(strName);
   if( strEmail.length > 0 )
   {
      document.write( "</A>" );
   }
}

function showHyperlinkNameScrolling( strName, strEmail )
{
   if( strEmail.length > 0 )
   {
      document.write("<img border='0' width='18' height='13' src='images/email18x13.gif'>&nbsp;<A HREF=\"MAILTO:" + strEmail + "?subject=Comments for COCCC Website\" title=\"Send E-mail to " + strName + "\" onMouseOver=\"startScrolling();return true\"");
      document.write("onMouseOut=\"stopScrolling();window.status='';return true\">");
   }
   document.write(strName);
   if( strEmail.length > 0 )
   {
      document.write( "</A>" );
   }
}

function showLastModified()
{
   mod_date = new Date(document.lastModified);
   which_month = mod_date.getMonth();                // returns 0 thru 11
   which_date  = mod_date.getDate();                 // returns 1 thru 31
   which_year  = mod_date.getYear();                 // returns 2 digit year if < 2000
   which_month++; 
   if( which_month < 10 )
   {
      which_month = "0" + which_month
   }

   if( which_date < 10 )
   {
      which_date = "0" + which_date
   }

   if( which_year < 1000 )
   {
      which_year += 2000;                            // ensure 4 digit year
   }

   last_mod = which_month + "/" + which_date + "/" + which_year

//   document.write("<h6>Last revision: " + last_mod + "</h6>");
}


var posMsg        = 1;
var ID1_scrollOut = 0;
var ID1_scrollIn  = 0;
var ID2_scrollOut = 0;
var ID2_scrollIn  = 0;
var Message       = "Send your comments regarding this website to Jack Lee";

function startScrolling()
{
	posMsg = 1;
	scrollIn();
}

function stopScrolling()
{
	if( ID1_scrollOut )
	{
		clearTimeout( ID1_scrollOut );
	}
	
	if( ID1_scrollIn )
	{
		clearTimeout( ID1_scrollIn );
	}
			
	if( ID2_scrollOut )
	{
		clearTimeout( ID2_scrollOut );
	}
	
	if( ID2_scrollIn )
	{
		clearTimeout( ID2_scrollIn );
	}
}

function scrollIn()
{
	window.status=Message.substring( 0, posMsg );
	if( posMsg >= Message.length )
	{
		posMsg=1;
		ID1_scrollOut = window.setTimeout( "scrollOut()", 2000 ); 
	}
	else
	{
		posMsg++;
		ID1_scrollIn = window.setTimeout( "scrollIn()", 50 ); 
   } 
}

function scrollOut()
{
	window.status=Message.substring( posMsg, Message.length );
	if( posMsg >= Message.length )
	{
		posMsg=1;
		ID2_scrollIn = window.setTimeout( "scrollIn()", 100 );
	}
	else
	{
		posMsg++;
		ID2_scrollOut = window.setTimeout( "scrollOut()", 50 );
   }
}
