// script.js

   var xhtmlNS = "http://www.w3.org/1999/xhtml" // xhtml namespace (used in library functions)

/*******************************************************\
 *** e x t r a c t   p o s t   i n f o r m a t i o n ***
\*******************************************************/
function getCategories()
{
   var categories = new Array()

	if( id('postList') )
	{
	   var lis = id('postList').getElementsByTagName('li')

		for( var cx = 0, li ; li = lis[cx] ; cx++ ) // for each post
		{
		   var categoryNames = li.getElementsByTagName('span')[0].firstChild.nodeValue.split(', ') // array

			for( var bx = 0, categoryName ; categoryName = categoryNames[bx] ; bx++ ) // for each category
			{
			   var thisCategoryName = categoryName.charAt(categoryName.length-1)==" " ? categoryName.substring(0, categoryName.length-1) : categoryName // remove trailing space if exists

				if( inArray(thisCategoryName, categories)==-1 ) categories.push(thisCategoryName)
			}
		}
	}

   return categories.length > 0 ? categories : false
}
function getPosts()
{
   var posts = new Array()

	if( id('postList') )
	{
	   var lis = id('postList').getElementsByTagName('li')

		for( var cx = 0, li ; li = lis[cx] ; cx++ ) // for each post
		{
		   var a     = li.getElementsByTagName('a'   )[0]
		   var span0 = li.getElementsByTagName('span')[0]
		   var span1 = li.getElementsByTagName('span')[1]

			posts[cx] = { // new Object()
			   title      : a.firstChild.nodeValue,
			   href       : a.getAttribute('href'),
			   categories : span0.firstChild && (span0.firstChild.nodeValue.charAt(span0.firstChild.nodeValue.length-1)!=" " ? span0.firstChild.nodeValue : span0.firstChild.nodeValue.substring(0, span0.firstChild.nodeValue.length-1)).split(', '), // array
			   date       : span1.firstChild && span1.firstChild.nodeValue
			}
		}
	}

   return posts.length > 0 ? posts : false
}

// returns array of all post tagged with passed any of passed category strings.
function getPostsByCategories(posts) // doesn't stop checking post's categories for match after found (cycles through all post's categories no matter what). fix?
{
   var categoryPosts = new Array()

	for( var cx = 0, post ; post = posts[cx] ; cx++ ) // for each post
	{
		for( var bx = 0, category ; category = post.categories[bx] ; bx++ ) // for each category assigned to post
		{
			for( var ax = 0, argument ; argument = arguments[ax] ; ax++ ) // for each category passed
			{
				if( ((category.charAt(category.length-1)==" ") ? category.substring(0, category.length-1) : category)==argument )
				{
					categoryPosts.push({ // new Object()
					   title      : post.title,
					   href       : post.href,
					   categories : post.categories,
					   date       : post.date
					})
					break
				}
			}
		}
	}

   return categoryPosts
}
// returns array of all posts from passed 'date'
function getPostsByDate(posts, date)
{
   var datePosts = new Array()

	for( var cx = 0, post ; post = posts[cx] ; cx++ ) // for each post
	{
		if( post.date==date )
		{
			datePosts.push({ // new Object()
			   title      : post.title,
			   href       : post.href,
			   categories : post.categories,
			   date       : post.date
			})
		}
	}

   return datePosts
}

/*******************************\
 *** c r e a t e   m e n u s ***
\*******************************/
// inserts passed 'menuItems' 'title' properties linked to 'href' properties into page as ol child of passed 'insertIntoElement'
function createCollapseableMenu(insertIntoElement, menuItems)
{
   var parentId = insertIntoElement.id

	create("ol" , parentId+"Menu"         , insertIntoElement  ).setAttribute("class", "collapseableMenu") ; id(parentId+"Menu").setAttribute("className", "collapseableMenu")
	create("div", parentId+"MenuContainer", id(parentId+"Menu"))

	for( var cx = 0, menuItem ; menuItem = menuItems[cx] ; cx++ ) // for each menu item
	{
		create("li", parentId+"MenuLi"+cx    , id(parentId+"MenuContainer"))
		create("a" , parentId+"MenuLi"+cx+"A", id(parentId+"MenuLi"+cx    )).setAttribute("href", menuItem.href)

		text(id(parentId+"MenuLi"+cx+"A"), menuItem.title)
	}

   return id(parentId+"Menu") // reference to newly created menu element
}
/*********************************************\
 *** s c r o l l i n g   f u n c t i o n s ***
\*********************************************/
function scrollMenu(event)
{
   var element = (event.target ? event.target : event.srcElement).nextSibling

	if( element.getAttribute('class')=="collapseableMenu" ) toggle(element)

   return null
}

   var scrollInterval

