var ns = (navigator.appName == "Netscape") > 0;
var ie = navigator.appName.indexOf("Explorer") > 0;
var ver = navigator.appVersion;
var mac = ver.indexOf("Macintosh") > 0;
var vnum = ie ? parseFloat(ver.substring(ver.lastIndexOf('MSIE ') + 5)) : parseFloat(ver);
var macIE4 = (mac && ie && (vnum < 5.0));
var ns4 = (document.layers) ? true:false;
//ie4 indicates all IE vers >= 4
var ie4 = (document.all) ? true:false;			
//w3c also indicates other W3C DOM compatible browsers
var w3c = !ie4 && (document.getElementById ? (document.getElementsByTagName('div')?true:false) : false);


var rollovr = (w3c || vnum >= 4 || (ns && vnum >= 3));
var dynamic = (w3c || (ie && vnum >= 4));
var gCell = 0;

/*
if( rollovr ) 
	{
	blueDot = new Image();
	blueDot.src = "images/blue.gif";
	redDot = new Image();
	redDot.src = "images/red.gif";
	}
function ovrImg(imgID) 			{if(rollovr)document.images[imgID].src = redDot.src;}
function stdImg(imgID,imgName)	{if(rollovr)document.images[imgID].src = blueDot.src;}
*/

function doBlur()				{if(gCell){mOut(gCell); gCell = 0;}}
function GetObjStyle( objName )	{return(w3c ? document.getElementById(objName).style : eval(objName + '.style'));}

function mOvr(bn,theLnk) 
{
	var lnkTitle = '';
	
	if( bn == 1 )
		lnkTitle = "NSW Rowing Home Page.";
	else if( bn == 2 )
		lnkTitle = "A brief introduction to the NSW Rowing Association.";
	else if( bn == 3 )
		lnkTitle = "The monthly newsletter and any important announcements";
	else if( bn == 4 )
		lnkTitle = "Regatta & Administrative Forms for printing.";
	else if( bn == 5 )
		lnkTitle = "Rowing Info, Membership Requirements, Rules...";
	else if( bn == 6 )
		lnkTitle = "NSW Regatta Calendar with links to draws & results.";
	else if( bn == 7 )
		lnkTitle = "Boat Race Officials Assessment Tests.";
	else if( bn == 8 )
		lnkTitle = "Resources/Courses/Positions for NSW Rowing Coaches.";
	else if( bn == 9 )
		lnkTitle = "A page for you to place advertisements or bulletins.";
	else if( bn == 10 )
		lnkTitle = "NSW Clubs and Schools: contacts, addresses, phone...";
	else if( bn == 11 )
		lnkTitle = "Items available for purchase through the NSWRA.";
	else if( bn == 12 )
		lnkTitle = "View photo galleries of regattas & other rowing events.";
	//else if( bn == 11 )
	//	lnkTitle = "2005 Australian Rowing Championships and Interstate Regatta";
	else if( bn == 13 )
		lnkTitle = "Links to other rowing web sites.";
	
		
	if( dynamic )
		{
		var cellStyl = GetObjStyle(theLnk.id.substring(0,4) + 'CELL');
		cellStyl.background = '#6666CC';
		var fontStyl = GetObjStyle(theLnk.id.substring(0,4) + 'FNT');
		fontStyl.color = '#ffff00';
		
		theLnk.title = lnkTitle;
		
		var lnkId = theLnk.id.substring(0,4);
		window.status = (w3c ? document.getElementById(lnkId).href : eval(lnkId + ".href"));
		}

	return true;
}

function mOut(theLnk) 
{
	window.status = "";
	
	if( dynamic )
		{
		var cellStyl = GetObjStyle(theLnk.id.substring(0,4) + 'CELL');
		cellStyl.background = '#000099';
		var fontStyl = GetObjStyle(theLnk.id.substring(0,4) + 'FNT');
		fontStyl.color = '#ffffcc';
		}
	
	return true;
}

