<!--

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


var tableOddColor = '#D4D9B9';
var tableEvenColor = '#B5CBB0';

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 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_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();		                           
 }


// 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) { //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.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];}
}

/**********************************
        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;
}


 
//-->
