// EXAMPLE TO USE
/*
  addMediaDiv('mediadiv', '', 'about_liberty', 'http://dev.libertyu.com/wwwadmin/globals/templates/9930/media/lg_about-liberty2.jpg', 'Around Liberty in 90 seconds');

   Requires class defaultstage and defaultmedia for some functionality

	eventual idea, fade into a center video, dark background, on-the fly div is created.
	X is cicked, div fades out.
	Over_All_Table must be defined as a div
*/
	

//Set some defaults...
var videowidth=500;
var videoheight=400;
var frameoffset=0;

var MediaTop= "0px";
var MediaHeight= "0px";
var MediaLeft="0px";
var MediaWidth= "0px";

var holder;

var digitalcampus=false;
var viewbook=false;
var formdisplay=false;


function addMediaTheater(stagename, medianame, stageclass, mediaclass, media, desc, opac, width, height, titletext, desctext)
{
	
	//assign default names if stagename and medianame are empty
	//this WILL break multiple stages being set up on the same page
	if(stagename=='')
	{
		stagename='__outerstage';
	}
	if(medianame=='')
	{
		medianame='__innerstage';
	}
	
	if(media == 'digitalcampus')
	{
		digitalcampus=true;	
		height=600;
		width=950;
	}
	else
	{
		digitalcampus=false;	
	}
	
	if(media=='viewbook')
	{
		viewbook=true;
		height=680;
		width=950;
	}
	else
	{
		viewbook=false;	
	}
	
	if(Left(media, 5) == "ajax:")
	{
		formdisplay=true;
		media=media.substring(5,media.length);
		
	}
	else
	{
		formdisplay=false;	
	}
	

//	width=950;
	//height=600;
	//assign some default stage properties
	if(stageclass=='')
	{
		stageclass='stage';
	}
	
	//assign some default media properties
	if(mediaclass=='')
	{
		mediaclass='media';
	}
		
	//generate stage and theater
	
		
	//then the media holder
	var stage = addMediaDiv(medianame, mediaclass, stagename, media, desc);
		
	//now the actual stage background
	var grandtheater = addStageDiv(stagename, medianame, stageclass, opac, stage, width+frameoffset, height, titletext, desctext);
	document.body.appendChild(grandtheater);

	//call any ajax dependent content to begin loading
	if(formdisplay) setTimeout("ajaxFunction('" + media + "', '" + medianame + "');", 400);

	//enjoy the show!	
	setTimeout("showTheater('"+stagename+"','"+ medianame+"', "+opac+", '"+width+"','"+height+"');", 350);
	if (browserId()=='IE6')
	{
		
		/*add additional styling for IE6 here*/
	}
}

function browserId()
{
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1) return 'Opera';
	if (agt.indexOf("staroffice") != -1) return 'Star Office';
	if (agt.indexOf("webtv") != -1) return 'WebTV';
	if (agt.indexOf("beonex") != -1) return 'Beonex';
	if (agt.indexOf("chimera") != -1) return 'Chimera';
	if (agt.indexOf("netpositive") != -1) return 'NetPositive';
	if (agt.indexOf("phoenix") != -1) return 'Phoenix';
	if (agt.indexOf("firefox") != -1) return 'Firefox';
	if (agt.indexOf("safari") != -1) return 'Safari';
	if (agt.indexOf("skipstone") != -1) return 'SkipStone';
	if (agt.indexOf("msie 6.0") != -1) return 'IE6';
	if (agt.indexOf("msie") != -1) return 'IE';
	if (agt.indexOf("netscape") != -1) return 'Netscape';
	if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
	if (agt.indexOf('\/') != -1) {
	if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
	return navigator.userAgent.substr(0,agt.indexOf('\/'));}
	else return 'Netscape';} else if (agt.indexOf(' ') != -1)
	return navigator.userAgent.substr(0,agt.indexOf(' '));
	else return navigator.userAgent;
}

function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var oopacity = options.opacity || 70;
  var opaque = (oopacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
	if(!detectMacXFF()) // fix problem with mac firefox rendering flash*
	{
    	dark.style.opacity=0;                      
    	dark.style.MozOpacity=0;                   
    	dark.style.filter='alpha(opacity='+0+')'; 
	}
    dark.style.zIndex=zindex; 
	dark.style.backgroundColor=bgcolor;    
	if(browserId()=="Mozilla" || browserId()=="Firefox")
	{
		//fix mozilla bug where fullscreen refuses to be fullscreen.
		dark.style.position="fixed";
		dark.style.bottom="0px";
		dark.style.right="0px";
		dark.style.left="0px";
		dark.style.top="0px";
	}
    else
	{
		dark.style.width= pageWidth;
		dark.style.height= pageHeight;
	}
    dark.style.display='inline'; 
	opacity('darkenScreenObject', 0, oopacity, 500); 
  } else {
	 opacity('darkenScreenObject', oopacity,0, 500); 
	 setTimeout("document.body.removeChild(document.getElementById('darkenScreenObject'));", 500);
  }
}

