// Allows multiple functions to load

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


// Clears & validates forms

function resetFields(whichform) {
  for (var i=0; i<whichform.elements.length; i++) {
    var element = whichform.elements[i];
    if (element.type == "submit") continue;
    if (!element.defaultValue) continue;
    element.onfocus = function() {
    if (this.value == "enter e-mail here") {
      this.value = "";
     }
    }
    element.onblur = function() {
      if (this.value == "") {
        this.value = "enter e-mail here";
      }
    }
  }
}

function validateForm(whichform) {
  for (var i=0; i<whichform.elements.length; i++) {
    var element = whichform.elements[i];
    if (element.className.indexOf("requ") != -1) {
      if (!isFilled(element)) {
        alert("Please complete all required fields");
        return false;
      }
    }
    if (element.className.indexOf("reqmail") != -1) {
      if (!isFilled(element))  {
        alert("Please enter your e-mail");
        return false;
      }
      if (!isEmail(element)) {
        alert("Please enter your e-mail again - it doesn\'t appear to be correct \n(If the problem persists please e-mail us directly at info@korashriners.org)");
        return false;
      }
    }
    if (element.className.indexOf("reqfrmail") != -1) {
      if (!isEmail(element)) {
        alert("Please enter your friend\'s e-mail again - it doesn\'t appear to be valid \n(if the problem persists please e-mail us directly at info@korashriners.org)");
        return false;
      }
    }
    if (element.className.indexOf("email") != -1) {
      if (!isEmail(element)) {
        alert("Please enter your e-mail again - it doesn\'t appear to be valid \n(If the problem persists please e-mail us directly at info@korashriners.org)");
        return false;
      }
    }
   	if (element.className.indexOf("schplaque") > 20) {
      if (!isFilled(element)) {
        alert("Each line can only have a maximum of 20 characters");
        return false;
      }
    }

  }
  return true;
}

function isFilled(field) {
  if (field.value.length < 1 || field.value == field.defaultValue) {
    return false;
  } else {
    return true;
  }
}

function isEmail(field)
{
    // you could add a test to see if the brower support regular expression or not here
    if (RegExp) {
        return checkEmail(field.value);
    } else {
      if (field.value.indexOf("@") == -1 || field.value.indexOf(".") == -1) {
        return false;
      } else {
        return true;
      }
   }
}

function checkEmail(addr)
{
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,9}(?:\.[a-z]{2})?)$/i
    return filter.test(addr);
}

function prepareForms() {
  for (var i=0; i<document.forms.length; i++) {
    var thisform = document.forms[i];
    resetFields(thisform);
    thisform.onsubmit = function() {
      return validateForm(this);
    }
  }
}


// Opens PDF links in new windows

function doPopups()
{
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].href.indexOf('.pdf') !== -1) {
   links[i].onclick =
    function() {
     window.open(this.href,'popper','resizable,scrollbars');
     return false;
    }
    links[i].title += "\n(opens in a new window)";
    var img = document.createElement("img");
    img.setAttribute("src", "http://www.korashriners.org/i/new-win-icon.gif");
    img.setAttribute("alt", "(opens in a new window)");
    links[i].appendChild(img);
  }
 }
}


// Opens virtual tour in new window

function doVirtual() {
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].className.match('virtual')) {
   links[i].onclick =
    function() {
     window.open(this.href,'popper','width=390,height=560,resizable,scrollbars');
     return false;
    }
    links[i].title = "(opens in a new window - may take up to two minutes to download on a dial-up modem)";
    var img = document.createElement("img");
    img.setAttribute("src", "/i/new-win-icon.gif");
    img.setAttribute("alt", "(opens in a new window)");
    links[i].appendChild(img);
  }
 }
}


// Opens tell a friend in new window

function doTellFriend() {
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].className.match('friend')) {
   links[i].onclick =
    function() {
     window.open(this.href,'popper','width=410,height=540,resizable,scrollbars');
     return false;
    }
    links[i].title += "(opens in a new window)";
    var img = document.createElement("img");
    img.setAttribute("src", "/i/new-win-icon.gif");
    img.setAttribute("alt", "(opens in a new window)");
    links[i].appendChild(img);
  }
 }
}


