// JavaScript Document

function create_container(i) {
	var left;
	left=(780-i.width)/2;
	left=parseInt(left); //cast to integer - gets rid of any fractional part
	left=left+"px"; //cast to string

	
	var new_div=document.createElement("div");
	new_div.id="large_image";
	new_div.style.position="absolute";
	new_div.style.display="block";
	new_div.style.top="50px";
	new_div.style.left=left;
	new_div.style.zIndex="2000";
	new_div.style.backgroundColor="#e0e0e0";
	new_div.style.border="1px solid #303030";
	new_div.onclick=close_img;
	new_div.appendChild(i);
	
	var p=document.createElement("p");
	p.style.textAlign="center";
	p.style.textDecoration="underline";
	p.innerHTML="Close";
	
	new_div.appendChild(p);
	
	var container=document.getElementById("frame");
	container.appendChild(new_div);
}

function close_img() {
	
		
		var large_image;
		if (large_image=document.getElementById("large_image")) {
			large_image.parentNode.removeChild(large_image);
		}
		
		
}

function display_jpeg(jpeg_src) {
		close_img();
		var image1=new Image;
		image1.style.margin="20px";
		image1.style.border="1px solid #303030";

		image1.onLoad=create_container;	
		image1.src=jpeg_src;
		if (image1.complete) {
			//image already cached
			create_container(image1);
		} else {
			//not loaded, wait until loaded then display	
			image1.onload = function () { create_container(image1); }	
		}
		
	
}


function display_swf(swf_src) {
	var container=document.getElementById("flash_container");
	container.innerHTML="<object id='video_player' type=\"application/x-shockwave-flash\" data=\""+swf_src+"\"  width=\"300\" height=\"300\" ><param name=\"movie\" value=\""+swf_src+"\" /><param name=\"autoplay\" value=\"1\" /><param name=\"menu\" value=\"true\" /></object><p>Please be patient - this video may take a few moments to load</p>";
}