//Find out how far down the top of the screen is.
function getScrollY() {
 scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

// ***********************************************
// * Create a stage in center of screen.
// * 
// 
function addStageDiv(name, childname, stageclass, opac, child, width, height, titletext, descriptiontext)
{
	//create the new div
		//<div id="outter_#media#" style="background-color:#attributes.viewer_color#; background-image:url(#attributes.bgimage#); height:#attributes.height#px; width:#attributes.width#px; filter:alpha(opacity=#attributes.opc#); -moz-opacity:.#attributes.opc#; opacity:.#attributes.opc#; position:absolute; top:100px; left:100px; z-index:101; display:none;">
	
	if (titletext == undefined)
		titletext="libertyu.com";
	
	if(descriptiontext == undefined)
		descriptiontext = "";
		
	if(descriptiontext == "" || formdisplay || digitalcampus || viewbook)
		descriptionheight=20;
	else
		descriptionheight=100;
	
	if (digitalcampus || formdisplay || viewbook)
	{
		height = parseInt(height,10) + 23;	
	}

	var theater = document.createElement('div');
	theater.id=elem.name=name;
	theater.position="absolute";
	theater.className=stageclass;
	theater.style.zindex=97;
	theater.display="none";
	theater.style.filter='alpha(opacity='+100+')';
	

	theater.style.width=(width+84+84+20+10)+"px";
	if((document.body.offsetWidth-(width+20+10))/2 >0 )
	{
	theater.style.left=(document.body.offsetWidth-(width+84+84+20+10))/2+"px";
	MediaLeft =(document.body.offsetWidth-(width+84+84+20+10))/2 + +84+15+"px";
	}
	else
	{
		theater.style.left=	'-84px';
		MediaLeft =15+'px';
	}
	theater.style.left=(document.body.offsetWidth-(width+84+84+20+10))/2+"px";
	MediaLeft =(document.body.offsetWidth-(width+84+84+20+10))/2 + +84+15+"px";
	theater.style.height=(height + 10 + descriptionheight )+"px";
	if((getScrollY() + (document.body.offsetHeight-(height+100+10))/2) >0)
	{
		MediaTop = getScrollY() + (document.body.offsetHeight-(height+100+10))/2 + 58 + "px";
		theater.style.top=((getScrollY() + (document.body.offsetHeight-(height+100+10))/2) + 20 + "px");
	}
	else
	{
		MediaTop = '58px';	
		theater.style.top = '20px';
	}
	
	
	/*decoration*/
		var container =document.createElement('div');
		container.className='t_container';
		container.style.width=(width+84+84+20+10)+"px";
		container.style.height=(height+descriptionheight+10)+"px";
		
		var decorationl=document.createElement('div');
		decorationl.className="t_bkg_left";
		container.appendChild(decorationl);
		
		var outside = document.createElement('div');
		outside.className="t_outside";
		outside.style.width=(width+20+10)+"px";
		
		outside.style.height=(height + descriptionheight + 10) + "px";
		
		
		/* outside */
			var title_holder = document.createElement('div');
			title_holder.className="t_title_holder";
			title_holder.style.zindex=98;
			if(titletext.length * 13 + 100 > width)
			{
				 titletext=Left(titletext ,((width-100)/13)  - 3) + "...";
				
			}
			/*title_holder*/
				var title = document.createElement('div');
				title.className="t_title";
				title.innerHTML="<h2>" + titletext + "</h2>";
				title_holder.appendChild(title);
			/* /title_holder */
			
			outside.appendChild(title_holder);
			
			var closebutton = document.createElement('a');
			closebutton.style.cursor="pointer";
			closebutton.href="javascript:hideTheater('" + name + "', '" + childname + "', " + opac + ", " + getScrollY() + ");";
			closebutton.style.border="none";
			closebutton.style.zindex=98;
			
				var closeit = document.createElement('div');
				closeit.className = "t_close";
				closeit.style.left=(width-36)+"px";
				closeit.style.zindex=99;
			
			closebutton.appendChild(closeit);
			outside.appendChild(closebutton);

			var media = document.createElement('div');
			media.id=media.className="t_media";
			media.style.overflow="hidden";

			MediaWidth=media.style.width=width+"px";
			MediaHeight=height-23+"px";

			media.style.height=height+"px";
			/* media content */
				child.style.height=MediaHeight;
				child.style.width=MediaWidth;
				media.appendChild(child);
			/* /media */
			
			outside.appendChild(media);
			
			var description = document.createElement('div');
			description.className="t_description";
			description.style.width=(width+10)+"px";
			description.style.height=descriptionheight + "px";
			description.innerHTML=descriptiontext;
			outside.appendChild(description);
		/* /outside */
		
		container.appendChild(outside);
		
		var decorationr=document.createElement('div');
		decorationr.className="t_bkg_right";
		container.appendChild(decorationr);
		/* /decoration */

	theater.appendChild(container);
	
	
	theater.style.display="none";
	return(theater);
	
}

// ***********************************************
// * addMediaDiv
// * 
// * Creates defined media div and inserts it as 
// * child of given node.
// *
// 
function addMediaDiv(name, mediaclass, parentname, media, desc)
{
	//create the new div
	elem = document.createElement("div");
	elem.id=elem.name=name;
	elem.className=mediaclass;
	
	
		//stylize
	elem.style.position="absolute";
	elem.style.left="0px";
	elem.style.top="23px";
	elem.style.background="black";
	elem.style.verticalalign="middle";
	elem.style.margin="auto";
	elem.style.display="block";
	elem.style.zindex="100";
	
	
	if(getMediaType(media)=="image")
	{
		elem=createPictureHolder(media, elem, desc);
	}
	else if(formdisplay)
	{
		elem=createFormHolder(media, elem);
	}
	else
	{
		elem=createSWplayer(media, elem);
	}
	
	//assign to parent
	return elem;
}

// ***********************************************
// *   Creates a template to hold an image
// *
// 
function createPictureHolder(media, elem, desc)
{
	elem.innerHTML="<img src='" + media + "' caption='" + desc + ">";
	return elem;
}

function createFormHolder(media, elem)
{
	elem.style.overflow="scroll";
	return elem;
}

// ***********************************************
// *   Creates a template to hold a SWF movie
// *
// 
function createSWplayer(media, elem)
{
	var video = document.createElement("div");
	video.id=video.name=video.className="video";
	video.align="center";
	video.style.display="block";
	video.style.zindex="20";
	video.style.margin="auto";
	
	elem.appendChild(video);
	setTimeout("createSWerror()",799);
	setTimeout("writeSWplayer('" + media + "');", 800);
	
	return elem;
}

function createSWerror()
{

	var video=document.getElementById('video');
	var errortext=document.createElement("a");
	errortext.link="http://www.macromedia.com/go/getflashplayer";
	errortext.href="http://www.macromedia.com/go/getflashplayer";
	errortext.target="_blank";
	errortext.style.zindex="109";
	errortext.style.position="relative";
	var errorpic = document.createElement('img');
	if(digitalcampus) 
	{
		errorpic.src="/media/9930/images/download_flash_dc.jpg";
	}
	else if(viewbook) 
	{
		errorpic.src="/media/9930/images/download_flash_viewbook.jpg";
	}
	else {
		errorpic.src="/media/9930/images/download_flash_video.jpg";
	}
		
	errortext.appendChild(errorpic);
	video.appendChild(errortext);
	
}


function getOpac(iid) {
	var object = document.getElementById(iid).style;
		object.opacity = (opacity / 100);
//		object.MozOpacity = (opacity / 100);
//		object.KhtmlOpacity = (opacity / 100);
//		object.filter = "alpha(opacity=" + opacity + ")";	
		
	return object.opacity;
}

function writeSWplayer(media)
{
	if(digitalcampus)
	{	
		showDigitalCampus();
		
	}
	else if (viewbook) 
	{
		showViewbook();	
	}
	
	else
	{
		swfobject.flashvars = { };
		swfobject.params = {
			wmode: "transparent",
			allowfullscreen: "true"
		};
		
		swfobject.embedSWF(media, "video", "500", "400", "8.0.23", "/media/9930/flash/expressInstall.swf",swfobject.flashvars , swfobject.params);
	}

}

// ************************************************
// * getMediaType
// *
// * determines appropriate stage container based on
// * extension of media type.
// 
function getMediaType(media)
{
	if (media.substr(media.length - 3 , media.length).toUpperCase() == 'JPG')
		return "image";
	else
		return "movie";
}

function showTheater( outer, inner, opac, width, height)
{
	
	mediaDivVisible = true;
	//set stage to middle of screen

	//obfusticated so that the document won't flicker
	setTimeout("document.getElementById('"+ outer +"').style.display='inline';", 3);
	opacity(outer,1,0,1);	
	setTimeout("document.getElementById('"+ inner +"').style.display='inline';", 3);
	document.getElementById(inner).style.height=MediaHeight;
	document.getElementById(inner).style.width=MediaWidth;
	opacity(inner,1,0,1);
	
	grayOut(true);
	opacity(outer,  0, 100, 700);
	opacity(inner,  0, 100, 700);
}

function hideTheater(outer, inner, opacstart, returnheight)
{
	mediaDivVisible = false;
	document.getElementById(inner).innerHTML="";
	opacity(inner, 100, 0, 700);
	opacity(outer, 100, 0, 700);
	grayOut(false);
	setTimeout("document.body.removeChild(document.getElementById('"+ outer+"'));", 250);
	try
	{
		document.body.removeChild(holder);
	}
	catch(e)
	{
	}
}

function detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}
																			
