<!--

// Copyright (C) 1987-2007 DreamLight Incorporated, All Rights Reserved.
// No portion of this JavaScript may be used for any reason
//    without the express written consent of DreamLight Incorporated.

function testBrowser() {
// Create a browser object so we can determine which brawser is running

	var browser = "BROWSER INFORMATION:\n";
	for(var propname in navigator) {
  	  browser += propname + ": "
  	  + navigator[propname] + "\n"
	}
	alert(browser); 

	var browser = new Object();

	browser.version = parseInt( navigator.appVersion );
	browser.isMicrosoft = false;
	browser.isNetscape = false;
	browser.isApple = false;
	if (navigator.appName.indexOf("Microsoft") != -1 ) browser.isMicrosoft = true;
	if (navigator.appName.indexOf("Netscape") != -1 ) browser.isNetscape = true;
	if (navigator.appName.indexOf("Apple") != -1 ) browser.isApple = true;

	alert( browser.isMicrosoft + browser.isNetscape + browser.isApple + browser.version );

}

var tableOddColor = '#FFD59F';
var tableEvenColor = '#FFEACF';

function DLI_paintTables( whichStyle, oddColor, evenColor ) {
	// Automatically paint all tables that have a CCS style, whichStyle, applied
	// with alternating rows of oddColor and evenColor

	// whichStyle:  The CSS Style applied to each table to paint
	// oddColor, evenColor: any valid JavaScript colors such as: '#FFF', '#FFFFFF', or 'white'
	// if no colors specified, first looks for global tableOddColor and tableEvenColor
	// if those don't exist, then defaults to lightgray and white

	// Check for odd/even local/global color overrides and use defaults if missing
	if ( !oddColor ) oddColor = (tableOddColor) ? tableOddColor : 'lightgray';
	if ( !evenColor ) evenColor = (tableEvenColor) ? tableEvenColor : 'white';
	
	var tables = document.getElementsByTagName("table");
	for (var n = 0; n < tables.length; n ++ ) {
		theTable = tables[n];
		if ( theTable.getAttributeNode('class') != null ) {
			if (theTable.getAttributeNode('class').value == whichStyle) {
			
				var odd = true; // even / odd row flag, start with odd row
				var tableBodies = theTable.getElementsByTagName("tbody");
				for (var i = 0; i < tableBodies.length; i++) {

					var tableRows = tableBodies[i].getElementsByTagName("tr");
					for (var j = 0; j < tableRows.length; j++) {
						var theRow = tableRows[j]
						if ( !elementHasClass(theRow)  && !theRow.bgColor ) {

							var rowCells = theRow.getElementsByTagName("td");
							for (var k = 0; k < rowCells.length; k++) {
								var theCell = rowCells[k]
								if( !elementHasClass(theCell) && !theCell.bgColor ) {
									theCell.bgColor = (odd) ? oddColor : evenColor;
								}
							}
							odd = !odd;
						}
					}
				}
			}
		}
	}
}

function elementHasClass( element ) {
	if (element.getAttributeNode('class') == null) {
		return false;
	} else {
		return element.getAttributeNode('class').value;
	}
}

function togglePopUp(id, state) {
	var newState = "";
		
	if (document.all!=null) {
		// Explorer document model
		
		if (state) newState = "visible";
		else newState = "hidden";
			
		document.all[id].style.visibility = newState;
	} else {
		// Netscape document model
		
		if (state) newState = "show";
		else newState = "hide";
			
		document.layers[id].visibility = newState;
	}
}

