/* AUTHOR: Dale Bechtel, TRC Interactive
   DESCRIPTION: Global Sitewide JavaScript Functions
   Copyright (c)2001-2003. All Rights Reserved
----------------------------------------------------------------------------------------------------
                                 G L O B A L   V A R I A B L E S
----------------------------------------------------------------------------------------------------*/
var winTop      = (screen.height-600)/2;                         // Window Centering Calculations
var winLeft     = (screen.width-800)/2;
var layerRef    = 'document.all';
var styleSwitch = '.style';
var viewSwitch  = '"visible"';
var hideSwitch  = '"hidden"';
var isNS = isIE = false;

/*---------------------------------------------------------------------------------------------------
                              O P E N   L E S S O N   W I N D O W
----------------------------------------------------------------------------------------------------*/
function openWindow(url)
{
var wTop      = winTop+130;
var wLeft     = winLeft+120;
var theURL    = ( (url == null) ? 'menu.asp' : url);
var winOption = 'height=600,width=800,titlebar=no,resizeable=no,left='+wLeft+',top='+wTop+',screenX='+wLeft+',screenY='+wTop;

   if (isNS) {winOption += ',scrollbars=yes';}
   if ((rWin!=null) && (rWin.open)){ rWin.close(); }
   rWin = window.open(theURL,"rWin", winOption);
   rWin.focus();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                          S H A R E D   F U N C T I O N A L I T Y
//////////////////////////////////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------------------------------------
//      Function: siteInit( )
//  Description: Initialize all website stuff.
//       Syntax: [SCRIPT]siteInit( statStr );[/SCRIPT]
//--------------------------------------------------------------------------------------------------*/
function siteInit( statStr )
{
   if (document.layers) {
      document.captureEvents(Event.KEYDOWN);
      layerRef    = 'document.layers';
      styleSwitch = '';
      viewSwitch  = '"show"';
      hideSwitch  = '"hide"';
      isNS        = true;
   }
   else if ((document.getElementByID) || (document.all)) {
      layerRef    = 'document.all';
      styleSwitch = '.style';
      viewSwitch  = '"visible"';
      isIE        = true;
   }

   if ( isIE==false) { 
	//  alert('This Application Requires Microsoft Internet Explorer Version 5.5 or Higher!');
	//  alert('This Application Requires Microsoft Internet Explorer Version 6, 7 or 8.');
	//  self.location.replace('default.asp');
   }

   document.onmousedown = NoRightClick;
   document.onkeydown   = getKeycode;
}
/*--------------------------------------------------------------------------------------------------
|                              E V E N T   H A N D L E R S
|---------------------------------------------------------------------------------------------------*/
function NoRightClick(b)
{ if (((isIE)&&(event.button > 1))||((isNS)&&(b.which > 1))) {alert('Use the left button');return false;} }

/*--------------------------------------------------------------------------------------------------*/
function getKeycode(e)
{var theKey;

   theKey = (isNS==true) ? e.which : event.keyCode; //alert('Keycode= '+theKey);

   if (theKey==18) {return false;}  // Disable ALT key
   if (theKey==113) {enableEdit();}
   
}
/*--------------------------------------------------------------------------------------------------
        Function: enableEdit()
     Description: This is a test...
----------------------------------------------------------------------------------------------------*/
function enableEdit()
{
var targetDoc = parent.Main.document;

   if (isIE)
   { 
      targetDoc.designMode = (targetDoc.designMode == "On") ? "Off" : "On"; 
   }

return;
}
/*------------------------------------------------------------------------------------------------
 			Show/Hide Layers Routines
-------------------------------------------------------------------------------------------------*/
function showLayer(layerID) {
   eval(layerRef+'["' + layerID + '"]' + styleSwitch + '.visibility= "visible"');
}

function hideLayer(layerID) {
   eval(layerRef+'["' + layerID + '"]' + styleSwitch + '.visibility= "hidden"');
}
/*--------------------------------------------------------------------------------------------------
     Function to Return a formatted date string
---------------------------------------------------------------------------------------------------*/
function currentDate()
{
var result = '';

   var d   = new Date();
   result  = (d.getMonth()+1)+'/';
   result += d.getDate()+'/';
   result += d.getFullYear();

return result;
}
/*--------------------------------------------------------------------------------------------------*/
function ClearError() {return true; }
/*--------------------------------------------------------------------------------------------------
//      Function: showTip()
//  Description: Cross-browser tooltips with multi-line capability
//--------------------------------------------------------------------------------------------------*/
function showtip(current,e,text)
{
   if (document.all)
   {
      thetitle=text.split('<br>');
      if (thetitle.length > 1)
      {
        thetitles="";
        for (i=0; i<thetitle.length; i++)
           thetitles += thetitle[i] + "\r\n";
        current.title = thetitles;
      }
      else current.title = text
   }

   else if (document.layers)
   {
       document.tooltip.document.write(
           '<layer bgColor="#FFFFE7" style="border:1px ' +
           'solid black; font-size:12px;color:#000000;">' + text + '</layer>');
       document.tooltip.document.close();
       document.tooltip.left=e.pageX+5;
       document.tooltip.top=e.pageY+5;
       document.tooltip.visibility="show";
   }
}
/*------------------------------------------------------------------------------------------------*/
function hidetip(){ if (document.layers) {document.tooltip.visibility="hidden"; } }
/*------------------------------------------------------------------------------------------------*/

/*////////////////////////////////////////////////////////////////////////////////////////////////////
//	           ACTIVE CONTENT FOR ANNOUNCED MS INTERNET EXPLORER 7.0 BROWSER CHANGES - 06/01/06 
////////////////////////////////////////////////////////////////////////////////////////////////////*/

/*--------------------------------------------------------------------------------------------------
  Function: loadSWF()
  Description: Dynamically load Flash objects.
--------------------------------------------------------------------------------------------------*/
function loadSWF( swf, name, width, height ) {

var s   = '';                                           // temporary variable building the embedded object
var fdr = ''; 											// Default folder where swf files are stored
var h   = (!height) ? '340'     : height;               // SWF object height default
var w   = (!width)  ? '760'     : width;                // SWF object width default
var n   = (!name)   ? 'swf'     : name;                 // SWF object name/id default

   s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'" name="'+n+'" id="'+n+'">';
   s += '<param name="movie" value="'+swf+'">';
   s += '<param name="quality" value="high">';
   s += '<param name="wmode" value="transparent">';
   s += '<embed src="'+swf+'" width="'+w+'" height="'+h+'" name="'+n+'" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';   
   s += '</object>';

//return(s);
document.write(s);
}

function loadSWF_test( swf, name, width, height ) {

var s   = '';                                           // temporary variable building the embedded object
var fdr = ''; 											// Default folder where swf files are stored
var h   = (!height) ? '340'     : height;               // SWF object height default
var w   = (!width)  ? '760'     : width;                // SWF object width default
var n   = (!name)   ? 'swf'     : name;                 // SWF object name/id default

   s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'" name="'+n+'" id="'+n+'">';
   s += '<param name="movie" value="'+swf+'">';
   s += '<param name="quality" value="high">';
   s += '<param name="wmode" value="transparent">';
   s += '<embed src="'+swf+'" width="'+w+'" height="'+h+'" name="'+n+'" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
   s += '</object>';

//return(s);
document.write(s);
}

function loadSWF_2( swf, name, width, height ) {

var s   = '';                                           // temporary variable building the embedded object
var fdr = ''; 											// Default folder where swf files are stored
var h   = (!height) ? '340'     : height;               // SWF object height default
var w   = (!width)  ? '760'     : width;                // SWF object width default
var n   = (!name)   ? 'swf'     : name;                 // SWF object name/id default

   s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'" name="'+n+'" id="'+n+'">';
   s += '<param name="movie" value="'+swf+'">';
   s += '<param name="quality" value="high">';
   s += '<param name="wmode" value="transparent">';   
   s += '<embed src="'+swf+'" width="'+w+'" height="'+h+'" name="'+n+'" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
   s += '</object>';

//return(s);
//document.write(s);
document.write("<embed src='chck_u1_00.swf' type='application/x-shockwave-flash' wmode='transparent' name='myMovie' swLiveConnect='true' width='760' height='340' border='0' palette='FOREGROUND' align='left'>");
}

function RunFoo()
{
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="225">\n');
    document.write('<param name="movie" value="flash/default.swf" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<embed src="flash/default.swf" width="'+w+'" height="'+h+'" name="'+n+'" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">\n');
    document.write('</object>\n');
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////
///				                       E N D   O F   C O D E
////////////////////////////////////////////////////////////////////////////////////////////////////*/