<!--

	/*
	  CopyRight 2004-2007 Scott MacNeill. All rights reserved

	  Terms:
		You may use this library for no charge. Though you may NOT distribute it.
		You may modify this library for use in your application only.
		All information above this statement including this statement must remain un-altered.
		Any question or modification request can be sent to macneill.scott@gmail.com
		http://www.legionware.com/
	*/


	/*
	  ==> This is the Flash Handler v0.6
	      This is where we build flash elements
	*/


	/*
	  Using DOM code create the neccessary elements to add flash
	*/
	function flash_handler (elem_container, elem_name, elem_width, elem_height, elem_bg, elem_wmode, req_ver, elem_src) {

		if (v < req_ver) return false;

		elem_container = document.getElementById(elem_container);

		if (navigator.plugins.length) {

		  	flash_element = document.createElement('embed');

			flash_element.setAttribute('src', elem_src);
			flash_element.setAttribute('quality', 'high');
			flash_element.setAttribute('bgcolor', elem_bg);
			flash_element.setAttribute('width', elem_width);
			flash_element.setAttribute('height', elem_height);
			flash_element.setAttribute('name', elem_name);
			flash_element.setAttribute('id', elem_name);
			flash_element.setAttribute('allowScriptAccess', 'sameDomain');
			flash_element.setAttribute('type', 'application/x-shockwave-flash');
			flash_element.setAttribute('pluginspage', 'http://www.macromedia.com/go/getflashplayer');
			if (elem_wmode) flash_element.setAttribute('wmode', 'transparent');

		} else {

			flash_element = document.createElement('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">');

			flash_element.setAttribute('codebase', 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0');
			flash_element.setAttribute('width', elem_width);
			flash_element.setAttribute('height', elem_height);
			flash_element.setAttribute('id', elem_name);
			if (elem_wmode) flash_element.setAttribute('wmode', 'transparent');

			params = new Array('allowScriptAccess', 'movie', 'quality', 'bgcolor');
			params_val = new Array('sameDomain', elem_src, 'high', elem_bg);

			for (i = 0; i < params.length; i++) {

				param = document.createElement('param');
				param.setAttribute('name', params[i]);
				param.setAttribute('value', params_val[i]);

				flash_element.insertBefore(param);

			}

		}

		while (elem_container.firstChild) elem_container.removeChild(elem_container.firstChild);

		elem_container.appendChild(flash_element);

	}


	/*
	  Set/get location.hash
	  if action = "set" pass hash variables to set to "str"
	*/
	function handle_hash (action, str) {

		if (action == "set") location.href = location.href.split("#")[0] + "#" + str;

		else return location.hash;

	}


	/*
	  Resize a flash movie
	*/
	function resize_flash (target_movie, new_width, new_height) {

		document.getElementById(target_movie).style.width = new_width + "px";
		document.getElementById(target_movie).style.height = new_height + "px";

	}


	/*
	  Detect flash player and version
	*/
	var v = 0;
	var f = navigator.plugins["Shockwave Flash"];
	
	if (f) v = parseInt(f['description'].match(/\d+.\d+/i));

	else {

		document.write("\<script type=\"text/vbscript\"\> \n" +
		"On Error Resume Next \n" +
		"For i = 15 To 0 Step -1 \n" +
		"	f = IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & i)) \n" +
		"	If f Then \n" +
		"		v = i \n" +
		"		Exit For \n" +
		"	End If \n" +
		"Next \n" +
		"\</script\> \n");

	}


// -->