function Embed_Swf(swf,w,h,id,flshVer,noTrans)
{
	flshVer = (!flshVer) ? 7 : flshVer;
	if(swf.lastIndexOf("/") != -1)
	{
		swf_name = swf.substring(swf.lastIndexOf("/") + 1, (swf.length - 4));
	}
	{
		swf_name = swf.substring(0, (swf.length - 4));
	}
	var text_to_return = "";

	text_to_return += ('<div id="swfDIV_'+id+'" style="display:inline"><object tabindex=9 id="'+id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flshVer+',0,0,0" width="'+w+'" height="'+h+'" align="middle">');

	text_to_return += ('<param name="allowScriptAccess" value="always" />');
	text_to_return += ('<param name="movie" value="'+swf+'" />');
	text_to_return += ('<param name="quality" value="best" />');
	text_to_return += ('<param name="bgcolor" value="#ffffff" />');
	text_to_return += ('<param name="menu" value="true"/>');
	if(!noTrans)
	{ 
		text_to_return += ('<param name="wmode" value="transparent">'); 
	}
	
	text_to_return += ('<embed SWLIVECONNECT=true menu=true id="'+id+'"  src="'+swf+'" quality="best" bgcolor="#ffffff" '+((!noTrans)?'wmode="transparent"':'')+' width="'+w+'" height="'+h+'" name="' + swf_name + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	text_to_return += ('</object></div>');

	document.write(text_to_return);
	
	//document.getElementById("swfDIV_"+id).style.display="inline";
	//document.getElementById("swfDIV_"+id).id = "SWF_Embedded";
}


function Popup(object,windowWidth,windowHeight,windowTitle,xml)
{
	//windowHeight = (REQUIRED_RESOLUTION_HEIGHT>windowHeight) ? windowHeight : REQUIRED_RESOLUTION_HEIGHT-40;
	//windowWidth  = (REQUIRED_RESOLUTION_WIDTH>windowWidth)   ? windowWidth  : REQUIRED_RESOLUTION_WIDTH-20;
	scrollBars   = (windowWidth>(windowWidth+50) && windowHeight>(windowHeight+50)) ? "no" : "yes";
	windowTitle  = (windowTitle!="") ? escape(windowTitle) : escape("&nbsp;");
	windowName   = ("OptionSixPopup"+windowWidth+"x"+windowHeight+(Math.random()*10)).replace(/\./g,"");;

	if(object.indexOf(".htm")!=-1 || object.indexOf(".html")!=-1)
	{
		scrollBars = "yes";
		sPath = (location.href.indexOf("popups/")!=-1) ? "" : "popups/";
		sPath = (location.href.indexOf("interface/")!=-1) ? "../popups/" : sPath;
		win = open(sPath+object,windowName,"width="+windowWidth+",height="+windowHeight+",scrollbars="+scrollBars+",resizable=yes,menubars=no,toolbar=no,directories=no,top="+((screen.availHeight/2)-(windowHeight/2))+',left='+((screen.availWidth/2)-(windowWidth/2)));
		win.focus();
	}
	if(object.indexOf(".jpg")!=-1 || object.indexOf(".gif")!=-1)
	{
		sPath = (location.href.indexOf("popups/")!=-1) ? "" : "popups/";
		sPath = (location.href.indexOf("interface/")!=-1) ? "../popups/" : sPath;
		win = open(sPath+"00_showimage.htm?IMG="+object+"&WIDTH="+windowWidth+"&HEIGHT="+windowHeight+"&TITLE="+windowTitle,windowName,"width="+(windowWidth+50)+",height="+(windowHeight+50)+",scrollbars="+scrollBars+",menubars=no,toolbar=no,directories=no,top="+((screen.availHeight/2)-(windowHeight/2))+',left='+((screen.availWidth/2)-(windowWidth/2)));
		win.focus();
	}
	if(object.indexOf(".swf")!=-1)
	{
		sPath = (location.href.indexOf("media/flash/")!=-1) ? "" : "../media/flash/";
		sPath = (location.href.indexOf("popups/")!=-1) ? "../../media/flash/" : sPath;
		sPath = (location.href.indexOf("interface/")!=-1) ? "../../media/flash/" : sPath;

		win = open(sPath+"00_showflash.htm?SWF="+object+"&WIDTH="+windowWidth+"&HEIGHT="+windowHeight+"&TITLE="+windowTitle+"&XML="+xml,windowName,"width="+(windowWidth+0)+",height="+(windowHeight+0)+",scrollbars=no,menubars=no,toolbar=no,directories=no,top="+((screen.availHeight/2)-(windowHeight/2))+',left='+((screen.availWidth/2)-(windowWidth/2)));
		win.focus();
	}
	if(object.indexOf(".doc")!=-1 || object.indexOf(".xls")!=-1 || object.indexOf(".pdf")!=-1 || object.indexOf(".ppt")!=-1)
	{
		scrollBars = "yes";
		sPath = (location.href.indexOf("popups/")!=-1) ? "../" : "";
		sPath = (location.href.indexOf("interface/")!=-1) ? "../popups/" : sPath;
		win = open(sPath+"documents/"+object,windowName,"width="+windowWidth+",height="+windowHeight+",scrollbars="+scrollBars+",resizable=yes,menubars=yes,toolbar=yes,directories=no,top="+((screen.availHeight/2)-(windowHeight/2))+',left='+((screen.availWidth/2)-(windowWidth/2)));
		//win.focus();
	}
}

function CheckSize()
{
	if(navigator.appName.indexOf("Internet Explorer")==-1)
	{
		document.getElementById("CONTENT").height=getHeight()-135;
	}
}

IMG_PATH = "../media/images/generic_icons/";

function ToggleTwisty(tID)
{
	var twisty=document.getElementById(tID);
	var twisty_img=document.getElementById(tID+"_img");
	var twisty_title=document.getElementById(tID+"_title");
	
	if(twisty.style.display=="none")
	{
		twisty.style.display="block";
		twisty_img.src=IMG_PATH+"twisty_open.gif";
		twisty_title.style.color="#ffffff";
	}
	else
	{
		twisty.style.display="none";
		twisty_img.src=IMG_PATH+"twisty_collapsed.gif";
		twisty_title.style.color="#000000";
	}
}

function BeginTwisty(sTitle)
{
	unName = "twisty_"+(Math.random()+"").replace("\.","x");
	sImg_closed = "twisty_collapsed.gif";
	sImg_open   = "twisty_open.gif";

	document.writeln("<div id='TWISTY' style='width: 100%;'>");
	document.writeln("<div style='height: 37px'>");
	document.writeln("<img id='"+unName+"_img' onclick='ToggleTwisty(\""+unName+"\");' src="+IMG_PATH+sImg_closed+">");	
	document.writeln("<div id='"+unName+"_title' style='position: relative; right: -40px; bottom: 30px'>"+sTitle+"</div>");
	document.writeln("</div>");
	document.writeln("<div style='display: none; position: relative; left: 50px; width: 490px' id="+unName+">");
}
function EndTwisty()
{
	document.write("</div>");
	document.write("</div>");
}

// ---- END TWISTY----

function send_data_to_flash(movie_name, variable, value)
{
	 var flashMovie=get_flash_object(movie_name);
	 flashMovie.SetVariable("/:" + variable , value);
}

function get_flash_object(movieName)
{
	if (window.document[movieName]) 
	{
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
	if (document.embeds && document.embeds[movieName])
		return document.embeds[movieName]; 
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(movieName);
	}
}
function getHeight()
{
	if (this.webkit419) return this.innerHeight;
	if (this.opera) return document.body.clientHeight;
		return document.documentElement.clientHeight;
}

function Login()
{
	if(window.parent.CheckLogin(document.getElementById("Team_Name").value,document.getElementById("Team_Login").value)==true)
	{
		document.getElementById("LOGIN").style.display="none";
		document.getElementById("LOGGEDIN").style.display="inline";
	}
}

function Check_Login()
{
	if(window.parent.LoggedIn!="")
	{
		document.getElementById("LOGIN").style.display="none";
		document.getElementById("LOGGEDIN").style.display="inline";
	}
}

function Check_Team(id)
{
	if(id!=window.parent.LoggedIn)
		document.body.innerText="You must be logged in to view this page";
}

function Load_Team()
{
	location.replace(window.parent.LoggedIn+".htm");
}

function Logout()
{
	window.parent.LoggedIn="";
	if(location.href.indexOf("Team")!=-1)
		location.replace("myteam.htm");
	else
		location.reload();
}