function DLI_ViewImage( filename, width, height ) {

	// if no width or height passed, defaults to 640 x 480
	if ( arguments.length < 3 ) {
		var width = 640;
		var height = 480;
	}

	var safariOverWidth = 16; // Safari windows open one pixel too narrow.
	var safariStatusBar = 16; // Safari Status bar is 16 pixels tall.
	var safariOverHeight = -1; // Safari windows open one pixel too short.
	
	width += safariOverWidth; // adjust width
	height += (safariStatusBar - safariOverHeight); // adjust height

	// Determine if image window will fit on screen or not
	if (width > screen.availWidth) width = screen.availWidth;
	if (height > screen.availHeight) height = screen.availHeight;

	viewWindow = window.open
		(filename,"_blank","WIDTH=" + width + ",HEIGHT=" + height
						+ ",TOP=" + 0 + ",LEFT=" + 0
    					+ ",statusbar=yes,resizable=yes,scrollbars=yes" );

}


function View(filename, width, height) {
     width += 0; // add border if necessary
     height += 0; // add border if necessary
		viewWindow = window.open
    (filename,"viewWin","WIDTH=" + width + ",HEIGHT=" + height
    					+ ",status=yes,resizable=yes,scrollbars=yes" );
 }

function MM_ViewImage(filename, width, height) {
     width += 0; // add border if necessary
     height += 0; // add border if necessary
		viewWindow = window.open
    (filename,"imageViewer","WIDTH=" + width + ",HEIGHT=" + height
    					+ ",status=yes,resizable=yes,scrollbars=yes" );
 }

function MM_PlayShockwave(filename, width, height) {
     width += 0; // add border if necessary
     height += 0; // add border if necessary
		viewWindow = window.open
    (filename,"imageViewer","WIDTH=" + width + ",HEIGHT=" + height
    					+ ",status=yes,resizable=no,scrollbars=no" );
 }
 
function MM_PlaySWA(filename, message) {
// (C) 1997 DreamLight Incorporated
	var width = 460 + 32; //  + margins
	var height = 24 + 16 + 10 + 36; // + controller + text + margins
	
	soundStrip = window.open( filename, "SoundStrip", 
	                           "width="+ width + ",height=" + height 
	                           + ",status=yes,resizable=yes,scrollbars=no" );
 }

function DLI_PlayVideo( videoViewerURL, width, height, wmvWidth, wmvHeight ) {
// Pass url but not ".mov.html" or ".wmv.html" which will be added
// depending if quicktime is available or not...
// Requires one QuickTime ".mov" and one Windows Media ".wmv" file
// May pass two different sets of sizes if the wmv is a different size than the mov

	if ( arguments.length < 3 ) {
		// if no width or height passed, defaults to 320 x 240
		var width = 320;
		var height = 240;
	}
	
	if ( arguments.length < 5 ) {
		// if no wmvWidth or wmvHeight passed, defaults to width + height
		var wmvWidth = width;
		var wmvHeight = height;
	}		

	// if not on a Mac AND QuickTime 4.11 not detected
	// then play the windows media player version
	// Otherwise play the QuickTime version.
	if ( ! mac() && plugInAvailable( "QuickTime" ) <= 0 ) 
		{ MM_PlayMP( videoViewerURL + ".wmv.html", wmvWidth, wmvHeight ) }
	else MM_PlayQT( videoViewerURL + ".mov.html", width, height );

}

function MM_PlayVideo( videoViewerURL, width, height ) {
// Pass url but not ".mov.html" or ".asf.html" which will be added
// depending if quicktime is available or not...
// OLDER USING OLD ASF Windows Video

	if ( arguments.length < 3 ) {
		// if no width or height passed, defaults to 320 x 240
		var width = 320;
		var height = 240;
	}

	// if not on a Mac AND QuickTime 4.11 not detected
	// then play the windows media player version
	// Otherwise play the QuickTime version.
	if ( ! mac() && plugInAvailable( "QuickTime" ) <= 0 ) 
		{ MM_PlayMP( videoViewerURL + ".asf.html", width, height ) }
	else MM_PlayQT( videoViewerURL + ".mov.html", width, height );

}