function toggle(element)
{
   var fullHeight    = +firstElementChild(element).offsetHeight
   var currentHeight = +numbersOnly(element.style.height)
   var inc = 16
   var closed = (element.previousSibling.getAttribute('class').indexOf('closed')!=-1)
   var scroll = closed ? scrollOpenY : scrollCloseY

	element.previousSibling.setAttribute("class"    , (closed) ? "scroller open" : "scroller closed")
	element.previousSibling.setAttribute("className", (closed) ? "scroller open" : "scroller closed")

	scrollInterval = setInterval(scroll, 10) // beginning animation

	function scrollOpenY()
	{
		if( currentHeight < fullHeight ) currentHeight = setElementHeightPX(element, currentHeight + inc) // add 'inc'
		else clearInterval(scrollInterval)
	}
	function scrollCloseY()
	{
		if( currentHeight > 0 ) currentHeight = setElementHeightPX(element, currentHeight - inc) // subtract 'inc'
		else clearInterval(scrollInterval)
	}

   return null
}

/*************************************\
 *** s t y l e   f u n c t i o n s ***
\*************************************/
function setElementHeightPX(element, height)
{
	element.style.height = height + "px"

   return height
}

/*****************************************\
 *** l i b r a r y   f u n c t i o n s ***
\*****************************************/
// returns reference to element with passed 'id' attribute
function id(nodeId) { return document.getElementById(nodeId) }
// returns reference to created element (with namespace if available) of passed type, with passed 'id' attribute, and as a childnode of passed parent (childnode of 'document' element if parent not defined)
function create(element, id, parent)
{
   if( !document.getElementById(id) ) // if element doesn't already exist
   {
      var node = document.createElementNS ? document.createElementNS(xhtmlNS, element) : document.createElement(element)
	    node.setAttribute("id", id)

	   parent ? parent.appendChild(node) : document.body.appendChild(node)
   }

   return document.getElementById(id)
}
// returns reference to element after creating childnode containing passed string
function text(element, string)
{
	element.appendChild(document.createTextNode(string))

   return element
}
// returns reference to an element after removing all of its child nodes
function clear(parent)
{
	while( parent.hasChildNodes() ) parent.removeChild(parent.firstChild)

   return parent
}
// returns reference to the first element childnode of passed parent
function firstElementChild(parent)
{
   var child = parent.firstChild

	while( child.nodeType!=1 ) child = child.nextSibling

   return child
}
// returns reference to passed 'element' after setting passed 'event' listener to be handled by passed 'handler'
function listener(element, capturedEvent, handler)
{
	if( element.addEventListener ) element.addEventListener(capturedEvent, handler, false)
	else if( element.attachEvent ) element.attachEvent("on"+capturedEvent, handler)
	else element["on"+capturedEvent] = handler

   return element
}

// method returns string object if consists of numeric characters, or false
String.prototype.isNumbers = function()
{
	for( var cx = 0, character ; character = this.charAt(cx) ; cx++ ) // for each character in string
	{
	   if( character!=0 &&
	       character!=1 &&
	       character!=2 &&
	       character!=3 &&
	       character!=4 &&
	       character!=5 &&
	       character!=6 &&
	       character!=7 &&
	       character!=8 &&
	       character!=9    ) return false
	}

   return this
}
function numbersOnly(string)
{
   var numericString = ""

	for( var cx = 0, character ; character = string.charAt(cx) ; cx++ ) if( character.isNumbers() ) numericString += character

   return numericString
}
// returns first found index of passed 'element' in passed 'array', or false if not found
function inArray(element, array)
{
	for( var cx = 0, arrayElement ; arrayElement = array[cx] ; cx++ ) if( arrayElement==element ) return cx

   return -1
}
// sorts an array of objects by passed property
Array.prototype.sortObjectsByProperty = function(property)
{
	this.sort(function(a, b) {
	       if( a[property]<b[property] ) return -1
	  else if( a[property]>b[property] ) return  1
	                                     return  0
	})

   return this
}