// Cancel links with # in them

function cancelLink() {
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].href.match(/#$/)) {
   links[i].onclick =
    function() {
     return false;
    }
  }
 }
}


// Puts rounded corners on to menu items

function roundedCorners() {
  if (!document.getElementsByTagName) return false;
  var divs = document.getElementsByTagName('div');
  var rounded_divs = [];
  for (var i = 0; i < divs.length; i++) {
    if (/\bbox\b/.exec(divs[i].className)) {
      rounded_divs[rounded_divs.length] = divs[i];
    }
  }
  for (var i = 0; i < rounded_divs.length; i++) {
    var original = rounded_divs[i];
    original.className = original.className.replace('box', '');
    var div2 = document.createElement('div');
    div2.className = 'box2';
    original.parentNode.replaceChild(div2, original);
    for (var ii = 3; ii < 9; ++ii) {
        eval("var div" + ii + " = document.createElement('div');");
    }
    for (var iii = 2; iii < 8; ++iii) {
        eval("div" + iii + ".appendChild(div" + (iii + 1) + ");");
    }
    div8.appendChild(original);
  }
}


// Turns e-mail addresses into mailtos

function changeMail() {
 if (!document.getElementsByTagName) return false;
 var span = document.getElementsByTagName("span");
 for (var i=0; i < span.length; i++) {
  if (span[i].className.match('email')) {
   var innerspan = span[i].getElementsByTagName("span")[0].firstChild.nodeValue;
   span[i].innerHTML = "<a href='mailto:"+innerspan+"@korashriners.org'>"+innerspan+"@korashriners.org"
  }
 }
}


// Stylesheet switcher

function getAllSheets() {
	if( !window.ScriptEngine && navigator.__ice_version ) {
        return document.styleSheets;
    }
	if( document.getElementsByTagName ) {
        var Lt = document.getElementsByTagName('link'), St = document.getElementsByTagName('style');
	} else if(
        document.styleSheets && document.all ) { var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
	} else { return []; } for( var x = 0, os = []; Lt[x]; x++ ) {
		var rel = Lt[x].rel ? Lt[x].rel : Lt[x].getAttribute ? Lt[x].getAttribute('rel') : '';
		if( typeof( rel ) == 'string' && rel.toLowerCase().indexOf('style') + 1 ) { os[os.length] = Lt[x]; }
	}
    for(var x = 0; St[x]; x++ ) {
        os[os.length] = St[x];
    }
    return os;
}
function changeStyle() {
	window.userHasChosen = window.MWJss;
	for( var x = 0, ss = getAllSheets(); ss[x]; x++ ) {
		if( ss[x].title ) { ss[x].disabled = true; }
		for( var y = 0; y < arguments.length; y++ ) { if( ss[x].title == arguments[y] ) { ss[x].disabled = false; } }
} 
	backToRegularView()
}
function rememberStyle( cookieName, cookieLife ) {
	for( var viewUsed = false, ss = getAllSheets(), x = 0; window.MWJss && ss[x]; x++ ) {
        if( ss[x].disabled != MWJss[x] ) {
            viewUsed = true;
            break;
        }
    }
	if( !window.userHasChosen && !viewUsed ) {
        return;
    }
	for( var x = 0, outLine = '', doneYet = []; ss[x]; x++ ) {
		if( ss[x].title && ss[x].disabled == false && !doneYet[ss[x].title] ) {
            doneYet[ss[x].title] = true;
            outLine += ( outLine ? ' MWJ ' : '' ) + escape( ss[x].title );
        }
    }
	if( ss.length ) {
	
        document.cookie = escape( cookieName ) + '=' + escape( outLine ) + ( cookieLife ? ';expires=' + new Date( ( new Date() ).getTime() + ( cookieLife * 86400000 ) ).toGMTString() : '' ) + ';path=/';
    }
}
function useStyleAgain( cookieName ) {
	
	for( var x = 0; x < document.cookie.split( "; " ).length; x++ ) {
		
		var oneCookie = document.cookie.split( "; " )[x].split( "=" );
		if( oneCookie[0] == escape( cookieName ) ) {
			var styleStrings = unescape( oneCookie[1] ).split( " MWJ " );
			for( var y = 0, funcStr = ''; styleStrings[y]; y++ ) { funcStr += ( y ? ',' : '' ) + 'unescape( styleStrings[' + y + '] )'; }
			eval( 'changeStyle(' + funcStr + ');' );
            break;
	   }
    }
    window.MWJss = []; for( var ss = getAllSheets(), x = 0; ss[x]; x++ ) {
        MWJss[x] = ss[x].disabled;
    }
}

