		function buildFlashString(url, width, height, scale, flashvars){

			var movie		= url
			var wmode		= 'opaque'
			var align		= 'TL'
			var scale		= scale == undefined ? 'noscale' : scale
			var flashvars	= flashvars == undefined ? '' : flashvars
			
			var flashStr='<object'
				+ ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
				+ ' codebase	= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"'

				+ ' width		= "' +width+ '"'
				+ ' height		= "' +height+ '"'
				
				+ '>'
				

				+ ' <param name="movie"		value="'+movie+'">'
				//+ ' <param name="align"		value="'+align+'">'
				//+ ' <param name="salign"	value="'+align+'">'
				+ ' <param name="wmode"		value="'+wmode+'">'
				+ ' <param name="flashvars"	value="'+flashvars+'">'
				+ ' <param name="scale"		value="'+scale+'">'

				+ ' <param name="play"		value="true>"'
				+ ' <param name="loop"		value="false>"'
				+ ' <param name="quality"	value="high>"'
				+ ' <param name="menu"		value="false>"'

					+ '<embed '
						+ ' src			= "' +movie+ '"'
						+ ' width		= "' +width+ '"'
						+ ' height		= "' +height+ '"'
						//+ ' salign		= "' +align+ '"'
						+ ' wmode		= "' +wmode+ '"'
						+ ' flashvars	= "' +flashvars+ '"'
						+ ' scale		= "' +scale+ '"'

						+ ' play		= "true"'
						+ ' loop		= "false"'
						+ ' quality		= "high"'
						+ ' menu		= "false"'
						+ ' type		= "application/x-shockwave-flash"'
						+ ' pluginspage	= "http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash>"'
					+ '</embed>'
				+ '</object>'

			return flashStr
			}
			
		function buildQuicktimeString(url, width, height, options){
			
			var html = ''
			var defaultOptions =
				{
				scale:		'aspect',
				autoplay:	'true',
				bgcolor:	'666666',
				cache:		'true',
				loop:		false
				}
				
			for(var i in options){
				if(i != 'title'){
					defaultOptions[i] = options[i]
					}
				}
				
			for(var i in defaultOptions){
				html += i + '="' +defaultOptions[i]+ '" '
				}
			html = '<embed src="' +url+ '" width="' +width+ '" height="' +height+ '" ' +html+ '>'
			
			//return '<embed src="' +url+ '" width="' +width+ '" height="' +height+ '" scale="aspect" autoplay="true" bgcolor="666666" cache="true" loop="' +loop+ '">'
			return html
			}

			
		function processMedia(url, w, h, options){
			
			// variables
				var exts	= /(swf|mov|html)/
				var ext		= exts.exec(url)
				var html	= null
				
			// get strings
				if(ext){
					ext			= ext[0]
					switch(ext){
						case 'swf':
							html		= buildFlashString(url, w, h)
							break;
							
						case 'mov':
							// override width and height if ctrl is pressed
								if(window.ctrlPressed){
									w = '100%'
									h = '100%'
									options.bgcolor = '000000'
									}
								else{
									h = parseInt(h) + 15
									}
							html		= buildQuicktimeString(url, w, h, options)
							break;
							
						case 'html':
							win	= window.open(url, '', 'status=no,resizable=yes')
							return;
							break;
						}
					}
					
			// make desicions
				var media	= document.getElementById('media')
				if(media){
					if(window.ctrlPressed && ext == 'mov'){
						showMediaFullScreen(html, options.title)
						}
					else{
						embedMedia(html, w, h)
						}
					}
				else{
					showMedia(html, w, h, options.title)
					}
			window.ctrlPressed = false
			}
			
		
		function embedMedia(html, w, h){
			var media = $('#media')
			media.css('visibility', 'hidden')
			media.html('&nbsp;')
			media.animate(
							{width:w, height:h, borderWidth:'0px'}, 
							500, 
							'linear', 
							function(){
								media.html(html);
								media.css('visibility', 'visible')
								}
						)
			}
			
			
		function showMedia(html, w, h, title){

			var winHtml	= ''
			var gutter	= 30
			
			var winProps= 'status=no,resizable=0,width='+ (w+(gutter * 2)) +',height='+ (h+(gutter * 2))

			winHtml		+= '<html><head><title>' +title+ '</title></head>'
			winHtml		+= '<body style="margin:0px;padding:' +gutter+ 'px;background:#666;">'
			winHtml		+= html
			//winHtml		+= '<script type="text/javascript">document.title="'+title.replace(/"/g,'\"')+'"</scr'+'ipt>'
			winHtml		+= '</body></html>'
			
			win			= window.open('','',winProps)

			win.document.open()
			win.document.write(winHtml)
			win.document.close()
			
			}
			
		function showImage(src, w, h, title){
			var html = '<img src="' +src+ '" />' //width="' +w+ '" height="' +h+ '"
			showMedia(html, w, h, title)
			}
			
/*

// SAFARI BULLSHIT
		var newWin = {
						window:	null,
						title:	'',
						html:	''
						}
			
		function showMedia(html, w, h, title){
			
			alert('showmedia!')

			var gutter		= 30
			var props		= 'status=no,resizable=0,width='+ (w+(gutter * 2)) +',height='+ (h+(gutter * 2))

			win				= window.open('media.html','',props)

			newWin.window	= win
			newWin.title	= title
			newWin.html		= html

			return false
			}
			
		function callback(){
			alert('callback: title!')
			newWin.window.setTitle(newWin.title)
			alert('callback: html!')
			newWin.window.setHTML(newWin.html)
			}
*/
		function showMediaFullScreen(html, title){

			var winHtml	= ''
			
			var winProps= 'status=no,resizable=yes,width='+ screen.availWidth +',height='+ screen.availHeight

			winHtml		+= '<html><head><title>' +title+ '</title></head>'
			winHtml		+= '<body style="margin:0px; padding:0px; background:#000">'
			winHtml		+= html
			winHtml		+= '</body></html>'
			
			win			= window.open('','',winProps)

			win.document.open()
			win.document.write(winHtml)
			win.document.close()

			win.document.title = title
			
			}
			
		function launchCenteredWindow(url, w, h){
			var x	= (screen.availWidth / 2) - (w / 2)
			var y	= (screen.availHeight / 2) - (h / 2)
			window.open(url,'', 'left=' +x+ ',top=' +y+ ',width=' +w+ ',height=' +h+ ',status=0'); void(0)
			}
			

