// JavaScript Document

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function openCenteredWindow(url, height, width, name, parms) {
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( ((screen.height-35) - height) / 2);
   if (top < 0) top = 0
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}

function launchuserinfo(userID,urltoken){
	var attributes = "toolbar=no,scrollbars=auto,resizable=yes,width=300,height=450,left=100,top=100";
	msgWindow=window.open("http://www.mmorpg.com/userinfo.cfm?" + urltoken + "&userID=" + userID,"UserInformation",attributes);
	}

function showScreen(width,height,id,gameID,type)
{
	if(!type){
		type = 1;
	}
	openCenteredWindow('/view_screenshot.cfm?gameID=' + gameID + '&screenID=' + id + '&type=' + type,height+50,width+8,'screenView','');
}

function showScreen2(id,gameId,type,mode){
	if(!type){
		type = 1;
	}
	if(!mode){
		mode = 1;
	}
	openCenteredWindow('/dsp/dspScreenViewer.cfm?gameId=' + gameId + '&screenId=' + id + '&type=' + type + '&mode=' + mode,625,801,'screenViewer','');
}

function viewImage(width,height,file)
{	
	var sWidth, sHeight;
	var aWidth	= screen.width - 8;
	var aHeight	= screen.height - 50;	
	var scroll	= 'no';
	
	// if the width or height exceeds the users screen dimensions alter it
	sWidth	= width;
	sHeight	= height;
	
	if(aWidth < width){
		sWidth	= aWidth;
		scroll	= 'yes';
	}
	
	if(aHeight < height){
		sHeight	= aHeight;
		scroll	= 'yes';
	}	
	
	openCenteredWindow('http://' + window.location.hostname + '/view_screenshot.cfm?file=' + file,sHeight+50,sWidth+8,'imageView','scrollbars='+scroll);
	return;
}
function testCookies() { 
 var exp = new Date(); 
 exp.setTime(exp.getTime() + 1800000); 
 // first write a test cookie 
 setCookie("cookies", "cookies", exp, false, false, false); 
 if (document.cookie.indexOf('cookies') != -1) { 
  found = false;
 } 
 else { 
    found = true;
 } 
 // now delete the test cookie 
  exp = new Date(); 
  exp.setTime(exp.getTime() - 1800000); 
  setCookie("cookies", "cookies", exp, false, false, false); 
  return found;
 }

function setCookie(name, value, expires, path, domain, secure) { 
 var curCookie = name + "=" + escape(value) + 
    ((expires) ? "; expires=" + expires.toGMTString() : "") + 
    ((path) ? "; path=" + path : "") + 
    ((domain) ? "; domain=" + domain : "") + 
    ((secure) ? "; secure" : ""); 
 document.cookie = curCookie; }
 
 function everyPage()
 {
 	if (testCookies())
		if (!cookieBypass)document.location = '/errors/nocookies.cfm';
 }
 function showPrivacy()
{
	openCenteredWindow('http://www.mmorpg.com/privacy.cfm',500,400,'privacy','toolbar=true,scrollbars=yes,resizable=yes');
}
function showCopyright()
{
	openCenteredWindow('http://www.mmorpg.com/copyright.cfm',270,400,'copyright','toolbar=false,scrollbars=no,resizable=yes');
}
function showRules()
{
	openCenteredWindow('http://www.mmorpg.com/rules.cfm',500,400,'rules','toolbar=false,scrollbars=yes,resizable=yes');
}

function showBioPage(){
	openCenteredWindow('http://www.mmorpg.com/bio.cfm',500,600,'rules','toolbar=false,scrollbars=yes,resizable=yes');
}


function lostpw()
{
	var attributes = "toolbar=no,scrollbars=no,resizable=no,titlebar=no,status=no,menubar=no,directories=no";
	openCenteredWindow("http://www.mmorpg.com/lostpw.cfm?firstload=true",250,350,"lostpw",attributes);
}

//****** Retrieve a reference to an object in the document
//
function getObj(objID)
{
    if(document.getElementById){
        return document.getElementById(objID);
    } else if (document.all){
        return document.all[objID];
    } else if (document.layers){
        return document.layers[objID];
    }
}

//******
// Retrieve a reference to an object in the parent's dom
function getParentObj(objID){
    if(document.getElementById){
        return parent.document.getElementById(objID);
    } else if (document.all){
        return parent.document.all[objID];
    } else if (document.layers){
        return parent.document.layers[objID];
    }   
}