window.onload = function(e) {
    useStyleAgain('styleTestStore');
}
window.onunload = function(e) {
    rememberStyle('styleTestStore',10);
}


function fontDisplay() {

  if (navigator.appName == 'Microsoft Internet Explorer' && navigator.platform == 'MacPPC' || !document.getElementById || !document.getElementById("fontch")) return false;

  var div = document.createElement("div");
  var h2 = document.createElement("h2");
  h2.appendChild(document.createTextNode("Font size"));
  var ulist = document.createElement("ul");
  ulist.setAttribute("id","fonts");

  var listitem1 = document.createElement("li");
  var ahref1 = document.createElement("a");
  var off1 = document.createElement("span");

  listitem1.setAttribute("class", "sma");
  listitem1.setAttribute("className", "sma");
  ahref1.setAttribute("href","#");
  off1.setAttribute("class", "off");
  off1.setAttribute("className", "off");

  off1.appendChild(document.createTextNode("Regular font size "));
  ahref1.appendChild(off1);
  ahref1.appendChild(document.createTextNode("A"));
  listitem1.appendChild(ahref1);


  var listitem2 = document.createElement("li");
  var ahref2 = document.createElement("a");
  var off2 = document.createElement("span");

  listitem2.setAttribute("class", "med");
  listitem2.setAttribute("className", "med");
  ahref2.setAttribute("href","#");
  off2.setAttribute("class", "off");
  off2.setAttribute("className", "off");

  off2.appendChild(document.createTextNode("Medium font size "));
  ahref2.appendChild(off2);
  ahref2.appendChild(document.createTextNode("A"));
  listitem2.appendChild(ahref2);


  var listitem3 = document.createElement("li");
  var ahref3 = document.createElement("a");
  var off3 = document.createElement("span");

  listitem3.setAttribute("class", "lar");
  listitem3.setAttribute("className", "lar");
  ahref3.setAttribute("href","#");
  off3.setAttribute("class", "off");
  off3.setAttribute("className", "off");

  off3.appendChild(document.createTextNode("Large font size "));
  ahref3.appendChild(off3);
  ahref3.appendChild(document.createTextNode("A"));
  listitem3.appendChild(ahref3);


  ulist.appendChild(listitem1);
  ulist.appendChild(listitem2);
  ulist.appendChild(listitem3);

  var fontch = document.getElementById("fontch");
  div.appendChild(h2);
  div.appendChild(ulist);
  fontch.appendChild(div);

  var para = document.createElement("p");
  var viewopts = document.createElement("a");
  viewopts.setAttribute("href","http://www.korashriners.org/viewopts.shtml");
  viewopts.appendChild(document.createTextNode("More viewing options"));
  para.appendChild(viewopts);
  fontch.appendChild(para);

  ahref1.onclick = function () {changeStyle(''); return false}
  ahref2.onclick = function () {changeStyle('med'); return false}
  ahref3.onclick = function () {changeStyle('lar'); return false}

  ahref1.onmouseover = function () {window.status=''; return true}
  ahref2.onmouseover = function () {window.status=''; return true}
  ahref3.onmouseover = function () {window.status=''; return true}
}

