	
	/***********************************************
	* Writes the bottom navigational menu
	*/
	writeBottomNav = function (page) {
		for(var i in topNav) {
			if(i != 'each' && i != 'iterate') {
				if(i == page) {
					document.write('<a href="'+i+ '.php" class="footermenu_selected" >' + topNav[i] + '</a>');
				}else {
					document.write('<a href="'+i+ '.php" class="footermenu" >' + topNav[i] + '</a>');
				}
				
				document.write(' &#8226; ');
				/**************
				if(i == 'contact') {
					if(topNav['profile']) {
						document.write(' &#8226; ');	
					}
				}else if(i != 'profile') {
					document.write(' &#8226; ');
				}
				*************/
			}
		}
	}
	
	/***********************************************
	* Kill the feed to the FLV video player 
	*	id : STRING : id/name of FLV object
	*/
	function stopVideo(id,iframeFire) {
		if(iframeFire) {
			parent.stopVideo(id);
		}else {
			flash = flashAccess(id);
			try {
				flash.stopVideo();
			}catch(e) {}
		}
		
	}
	
	/***********************************************
	* Gain access to the FLV flash player and tell it when to start/stop streaming for optimized page performance
	*	Called in shell.php _printbody();
	*	id		-	String	- id/name of swf object / embed
	*	beg 	-  	BOOL 	- requests that page loads first , then page calls flash vid to begin buffer
	*	newFile - 	string 	- request a new file to play without reloading page
	*/
	function playVideo(id,beg,newFile) {
		if(!newFile) {
			newFile = '';
		}

		if(!beg) {
			if (typeof window.onload == 'function') var exLoad = window.onload;
				
			window.onload = function() {
				if(exLoad) exLoad();
				self.setTimeout("playVideo('"+id + "',true,'"+newFile+"');",1000);
			}
		}else {
			if(newFile) {
				cutScene = 'true';
			}else {
				cutScene = '';
			}
			
			self.clearTimeout();
			flash = flashAccess(id);
			try {
				if(newFile) {
					flash.playVideo('',newFile,true,true); // start user-clicked video
				}else {
					flash.playVideo();
				}
			}catch(e) { // the page may need a second longer to find the completed flash obj, so try again
			///	alert('error caught');
				 self.setTimeout("playVideo('"+id+"',true,'"+newFile+"','"+cutScene+"');",'1000'); // 1 second
				 
			}
		}
	}
	
	/***********************************************
	* Embed flash banner system
	*/
	function printFlashBanner(code) {
			inject = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  id=""   codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="468" height="60" align="middle">';
			inject += '<param name="allowScriptAccess" value="sameDomain" />';
			inject += '<param name="movie" value="flash/banners.swf?code=' + code + '"/>';
			inject += '<param name="menu" value="false" />';
			inject += '<param name="quality" value="high" />';
			inject += '<param name="wmode" value="transparent" />';
			inject += '<param name="bgcolor" value="#000000" />';
			inject += '<embed src="flash/banners.swf" menu="false" quality="high"  wmode="transparent" width="469" height="60" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />';
			inject += '</object>';
			
			bantarg = getEl('bannersys');
			bantarg.innerHTML = inject;
			
		}
	function printFlashBannerBK(CMS) {
			inject = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  id=""   codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="468" height="60" align="middle">';
			inject += '<param name="allowScriptAccess" value="sameDomain" />';
			inject += '<param name="movie" value="flash/banners.swf?CMS=' + CMS + '"/>';
			inject += '<param name="menu" value="false" />';
			inject += '<param name="quality" value="high" />';
			inject += '<param name="wmode" value="transparent" />';
			inject += '<param name="bgcolor" value="#000000" />';
			inject += '<embed src="flash/banners.swf" menu="false" quality="high"  wmode="transparent" width="469" height="60" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
			inject += '</object>';
			
			bantarg = getEl('bannersys');
			bantarg.innerHTML = inject;
			
		}
	
	/***********************************************
	* Embed Jon Will's Java media player for archived webcasts
	*/	
	function cytekMediaPlayer(code,keycode,user) {
		
		var toWrite = '<applet codebase="/javachat/DDMediaPlayer" archive="/javachat/CyTekMediaPlayer/sCyTekMediaPlayer.jar" code="CyTekMediaPlayer/CyTekMediaPlayer.class" width="352" height="288">';
		toWrite += '<param name="server_host" value="digitaldancers.com" />';
		toWrite += '<param name="server_port" value="4030" />';
		toWrite += '<param name="filecode" value="'+code+'" />';
		toWrite += '<param name="keycode" value="'+keycode+'" />';
		toWrite += '<param name="play_video" value="true" />';
		toWrite += '<param name="play_audio" value="true" />';
		toWrite += '<param name="username" value="'+user+'" />';
		toWrite += '</applet>';
		
		document.write(toWrite);
	}
	
	/***********************************************
	*	This function is fired from $this->jsScripts in shell.php.  See FLVPlayer() in shell for more info
	*	After loading a page containing a flash video, this function collects all links and appends an onclick
	*	Your links now have an onclick that kills the video feed
	*
	*/
	function gatherLinks(id,setLinks,iframeFire,targParent) {
		
		if(targParent && setLinks) { // attempting to onclicks to an iframe
			// 1. Check to see if a flash movie exists
			try {
				var find = parent.getEl(id);
			}catch(e) {}
			if(!find) {
				return false; // do not apply the below functions when no flv player exists
			}
		}
		
		if(!setLinks) {
			if (typeof window.onload == 'function') var exLoad = window.onload;
			window.onload = function() { 	// do it on onload to ensure all links have been printed
				if(exLoad) exLoad();		// preserve current onload
				gatherLinks(id,true,'',targParent);		// add to onload
			}
		}else {
			//// Gather links
			var links 	= document.getElementsByTagName('a');
			//// Run through links and attach onclick to kill the video feed
			
			 for (var i=0; i<links.length; i++) {
			 	// Uses CSS classes to restrict certain <a>'s from stopping a video load
			 	if(links[i].className == 'pageSys' || links[i].className == 'pageOn') {
			 	
			 	}else if( links[i].className == 'skip') {
			 		
			 	}else {
				 	if (typeof links[i].onclick == 'function' ) {	// preserve current onclick (use this.sourceIndex to track it down during event)
				 		if(!curOnClick) {
					 		var curOnClick = new Array();
					 	}
				 		curOnClick[links[i].sourceIndex] = links[i].onclick;  
				 		
				 		
				 		if(!targParent)  {
					 		links[i].onclick = function(e){					// aw yeah, everything put here is read literally, so you cant use "i", your only vantage point is "this"
								
								stopVideo(id,iframeFire); 					// stop the FLV playback, "id" is same for all links, other wise youd have to base it on the sourceIndex
								curOnClick[this.sourceIndex]();				// this.sourceIndex refers back to the cell in the array above that has previously stored onclicks for this link
								return false;
							}
				 		}
				 		
				 	}else {
				 		if(targParent) {
				 			links[i].onclick = function(){

								parent.stopVideo(id,iframeFire); // stop the FLV playback
							}
				 		}else {
				 			
					 		links[i].onclick = function(){

								stopVideo(id,iframeFire); // stop the FLV playback
							}
						}
				 	}
				 }
			 }
		}
	      
	}
	