/*
 * Derek Clayton
 *   www.DerekClayton.com
 * February 2010
 * (c) Copyright Derek Clayton 2008-2010
 * asapCMS Copyright 2008-2010 Derek Clayton and DerekClayton.com, All rights Reserved.
 * Use of this code, in whole or in part, is expressly forbidden without the prior written permission of DerekClayton.com.
 */

//Detect if the user is using IE on Windows.
var isIE = 0;
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { isIE=1; }


// ------------------------
//Detect if the user has the Flash Plugin.
var flashPlugin = 0;
var flashVersion = 0;
flashPlugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( flashPlugin ) {
	var words = flashPlugin.description.split(" ");
	for (var i = 0; i<words.length; ++i) {
		if (isNaN(parseInt(words[i]))) {
			continue;
		} else {
			flashVersion = words[i];
		}
	}
} else if (isIE) {
	document.write( '<script language=vbscript\> \n' );
	document.write( 	'on error resume next \n' );
	document.write( 	'flashPlugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n' );
	document.write( '</script>' );
/*
	document.write( '<script language="vbscript">\n' );
	document.write( 	'on error resume next \n' );
	document.write( 	'flashPlugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n' );
	document.write( 	'If     IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.12")) Then \n' );
	document.write( 	'	flashVersion=12 \n' );
	document.write( 	'ElseIf IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.11")) Then \n' );
	document.write( 	'	flashVersion=11 \n' );
	document.write( 	'ElseIf IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10")) Then \n' );
	document.write( 	'	flashVersion=10 \n' );
	document.write( 	'ElseIf IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))  Then \n' );
	document.write( 	'	flashVersion=9 \n' );
	document.write( 	'ElseIf IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))  Then \n' );
	document.write( 	'	flashVersion=8 \n' );
	document.write( 	'ElseIf IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))  Then \n' );
	document.write( 	'	flashVersion=7 \n' );
	document.write( 	'ElseIf IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))  Then \n' );
	document.write( 	'	flashVersion=6 \n' );
	document.write( 	'End If \n' );
	document.write( '</script>\n' );
*/
}
//flashPlugin = 0; //for testing so site acts like no Flash is installed *****
//alert( "isIE: "+ isIE + ", flashPlugin: "+ flashPlugin +", flashVersion: "+ flashVersion );



// ------------------------
// function mail
// ***Not currently used***
function mail(box) {
	var domain = "lakewinnie.com";

	// This makes the page name (xxx.htm) the subject:
	//var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	//sSubject = sPage.substring(0, sPage.lastIndexOf('.') );

	// This makes the page title the subject:
	var sSubject = document.title;
	if (box=="xxx") {
		document.write("<a href='mailto:info@" + domain + "?subject=" + sSubject +"' />Contact Us</a>");
	} else if (box=="web") {
		document.write("<a href='mailto:webmaster@" + domain + "?subject=" + sSubject +"' />Contact Webmaster</a>");
	} else {
		document.write("<a href='mailto:" + box + "@" + domain + "?subject=" + sSubject +"' />" + box + "@" + domain + "</a>");
	}
} // ----- end mail function -----



// ------------------------
// function playFlash
function playFlash( parameter1, parameter2, parameter3 ) {
	if (flashPlugin && flashVersion>=8) {
		filename = "/images/video/" + parameter1;
		width = parameter2;
		height = parameter3;

		//Flash code for IE:
		document.write( "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+ width +"' height='"+ height +"' align='middle' id='flash'>\n" );
		document.write( "	<param name='allowScriptAccess' value='sameDomain' />\n" );
		document.write( "	<param name='movie' value='"+ filename +"' />\n" );
		document.write( "	<param name='quality' value='high' />\n" );
		document.write( "	<param name='loop' value='false' />\n" );
		document.write( "	<param name='menu' value='false' />\n" );
		document.write( "	<param name='play' value='true' />\n" );
		document.write( "	<param name='wmode' value='transparent' />\n" );
		//Flash code for Netscape:
		document.write( "	<embed src='"+ filename +"' width='"+ width +"' height='"+ height +"' wmode='transparent' quality='high' name='flash' loop='false' menu='false' play='true' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\n" );
		document.write( "</object>\n" );
	} //End if Flash.
}	// ----- end playFlash -----