function backToRegularView()
{
	var eleForm;
	var eleDiv;
	var eleInput;
		
	if(document.getElementById("returnnormalview"))
	{
		eleRemove = document.getElementById("returnnormalview");
		document.body.removeChild(eleRemove)
	}
	
	for( var x = 0, ss = getAllSheets(); ss[x]; x++ ) 
	{
		
		if (ss[x].rel == "alternate stylesheet")
		{
			// alert(ss[x].title + ":" + ss[x].disabled + ":" +  ss[x].rel);	
			if (ss[x].disabled == false)
			{				
				var eleForm = document.createElement("form");
				var eleInput = document.createElement("input");
				var eleDiv = document.createElement("div");
				
				eleDiv.setAttribute("id", "returnnormalview");
				
				eleForm.setAttribute("action", "#");
				eleForm.setAttribute("class", "regview");
				eleForm.setAttribute("className", "regview");
				
				eleInput.setAttribute("type", "submit");
				eleInput.setAttribute("value", "Back to regular view");
				eleInput.setAttribute("class", "button");
				eleInput.setAttribute("className", "button");
				
				eleForm.appendChild(eleInput);
				eleDiv.appendChild(eleForm);
				document.body.appendChild(eleDiv);
				
				eleDiv = document.getElementById("returnnormalview");
				eleInputs = eleDiv.getElementsByTagName("input");
				eleInputs[0].onclick = function () {changeStyle(''); return false}
			}
		}
	}
}

function changeFont()
{
	if (document.getElementById)
	{
		if (document.getElementById("viewopts"))
		{
  			document.getElementById("sma").onclick = function () {changeStyle('');};
  			document.getElementById("med").onclick = function () {changeStyle('med');};
			document.getElementById("lar").onclick = function () {changeStyle('lar');};
  			document.getElementById("high-con").onclick = function () {changeStyle('high-con');};
			document.getElementById("pda").onclick = function () {changeStyle('pda');};
		}
	}
}

// Link displayer for printing

function footnoteLinks(containerID, targetID)
{
      if (!document.getElementById || !document.getElementsByTagName || !document.createElement) return false;
      if (!document.getElementById(containerID) || !document.getElementById(targetID)) return false;

      var container = document.getElementById(containerID);
      var target    = document.getElementById(targetID);
      var h2        = document.createElement('h2');
      addClass.apply(h2,['printOnly']);

      var h2_txt    = document.createTextNode('Links');
      h2.appendChild(h2_txt);

      var coll = container.getElementsByTagName('*');
      var ol   = document.createElement('ol');
      addClass.apply(ol,['printOnly']);

      var myArr = [];
      var thisLink;
      var num = 1;
      for (var i=0; i< coll.length; i++) {
        var thisClass = coll[i].className;
        if ( (coll[i].getAttribute('href') || coll[i].getAttribute('cite')) && (thisClass == '' || thisClass.indexOf('nop') == -1)) {
          thisLink = coll[i].getAttribute('href') ? coll[i].href : coll[i].cite;
          var note = document.createElement('sup');
          addClass.apply(note,['printOnly']);
          var note_txt;
          var j = inArray.apply(myArr,[thisLink]);
          if ( j || j===0 ) {
            note_txt = document.createTextNode(j+1);
          } else {
            var li     = document.createElement('li');
            var li_txt = document.createTextNode(thisLink);
            li.appendChild(li_txt);
            ol.appendChild(li);
            myArr.push(thisLink);
            note_txt = document.createTextNode(num);
            num++;
          }
          note.appendChild(note_txt);
          if (coll[i].tagName.toLowerCase() == 'blockquote') {
            var lastChild = lastChildContainingText.apply(coll[i]);
            lastChild.appendChild(note);
          } else {
            coll[i].parentNode.insertBefore(note, coll[i].nextSibling);
          }
        }
      }
      target.appendChild(h2);
      target.appendChild(ol);
      addClass.apply(document.getElementsByTagName('html')[0],['noted']);
      return true;
}

 function doFootNoteLinks()
 {
    footnoteLinks('content','content');
 }

   function inArray(needle) {
      for (var i=0; i < this.length; i++) {
        if (this[i] === needle) {
          return i;
        }
      }
      return false;
    }
    function addClass(theClass) {
      if (this.className != '') {
        this.className += ' ' + theClass;
      } else {
        this.className = theClass;
      }
    }
    function lastChildContainingText() {
      var testChild = this.lastChild;
      var contentCntnr = ['p','li','dd'];
      while (testChild.nodeType != 1) {
        testChild = testChild.previousSibling;
      }
      var tag = testChild.tagName.toLowerCase();
      var tagInArr = inArray.apply(contentCntnr, [tag]);
      if (!tagInArr && tagInArr!==0) {
        testChild = lastChildContainingText.apply(testChild);
      }
      return testChild;
    }
    