//---------------
// google search
//---------------
if (!window['google']) {
window['google'] = {};
}
if (!window['google']['loader']) {
window['google']['loader'] = {};
google.loader.ServiceBase = 'http://www.google.com/uds';
google.loader.GoogleApisBase = 'http://ajax.googleapis.com/ajax';
google.loader.ApiKey = 'ABQIAAAAtP3VM_x1tMPIzm9ea-YPdhSOx7QCkUEpL9KegOAgaXkjcO_GKRTomBIB3u6tDcJUmnjYpJumv8cO_w';
google.loader.KeyVerified = true;
google.loader.LoadFailure = false;
google.loader.AdditionalParams = '';
(function() { 
function w(a){if(a in A){return A[a]}return A[a]=navigator.userAgent.toLowerCase().indexOf(a)!=-1}
var A={};function E(){return w("msie")}
function F(){return w("safari")||w("konqueror")}
function K(a,b){var c=function(){}
;c.prototype=b.prototype;a.I=b.prototype;a.prototype=new c}
function P(a,b){var c=a._JSAPI_boundArgs||[];c=c.concat(Array.prototype.slice.call(arguments,2));if(typeof a._JSAPI_boundSelf!="undefined"){b=a._JSAPI_boundSelf}if(typeof a._JSAPI_boundFn!="undefined"){a=a._JSAPI_boundFn}var d=function(){var e=c.concat(Array.prototype.slice.call(arguments));return a.apply(b,e)}
;d._JSAPI_boundArgs=c;d._JSAPI_boundSelf=b;d._JSAPI_boundFn=a;return d}
function B(a){var b=new Error(a);b.toString=function(){return this.message}
;return b}
;
var i={};var x={};var G={};var U={};var s=null;var M=false;function S(a,b,c){var d=i[":"+a];if(!d){throw B("Module: '"+a+"' not found!");}else{if(c&&!c["language"]&&c["locale"]){c["language"]=c["locale"]}var e=c&&c["callback"]!=null;if(e&&!d.n()){throw B("Module: '"+a+"' must be loaded before DOM onLoad!");}else if(e){if(d.i(b,c)){window.setTimeout(c["callback"],0)}else{d.j(b,c)}}else{if(!d.i(b,c)){d.j(b,c)}}}}
function Z(a,b){if(b){Y(a)}else{z(window,"load",a)}}
function z(a,b,c){if(a.addEventListener){a.addEventListener(b,c,false)}else if(a.attachEvent){a.attachEvent("on"+b,c)}else{var d=a["on"+b];if(d!=null){a["on"+b]=Q([c,d])}a["on"+b]=c}}
function Q(a){return function(){for(var b=0;b<a.length;b++){a[b]()}}
}
var p=[];function Y(a){if(p.length==0){z(window,"load",t);if(!E()&&!F()&&w("mozilla")||window.opera){window.addEventListener("DOMContentLoaded",t,false)}else if(E()){window.setTimeout(H,10);document.attachEvent("onreadystatechange",J)}else if(F()){window.setTimeout(I,10)}}p.push(a)}
function H(){try{if(p.length>0){document.documentElement.doScroll("left")}}catch(a){window.setTimeout(H,10);return}t()}
var L={loaded:true,complete:true};function J(){if(L[document.readyState]){document.detachEvent("onreadystatechange",J);t()}}
function I(){if(L[document.readyState]){t()}else if(p.length>0){window.setTimeout(I,10)}}
function t(){for(var a=0;a<p.length;a++){p[a]()}p.length=0}
function X(a){var b=window.location.href;var c;var d=b.length;for(var e in a){var f=b.indexOf(e);if(f!=-1&&f<d){c=e;d=f}}s=c?a[c]:null}
function r(a,b,c){if(c){var d;if(a=="script"){d=document.createElement("script");d.type="text/javascript";d.src=b}else if(a=="css"){d=document.createElement("link");d.type="text/css";d.href=b;d.rel="stylesheet"}var e=document.getElementsByTagName("head")[0];if(!e){e=document.body.parentNode.appendChild(document.createElement("head"))}e.appendChild(d)}else{if(a=="script"){document.write('<script src="'+b+'" type="text/javascript"><\/script>')}else if(a=="css"){document.write('<link href="'+b+'" type="text/css" rel="stylesheet"></link>'
)}}}
function k(a,b){var c=a.split(/\./);var d=window;for(var e=0;e<c.length-1;e++){if(!d[c[e]]){d[c[e]]={}}d=d[c[e]]}d[c[c.length-1]]=b}
function R(a,b,c){a[b]=c}
function V(a){x=a}
function W(a){for(var b in a){if(typeof b=="string"&&b&&b.charAt(0)==":"&&!i[b]){i[b]=new n(b.substring(1),a[b])}}}
k("google.load",S);k("google.setOnLoadCallback",Z);k("google.loader.writeLoadTag",r);k("google.loader.setApiKeyLookupMap",X);k("google.loader.callbacks",G);k("google.loader.eval",U);k("google.loader.rfm",V);k("google.loader.rpl",W);k("google_exportSymbol",k);k("google_exportProperty",R);
function h(a){this.a=a;this.l={};this.b={};this.initialLoad=true}
h.prototype.d=function(a,b){var c="";if(b!=undefined){if(b["language"]!=undefined){c+="&hl="+encodeURIComponent(b["language"])}if(b["nocss"]!=undefined){c+="&output="+encodeURIComponent("nocss="+b["nocss"])}if(b["nooldnames"]!=undefined){c+="&nooldnames="+encodeURIComponent(b["nooldnames"])}if(b["packages"]!=undefined){c+="&packages="+encodeURIComponent(b["packages"])}if(b["callback"]!=null){c+="&async=2"}if(b["other_params"]!=undefined){c+="&"+b["other_params"]}}if(!this.initialLoad){if(google[this.a]
&&google[this.a].JSHash){c+="&sig="+encodeURIComponent(google[this.a].JSHash)}var d=[];for(var e in this.l){if(e.charAt(0)==":"){d.push(e.substring(1))}}for(var e in this.b){if(e.charAt(0)==":"){d.push(e.substring(1))}}c+="&have="+encodeURIComponent(d.join(","))}if(s!=null&&!M){c+="&key="+encodeURIComponent(s);M=true}return google.loader.ServiceBase+"/?file="+this.a+"&v="+a+google.loader.AdditionalParams+c}
;h.prototype.p=function(a){var b=null;if(a){b=a["packages"]}var c=null;if(b){if(typeof b=="string"){c=[a["packages"]]}else if(b.length){c=[];for(var d=0;d<b.length;d++){if(typeof b[d]=="string"){c.push(b[d].replace(/^\s*|\s*$/,"").toLowerCase())}}}}if(!c){c=["default"]}var e=[];for(var d=0;d<c.length;d++){if(!this.l[":"+c[d]]){e.push(c[d])}}return e}
;h.prototype.j=function(a,b){var c=this.p(b);var d=b&&b["callback"]!=null;if(d){var e=new y(b["callback"])}var f=[];for(var j=c.length-1;j>=0;j--){var g=c[j];if(d){e.t(g)}if(this.b[":"+g]){c.splice(j,1);if(d){this.b[":"+g].push(e)}}else{f.push(g)}}if(c.length){if(b&&b["packages"]){b["packages"]=c.sort().join(",")}if(!b&&x[":"+this.a]!=null&&x[":"+this.a].versions[":"+a]!=null&&!google.loader.AdditionalParams&&this.initialLoad){var m=x[":"+this.a];google[this.a]=google[this.a]||{};for(var u in m.properties)
{if(u&&u.charAt(0)==":"){google[this.a][u.substring(1)]=m.properties[u]}}r("script","/googleSearchFunctions.js",d);if(m.css){r("css",google.loader.ServiceBase+m.path+m.css,d)}}else{r("script",this.d(a,b),d)}if(this.initialLoad){this.initialLoad=false}for(var j=0;j<f.length;j++){var g=f[j];this.b[":"+g]=[];if(d){this.b[":"+g].push(e)}}}}
;h.prototype.g=function(a){for(var b=0;b<a.components.length;b++){this.l[":"+a.components[b]]=true;var c=this.b[":"+a.components[b]];if(c){for(var d=0;d<c.length;d++){c[d].v(a.components[b])}delete this.b[":"+a.components[b]]}}v("hl",this.a)}
;h.prototype.i=function(a,b){return this.p(b).length==0}
;h.prototype.n=function(){return true}
;function y(a){this.u=a;this.k={};this.m=0}
y.prototype.t=function(a){this.m++;this.k[":"+a]=true}
;y.prototype.v=function(a){if(this.k[":"+a]){this.k[":"+a]=false;this.m--;if(this.m==0){window.setTimeout(this.u,0)}}}
;function T(a){i[":"+a.module].g(a)}
k("google.loader.loaded",T);
function l(a,b,c,d,e,f,j,g){this.a=a;this.B=b;this.A=c;this.q=d;this.s=e;this.z=f;this.r=j||{};this.e=false;this.o=false;this.f=[];if(typeof g=="string"){this.h=g}else if(g){this.h=b}else{this.h=null}this.F=g;G[this.a]=P(this.g,this)}
K(l,h);l.prototype.j=function(a,b){var c=b&&b["callback"]!=null;if(c){this.f.push(b["callback"]);b["callback"]="google.loader.callbacks."+this.a}else{this.e=true}r("script",this.d(a,b),c)}
;l.prototype.i=function(a,b){var c=b&&b["callback"]!=null;if(c){return this.o}else{return this.e}}
;l.prototype.g=function(){this.o=true;for(var a=0;a<this.f.length;a++){window.setTimeout(this.f[a],0)}this.f=[]}
;l.prototype.d=function(a,b){var c="";if(this.q!=null){c+="&"+this.q+"="+encodeURIComponent(s?s:google.loader.ApiKey)}if(this.s!=null){c+="&"+this.s+"="+encodeURIComponent(a)}var d=google.loader.ServiceBase.charAt(4)=="s";var e;if(d&&this.h){e=this.h}else{e=this.B;d=false}if(b!=null){for(var f in b){if(this.r[":"+f]!=null){var j=b[f];var g=this.r[":"+f];if(typeof g=="string"){c+="&"+g+"="+encodeURIComponent(j)}else{c+="&"+g(j)}}else if(f=="other_params"){c+="&"+b[f]}else if(f=="base_domain"){e=e.replace(
/^[^\/]*/,b[f]);d=false}}}google[this.a]={};if(!this.A&&c!=""){c="?"+c.substring(1)}v("el",this.a);return(d?"https":"http")+"://"+e+c}
;l.prototype.n=function(){return this.z}
;
function n(a,b){this.a=a;this.c=b;this.e=false}
K(n,h);n.prototype.j=function(a,b){this.e=true;r("script",this.d(a,b),false)}
;n.prototype.i=function(a,b){return this.e}
;n.prototype.g=function(){}
;n.prototype.d=function(a,b){if(!this.c["versions"][":"+a]){if(this.c["aliases"]){var c=this.c["aliases"][":"+a];if(c){a=c}}if(!this.c["versions"][":"+a]){throw B("Module: '"+this.a+"' with version '"+a+"' not found!");}}var d=b&&b["uncompressed"]?"uncompressed":"compressed";var e=google.loader.GoogleApisBase+"/libs/"+this.a+"/"+a+"/"+this.c["versions"][":"+a][d];v("el",this.a);return e}
;n.prototype.n=function(){return false}
;
function o(){}
var D=o.w=false;var N=o.C=5;var q=o.H=[];var O=o.G=function(){if(!D){z(window,"unload",C);D=(o.w=true)}}
;var v=o.record=function(a,b){O();var c=a+(b?"|"+b:"");q.push("r"+q.length+"="+encodeURIComponent(c));var d=q.length>N?0:15000;window.setTimeout(C,d)}
;var C=o.D=function(){if(q.length){var a=new Image;a.src=google.loader.ServiceBase+"/stats?"+q.join("&")+"&nocache="+Number(new Date);q.length=0}}
;k("google.loader.recordStat",v);
i[":search"]=new h("search");i[":feeds"]=new h("feeds");i[":language"]=new h("language");i[":elements"]=new h("elements");i[":maps"]=new l("maps","maps.google.com/maps?file=googleapi",true,"key","v",true,{":language":"hl",":callback":function(a){return"callback="+encodeURIComponent(a)+"&async=2"}
},"maps-api-ssl.google.com/maps?file=googleapi");i[":gdata"]=new h("gdata");i[":sharing"]=new l("sharing","www.google.com/s2/sharing/js",false,"key","v",false,{":locale":"hl"});i[":annotations"]=new l("annotations","www.google.com/reviews/scripts/annotations_bootstrap.js",false,"key","v",true,{":language":"hl",":country":"gl",":callback":"callback"});i[":visualization"]=new h("visualization");i[":books"]=new l("books","books.google.com/books/api.js",false,"key","v",true,{":language":"hl",":callback"
:"callback"});i[":earth"]=new h("earth");

 })()

google.loader.rfm({":feeds":{"versions":{":1":"1",":1.0":"1"},"path":"/api/feeds/1.0/9485f1e38d6efe511beac9408eb45c79/","js":"default+en.I.js","css":"default.css","properties":{":JSHash":"9485f1e38d6efe511beac9408eb45c79",":Version":"1.0"}},":search":{"versions":{":1":"1",":1.0":"1"},"path":"/api/search/1.0/9f362c5f2d2bc9f3c3f4585dc7dae979/","js":"default+en.I.js","css":"default.css","properties":{":JSHash":"9f362c5f2d2bc9f3c3f4585dc7dae979",":NoOldNames":false,":Version":"1.0"}},":language":{"versions":{":1":"1",":1.0":"1"},"path":"/api/language/1.0/0f2391a71287b4b0b02372874207fa7e/","js":"default+en.I.js","properties":{":JSHash":"0f2391a71287b4b0b02372874207fa7e",":Version":"1.0"}},":earth":{"versions":{":1":"1",":1.0":"1"},"path":"/api/earth/1.0/ab3a093c3613b0ef66e8aaf4edb7d3ea/","js":"default.I.js","properties":{":JSHash":"ab3a093c3613b0ef66e8aaf4edb7d3ea",":Version":"1.0"}},":gdata":{"versions":{":1":"1",":1.2":"1"},"path":"/api/gdata/1.2/5bd3c24f42bbfa0c36f04d54e9a07bae/","js":"default.I.js","properties":{":JSHash":"5bd3c24f42bbfa0c36f04d54e9a07bae",":Version":"1.2"}}});
google.loader.rpl({":scriptaculous":{"versions":{":1.8.1":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"}},"aliases":{":1.8":"1.8.1",":1":"1.8.1"}},":mootools":{"versions":{":1.11":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"}},"aliases":{":1":"1.11"}},":jqueryui":{"versions":{":1.5.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"}},"aliases":{":1":"1.5.2",":1.5":"1.5.2"}},":prototype":{"versions":{":1.6.0.2":{"uncompressed":"prototype.js","compressed":"prototype.js"}},"aliases":{":1":"1.6.0.2",":1.6":"1.6.0.2"}},":jquery":{"versions":{":1.2.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.2.6":{"uncompressed":"jquery.js","compressed":"jquery.min.js"}},"aliases":{":1":"1.2.6",":1.2":"1.2.6"}},":dojo":{"versions":{":1.1.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"}},"aliases":{":1":"1.1.1",":1.1":"1.1.1"}}});
}


