/*
popup()
===
-Allows you to dynamically assign popup functionality based on a user-defined attribute for the <a> tag
-Will create the correct kind of popup based on file extension
-Future version will support SWFs directly (although you can load the HTML that holds a SWF right now)

#####################################################################################################
#####################################################################################################
MAKE SURE TO INCLUDE "swfobject.js" LIBRARY WITH THIS FILE IF I INTEND TO USE THIS ON SWFs
#####################################################################################################
#####################################################################################################


FUTURE CONSIDERATION
===
-Direct SWF support
XXX Added 09/13/06

USAGE
===
<script language="javascript" type="text/javascript" src="./js/popup.js"></script>
<script language="javascript" type="text/javascript">
<!--
window.onload = function() { init_popup(); }
-->
</script>
.
.
.
<!-- FOR HTML -->
<a href="./test.html" type="popup">HTML link 1</a>
<a href="./test.html?width=760&height=420" type="popup">HTML link 2</a>
<!-- FOR IMAGES -->
<a href="./img/test.jpg" type="popup">JPG link 1</a>
<a href="./img/test.jpg?width=800&height=600&title=Bunny Wabbits" type="popup">JPG link 2</a>
<a href="./img/test.jpg?width=800&height=600&title=Bunny Wabbits&showCaption=1&alt=This is the alt text as well as the caption that will be shown over the bottom of the image" type="popup">JPG link 3</a>
*/