/*

File: AC_QuickTime.js

Abstract: This file contains functions to generate OBJECT and EMBED tags for QuickTime content.

Version: <1.1>

Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
Computer, Inc. ("Apple") in consideration of your agreement to the
following terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of these
terms.  If you do not agree with these terms, please do not use,
install, modify or redistribute this Apple software.

In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software. 
Neither the name, trademarks, service marks or logos of Apple Computer,
Inc. may be used to endorse or promote products derived from the Apple
Software without specific prior written permission from Apple.  Except
as expressly stated in this notice, no other rights or licenses, express
or implied, are granted by Apple herein, including but not limited to
any patent rights that may be infringed by your derivative works or by
other works in which the Apple Software may be incorporated.

The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.

IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Copyright © 2006 Apple Computer, Inc., All Rights Reserved

*/ 

/*
 * This file contains functions to generate OBJECT and EMBED tags for QuickTime content. 
 */

/************** LOCALIZABLE GLOBAL VARIABLES ****************/

var gArgCountErr =	'The "%%" function requires an even number of arguments.'
				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';

/******************** END LOCALIZABLE **********************/

var gTagAttrs				= null;
var gQTGeneratorVersion		= 1.0;

function AC_QuickTimeVersion()	{ return gQTGeneratorVersion; }

function _QTComplain(callingFcnName, errMsg)
{
    errMsg = errMsg.replace("%%", callingFcnName);
	alert(errMsg);
}

function _QTAddAttribute(prefix, slotName, tagName)
{
	var		value;

	value = gTagAttrs[prefix + slotName];
	if ( null == value )
		value = gTagAttrs[slotName];

	if ( null != value )
	{
		if ( 0 == slotName.indexOf(prefix) && (null == tagName) )
			tagName = slotName.substring(prefix.length); 
		if ( null == tagName ) 
			tagName = slotName;
		return tagName + '="' + value + '" ';
	}
	else
		return "";
}