function MM_PlayQT(videoViewerURL, width, height) {

	if ( arguments.length < 3 ) {
		// if no width or height passed, defaults to 320 x 240
		var width = 320;
		var height = 240;
	}

	var width = width + 32; //  + margins
	var height = height + 16 + 10 + 40; // + controller + text + margins
	
	videoViewer = window.open( videoViewerURL, "_blank", 
	                           "width="+ width + ",height=" + height 
	                           + ",status=yes,resizable=yes,scrollbars=no" );
	                          
	videoViewer.document.close();		                           
 }

function MM_PlayMP(videoViewerURL, width, height) {

	if ( arguments.length < 3 ) {
		// if no width or height passed, defaults to 320 x 240
		var width = 320;
		var height = 240;
	}

	var width = width + 32; //  + margins
	var height = height + 46 + 22 + 36; // + controller + text + margins
	
	videoViewer = window.open( videoViewerURL, "_blank", 
	                           "width="+ width + ",height=" + height 
	                           + ",status=yes,resizable=yes,scrollbars=no" );
	                          
	videoViewer.document.close();		                           
 }
 
function MM_PlayVideoFromPopup( whichPopup ) {
	var sel = whichPopup.selectedIndex;
	
	if (whichPopup.options[sel].value) {
		location.href = whichPopup.options[sel].value;
	}
}
 
function MM_GotoPageFromPopup( whichPopup ) {
	var sel = whichPopup.selectedIndex;
	
	if (whichPopup.options[sel].value) {
		location.href = whichPopup.options[sel].value;
	}
}




/**********************************
        UTILITY FUNCTIONS
***********************************/

var haveqt = false;
// top level JavaScript variable that is used in the VBScript
// to determine if QT 4.11 or later is installed in IE Win...

function plugInAvailable( whichPlugIn ) {
// Return 1 plug in available, 0 not known, -1 not available

	var available = 0;
	
	//alert( navigator.plugins.length );
	
	with (navigator) if ( plugins ) { 
		if ( plugins.length > 0 ) {
			available = -1;
			for ( n = 0; n < plugins.length ; n++ ) {
				if ( plugins[n].name.indexOf( whichPlugIn ) >= 0 ) available = 1;
			}
		}
	}

	if ( haveqt && whichPlugIn == "QuickTime" ) available = 1;
	
	// haveqt is a javascript variable that is set through a VB script
	// which can detect QT 4.1.1 or later in IE/Win
	// will not detect any QT that may be older than 4.1.1
	// That VB script from Apple technote 1197 must be included on the page
	// and run before this routine is called inorder to work...
	
	//alert ( "haveqt = " + haveqt + " available = " + available );
	return available;
}

function mac() {
// returns true if on a mac, false otherwise

	return navigator.appVersion.indexOf( "Mac" ) > -1;
}

function explorer() {
// returns true if explorer, false otherwise
	return navigator.appName.indexOf("Microsoft") != -1;
}

function version() {
// returns browser version
	var version = 0;

	if (explorer()) {	
 		temp = navigator.appVersion.split("MSIE");
		version = parseFloat(temp[1]);
	} else {
	 	version = parseFloat( navigator.appVersion );
	}
	
	return version;
}

function setCookie(name, value, expire) {
// Sets cookie values. Expiration date is optional and a date object
// sets the current domain and sets path to the most generic...
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
   + "; path=" + escape("/");
   
   //alert( document.cookie );
}

function getCookie(Name) {
// Gets a cookie given it's name

	//alert( document.cookie );
	
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      } 
   }
}

//  QuickHeading Status Functions
function cl(){
// (C) 1997 DreamLight Incorporated
   window.status = "";
}
function qh(){
// (C) 1997 DreamLight Incorporated
   window.status = 'DreamLight QuickHeading: Pulls up to the top for easier reading.';
}


// Macromedia Dreamweaver Functions

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Internet Explorer on Windows can't display PNG transparency correctly
//  this hack lets it display the alpha channel correctly.
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
}

if ( ! mac() && explorer() && version() >= 5.5 ) {
	window.attachEvent("onload", correctPNG);
}
 
//-->
