function showDialogue(sURL)
{
	hideSelectBoxes();
	hideFlash();
	var objBody = document.getElementsByTagName("body").item(0);
	
	/*
		// Create Following Structure
		<div id="overlay"></div>
		<div id="parentDialogue">	
			<div id="mainDialogue">		
				<div id="headDialogue"><a href="javascript:void(0);" onclick="hideDialogue();">Close</a></div>
				<div id="contentDialogue"></div>
			</div>
		</div>
	*/

	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay');
	objOverlay.style.display = 'none';
	objBody.insertBefore(objOverlay,objBody.childNodes[0])
	//objBody.appendChild(objOverlay);
	
	var objParentDialogue = document.createElement("div");
	objParentDialogue.setAttribute('id','parentDialogue');
	objParentDialogue.style.display = 'none';
	objBody.insertBefore(objParentDialogue,objBody.childNodes[1])
	//objBody.appendChild(objParentDialogue);
	
	var objMainDialogue = document.createElement("div");
	objMainDialogue.setAttribute('id','mainDialogue');
	objParentDialogue.appendChild(objMainDialogue);
	
	var objHeadDialogue = document.createElement("div");
	objHeadDialogue.setAttribute('id','headDialogue');
	objMainDialogue.appendChild(objHeadDialogue);
	
	var objNavCloseLink = document.createElement("a");
	objNavCloseLink.setAttribute('id','NavClose');
	objNavCloseLink.innerHTML = "Close";
	objNavCloseLink.setAttribute('href','#');
	objNavCloseLink.onclick = function() { hideDialogue(); return false; }
	objHeadDialogue.appendChild(objNavCloseLink);
	
	var objContentDialogue = document.createElement("div");
	objContentDialogue.setAttribute('id','contentDialogue');
	objMainDialogue.appendChild(objContentDialogue);
		
	var arrayPageSize = getPageSize();	
	document.getElementById("overlay").style.display="inline";	
	document.getElementById("overlay").style.width=arrayPageSize[0]+'px';
	document.getElementById("overlay").style.height=arrayPageSize[1]+'px';
	makeRequest1(sURL, 'contentDialogue' )
	document.getElementById("parentDialogue").style.display="block";
}

function hideDialogue()
{
	document.getElementById("overlay").style.display="none";	
	document.getElementById("parentDialogue").style.display="none";
	showSelectBoxes();
	showFlash();
}
function showSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------

function hideSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

// ---------------------------------------------------

function showFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i != flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
	}

	var flashEmbeds = document.getElementsByTagName("embeds");
	for (i = 0; i != flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
	}
	
	var flashEmbed = document.getElementsByTagName("embed");
	for (i = 0; i != flashEmbed.length; i++) {
		flashEmbed[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------

function hideFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i != flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
	}

	var flashEmbeds = document.getElementsByTagName("embeds");
	for (i = 0; i != flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
	}
	
	var flashEmbed = document.getElementsByTagName("embed");
	for (i = 0; i != flashEmbed.length; i++) {
		flashEmbed[i].style.visibility = "hidden";
	}

}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {			
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