function _QTAddObjectAttr(slotName, tagName)
{
	// don't bother if it is only for the embed tag
	if ( 0 == slotName.indexOf("emb#") )
		return "";

	if ( 0 == slotName.indexOf("obj#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("obj#", slotName, tagName);
}

function _QTAddEmbedAttr(slotName, tagName)
{
	// don't bother if it is only for the object tag
	if ( 0 == slotName.indexOf("obj#") )
		return "";

	if ( 0 == slotName.indexOf("emb#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("emb#", slotName, tagName);
}


function _QTAddObjectParam(slotName, generateXHTML)
{
	var		paramValue;
	var		paramStr = "";
	var		endTagChar = (generateXHTML) ? ' />' : '>';

	if ( -1 == slotName.indexOf("emb#") )
	{
		// look for the OBJECT-only param first. if there is none, look for a generic one
		paramValue = gTagAttrs["obj#" + slotName];
		if ( null == paramValue )
			paramValue = gTagAttrs[slotName];

		if ( 0 == slotName.indexOf("obj#") )
			slotName = slotName.substring(4); 
	
		if ( null != paramValue )
			paramStr = '  <param name="' + slotName + '" value="' + paramValue + '"' + endTagChar + '\n';
	}

	return paramStr;
}

function _QTDeleteTagAttrs()
{
	for ( var ndx = 0; ndx < arguments.length; ndx++ )
	{
		var attrName = arguments[ndx];
		delete gTagAttrs[attrName];
		delete gTagAttrs["emb#" + attrName];
		delete gTagAttrs["obj#" + attrName];
	}
}

		

// generate an embed and object tag, return as a string
function _QTGenerate(callingFcnName, generateXHTML, args)
{
	// is the number of optional arguments even?
	if ( args.length < 4 || (0 != (args.length % 2)) )
	{
		_QTComplain(callingFcnName, gArgCountErr);
		return "";
	}
	
	// allocate an array, fill in the required attributes with fixed place params and defaults
	gTagAttrs = new Array();
	gTagAttrs["src"] = args[0];
	gTagAttrs["width"] = args[1];
	gTagAttrs["height"] = args[2];
	gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
		//Impportant note: It is recommended that you use this exact classid in order to ensure a seamless experience for all viewers
	gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";

	// set up codebase attribute with specified or default version before parsing args so
	//  anything passed in will override
	var activexVers = args[3]
	if ( (null == activexVers) || ("" == activexVers) )
		activexVers = "6,0,2,0";
	gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;

	var	attrName,
		attrValue;

	// add all of the optional attributes to the array
	for ( var ndx = 4; ndx < args.length; ndx += 2)
	{
		attrName = args[ndx].toLowerCase();
		attrValue = args[ndx + 1];

		// "name" and "id" should have the same value, the former goes in the embed and the later goes in
		//  the object. use one array slot 
		if ( "name" == attrName || "id" == attrName )
			gTagAttrs["name"] = attrValue;

		else 
			gTagAttrs[attrName] = attrValue;
	}

	// init both tags with the required and "special" attributes
	var objTag =  '<object '
					+ _QTAddObjectAttr("classid")
					+ _QTAddObjectAttr("width")
					+ _QTAddObjectAttr("height")
					+ _QTAddObjectAttr("codebase")
					+ _QTAddObjectAttr("name", "id")
					+ _QTAddObjectAttr("tabindex")
					+ _QTAddObjectAttr("hspace")
					+ _QTAddObjectAttr("vspace")
					+ _QTAddObjectAttr("border")
					+ _QTAddObjectAttr("align")
					+ _QTAddObjectAttr("class")
					+ _QTAddObjectAttr("title")
					+ _QTAddObjectAttr("accesskey")
					+ _QTAddObjectAttr("noexternaldata")
					+ '>\n'
					+ _QTAddObjectParam("src", generateXHTML);
	var embedTag = '  <embed '
					+ _QTAddEmbedAttr("src")
					+ _QTAddEmbedAttr("width")
					+ _QTAddEmbedAttr("height")
					+ _QTAddEmbedAttr("pluginspage")
					+ _QTAddEmbedAttr("name")
					+ _QTAddEmbedAttr("align")
					+ _QTAddEmbedAttr("tabindex");

	// delete the attributes/params we have already added
	_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex",
					"hspace","vspace","border","align","noexternaldata","class","title","accesskey");

	// and finally, add all of the remaining attributes to the embed and object
	for ( var attrName in gTagAttrs )
	{
		attrValue = gTagAttrs[attrName];
		if ( null != attrValue )
		{
			embedTag += _QTAddEmbedAttr(attrName);
			objTag += _QTAddObjectParam(attrName, generateXHTML);
		}
	} 

	// end both tags, we're done
	return objTag + embedTag + '> </em' + 'bed>\n</ob' + 'ject' + '>';
}

// return the object/embed as a string
function QT_GenerateOBJECTText()
{
	return _QTGenerate("QT_GenerateOBJECTText", false, arguments);
}

function QT_GenerateOBJECTText_XHTML()
{
	return _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
}

function QT_WriteOBJECT()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT", false, arguments));
}

function QT_WriteOBJECT_XHTML()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT_XHTML", true, arguments));
}






addLoadEvent(prepareForms);
addLoadEvent(doPopups);
addLoadEvent(doVirtual);
addLoadEvent(doTellFriend);
addLoadEvent(cancelLink);
addLoadEvent(fontDisplay);
addLoadEvent(roundedCorners);
addLoadEvent(changeMail);
addLoadEvent(doFootNoteLinks);
addLoadEvent(changeFont);