//******
// Get a page elements X
function DL_GetElementLeft(eElement)
{
	if (!eElement && this)                       // if argument is invalid
	{                                            // (not specified, is null or is 0)
		eElement = this;                         // and function is a method
	}                                            // identify the element as the method owner
	
	var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
	var eParElement = eElement.offsetParent;     // identify first offset parent element  
	while (eParElement != null)
	{                                            // move up through element hierarchy
		nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
		eParElement = eParElement.offsetParent;  // until no more offset parents exist
	}
	return nLeftPos;                             // return the number calculated
}

//******
// Get a page elements Y
function DL_GetElementTop(eElement)
{
	if (!eElement && this)
	{
		eElement = this;
	}

	var nTopPos = eElement.offsetTop;
	var eParElement = eElement.offsetParent;
	while (eParElement != null)
	{
		nTopPos += eParElement.offsetTop;
		eParElement = eParElement.offsetParent;
	}
	return nTopPos;
}

//******
// Show the user post report frame
function showUserPostReport(elem,userId,postId,offsetX,offsetY){	
	var obj	= getObj(elem);
	
	if(!offsetX){
		offsetX	= -100;
	}
	
	if(!offsetY){
		offsetY	= 16;
	}
	
	var x	= (DL_GetElementLeft(obj)+ offsetX) + 'px';
	var y	= (DL_GetElementTop(obj)+ offsetY) + 'px';
	var ws	= getObj('userPostReport');
	var uf	= getObj('userPostReportFrame');											
	
	// hide?							
	if(ws.style.left == x && ws.style.top == y && ws.style.display == ''){								
		ws.style.display	= 'none';
		return;
	}
	
	// set the iframe src to the correct user
	uf.src	= 'dsp/dspUserPostReport.cfm?userId=' + userId + '&postId=' + postId;
	
	// move the div into position
	ws.style.left	= x;
	ws.style.top	= y;					
	ws.style.display	= '';																	
}

//******
// Close user post report
function closeUserPostReport(){
	var ws	= getObj('userPostReport');
	ws.style.display	= 'none';
}

//******
// Show the user actions
function showUserActions(elem,userId,postId,offsetX,offsetY){	
	var obj	= getObj(elem);
	
	if(!offsetX){
		offsetX	= -100;
	}
	
	if(!offsetY){
		offsetY	= 16;
	}
	
	var x	= (DL_GetElementLeft(obj)+ offsetX) + 'px';
	var y	= (DL_GetElementTop(obj)+ offsetY) + 'px';
	var ws	= getObj('userActions');
	var uf	= getObj('userActionFrame');											
	
	// hide?							
	if(ws.style.left == x && ws.style.top == y && ws.style.display == ''){								
		ws.style.display	= 'none';
		return;
	}
	
	// set the iframe src to the correct user
	uf.src	= 'dsp/dspUserActions.cfm?userId=' + userId + '&postId=' + postId;
	
	// move the div into position
	ws.style.left	= x;
	ws.style.top	= y;					
	ws.style.display	= '';																	
}

//******
// Close user actions
function closeUserActions(){
	var ws	= getObj('userActions');
	ws.style.display	= 'none';
}

