// FancyZoomHTML.js - v1.0
// Used to draw necessary HTML elements for FancyZoom
//
// Copyright (c) 2008 Cabel Sasser / Panic Inc
// All rights reserved.

function insertZoomHTML() {
	var inBody = document.getElementsByTagName("body").item(0);
	var inSpinbox = document.createElement("div");
	inSpinbox.setAttribute('id', 'ZoomSpin');
	inSpinbox.style.position = 'absolute';
	inSpinbox.style.left = '10px';
	inSpinbox.style.top = '10px';
	inSpinbox.style.visibility = 'hidden';
	inSpinbox.style.zIndex = '525';
	inBody.insertBefore(inSpinbox, inBody.firstChild);
	var inSpinImage = document.createElement("img");
	inSpinImage.setAttribute('id', 'SpinImage');
	inSpinImage.setAttribute('src', zoomImagesURI+'zoom-spin-1.png');
	inSpinbox.appendChild(inSpinImage);
	var inZoombox = document.createElement("div");
	inZoombox.setAttribute('id', 'ZoomBox');
	inZoombox.style.position = 'absolute'; 
	inZoombox.style.left = '10px';
	inZoombox.style.top = '10px';
	inZoombox.style.visibility = 'hidden';
	inZoombox.style.zIndex = '499';
	inBody.insertBefore(inZoombox, inSpinbox.nextSibling);
	var inImage1 = document.createElement("img");
	inImage1.onclick = function (event) { zoomOut(this, event); return false; };	
	inImage1.setAttribute('src',zoomImagesURI+'spacer.gif');
	inImage1.setAttribute('id','ZoomImage');
	inImage1.setAttribute('border', '0');
	inImage1.style.cursor = 'pointer';
	inZoombox.appendChild(inImage1);
	var inClosebox = document.createElement("div");
	inClosebox.setAttribute('id', 'ZoomClose');
	inClosebox.style.position = 'absolute';
	if (browserIsIE) {
		inClosebox.style.left = '-1px';
		inClosebox.style.top = '0px';	
	} else {
		inClosebox.style.left = '-1px';
		inClosebox.style.top = '0px';
	}
	inClosebox.style.visibility = 'hidden';
	inZoombox.appendChild(inClosebox);
		
	var inImage2 = document.createElement("img");
	if (! document.getElementById('ZoomImage').style.webkitBoxShadow && ! browserIsIE) {
		var inFixedBox = document.createElement("div");
		var inShadowTable = document.createElement("table");
		var inShadowTbody = document.createElement("tbody");
		var inRow1 = document.createElement("tr");
		var inCol1 = document.createElement("td");
		var inShadowImg1 = document.createElement("img");
		var inCol2 = document.createElement("td");
		var inSpacer1 = document.createElement("img");
		var inCol3 = document.createElement("td");
		var inShadowImg3 = document.createElement("img");
		var inCol4 = document.createElement("td");
		var inSpacer2 = document.createElement("img");
		var inCol5 = document.createElement("td");
		var inSpacer3 = document.createElement("img");
		var inCol6 = document.createElement("td");
		var inSpacer4 = document.createElement("img");
		var inRow3 = document.createElement("tr");
		var inCol7 = document.createElement("td");
		var inShadowImg7 = document.createElement("img");
		var inCol8 = document.createElement("td");
		var inSpacer5 = document.createElement("img");
		var inCol9 = document.createElement("td");
		var inShadowImg9 = document.createElement("img");
	}

	if (includeCaption) {
		var inCapDiv = document.createElement("div");
		inCapDiv.setAttribute('id', 'ZoomCapDiv');
		inCapDiv.style.position = 'absolute'; 		
		inCapDiv.style.visibility = 'hidden';
		inCapDiv.style.marginLeft = 'auto';
		inCapDiv.style.marginRight = 'auto';
		inCapDiv.style.zIndex = '501';
		inBody.insertBefore(inCapDiv, inZoombox.nextSibling);
		var inCapTable = document.createElement("table");
		inCapTable.setAttribute('border', '0');
		inCapTable.setAttribute('cellPadding', '0');
		inCapTable.setAttribute('cellSpacing', '0');
		inCapDiv.appendChild(inCapTable);
		var inTbody = document.createElement("tbody");
		inCapTable.appendChild(inTbody);
		var inCapRow1 = document.createElement("tr");
		inTbody.appendChild(inCapRow1);
		var inCapCol1 = document.createElement("td");
		var inCapImg1 = document.createElement("img");
		var inCapCol2 = document.createElement("td");
		inCapCol2.setAttribute('background', zoomImagesURI+'zoom-caption-fill.png');
		inCapCol2.setAttribute('id', 'ZoomCaption');
		inCapCol2.setAttribute('valign', 'middle');
		inCapCol2.style.fontSize = '14px';
		inCapCol2.style.fontFamily = 'Helvetica';
		inCapCol2.style.fontWeight = 'bold';
		inCapCol2.style.color = '#ffffff';
		inCapCol2.style.textShadow = '0px 2px 4px #000000';
		inCapCol2.style.whiteSpace = 'nowrap';
		inCapRow1.appendChild(inCapCol2);
		var inCapCol3 = document.createElement("td");
	}
}