function opacity(iid, opacStart, opacEnd, millisec) 
{
	if(detectMacXFF())
	{
		obj = document.getElementById(iid).style;
		if (opacEnd == 100)
		{
			obj.visibility='visible';
			obj.display='block';
			return;	
		}
		else if(opacEnd ==0)
		{
			obj.visibility='hidden';
			return;	
		}
			
	}

	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i-=5) {
			setTimeout("changeOpac(" + i + ",'" + iid + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i+=5)
			{
			setTimeout("changeOpac(" + i + ",'" + iid + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, iid) {
	if(	detectMacXFF() ) return;
	try{
		var object = document.getElementById(iid).style;
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
	}
	catch(e)
	{
	}										
}	

function slowscroll(scrollStart, scrollEnd, millisec)
{
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(scrollStart > scrollEnd) {
		for(i = scrollStart; i >= scrollEnd; i-=8) {
			setTimeout("scroll(0," + i +");",(timer * speed));
			timer++;
		}
	} else if(scrollStart < scrollEnd) {
		for(i = scrollStart; i <= scrollEnd; i+=8)
			{
			setTimeout("scroll(0," + i +");",(timer * speed));
			timer++;
		}
	}
}

function popupWindow() {
window.open('webcam.html','mywin','left=20,top=20,width=500,height=400,toolbar=0,resizable=0')

}





// *
// * SWFObject v2.0: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
// *
// * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
// * http://www.opensource.org/licenses/mit-license.php
// *
// 
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	deconcept.SWFObjectUtil.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
	}
	window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}