//-----------
// quicktime
//-----------
var gArgCountErr =	'The "%%" function requires an even number of arguments.'
				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';
var gTagAttrs				= null;
var gQTGeneratorVersion		= 1.2;
var gQTBehaviorID			= "qt_event_source";
var gQTEventsEnabled		= false;

function AC_QuickTimeVersion() { return gQTGeneratorVersion; }
function _QTComplain(callingFcnName, errMsg)
{
    errMsg = errMsg.replace("%%", callingFcnName);
	alert(errMsg);
}
function _QTIsMSIE()
{
    var ua = navigator.userAgent.toLowerCase();
	var msie = /msie/.test(ua) && !/opera/.test(ua);

	return msie;
}
function _QTGenerateBehavior()
{
	return objTag = '<!--[if IE]>'
				 + '<object id="' + gQTBehaviorID + '" classid="clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598"></object>'
				 + '<![endif]-->';
}
function _QTPageHasBehaviorObject(callingFcnName, args)
{
	var haveBehavior = false;
	var objects = document.getElementsByTagName('object');
	
	for ( var ndx = 0, obj; obj = objects[ndx]; ndx++ )
	{
		if ( obj.getAttribute('classid') == "clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598" )
		{
			if ( obj.getAttribute('id') == gQTBehaviorID ) haveBehavior = false;
			break;
		}
	}

	return haveBehavior;
}
function _QTShouldInsertBehavior()
{
	return ((gQTEventsEnabled && _QTIsMSIE() && !_QTPageHasBehaviorObject()) ? true : false)
}
function _QTAddAttribute(prefix, slotName, tagName)
{
	var value;

	value = gTagAttrs[prefix + slotName] || gTagAttrs[slotName];
	if ( value != null )
	{
		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 ( slotName.indexOf("emb#")==-1  )
	{
		// 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;
	}

	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 Object();
	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 = "7,3,0,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];

		gTagAttrs[attrName] = attrValue;

		if ( ("postdomevents" == attrName) && (attrValue.toLowerCase() != "false") )
		{
			gQTEventsEnabled = true;
			if ( _QTIsMSIE() ) gTagAttrs["obj#style"] = "behavior:url(#" + gQTBehaviorID + ")";
		}
	}

	// init both tags with the required and "special" attributes
	var objTag =  '<object '
					+ _QTAddObjectAttr("classid")
					+ _QTAddObjectAttr("width")
					+ _QTAddObjectAttr("height")
					+ _QTAddObjectAttr("codebase")
					+ _QTAddObjectAttr("name")
					+ _QTAddObjectAttr("id")
					+ _QTAddObjectAttr("tabindex")
					+ _QTAddObjectAttr("hspace")
					+ _QTAddObjectAttr("vspace")
					+ _QTAddObjectAttr("border")
					+ _QTAddObjectAttr("align")
					+ _QTAddObjectAttr("class")
					+ _QTAddObjectAttr("title")
					+ _QTAddObjectAttr("accesskey")
					+ _QTAddObjectAttr("noexternaldata")
					+ _QTAddObjectAttr("obj#style")
					+ '>'
					+ _QTAddObjectParam("src", generateXHTML);
	var embedTag = '<embed '
					+ _QTAddEmbedAttr("src")
					+ _QTAddEmbedAttr("width")
					+ _QTAddEmbedAttr("height")
					+ _QTAddEmbedAttr("pluginspage")
					+ _QTAddEmbedAttr("name")
					+ _QTAddEmbedAttr("id")
					+ _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","id","style");

	// 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></ob' + 'ject' + '>';
}
// return the object/embed as a string
function QT_GenerateOBJECTText()
{
	var txt = _QTGenerate("QT_GenerateOBJECTText", false, arguments);
	if ( _QTShouldInsertBehavior() ) txt = _QTGenerateBehavior() + txt;
	return txt;
}
function QT_GenerateOBJECTText_XHTML()
{
	var txt = _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
	if ( _QTShouldInsertBehavior() ) txt = _QTGenerateBehavior() + txt;
	return txt;
}
function QT_WriteOBJECT()
{
	var txt = _QTGenerate("QT_WriteOBJECT", false, arguments);
	if ( _QTShouldInsertBehavior() ) document.writeln(_QTGenerateBehavior());
	document.writeln(txt);
}
function QT_WriteOBJECT_XHTML()
{
	var	txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, arguments);
	if ( _QTShouldInsertBehavior() ) document.writeln(_QTGenerateBehavior());
	document.writeln(txt);
}
function QT_GenerateBehaviorOBJECT()
{
	return _QTGenerateBehavior();
}
function QT_ReplaceElementContents()
{
	var element = arguments[0];
	var args = [];

	// copy all other arguments we want to pass through to the fcn
	for ( var ndx = 1; ndx < arguments.length; ndx++ ) args.push(arguments[ndx]);

	var txt = _QTGenerate("QT_ReplaceElementContents", false, args);
	if ( txt.length > 0 ) element.innerHTML = txt;
}
function QT_ReplaceElementContents_XHTML()
{
	var element = arguments[0];
	var args = [];

	// copy all other arguments we want to pass through to the fcn
	for ( var ndx = 1; ndx < arguments.length; ndx++ ) args.push(arguments[ndx]);

	var txt = _QTGenerate("QT_ReplaceElementContents_XHTML", true, args);
	if ( txt.length > 0 ) element.innerHTML = txt;
}