function mClk(theCell)
{
	gCell = theCell;
	
	if( dynamic )
		{
		var objName = theCell.id.substring(0,4);
		theLnk = (w3c ? document.getElementById(objName) : eval(objName));
		self.location = theLnk.href;
		}
}

function WriteEAddress(addr1,addr2)
{
	if( addr2 == '' )
		addr2 = "rowingnsw_asn_au";
	
	addr2 = addr2.replace(/_/g, '.');
	document.write( '<A HREF="mai' );
	document.write( 'lto:' );
	document.write( addr1 );
	document.write( '&#64');
	document.write( addr2 );	
	document.write( '">' );
	document.write( addr1 );
	document.write( "&#64");
	document.write( addr2 );
	document.write( '<\/A>' );
}

function DateToday()
{
// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

// Array of month Names
var monthNames = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

var now = new Date();
document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear());
}


//updates field value with formatted DOB
function ValidateDOB( field )
{
	var dob,digits,c,i,x,day,mth,yr,numStr;
	
	dob = field.value;
	dob = Trim(dob);
	if( dob == "" ) 
		return true;
	
	digits = "0123456789";
	x = 1;
	day = 0;
	mth = 0;
	yr = 0;
	numStr = "";
	for( i=0; i<dob.length; i++)
		{
		c = dob.charAt(i);
		if( digits.indexOf(c) >= 0 )
			numStr = numStr + c;
		else
			{
			if( x == 1 ) day = parseInt(numStr,10);
			if( x == 2 ) mth = parseInt(numStr,10);
			x ++;
			numStr = "";
			}
		}
	if( x > 3 )
		{
		alert( "Invalid DATE OF BIRTH." );
		return false;
		}
			
	yr = parseInt(numStr,10); 
	
	if( yr > 0 && yr < 100 ) yr += 1900;
	
	if( (day < 1 || day > 31) || (mth < 1 || mth > 12) || yr < 1900 )		
		{
		alert( "Invalid DATE OF BIRTH." );
		return false;
		}
	
	if( day < 10 ) day = '0' + day;
	if( mth < 10 ) mth = '0' + mth;
		
	field.value = day + "/" + mth + "/" + yr;
	return true;
}


//remove leading non-digits
function MakeNumeric( str )
{
	while( str.length && isNaN(parseInt((str.charAt(0)))) )
		str = str.substring(1,str.length);
		
	return str;
}

//format dollars & cents
function FormatDollars( val )
{
	var x;
	
	if( val == 0 )
		return "";
	
	val = val.toString();
	val = val.replace(/^\$/,'');
	
	val *= 100;
	val = Math.round(val);
	if( isNaN(val) )
		return "";
	val /= 100;
	
	val = "$" + val;
	x = val.indexOf( "." );
  	if( x < 0 )
  		val += ".00";
  	else if( x == val.length - 2 )
  		val += "0";
  	
  	return val;
}

//remove trailing whitespace
function Trim( str )
{	
	while( str.length && str.charAt(str.length - 1) == ' ' )
		str = str.substring(str.length - 2,str.length - 1);
		
	return str;
}

function PopupHelp(hlpTitle,hlpTxt)
{
var objName = hlpTitle.replace(/ /gi, '');

var hlpHTML = '<img src="http://www.rowingnsw.asn.au/images/help.jpg" CLASS="noprint" ';
	hlpHTML += 'style="cursor: pointer;" onclick="document.getElementById(\''+objName+'\').style.display=\'\';">';

	hlpHTML += '<table id="'+objName+'" style="position:absolute; display: none; cursor: pointer; border: solid 1px #aaaaaa;" onclick="this.style.display=\'none\';"';
	hlpHTML += 'width="300" bgcolor="#eeeeee" cellpadding="2">';
	hlpHTML += '<tr><td><small>'+hlpTitle+'</small></td>';
	hlpHTML += '<td align="right"><span style="border: 1px solid grey; padding-left: 2px; padding-right: 2px;" onmouseover="this.style.background=\'#ff5500\';" onMouseOut="this.style.background=\'#ffeecc\';">X</span></td></tr>';
	hlpHTML += '<tr><td colspan="2">';
	hlpHTML += '<table bgcolor="#ffffcc"><tr><td><small>';
	hlpHTML += hlpTxt;
	hlpHTML += '</small></td></tr></table>';
	hlpHTML += '</td></tr></table>';
	
	document.write(hlpHTML);
}