/***********************************************
* Tabbed Document Viewer script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var selectedtablink=""
var tcischecked=false

function handlelink(aobject){
	selectedtablink=aobject.href
	tcischecked=(document.tabcontrol && document.tabcontrol.tabcheck.checked)? true : false
	if (document.getElementById && !tcischecked){
		var tabobj=document.getElementById("tablist")
		var tabobjlinks=tabobj.getElementsByTagName("A")
		for (i=0; i<tabobjlinks.length; i++)
		tabobjlinks[i].className=""
		aobject.className="current"
		document.getElementById("tabiframe").src=selectedtablink
		return false
	}
	else
		return true
}

function handleview(){
	tcischecked=document.tabcontrol.tabcheck.checked
	if (document.getElementById && tcischecked){
		if (selectedtablink!="")
		window.location=selectedtablink
	}
}



//******
// Game Jump Bar logic
function fillGameSection(){
	var gameId = false;
	var features = false;
	var reviews	= false;
	var hype	= false;
	var ratings	= false;
	var forum	= 0;
	var arrSectionStyle;
	var sBox	= false;
	var opt;
	var arrStyles	= new Array();			
	
	//sBox.options.length = 0;
	
	arrStyles[0] = new Object();
	arrStyles[0].style = 'color';
	arrStyles[0].value = 'white';
	addOption2Select(sBox,'Select Section','',arrStyles);
	
	if(1){				
		return;
	}
	else{
		arrSectionStyle	= false;
		
		if(arrSectionStyle[0] == 1){
			features = true;
		}			
		
		if(arrSectionStyle[1] == 1){
			reviews	= true;
		}
		
		forum = arrSectionStyle[2];
		
		switch(arrSectionStyle[3]){
			case '1':
				hype = true;	
				break;
			case '2':
				hype = true;
				break;
			case '3':
				ratings = true;
				break;
		}
		
		//arrStyles[0].value = 'yellow';
		addOption2Select(sBox,'Overview','overview',arrStyles);
		
		if(reviews){
			addOption2Select(sBox,'Reviews','review',arrStyles);
		}
		
		if(features){
			addOption2Select(sBox,'Features','features',arrStyles);
		}
		
		if(forum > 0){
			addOption2Select(sBox,'Forums','forums',arrStyles);
		}			
		
		addOption2Select(sBox,'Resources','resources',arrStyles);
		//arrStyles[0].value = 'white';
		addOption2Select(sBox,'  Guides','resources',arrStyles);
		addOption2Select(sBox,'  Maps','resources',arrStyles);
		
		//arrStyles[0].value = 'yellow';
		addOption2Select(sBox,'Screenshots','screens',arrStyles);
		
		addOption2Select(sBox,'News','news',arrStyles);
		
		if(hype){
			addOption2Select(sBox,'Hype-Meter','hype',arrStyles);
		}
		
		if(ratings){
			addOption2Select(sBox,'Ratings','ratings',arrStyles);
		}
		
		addOption2Select(sBox,'Links','links',arrStyles);				
		
	}
	
	return;
	
}

function addOption2Select(obj,text,value,arrStyles){
	var opt = new Option(text,value);	
	if(arrStyles){
		for(var i=0;i<arrStyles.length;i++){
			opt.style[arrStyles[i].style] = arrStyles[i].value;
		}
	}
	//obj.options[obj.options.length] = opt;
			
	return;		
}

function gqjSubmit(){
	var strLink;
	var gameId	= false;
	var section = false;
	var arrSectionStyle;
	
	if(gameId){	
		
		if(section && section != 'forums'){
			strLink = '/gamelist.cfm/gameId/' + gameId + '/setView/' + section;
			
			/*if(section == 'features'){
				strLink += '/loadFeature/0';
			}*/
			
		}
		else if(section && section == 'forums'){
		//	arrSectionStyle	= games[gameId].sectionStyle.split(',');
			strLink = '/discussion.cfm/load/forums/loadClass/' + arrSectionStyle[2];
		}
		else{
			strLink = '/gamelist.cfm/gameId/' + gameId;
		}
		
		location.href = strLink;				
		
	}	
}

//*****
// Create the mailTo for an email href
function writeEmailAddress(obj,user,domain,args){
	var rVal = user + '@' + domain;
	rVal += args != '' ? '?' + args : '';
	
	obj.href	= 'mailTo:' + rVal;
}

//*****
// Change the className of an obj
function changeClass(obj,newClass){
	obj.className	= newClass;
}


//******
// Switch an objects vis
function switchVis(elem){
	var obj	= getObj(elem);
	
	if(obj.style.display == 'none'){
		obj.style.display = '';
	}
	else{
		obj.style.display = 'none';
	}
}

//******
// Switch an elements text
function switchText(elem,str1,str2){
	var obj	= getObj(elem);
	
	if(obj.innerHTML == str1){
		obj.innerHTML	= str2;	
	}
	else{
		obj.innerHTML	= str1;
	}
}

//******
// Do Nothing
function doNothing(){
	
}

//******
// Return the path to the current template
// with the option of changing the delimiter
function GetAPath(delim){
	var tDelim	= '/';
	var iArr, result;
	var result = '';
	if(delim)
		tDelim	= delim;
		
	iArr	= window.location.pathname.split('/');
	
	for(var i=0;i<iArr.length-1;i++){			
		result += iArr[i] + tDelim;
	}
	
	return result;		
}

//******
// Launch function for the libsyn flash player
function launch(page){
	OpenWin = this.open(page, "LibsynPlayer", "toolbar=no,menubar=no,location=no,status=no,scrollbars=no,resizable=yes,width=195,height=75");
}

