if (!TT)
{
	var TT = {};
}
if (!TT.swf)
{
	TT.swf = new SWF(TT);
}
function SWF ( TT_obj )
{
	this.TT = TT_obj;
	return this;
}

/** Adapted from Adobe Tag injector **/
SWF.prototype.build_output = function ()
{
	var client = this.TT.client_type;
	var browser = client.b_type;
	var os = client.os_type;
	this.output = '';
	if (browser == "ie" && os == "win")
	{
		this.output += '<object ';
		for (var i in this.object_tag)
		{
			if (i != "name")
			{
				this.output += i + '="' + this.object_tag[i] + '" ';
			}
		}
		this.output += '>';
		for (var i in this.params)
		{
			this.output += '<param name="' + i + '" value="' + this.params[i] + '" /> ';
		}
		this.output += '</object>';
	}
	else
	{
		this.output += '<embed ';
		for (var i in this.embed_tag)
		{
			this.output += i + '="' + this.embed_tag[i] + '" ';
		}
		this.output += '> </embed>';
	}
}

/** Adapted from Adobe Tag injector **/
SWF.prototype.build_tags = function (args, element_name)
{
	if ((navigator.plugins["Shockwave Flash"] == null) && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash") == null))
	{
		return false;
	}
	var element = document.getElementById(element_name);
	if( !element )
	{
		return false;
	}

	this.embed_tag = new Object();
	this.params = new Object();
	this.object_tag = new Object();
	for (var i=0; i < args.length; i=i+2)
	{
		switch (args[i].toLowerCase())
		{
			case "accesskey":
			case "align":
			case "class":
			case "height":
			case "hspace":
			case "name":
			case "tabindex":
			case "title":
			case "vspace": 
			case "width":
			this.embed_tag[args[i]] = this.object_tag[args[i]] = args[i+1];
			break;
			case "classid":
			break;
			case "codebase":
			case "id":
			case "onactivate":
			case "onafterupdate":
			case "onbeforedeactivate":
			case "onbeforeeditfocus":
			case "onbeforeupdate":
			case "onblur":
			case "oncellchange":
			case "onclick":
			case "ondblclick":
			case "ondeactivate":
			case "ondrag":
			case "ondragend":
			case "ondragenter":
			case "ondragleave":
			case "ondragover":
			case "ondrop":
			case "onfinish":
			case "onfocus":
			case "onhelp":
			case "onkeypress":
			case "onkeydown":
			case "onkeyup":
			case "onload":
			case "onlosecapture":
			case "onmousedown":
			case "onmousemove":
			case "onmouseout":
			case "onmouseover":
			case "onmouseup":
			case "onpropertychange":
			case "onreadystatechange":
			case "onrowenter":
			case "onrowexit":
			case "onrowsdelete":
			case "onrowsinserted":
			case "onscroll":
			case "onstart":
			case "type":
			this.object_tag[args[i]] = args[i+1];
			break;
			case "pluginspage":
			this.embed_tag[args[i]] = args[i+1];
			break;
			case "movie":	
			case "src":
			this.embed_tag["src"] = args[i+1];
			this.params["movie"] = args[i+1];
			break;
			default:
			this.embed_tag[args[i]] = this.params[args[i]] = args[i+1];
		}
	}
	this.object_tag["classid"] = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
	this.embed_tag["type"] = "application/x-shockwave-flash";
	this.build_output();
	element.innerHTML = this.output;
}

/** Adapted from Adobe Tag injector **/
SWF.prototype.fix_extention = function (url, ext)
{
  if (url.indexOf('?') != -1)
    return url.replace(/\?/, ext+'?'); 
  else
    return url + ext;
}

/** Start Flash Version of Site **/
SWF.prototype.init_swf = function ()
{
	this.TT.use_flash = true;
	var html_divs = this.TT.set_vis( "html_divs", "hidden" );
}