function GetRadioButtonValue(radioButtons,formName,butName)
{
	var theVal = false;
	var i;
	
	if( macIE4 ) //evaluate all elements of form looking for butName
		{
		radioButtons = eval('document.' + formName);
		for( i=0; i<radioButtons.length; i++ )
			{
			if( radioButtons.elements[i].name == butName && radioButtons.elements[i].checked ) 
				theVal = radioButtons.elements[i].value;
			}
		}
	else	//just look at radioButtons
		{
		if( !radioButtons.length || isNaN(radioButtons.length) )	//just 1 radio button
			return radioButtons.value;
		
		for( i=0; i<radioButtons.length; i++ )
			{
			if( radioButtons[i].checked ) 
				theVal = radioButtons[i].value;
			}
		}
	
	return theVal;
}

function SetRadioButtonValue(radioButtons, newValue)
{
	if(!radioButtons)
		return;
	if( !radioButtons.length || isNaN(radioButtons.length) )	//just 1 radio button
		{
		radioButtons.checked = (radioButtons.value == newValue.toString());
		return;
		}
	for(var i = 0; i < radioButtons.length; i++)
		{
		radioButtons[i].checked = false;
		if( radioButtons[i].value == newValue.toString() )
			radioButtons[i].checked = true;
		}
}

function SetSelection( menuObj, val )
{
	var i; 
	if( menuObj && menuObj.type.toUpperCase().indexOf('SELECT') >= 0 )
		{
		for(i=0; i<menuObj.length; i++)
			{
			if( menuObj.options[i].value == val ) 
				menuObj.selectedIndex = i;
			}
		}
}

// Make an object visible
function ShowObject(objName)
{	
	if( ns4 ) 
		{
		obj = eval( "document." + objName );
		obj.visibility = "show";
		}
	else if( w3c )
		{
		obj = document.getElementById(objName);
		obj.style.visibility = "visible";
		}
	else if( ie4 )
		{
		obj = eval( objName + ".style" );
	    obj.visibility = "visible";
	    obj.zIndex = "0";	//for MacOS IE 4.0
	    }
}

// Hides an object
function HideObject(objName)
{
	if( ns4 )
		{
		obj = eval( "document." + objName );
		obj.visibility = "hide";
		}
	else if( w3c )
		{
		obj = document.getElementById(objName);
		obj.style.visibility = "hidden";
		}
	else if( ie4 )
		{
		obj = eval( objName + ".style" );
		obj.visibility = "hidden";
		}
}

function ToggleDisplay( objName )
{
	var obj = document.getElementById(objName);
	if( obj )
		obj.style.display = (obj.style.display == 'none' ? '' : 'none');

}

//global image variables
var newImg = new Image();
var newImgEvt;
var newImgUrl;
var newImgDiv;

function ShowImage( e, imgUrl )
{
	newImgEvt = e;
	newImgUrl = imgUrl;
	newImgDiv = document.getElementById("Preview");
	if( newImgDiv )
		{
		//load new image
		newImg.src = imgUrl;
		
		//if its not already loaded then defer display
		if( !newImg.width ) 
			newImg.onload = DisplayImage;
		else
			DisplayImage();
		}
}