// The code below contains functions that run active content. The functions
// assemble an OBJECT/EMBED tag string, and then perform a document.write of 
// this string in the calling html document.
//   AC_RunFlContent() - build tags to display Flash content.
//   AC_RunFlContentX() - build XHTML formatted tags to display Flash content.
//   AC_RunSWContent() - build tags to display Shockwave content.
//   AC_RunSWContentX()  - build XHTML formatted tags to display Shockwave content.
//
// To call one of these functions, pass all the attributes and values that you would 
// otherwise specify for the object, param, and embed tags in the following form:
//   AC_RunFlContent(
//     "attrName1", "attrValue1"
//     "attrName2", "attrValue2"
//     ...
//     "attrNamen", "attrValuen"
//   )
//
// When passing in the src or movie attributes, do not include the file extension.
// Note, these functions use default values for several standard tag attributes, 
// including classid, codebase, pluginsPage, and mimeType, depending on the function
// you call. So, you should not pass in values for these attributes. If you require
// an alternate values for these attributes, you'll need to modify the default values 
// used in the 'Run' function implementations below. However, you may pass in an
// alternate version for the codebase value, as in AC_RunFlContent("codebase","6,0,0,0",...).
// Note that you should only pass in the version string rather than the full
// codebase URL.
//
// You must include AC_RunActiveContent.js for these functions to work.

function AC_RunFlContent()
{
  // First, look for a "movie" and "src" params, and if either exists, add a ".swf" to the end
  // if it doesn't already have one (this function will only run swf files)
  AC_AddExtension(arguments, "movie", ".swf");
  AC_AddExtension(arguments, "src", ".swf");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="
                  , "7,0,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunFlContent()", false, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   , codebase
   , "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
   , "application/x-shockwave-flash", arguments
  );
}

function AC_RunFlContentX()
{
  // First, look for a "movie" and "src" params, and if either exists, add a ".swf" to the end
  // if it doesn't already have one (this function will only run swf files)
  AC_AddExtension(arguments, "movie", ".swf");
  AC_AddExtension(arguments, "src", ".swf");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="
                  , "7,0,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunFlContentX()", true, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   , codebase
   , "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
   , "application/x-shockwave-flash", arguments
  );	
}

function AC_RunSWContent()
{
  // First, look for a "src" param, and if it exists, add a ".dcr" to the end
  // if it doesn't already have one (this function will only run dcr files)
  AC_AddExtension(arguments, "src", ".dcr");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "http://fpdownload.macromedia.com/pub/shockwave/cabs/director/sw.cab#version="
                  , "8,5,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunSWContent()", false, "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
   , codebase
   , "http://www.macromedia.com/shockwave/download/", null, arguments
  );
}
	
function AC_RunSWContentX()
{
  // First, look for a "src" param, and if it exists, add a ".dcr" to the end
  // if it doesn't already have one (this function will only run dcr files)
  AC_AddExtension(arguments, "src", ".dcr");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "http://fpdownload.macromedia.com/pub/shockwave/cabs/director/sw.cab#version="
                  , "8,5,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunSWContentX()", true, "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
   , codebase
   , "http://www.macromedia.com/shockwave/download/", null, arguments
  );
}
	
// Implements AC_GenerateObj() function. This is a generic function used to generate
// object/embed/param tags. It is used by higher level api functions.

/************** LOCALIZABLE GLOBAL VARIABLES ****************/

var MSG_EvenArgs = 'The %s function requires an even number of arguments.'
                 + '\nArguments should be in the form "atttributeName","attributeValue",...';
var MSG_SrcRequired = "The %s function requires that a movie src be passed in as one of the arguments.";

/******************** END LOCALIZABLE **********************/

// Finds a parameter with the name paramName, and checks to see if it has the 
// passed extension. If it doesn't have it, this function adds the extension.
function AC_AddExtension(args, paramName, extension)
{
  var currArg, paramVal, queryStr, endStr;
  for (var i=0; i < args.length; i=i+2){
    currArg = args[i].toLowerCase();    
    if (currArg == paramName.toLowerCase() && args.length > i+1) {
      paramVal = args[i+1];
      queryStr = "";

      // Pull off the query string if it exists.
      var indQueryStr = args[i+1].indexOf('?');
      if (indQueryStr != -1){
        paramVal = args[i+1].substring(0, indQueryStr);
        queryStr = args[i+1].substr(indQueryStr);
      }

      endStr = "";
      if (paramVal.length > extension.length)
        endStr = paramVal.substr(paramVal.length - extension.length);
      if (endStr.toLowerCase() != extension.toLowerCase()) {
        // Extension doesn't exist, add it
        args[i+1] = paramVal + extension + queryStr;
      }
    }
  }
}