function init_popup() {
	//alert("init_popup()");
	// First, look for all <a> elements
	var arr_a = document.getElementsByTagName('a');
	// Next, separate the elements that have the attribute "popup"
	for(var i = 0; i < arr_a.length; i++) {
		if(null !== arr_a[i].getAttribute("type") && arr_a[i].getAttribute("type") == 'popup') {
			// So with each one that is type "popup", add the eventHandler "onclick"
			arr_a[i].onclick = function() { return popup(this.href); };
		}
	}
}
// Universal function that should be able to assign the correct popup type based on the contents of string 'src'
function popup(src) {
	// VARIABLE DECLARATION
	var arr = new Array();
	var arr2, arr3, arr4;
	var dot, file_ext;
	//
	// If there's no value inserted, return true so the 'src' file displays in-window
	if(null == src || src == '') { return true; }
	// First, split 'str' at the '?' character to extract the source
	// If the string entered has parameters...
	if(src.indexOf("?") > -1) {
		arr2 = src.split("?");
		arr["src"] = arr2[0];
		// Split the string again at the '&' character and assign it to a temp array
		arr3 = arr2[1].split("&");
		for(var q in arr3) {
			// With each element of arr3, split it into the temp array arr4, then assign the pieces to the master array
			arr4 = arr3[q].split("=");
			arr[arr4[0]] = unescape(arr4[1]);
		}
	} else {
		// Assign the 'src' as the src value
		arr["src"] = src;
	}
	// ERROR CHECKING
	// Check if width and height parameters were passed
	if(null == arr["width"]) { arr["window_width"] = self.screen.width/1;}
	else { arr["window_width"] = arr["width"]; }
	if(null == arr["height"]) { arr["window_height"] = self.screen.height/1; }
	else { arr["window_height"] = arr["height"]; }
	// Get the file extension of the 'src'
	dot = arr["src"].lastIndexOf('.');
	// If the 'src' is formatted correctly, find out the file extension, else return true
	if(dot > -1) { file_ext = arr["src"].substr(dot+1, arr["src"].length); }
	else { file_ext = null; return true; }
	switch(file_ext) {
		default:
			// Do standard popup action here
			popup_html(arr["src"], arr["window_width"], arr["window_height"], true);
			break;
		case "htm":
		case "html":
		case "php":
		case "asp":
			// Do standard popup action here
			popup_html(arr["src"], arr["window_width"], arr["window_height"]);
			break;
		case "jpg":
		case "gif":
		case "png":
			// Do image popup here
			popup_img(arr["src"], arr["width"], arr["height"], arr["window_width"], arr["window_height"], arr["alt"], arr["title"], arr["showCaption"]);
			break;
		case "swf":
			// For next iteration will add swf support. return true for now
			popup_swf(arr["src"], arr["width"], arr["height"], arr["window_width"], arr["window_height"], arr["alt"], arr["title"]);
			break;
		case "mov":
			popup_qt(arr["src"], arr["width"], arr["height"], arr["window_width"], arr["window_height"], arr["alt"], arr["title"]);
			break;
		case "mp4":
			popup_mp4(arr["src"], arr["width"], arr["height"], arr["window_width"], arr["window_height"], arr["alt"], arr["title"]);
			break;
	}
	return false;
};
function popup_html(url,w, h, force_scroll) {
	// Center x/y params
	var cX = (screen.width - w)/2;
	var cY = (screen.height - h)/2;
	var scrollbars, resizable;
	// Add a conditional check: if h is blank or larger than screen.height, 
	//alert("h: "+h+", screen.availHeight: "+(screen.availHeight -55)); //55px is the size of the title and status bars in FF
	if(null == force_scroll) {
		if(parseInt(h) > parseInt(screen.availHeight - 55)) {
			// increase the width to accomodate a scrollbar and make the attributes scrollbars=1, resizable=1, 
			w = parseInt(w) + 17; // 18px is the default size of WinIE scrollbars
			scrollbars = resizable = '1';
		} else if(h == '') {
			// If 'h' was not passed as a parameter
			scrollbars = resizable = '1';
		} else {
			// else make them both 0
			scrollbars = resizable = '0';
		}
	} else {
		w = parseInt(w) + 17; // 18px is the default size of WinIE scrollbars
		scrollbars = resizable = '1';
	}
	// Create blank window using window_width and window_height params
	var win_html = window.open(url, 'html_window', 'width='+w+',height='+h+',toolbar=no,location=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable='+resizable+',left='+cX+',top='+cY);
	if(window.focus) { win_html.focus(); }
};
function __popup_html(url,w, h, force_scroll) {
	// Center x/y params
	var cX = (screen.width - w)/2;
	var cY = (screen.height - h)/2;
	var scrollbars, resizable;
	
	w = parseInt(w) + 17; // 18px is the default size of WinIE scrollbars
	scrollbars = resizable = '1';
	
	// Create blank window using window_width and window_height params
	var win_html = window.open(url, 'html_window', 'width='+w+',height='+h+',toolbar=no,location=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable='+resizable+',left='+cX+',top='+cY);
	if(window.focus) { win_html.focus(); }
};
function popup_img(src,w,h,w2, h2,alt,ttl, showCaption) {
	var tmp_slash = src.lastIndexOf('/');
	var filename = src.substr(tmp_slash+1, src.length);
	var scrollbars, resizable;
	var img_width, img_height;
	// Variable adjustments
	if(null == w) { w = ''; }
	if(null == h) { h = ''; }
	if(null == alt) { alt = ''; }
	if(null == ttl) { ttl = ''; }
	// Center x/y params
	var cX = (screen.width - w2)/2;
	var cY = (screen.height - h2)/2;
	// Adjust display properties for <img> attrib width/height
	if(w == '') { img_width = ''; } else { img_width = 'width="'+w+'"'; }
	if(h == '') { img_height = ''; } else { img_height = 'height="'+h+'"'; }
	// Add a conditional check: if h is blank or larger than screen.height, 
	//alert("h: "+h+", screen.availHeight: "+(screen.availHeight -55)); //55px is the size of the title and status bars in FF
	if(parseInt(h) > parseInt(screen.availHeight - 55)) {
		// increase the width to accomodate a scrollbar and make the attributes scrollbars=1, resizable=1, 
		w2 = parseInt(w2) + 17; // 18px is the default size of WinIE scrollbars
		scrollbars = resizable = '1';
	} else if(h == '') {
		// If 'h' was not passed as a parameter
		scrollbars = resizable = '1';
	} else {
		// else make them both 0
		scrollbars = resizable = '0';
	}
	var num = Math.floor(Math.random()*9999);
	// Create blank window using window_width and window_height params
	var new_win = window.open('','jpg_popup'+num,'width='+w2+',height='+h2+',toolbar=0,statusbar=0,location=0,scrollbars='+scrollbars+',resizable='+resizable+',left='+cX+',top='+cY);
	// Create blank document
	// \r\n is the Javascript equivalent of chr(10) in ActionScript
	new_win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r\n');
	new_win.document.write('<html xmlns="http://www.w3.org/1999/xhtml">\r\n');
	new_win.document.write('<head>\r\n');
	new_win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\r\n');
	//new_win.document.write('<title>'+filename+'</title>\r\n');
	new_win.document.write('<title>'+ttl+'</title>\r\n');
	new_win.document.write('<style media="all" type="text/css">\r\n');
	new_win.document.write('<!--\r\n');
	new_win.document.write('body { position:relative; margin:0; padding:0; background-color:#AAAFB3; font:10px/140% normal Arial, Verdana, Helvetica, sans-serif; color:#000; }\r\n');
	new_win.document.write('a { display: block; color:#000; font-weight:bold; text-decoration:none; }\r\n');
	new_win.document.write('img { border:0; }\r\n');
	new_win.document.write('.button { position:absolute; top:10px; right:10px; display:block; width:auto; padding:0.25em; text-align:center; background-color:#FFF; border:1px solid #000; }\r\n');
//	new_win.document.write('.caption { position:absolute; bottom:10px; right:10px; display:block; width:auto; padding:1em; margin: 0 0 0 10px; text-align:left; background-color:#FFF; border:3px inset #999; font-size: 12px; font-weight: bold; filter:alpha(opacity=85); -moz-opacity:.85; opacity:.85;}\r\n');
	new_win.document.write('.caption { position:absolute; bottom:0.20em; left: 0px; display:block; width:'+(w-20)+'px; padding:10px; margin: 0; text-align:left; background-color:#FFF; border-top:5px groove #999; font-size: 12px; font-weight: bold; filter:alpha(opacity=80); -moz-opacity:.80; opacity:.80;}\r\n');
	new_win.document.write('#up { filter:alpha(opacity=50); -moz-opacity:.50; opacity:.50; }\r\n');
	new_win.document.write('#ov { filter:alpha(opacity=99); -moz-opacity:.99; opacity:.99; }\r\n');
	new_win.document.write('-->\r\n');
	new_win.document.write('</style>\r\n');
	new_win.document.write('</head>\r\n');
	new_win.document.write('<body>\r\n');
	//new_win.document.write('	<div id="up" class="button" onmouseover="this.id=\'ov\';" onmouseout="this.id=\'up\';" ><a href="javascript:self.close();" title="close this window">[X] close</a></div>\r\n');
	// If I want to make it so clicking the image closes the window...
	//new_win.document.write('	<a style="border:0;" href="javascript:self.close();" title="click image to close window"><img style="border:0;" src="'+src+'" width="'+w+'" height="'+h+'" alt="'+alt+'" title="'+ttl+'"/></a>\r\n');
	// Caption window which sits on top of the <img>; Displays alt text
	if(showCaption == "1" || showCaption == 1) {
		new_win.document.write('	<div class="caption">'+alt+'</div>\r\n');
	}
	//
	new_win.document.write('	<img src="'+src+'" '+img_width+' '+img_height+' alt="'+alt+'" title="'+ttl+'"/>\r\n');
	new_win.document.write('</body>\r\n');
	new_win.document.write('</html>');
	// Close document
	new_win.document.close();
	// If Netscape, bring popup window to the front
	if(window.focus) { new_win.focus(); }
}
function popup_swf(src,w,h,w2, h2,alt,ttl) {
	var tmp_slash = src.lastIndexOf('/');
	var filename = src.substr(tmp_slash+1, src.length);
	var scrollbars, resizable;
	var img_width, img_height;
	// Variable adjustments
	if(null == w) { w = ''; }
	if(null == h) { h = ''; }
	if(null == alt) { alt = ''; }
	if(null == ttl) { ttl = ''; }
	// Center x/y params
	var cX = (screen.width - w2)/2;
	var cY = (screen.height - h2)/2;
	// Adjust display properties for <img> attrib width/height
	if(w == '') { img_width = ''; } else { img_width = 'width="'+w+'"'; }
	if(h == '') { img_height = ''; } else { img_height = 'height="'+h+'"'; }
	// Add a conditional check: if h is blank or larger than screen.height, 
	//alert("h: "+h+", screen.availHeight: "+(screen.availHeight -55)); //55px is the size of the title and status bars in FF
	if(parseInt(h) > parseInt(screen.availHeight - 55)) {
		// increase the width to accomodate a scrollbar and make the attributes scrollbars=1, resizable=1, 
		w2 = parseInt(w2) + 17; // 18px is the default size of WinIE scrollbars
		scrollbars = resizable = '1';
	} else if(h == '') {
		// If 'h' was not passed as a parameter
		scrollbars = resizable = '1';
	} else {
		// else make them both 0
		scrollbars = resizable = '0';
	}
	// Because document.write is stupid...
	var q = '';
	// Create blank window using window_width and window_height params
	var new_win = window.open('','jpg_popup','width='+w2+',height='+h2+',toolbar=0,statusbar=0,location=0,scrollbars='+scrollbars+',resizable='+resizable+',left='+cX+',top='+cY);
	// Create blank document
	// \r\n is the Javascript equivalent of chr(10) in ActionScript
	new_win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r\n');
	new_win.document.write('<html xmlns="http://www.w3.org/1999/xhtml">\r\n');
	new_win.document.write('<head>\r\n');
	new_win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\r\n');
	//new_win.document.write('<title>'+filename+'</title>\r\n');
	new_win.document.write('<title>'+ttl+'</title>\r\n');
	new_win.document.write('<style media="all" type="text/css">\r\n');
	new_win.document.write('<!--\r\n');
	new_win.document.write('body { position:relative; margin:0; padding:0; background-color:#AAAFB3; font:10px/140% normal Arial, Verdana, Helvetica, sans-serif; color:#FFF; }\r\n');
	new_win.document.write('-->\r\n');
	new_win.document.write('</style>\r\n');
	new_win.document.write('<scr'+q+'ipt language="javascript" type="text/javascript" src="./js/swfobject.js"></script>\r\n');
	new_win.document.write('</head>\r\n');
	new_win.document.write('<body>\r\n');
	new_win.document.write('<div id="swf_container"></div>\r\n');
	new_win.document.write('<scr'+q+'ipt language="javascript" type="text/javascript">\r\n');
	new_win.document.write('// <![CDATA[\r\n');
	//new_win.document.write("docu"+q+"ment.write(\'<object type=\"application/x-shockwave-flash\" data=\""+src+"\" "+img_width+" "+img_height+"><param name=\"movie\" value=\""+src+"\"/><param name=\"allowScriptAccess\" value=\"sameDomain\"/></object>\');\r\n");
	new_win.document.write('var so = new SWFObject("'+src+'", "swf_window", '+img_width+', '+img_height+', "8", "#000000"); so.addParam("wmode", "transparent"); so.addParam("allowScriptAccess", "sameDomain"); so.addParam("movie", "'+src+'"); so.write("swf_container"); \r\n');
	new_win.document.write('// ]]>\r\n');
	new_win.document.write('</sc'+q+'ript>\r\n');
	//new_win.document.write('<object type="application/x-shockwave-flash" data="'+src+'" '+img_width+' '+img_height+'><param name="movie" value="'+src+'"/><param name="allowScriptAccess" value="sameDomain"/></object>\r\n');
	new_win.document.write('</body>\r\n');
	new_win.document.write('</html>');
	// Close document
	new_win.document.close();
	// If Netscape, bring popup window to the front
	if(window.focus) { new_win.focus(); }
}
function popup_qt(src,w,h,w2, h2,alt,ttl) {
	var tmp_slash = src.lastIndexOf('/');
	var filename = src.substr(tmp_slash+1, src.length);
	var scrollbars, resizable;
	var img_width, img_height;
	// Variable adjustments
	if(null == w) { w = ''; }
	if(null == h) { h = ''; }
	if(null == alt) { alt = ''; }
	if(null == ttl) { ttl = ''; }
	// Center x/y params
	var cX = (screen.width - w2)/2;
	var cY = (screen.height - h2)/2;
	// Adjust display properties for <img> attrib width/height
	if(w == '') { img_width = ''; } else { img_width = 'width="'+w+'"'; }
	if(h == '') { img_height = ''; } else { img_height = 'height="'+h+'"'; }
	// Add a conditional check: if h is blank or larger than screen.height, 
	//alert("h: "+h+", screen.availHeight: "+(screen.availHeight -55)); //55px is the size of the title and status bars in FF
	if(parseInt(h) > parseInt(screen.availHeight - 55)) {
		// increase the width to accomodate a scrollbar and make the attributes scrollbars=1, resizable=1, 
		w2 = parseInt(w2) + 17; // 18px is the default size of WinIE scrollbars
		scrollbars = resizable = '1';
	} else if(h == '') {
		// If 'h' was not passed as a parameter
		scrollbars = resizable = '1';
	} else {
		// else make them both 0
		scrollbars = resizable = '0';
	}
	// Because document.write is stupid...
	var q = '';
	// Create blank window using window_width and window_height params
	var new_win = window.open('','jpg_popup','width='+w2+',height='+h2+',toolbar=0,statusbar=0,location=0,scrollbars='+scrollbars+',resizable='+resizable+',left='+cX+',top='+cY);
	// Create blank document
	// \r\n is the Javascript equivalent of chr(10) in ActionScript
	new_win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r\n');
	new_win.document.write('<html xmlns="http://www.w3.org/1999/xhtml">\r\n');
	new_win.document.write('<head>\r\n');
	new_win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\r\n');
	//new_win.document.write('<title>'+filename+'</title>\r\n');
	new_win.document.write('<title>'+ttl+'</title>\r\n');
	new_win.document.write('<style media="all" type="text/css">\r\n');
	new_win.document.write('<!--\r\n');
	new_win.document.write('body { position:relative; margin:0; padding:0; background-color:#AAAFB3; font:10px/140% normal Arial, Verdana, Helvetica, sans-serif; color:#FFF; }\r\n');
	new_win.document.write('-->\r\n');
	new_win.document.write('</style>\r\n');
	new_win.document.write('</head>\r\n');
	new_win.document.write('<body>\r\n');
///////////////////////////////////////////////////
	new_win.document.write('<object '+img_width+' '+img_height+' classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\r\n');
	new_win.document.write('	<param name="src" value="'+src+'"/>\r\n');
	new_win.document.write('	<param name="width" value="'+w+'"/>\r\n');
	new_win.document.write('	<param name="height" value="'+h+'"/>\r\n');
	new_win.document.write('	<param name="type" value="video/quicktime"/>\r\n');
	new_win.document.write('	<param name="autoplay" value="true"/>\r\n');
	new_win.document.write('	<param name="controller" value="true"/>\r\n');
	new_win.document.write('	<param name="pluginspage" value="http://www.apple.com/quicktime/download/index.html"/>\r\n');
	new_win.document.write('	<embed src="'+src+'" '+img_width+' '+img_height+' type="video/quicktime" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/index.html"></embed>\r\n');
	new_win.document.write('</object>\r\n');
///////////////////////////////////////////////////
	new_win.document.write('</body>\r\n');
	new_win.document.write('</html>');
	// Close document
	new_win.document.close();
	// If Netscape, bring popup window to the front
	if(window.focus) { new_win.focus(); }
}
function popup_mp4(src,w,h,w2, h2,alt,ttl) {
	var tmp_slash = src.lastIndexOf('/');
	var filename = src.substr(tmp_slash+1, src.length);
	var scrollbars, resizable;
	var img_width, img_height;
	// Variable adjustments
	if(null == w) { w = ''; }
	if(null == h) { h = ''; }
	if(null == alt) { alt = ''; }
	if(null == ttl) { ttl = ''; }
	// Center x/y params
	var cX = (screen.width - w2)/2;
	var cY = (screen.height - h2)/2;
	// Adjust display properties for <img> attrib width/height
	if(w == '') { img_width = ''; } else { img_width = 'width="'+w+'"'; }
	if(h == '') { img_height = ''; } else { img_height = 'height="'+h+'"'; }
	// Add a conditional check: if h is blank or larger than screen.height, 
	//alert("h: "+h+", screen.availHeight: "+(screen.availHeight -55)); //55px is the size of the title and status bars in FF
	if(parseInt(h) > parseInt(screen.availHeight - 55)) {
		// increase the width to accomodate a scrollbar and make the attributes scrollbars=1, resizable=1, 
		w2 = parseInt(w2) + 17; // 18px is the default size of WinIE scrollbars
		scrollbars = resizable = '1';
	} else if(h == '') {
		// If 'h' was not passed as a parameter
		scrollbars = resizable = '1';
	} else {
		// else make them both 0
		scrollbars = resizable = '0';
	}
	// Because document.write is stupid...
	var q = '';
	// Create blank window using window_width and window_height params
	var new_win = window.open('','jpg_popup','width='+w2+',height='+h2+',toolbar=0,statusbar=0,location=0,scrollbars='+scrollbars+',resizable='+resizable+',left='+cX+',top='+cY);
	// Create blank document
	// \r\n is the Javascript equivalent of chr(10) in ActionScript
	new_win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r\n');
	new_win.document.write('<html xmlns="http://www.w3.org/1999/xhtml">\r\n');
	new_win.document.write('<head>\r\n');
	new_win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\r\n');
	//new_win.document.write('<title>'+filename+'</title>\r\n');
	new_win.document.write('<title>'+ttl+'</title>\r\n');
	new_win.document.write('<style media="all" type="text/css">\r\n');
	new_win.document.write('<!--\r\n');
	new_win.document.write('body { position:relative; margin:0; padding:0; background-color:#AAAFB3; font:10px/140% normal Arial, Verdana, Helvetica, sans-serif; color:#FFF; }\r\n');
	new_win.document.write('a { display: block; color:#000; font-weight:bold; text-decoration:none; }\r\n');
	new_win.document.write('img { border:0; }\r\n');
	new_win.document.write('.button { position:absolute; top:10px; right:10px; display:block; width:auto; padding:0.25em; text-align:center; background-color:#FFF; border:1px solid #000; }\r\n');
	new_win.document.write('#up { filter:alpha(opacity=50); -moz-opacity:.50; opacity:.50; }\r\n');
	new_win.document.write('#ov { filter:alpha(opacity=99); -moz-opacity:.99; opacity:.99; }\r\n');
	new_win.document.write('-->\r\n');
	new_win.document.write('</style>\r\n');
	new_win.document.write('</head>\r\n');
	new_win.document.write('<body>\r\n');
//	new_win.document.write('	<div id="up" class="button" onmouseover="this.id=\'ov\';" onmouseout="this.id=\'up\';" ><a href="javascript:self.close();" title="close this window">[X] close</a></div>\r\n');
///////////////////////////////////////////////////
	new_win.document.write('	<object '+img_width+' '+img_height+' classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\r\n');
	new_win.document.write('		<param name="src" value="'+src+'"/>\r\n');
	new_win.document.write('		<param name="width" value="'+w+'"/>\r\n');
	new_win.document.write('		<param name="height" value="'+h+'"/>\r\n');
	new_win.document.write('		<param name="autoplay" value="true"/>\r\n');
	new_win.document.write('		<param name="controller" value="true"/>\r\n');
	new_win.document.write('		<param name="pluginspage" value="http://www.apple.com/quicktime/download/index.html"/>\r\n');
	new_win.document.write('		<embed src="QTMimeType.pntg" qtsrc="'+src+'" '+img_width+' '+img_height+' type="image/x-macpaint" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download"></embed>\r\n');
	new_win.document.write('	</object>\r\n');
///////////////////////////////////////////////////
	new_win.document.write('</body>\r\n');
	new_win.document.write('</html>');
	// Close document
	new_win.document.close();
	// If Netscape, bring popup window to the front
	if(window.focus) { new_win.focus(); }
}