function DisplayImage()
{
	if( newImg && newImgDiv )
		{
		var imgTitle = newImgUrl.replace(/.*\//,'');
		
		var imgH = newImg.height;
		var imgW = newImg.width;
		
		var txt = '<TABLE BORDER="1" CELLSPACING="0" BGCOLOR="#ffffff"><COL WIDTH="' + imgW +'"><COL WIDTH="18"><TR><TD ALIGN="center" BGCOLOR="#000099" STYLE="color:#ffffff; cursor:default;" ID="titlebar" onmousedown="DragWindowStart(event);">Click photo to close, Right-click to save<\/TD>';
			txt += '<TD WIDTH="18" ALIGN="center" BGCOLOR="#ff0000" STYLE="width:18px;" onClick="HideObject(\'Preview\');"><SPAN style="border: 0px solid grey; padding-left: 2px; padding-right: 2px; color:#ffffff;" onMouseOver="this.style.color=\'#ffff00\'; this.style.cursor=\'pointer\';" onMouseOut="this.style.color=\'#ffffff\';"><B>X<\/B><\/SPAN><\/TD><\/TR>';
			txt += '<TR><TD COLSPAN="2"><IMG SRC="' + newImgUrl + '"border="0" alt="' + imgTitle + '" STYLE="margin:10px;" onClick="HideObject(\'Preview\');"><\/TD><\/TR>';
			txt += '<TR><TD ALIGN="CENTER" COLSPAN="2">' + imgTitle + '<\/TD><\/TR><\/TABLE>';
		
		newImgDiv.innerHTML = txt;
				
		var winPos = GetMouseWindowPos(newImgEvt);
		var left = winPos[0] - GetScrollLeft();
		var top = winPos[1] - GetScrollTop();
	
		//alert(top + ':' + winH + ':' + GetScrollTop());
		
		var winW = GetClientWidth();
		var winH = GetClientHeight();
			
		if( winW && left + imgW > winW )
			left = winW - imgW;
			
		if( winH && top + imgH > winH )
			top = winH - imgH;
					
		newImgDiv.style.left = left + GetScrollLeft() - 40;
		newImgDiv.style.top = top + GetScrollTop() - 80;
			
		ShowObject( "Preview" );
		}
}

//-----------------------------------------------------------------------------
// Window dragging.
//-----------------------------------------------------------------------------

var inDragWindow = false;
var dragTarget = null;
var dragXOffset = 0;
var dragYOffset = 0;

function DragWindowStart(event)
{
	var x, y;

	if( !ie4 && !w3c ) return;
	
	dragTarget = document.getElementById("Preview");

	//Get cursor offset from window frame.
	if( ie4 ) 
		{
		x = window.event.x;
		y = window.event.y;
		}
	if( w3c )
		{
    	x = event.pageX;
    	y = event.pageY;
		}
 	dragXOffset = dragTarget.offsetLeft - x;
 	dragYOffset = dragTarget.offsetTop  - y;

	//Set document to capture mousemove and mouseup events.
	document.onmousemove = DragWindowDrag;
    document.onmouseup   = DragWindowStop;

  	inDragWindow = true;
}

function DragWindowDrag(event)
{
	var x, y;

	if( !inDragWindow ) return;

  	//Get cursor position.	
	if( w3c )
		{
		x = event.pageX;
		y = event.pageY;
    	event.preventDefault();
    	}
	if( ie4 )
		{
		x = window.event.x;
		y = window.event.y;
		window.event.cancelBubble = true;
    	window.event.returnValue = false;
		}

	//Move window frame based on offset from cursor.
	dragTarget.style.left = x + dragXOffset + "px";
	dragTarget.style.top  = y + dragYOffset + "px";
}

function DragWindowStop(event)
{
	inDragWindow = false;

	//Remove mousemove and mouseup event captures on document.
	document.onmousemove = null;
	document.onmouseup   = null;
}

//-----------------------------------------------------------------------------
// http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
//-----------------------------------------------------------------------------

function GetClientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function GetClientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function GetScrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function GetScrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------

function MoveObjectTo(objName,x,y)
{
	var obj = document.getElementById(objName);
	if( obj )
		{
		obj.style.left = x;
		obj.style.top = y;
		}
}

function FindObjectPosition(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
		{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent)
			{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
			}
		}
	return [curleft,curtop];
}

