// Popup functions (Image, Flash, QTmovie)

screen_w = window.screen.width;
screen_h = window.screen.height;

function popup_image (fpath, w, h) {
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Macintosh") == -1 && navigator.appVersion.indexOf("68K") == -1) {
		offset_x = 0;
		offset_y = 0;
	}else{
		offset_x = 1;
		offset_y = 5;
	}
	
	if (w > screen_w && h < screen_h){
		new_window = open("","displayWindow","width=" + (screen_w - 10) + ",height=" + (h + offset_y + 16) + ",left=0 ,scrollbars=yes");
	} else if ( w < screen_w && h > screen_h ){
		new_window = open("","displayWindow","width=" + (w + offset_x + 16) + ",height=" + (screen_h - 30) + ",top=0 ,scrollbars=yes" );
	} else if ( w > screen_w && h > screen_h ){
		new_window = open("","displayWindow","width=" + (screen_w - 10)+ ",height=" + (screen_h - 30) + ",left=0, top=0, scrollbars=yes" );
	} else {
		new_window = open("","displayWindow","width=" + (w + offset_x) + ",height=" + (h + offset_y));
	}		
		
	new_window.document.open();

	new_window.document.write("<html>");
	new_window.document.write("<head>");
	new_window.document.write("<title>Hi-res Image</title>");
	new_window.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
	new_window.document.write("</head>");
	new_window.document.write("<body marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\" leftmargin=\"0\">");
	new_window.document.write("<table height=\"100%\" width=\"100%\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
	new_window.document.write("<tr>");
	new_window.document.write("<td><a href=\"javascript:window.close()\"><img src=\"" + fpath + "\" width=\"" + w + "\" height=\"" + h + "\" border=\"0\" alt=\"Click to close the window\"></a></td>");
	new_window.document.write("</tr>");
	new_window.document.write("</table>");
	new_window.document.write("</body>");
	new_window.document.write("</html>");

	new_window.document.close(); 
}


function popup_flash (fpath, w, h) {
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Macintosh") == -1 && navigator.appVersion.indexOf("68K") == -1) {
		offset_x = 0;
		offset_y = 0;
	}else{
		offset_x = 1;
		offset_y = 5;
	}
	
	if (w > screen_w && h < screen_h){
		new_window = open("","displayWindow","width=" + (screen_w - 10) + ",height=" + (h + offset_y + 16) + ",left=0 ,scrollbars=yes");
	} else if ( w < screen_w && h > screen_h ){
		new_window = open("","displayWindow","width=" + (w + offset_x + 16) + ",height=" + (screen_h - 30) + ",top=0 ,scrollbars=yes" );
	} else if ( w > screen_w && h > screen_h ){
		new_window = open("","displayWindow","width=" + (screen_w - 10)+ ",height=" + (screen_h - 30) + ",left=0, top=0, scrollbars=yes" );
	} else {
		new_window = open("","displayWindow","width=" + (w + offset_x) + ",height=" + (h + offset_y));
	}		
		
	new_window.document.open();

	new_window.document.write("<html>");
	new_window.document.write("<head>");
	new_window.document.write("<title>Flash</title>");
	new_window.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
	new_window.document.write("</head>");
	new_window.document.write("<body marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\" leftmargin=\"0\">");
	new_window.document.write("<table height=\"100%\" width=\"100%\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
	new_window.document.write("<tr>");
	new_window.document.write("<td><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + w + "\" height=\"" + h + "\" id=\"Flash\" align=\"middle\">");
	new_window.document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
	new_window.document.write("<param name=\"movie\" value=\"" + fpath + "\" />");
	new_window.document.write("<param name=\"quality\" value=\"high\" />");
	new_window.document.write("<param name=\"bgcolor\" value=\"#FFFFFF\" />");
	new_window.document.write("<embed src=\"" + fpath + "\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"" + w + "\" height=\"" + h + "\" name=\"Flash\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
	new_window.document.write("</object></td>");
	new_window.document.write("</tr>");
	new_window.document.write("</table>");
	new_window.document.write("</body>");
	new_window.document.write("</html>");

	new_window.document.close(); 
}

function popup_qtmovie (fpath, w, h) {
	//Hi Bingo!!
}


function pop_html (fpath, w, h) {
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Macintosh") == -1 && navigator.appVersion.indexOf("68K") == -1) {
		offset_x = 0;
		offset_y = 0;
	}else{
		offset_x = 1;
		offset_y = 5;
	}
	
	if (w > screen_w && h < screen_h){
		new_window = window.open(fpath,"gallery","width=" + (screen_w - 10) + ",height=" + (h + offset_y + 16) + ",left=0 ,scrollbars=yes");
	} else if ( w < screen_w && h > screen_h ){
		new_window = window.open(fpath,"gallery","width=" + (w + offset_x + 16) + ",height=" + (screen_h - 30) + ",top=0 ,scrollbars=yes" );
	} else if ( w > screen_w && h > screen_h ){
		new_window = window.open(fpath,"gallery","width=" + (screen_w - 10)+ ",height=" + (screen_h - 30) + ",left=0, top=0, scrollbars=yes" );
	} else {
		new_window = window.open(fpath,"gallery","width=" + (w + offset_x) + ",height=" + (h + offset_y));
	}

	if (window.focus) {
		new_window.focus();
	}
//	return false;
}