function showDigitalCampus()
{							
	var so = new SWFObject('/media/9930/flash/DC/lu_digitalCampus.swf', 'video', '950', '600', '8', '#000000');
	so.useExpressInstall('/media/9930/flash/DC/expressinstall.swf');
	so.addParam('menu', 'false');
	so.addParam('scale', 'noscale');
	so.addParam('salign', 'lt');  
	if(browserId()=="Mozilla" || browserId()=="Firefox")
	{
		so.addParam('wmode', 'opaque');
	}
	buildmanualstage();
	document.getElementById("t_media").backgroundcolor="black!";
	so.write('video');
	
	var macmousewheel = new SWFMacMouseWheel( so );
	

	
}
function buildmanualstage ()
{
	
	var stage = document.createElement('div');
	stage.id=stage.name=stage.className="video";

	stage.align="center";
	stage.style.display="block";
	stage.style.margin="auto";
	if(browserId() == "IE" || browserId()=="IE6" )
	{
		stage.style.height= MediaHeight;
		stage.style.width= MediaWidth;
		stage.style.left= MediaLeft;
		stage.style.top= MediaTop;
	}
	else
	{
		stage.style.height= MediaHeight+"!";
		stage.style.width= MediaWidth+"!";
		stage.style.left= MediaLeft+"!";
		stage.style.top= MediaTop+"!";
	}
	stage.style.zindex="200";
	
	holder = stage;
	
	
	document.body.appendChild(stage);
}
function showViewbook()
{
	
	buildmanualstage();
	var so = new SWFObject('/media/9930/viewbook/viewbook_window.swf', 'video', '950', '680', '8', '#FFFFFF');
	so.addParam('scale', 'noscale');
	so.addParam('salign', 'lt'); 
	so.addParam('play', 'true');
	so.addParam('loop', 'true');
	so.addParam('scale', 'showall');
	so.addParam('wmode', 'window');
	so.addParam('devicefont', 'false');
	so.addParam('id', 'viewbook_window');
	so.addParam('bgcolor', '#333333');
	so.addParam('name', 'viewbook_window');
	so.addParam('menu', 'true');
	so.addParam('allowScriptAccess','sameDomain');
	so.addParam('allowFullScreen','false');
	so.addParam('movie', 'viewbook_window');
	so.addParam('salign', '');
	if(browserId()=="Mozilla" || browserId()=="Firefox")
	{
		so.addParam('wmode', 'transparent');
	}
	
	so.write('video');
}


function ajaxFunction(media, zombiediv)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				window.location('/index.cfm?PID=' + media.substring(media.length-5,media.length));
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var xttpresponse = xmlHttp.responseText;
			document.getElementById(zombiediv).innerHTML= xttpresponse;
		}
	}
	xmlHttp.open("GET",media,true);
	xmlHttp.send(null);
}