function _FixIEController(element)
{
	if(navigator.appName != "Microsoft Internet Explorer") return;

	var movieObj = element.lastChild;

	if(!movieObj.GetControllerVisible());
		setTimeout( function() { movieObj.SetControllerVisible(true); }, 100);
}
function _FixOperaOpacity(element)
{
	if(navigator.appName == "Opera") element.style.opacity = "1.0";
}
function QT_ReplaceWithPoster()
{
      var args = Array.prototype.slice.call(arguments);
      var clickText = args.shift();
      var posterSrc = args.shift();
      var element = args.shift();
      var src = args[0];
      var width = args[1];
      var height = args[2];

		if (navigator.platform.indexOf('iPhone') > -1) 
		{
 			QT_ReplaceElementContents(element, 
        posterSrc,
				width, height, '',
				'href', src,
				'target', 'myself',
				'controller', 'false', 
				'autoplay', 'true', 
				'scale', 'aspect');
		}
		else
		{
			element.style.position = 'relative';
			element.style.width = width + 'px';
			element.style.height = height + 'px';
			element.style.textAlign = 'center';
			element.style.backgroundImage = 'url(' + posterSrc + ')';
			element.style.backgroundRepeat = 'no-repeat';
			element.style.backgroundPosition = 'top center';
      element.args = args;

			var play = element.appendChild(document.createElement('span'));
			play.innerHTML = clickText;
			play.className = 'playButton';
			_FixOperaOpacity(play);

			element.onclick = function() { 
        element.onclick = '';
        play.style.display = 'none';
        var playBackground = element.appendChild(document.createElement('div'));
        playBackground.className = 'playBackground';
        playBackground.style.opacity = '0';
        playBackground.style.width = element.style.width;
        playBackground.style.height = element.style.height;

        var intervalId = setInterval(function() {
          var opacity = parseFloat(playBackground.style.opacity);
          opacity = Math.min(1.0, opacity + 0.2);
          playBackground.style.opacity = opacity;
          playBackground.style.filter = 'alpha(opacity='+(opacity*100)+')';
          }, 25);

        setTimeout(function() {
            clearInterval(intervalId); 
            element.style.backgroundImage = '';
            element.style.backgroundColor = 'rgb(0,0,0)';
            playBackground.style.opacity = '1.';
            playBackground.style.filter = 'alpha(opacity=100)';

            var	txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, args);
            if(txt.length > 0)
              element.innerHTML = txt;

              _FixIEController(this);
          }, 250);
      }
		}
}
function QT_WritePoster_XHTML()
{
	var args = Array.prototype.slice.call(arguments);
	var clickText = args.shift();
	var posterSrc = args.shift();
	var src = args[0];
	var width = args[1];
	var height = args[2];

	if (navigator.platform.indexOf('iPhone') > -1) 
	{
		QT_WriteOBJECT_XHTML( posterSrc,
			width, height, '',
			'href', src,
			'target', 'myself',
			'controller', 'false', 
			'autoplay', 'true', 
			'scale', 'aspect');
	}
	else
	{
		var id = 'qtp_poster_div_id_' + Math.random();
		document.writeln('<div id="'+id+'"></div>');
		var element = document.getElementById(id);
		element.id = '';
		element.style.position = 'relative';
		element.style.width = width + 'px';
		element.style.height = height + 'px';
		element.style.textAlign = 'center';
		element.style.backgroundImage = 'url(' + posterSrc + ')';
		element.style.backgroundRepeat = 'no-repeat';
		element.style.backgroundPosition = 'top center';

		var play = element.appendChild(document.createElement('span'));
		play.innerHTML = clickText;
		play.className = 'playButton';
		_FixOperaOpacity(play);

		element.onclick = function() { 
			element.onclick = '';
			play.style.display = 'none';
			var playBackground = element.appendChild(document.createElement('div'));
			playBackground.className = 'playBackground';
			playBackground.style.opacity = '0';
			playBackground.style.width = element.style.width;
			playBackground.style.height = element.style.height;

			var intervalId = setInterval(function() {
			var opacity = parseFloat(playBackground.style.opacity);
			opacity = Math.min(1.0, opacity + 0.2);
			playBackground.style.opacity = opacity;
			playBackground.style.filter = 'alpha(opacity='+(opacity*100)+')';
			}, 25);

			setTimeout(function() {
				clearInterval(intervalId); 
				element.style.backgroundImage = '';
				element.style.backgroundColor = 'rgb(0,0,0)';
				playBackground.style.opacity = '1.';
				playBackground.style.filter = 'alpha(opacity=100)';

				var txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, args);
				if(txt.length > 0)
				element.innerHTML = txt;

				_FixIEController(element);
			}, 250);
		}
	}
}
<!-- ph=1 -->

