// **********************************************************************
// Global Scripts
// Copyright (c) 2004-2005 mkeefeDESIGN
// http://www.mkeefedesign.com/
// **********************************************************************
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
// **********************************************************************
//
// **********************************************************************
// UPDATES AND FIXES
// **********************************************************************
//


var ns4 = document.layers
var ie4 = document.all
var ns6 = document.getElementById && !document.all


/*******************************
DIV SHOW/HIDE CODE
*******************************/

var objects = new Array();
var DOMtype = '';

if (document.getElementById) 
	{ 
	DOMtype = "std"; 
	} 
else if (document.all) 
	{ 
	DOMtype = "ie4"; 
	} 
else if (document.layers) 
	{ 
	DOMtype = "ns4"; 
	}

function openAll(elem, titleidname, act)
	{
	for(var i=0; i<=total_shows; i++)
		{
		obj = fetch_obj(elem + i);
		title = fetch_obj(titleidname + i);
		if (obj)
			{
			if (act == "open")
				{
				obj.style.display = "";
				title.innerHTML = "Close";
				}
			else if (act == "close")
				{
				obj.style.display = "none";
				title.innerHTML = "Open";
				}
			}
		}
	
	}

function fetch_obj(idname, forcefetch)
	{
	if (forcefetch || typeof(objects[idname]) == "undefined")
		{
		switch (DOMtype)
			{
			case "std":
				{
				objects[idname] = document.getElementById(idname);
				}
			break;

			case "ie4":
				{
				objects[idname] = document.all[idname];
				}
			break;

			case "ns4":
				{
				objects[idname] = document.layers[idname];
				}
			break;
			}
		}
	return objects[idname];
	}

// Toggle 'display' attribute of an object
function toggle_display(idname,titleidname)
	{
	obj = fetch_obj(idname);
	title = fetch_obj(titleidname);
	if (obj)
		{
		if (obj.style.display == "none")
			{
			obj.style.display = "";
			title.innerHTML = "Close";
			}
		else
			{
			obj.style.display = "none";
			title.innerHTML = "Open";
			}
		}
	}


/*******************************
GENERATE BYLINE FOOTER
*******************************/

// Flash Version Detector  v1.2.1
// documentation: http://www.dithered.com/javascript/flash_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// with VBScript code from Alastair Hamilton (now somewhat modified)
function isDefined(property) { return (typeof property != 'undefined'); }
var flashVersion = 0;
function getFlashVersion() {
	var latestFlashVersion = 8;
	var agent = navigator.userAgent.toLowerCase(); 
	// NS3 needs flashVersion to be a local variable
	if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
	}
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			for (var i = latestFlashVersion; i >= 3; i--) {
				if (flashPlugin.description.indexOf(i + '.') != -1) {
				   flashVersion = i;
				   break;
				}
			}
		}
	}
	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
		var doc = '<scr' + 'ipt language="VBScript"\> \n';
		doc += 'On Error Resume Next \n';
		doc += 'Dim obFlash \n';
		doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
		doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
		doc += '   If IsObject(obFlash) Then \n';
		doc += '      flashVersion = i \n';
		doc += '      Exit For \n';
		doc += '   End If \n';
		doc += 'Next \n';
		doc += '</scr' + 'ipt\> \n';
		document.write(doc);
	}
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;
	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;
	// Can't detect in all other cases
	else { flashVersion = flashVersion_DONTKNOW; }
	return flashVersion;
}
flashVersion_DONTKNOW = -1;

function showByline()
	{
	if (getFlashVersion() < 6) 
		{
		document.write('<a href="' + mkeefeDESIGNURL + '" target="_blank"><image src="' + PRESSKITLINK + 'mkd_footer_logo.gif" width="100" height="25" border="0" alt="Visit mkeefeDESIGN"/></a>');
		} 
	else 
		{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100" height="25" id="byline" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + PRESSKITLINK + 'mkd_footer_logo.swf?Key=80707" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#000000" />');
		document.write('<embed src="' + PRESSKITLINK + 'mkd_footer_logo.swf?Key=80707" quality="high" wmode="transparent" bgcolor="#000000" width="100" height="25" name="byline" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
		}
	}