function GetScreenSize()
{
  var myWidth = 0, myHeight = 0;
  if( screen.availWidth ) 
  	{
    myWidth = screen.availWidth;
    myHeight = screen.availHeight;
  	} 
  else if( screen.width ) 
  	{
    myWidth = screen.width;
    myHeight = screen.height;
  	} 
  return [myWidth,myHeight];
}

function GetWindowSize()
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) 
  	{
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  	} 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
  	{
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  	} 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
  	{
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  	}
  return [myWidth,myHeight];
}

function GetMouseScreenPos(e) 
{
	var posx = 0;
	var posy = 0;
	if(!e) var e = window.event;
	if(e.screenX || e.screenY) 	
		{
		posx = e.screenX;
		posy = e.screenY;
		}

	return [posx,posy];
}

function GetMouseWindowPos(e) 
{
	var posx = 0;
	var posy = 0;
	if(!e) var e = window.event;
	if(e.pageX || e.pageY) 	
		{
		posx = e.pageX;
		posy = e.pageY;
		}
	else if(e.clientX || e.clientY)
		{
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		}
	// posx and posy contain the mouse position relative to the document
	return [posx,posy];
}

//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------

function XML_Request( requestUrl,formContents ) 
{
	var xmlRequest = null;
	var xmlResponse = 'ERROR: xml request not supported';

	if( window.XMLHttpRequest ) 
		{
		try		{xmlRequest = new XMLHttpRequest();}
		catch(e){xmlRequest = false;}
		} 
	else if( window.ActiveXObject ) 
		{
		try		 {xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");}
		catch(e) {xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");}
		}
	if( xmlRequest ) 
		{
		if( formContents && formContents.length )
			{
			xmlRequest.open("POST", requestUrl, false);
			xmlRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    		xmlRequest.setRequestHeader("Content-length", formContents.length);
    		xmlRequest.send(formContents);
			}
		else
			{
			xmlRequest.open("GET", requestUrl, false);	//false -> synchronous (wait for completion)
			xmlRequest.send(null);
			}
			
		if( xmlRequest.status == 200 ) 
			xmlResponse = xmlRequest.responseText;
		else
			xmlResponse = (xmlRequest.statusText ? "ERROR: " + xmlRequest.statusText : 'Unknown Error');
		}		
		
	return xmlResponse;
}

//-----------------------------------------------------------------------------
// Detect whether PDF plugin is available
//-----------------------------------------------------------------------------

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;

//Browser detection (using IE conditional compilation)
var UNDEF = "undefined";
var ua = new Array();
ua.w3cdom = typeof document.getElementById != UNDEF && typeof document.getElementsByTagName != UNDEF && typeof document.createElement != UNDEF && typeof document.appendChild != UNDEF && typeof document.replaceChild != UNDEF && typeof document.removeChild != UNDEF && typeof document.cloneNode != UNDEF;
ua.u = navigator.userAgent.toLowerCase();
ua.p = navigator.platform.toLowerCase();
ua.webkit = /webkit/.test(ua.u) ? parseFloat(ua.u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false; // returns either the webkit version or false if not webkit
ua.ie = false;
ua.windows = ua.p ? /win/.test(ua.p) : /win/.test(ua.u);
ua.mac = ua.p ? /mac/.test(ua.p) : /mac/.test(ua.u);
/*@cc_on
	ua.ie = true;
	@if (@_win32)
		ua.windows = true;
	@elif (@_mac)
		ua.mac = true;
	@end
@*/

function DetectPDF(redirectURL) 
{
	//redirect if we can't detect
	if( !canDetectPlugins() )
		{
		pluginNotAvailable(redirectURL);
		return false;
		}

	pluginFound = detectPlugin('Adobe','Acrobat');
	if( !pluginFound )
		pluginFound = detectPlugin('PDF');
	// if not found, try to detect with VisualBasic
	if( !pluginFound && detectableWithVB )
		{
		var vers = 1;
		while( !pluginFound && vers <= 6 )
			{
			if(!pluginFound )	pluginFound = detectActiveXControl('PDF.PdfCtrl.' + vers);
			//v7.0 && 8.0
			if(!pluginFound )	pluginFound = detectActiveXControl('AcroPDF.PDF.' + vers);
			vers ++;
			}
		}
	
	if( !pluginFound )
		pluginNotAvailable( redirectURL );

	return pluginFound;
}

function ResizePDF()
{
	//var embPDF = document.getElementById( ua.ie ? 'pdfobject' : 'pdfembed');
	var embPDF = document.getElementById('pdfembed');
	if( embPDF )
		{
		embPDF.style.width = GetClientWidth() - 230;
		embPDF.style.height = GetClientHeight() - 170;
		embPDF.style.zIndex = 0;
		}
}

function pluginNotAvailable( redirectURL )
{
	document.write('<small>This page is best viewed with the Adobe Reader PDF plugin installed.');
	document.write('<br><a href="http://www.adobe.com/products/acrobat/readstep2.html">Adobe Reader</a> may be downloaded from the Adobe website.<p></small>');
	if( ua.webkit )
		document.write('<small><b>Safari deos not support viewing PDFs within the page.</b> Please use the link above.<p></small>');
	
	if( redirectURL )
		{
		var fileName = redirectURL;
		if( redirectURL.search( /\/([^\/]*)\.pdf$/i ) != -1 )
			fileName = RegExp.$1;
		
		fileName = fileName.replace( /%20/g, ' ' );
		
		document.write('<BR>Download File: <A HREF="' + redirectURL + '"><IMG SRC="/images/icon_pdf.gif" BORDER=0>' + fileName + '</A><P>' );
		}
}

function canDetectPlugins() {
	if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
		return true;
	} else {
		return false;
	}
}

function detectPlugin() {
	// allow for multiple checks in a single pass
	var daPlugins = detectPlugin.arguments;
	// consider pluginFound to be false until proven true
	var pluginFound = false;
	// if plugins array is there and not fake
	if (navigator.plugins && navigator.plugins.length > 0) {
		var pluginsArrayLength = navigator.plugins.length;
		// for each plugin...
		for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
			// loop through all desired names and check each against the current plugin name
			var numFound = 0;
			for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
				// if desired plugin name is found in either plugin name or description
				if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
					(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
					// this name was found
					numFound++;
				}   
			}
			// now that we have checked all the required names against this one plugin,
			// if the number we found matches the total number provided then we were successful
			if(numFound == daPlugins.length) {
				pluginFound = true;
				// if we've found the plugin, we can stop looking through at the rest of the plugins
				break;
			}
		}
	}
	return pluginFound;
} // detectPlugin


// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
	document.writeln('<script language="VBscript">');

	document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
	document.writeln('detectableWithVB = False');
	document.writeln('If ScriptEngineMajorVersion >= 2 then');
	document.writeln('  detectableWithVB = True');
	document.writeln('End If');

	document.writeln('\'this next function will detect most plugins');
	document.writeln('Function detectActiveXControl(activeXControlName)');
	document.writeln('  on error resume next');
	document.writeln('  detectActiveXControl = False');
	document.writeln('  If detectableWithVB Then');
	document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
	document.writeln('  End If');
	document.writeln('End Function');

	document.writeln('\'and the following function handles QuickTime');
	document.writeln('Function detectQuickTimeActiveXControl()');
	document.writeln('  on error resume next');
	document.writeln('  detectQuickTimeActiveXControl = False');
	document.writeln('  If detectableWithVB Then');
	document.writeln('    detectQuickTimeActiveXControl = False');
	document.writeln('    hasQuickTimeChecker = false');
	document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
	document.writeln('    If IsObject(hasQuickTimeChecker) Then');
	document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
	document.writeln('        detectQuickTimeActiveXControl = True');
	document.writeln('      End If');
	document.writeln('    End If');
	document.writeln('  End If');
	document.writeln('End Function');

	document.writeln('</scr' + 'ipt>');
}