// Builds the codebase value to use. If the 'codebase' parameter is found in the args,
// uses its value as the version for the baseURL. If 'codebase' is not found in the args,
// uses the defaultVersion.
function AC_GetCodebase(baseURL, defaultVersion, args)
{
  var codebase = baseURL + defaultVersion;
  for (var i=0; i < args.length; i=i+2) {
    currArg = args[i].toLowerCase();    
    if (currArg == "codebase" && args.length > i+1) {
      if (args[i+1].indexOf("http://") == 0) {
        // User passed in a full codebase, so use it.
        codebase = args[i+1];
      }
      else {
        codebase = baseURL + args[i+1];
      }
    }
  }
	
  return codebase;	
}

// Substitutes values for %s in a string.
// Usage: AC_sprintf("The %s function requires %s arguments.","foo()","4");
function AC_sprintf(str){
  for (var i=1; i < arguments.length; i++){
    str = str.replace(/%s/,arguments[i]);
  }
  return str;
}
		
// Checks that args, the argument list to check, has an even number of 
// arguments. Alerts the user if an odd number of arguments is found.
function AC_checkArgs(args,callingFn){
  var retVal = true;
  // If number of arguments isn't even, show a warning and return false.
  if (parseFloat(args.length/2) != parseInt(args.length/2)){
    alert(sprintf(MSG_EvenArgs,callingFn));
    retVal = false;
  }
  return retVal;
}
	
function AC_GenerateObj(callingFn, useXHTML, classid, codebase, pluginsPage, mimeType, args){

  if (!AC_checkArgs(args,callingFn)){
    return;
  }

  // Initialize variables
  var tagStr = '';
  var currArg = '';
  var closer = (useXHTML) ? '/>' : '>';
  var srcFound = false;
  var embedStr = '<embed';
  var paramStr = '';
  var embedNameAttr = '';
  var objStr = '<object classid="' + classid + '" codebase="' + codebase + '"';

  // Spin through all the argument pairs, assigning attributes and values to the object,
  // param, and embed tags as appropriate.
  for (var i=0; i < args.length; i=i+2){
    currArg = args[i].toLowerCase();    

    if (currArg == "src"){
      if (callingFn.indexOf("RunSW") != -1){
        paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n';
        embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
        srcFound = true;
      }
      else if (!srcFound){
        paramStr += '<param name="movie" value="' + args[i+1] + '"' + closer + '\n'; 
        embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
        srcFound = true;
      }
    }
    else if (currArg == "movie"){
      if (!srcFound){
        paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n'; 
        embedStr += ' src="' + args[i+1] + '"';
        srcFound = true;
      }
    }
    else if (   currArg == "width" 
              || currArg == "height" 
              || currArg == "align" 
              || currArg == "vspace" 
              || currArg == "hspace" 
              || currArg == "class" 
              || currArg == "title" 
              || currArg == "accesskey" 
              || currArg == "tabindex"){
      objStr += ' ' + args[i] + '="' + args[i+1] + '"';
      embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
    }
    else if (currArg == "id"){
      objStr += ' ' + args[i] + '="' + args[i+1] + '"';
      // Only add the name attribute to the embed tag if a name attribute 
      // isn't already there. This is what Dreamweaver does if the user
      // enters a name for a movie in the PI: it adds id to the object
      // tag, and name to the embed tag.
      if (embedNameAttr == "")
        embedNameAttr = ' name="' + args[i+1] + '"';
    }
    else if (currArg == "name"){
      objStr += ' ' + args[i] + '="' + args[i+1] + '"';
      // Replace the current embed tag name attribute with the one passed in.
      embedNameAttr = ' ' + args[i] + '="' + args[i+1] + '"';
    }    
    else if (currArg == "codebase"){
      // The codebase parameter has already been handled, so ignore it. 
    }    
    // This is an attribute we don't know about. Assume that we should add it to the 
    // param and embed strings.
    else{
      paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n'; 
      embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
    }
  }

  // Tell the user that a movie/src is required, if one was not passed in.
  if (!srcFound){
    alert(AC_sprintf(MSG_SrcRequired,callingFn));
    return;
  }

  if (embedNameAttr)
    embedStr += embedNameAttr;	
  if (pluginsPage)
    embedStr += ' pluginspage="' + pluginsPage + '"';
  if (mimeType)
    embedStr += ' type="' + mimeType + '"';
    
  // Close off the object and embed strings
  objStr += '>\n';
  embedStr += '></embed>\n'; 

  // Assemble the three tag strings into a single string.
  tagStr = objStr + paramStr + embedStr + "</object>\n"; 

  document.write(tagStr);
}




