
function content2iframe(elementID,src,frameborder,scrolling)
{
	var objParent=document.getElementById(elementID);
	if(objParent)
	{
		var objIframe=document.createElement('iframe');
		if(objIframe)
		{

			objIframe.frameBorder=frameborder;
			objIframe.scrolling=scrolling;
			
			objIframe.style.height="100%";
			objIframe.style.width="100%";
	//objIframe.style.top="0";
	//objIframe.style.left="0";
	//objIframe.style.visibility="visible";
			objIframe.src=src;
			while(objParent.firstChild)objParent.removeChild(objParent.firstChild);
			objParent.appendChild(objIframe);
		}
	}	
}

function showsitemap()
{
	document.getElementById("sitemap").style.left=document.body.scrollWidth/2-215+"px";
	document.getElementById("sitemap").style.display = "inline";
	window.defaultStatus="Use the links on this sitemap to visit other sections of the Operating Theatre Company's website";
}


function hidesitemap()
{
	document.getElementById("sitemap").style.display = "none";
	window.defaultStatus=document.title;
}

function emailStatus()
{
	statusmessage('Click to send an email to this address');
	return true;
}	

function statusmessage(newstatus)
{
	window.status=newstatus;
	return true;
}

function enquirystatus()
{
	window.status="Click to send an e-mail to the Operating Theatre Company";
	return true;
}

function clickmessage()
{
	window.status="Click here to view this web page";
	return true;
}


function updateLayout()
{
/*	//Isnt working don't know why

	var map=document.getElementsByTagName("map");
	if(map.length)for (g=0;g<map.length;g=g+1)
	{
		var docanchors=map[g].getElementsByTagName("area");
		for (f=0;f<docanchors.length;f=f+1)if (docanchors[f].getAttribute("href"))
		{
			if(docanchors[f].getAttribute("title"))
		{		
			docanchors[f].onmouseover=new Function
				("statusmessage('Click for "+docanchors[f].title+"');return true;");	
			docanchors[f].title = ""
		}
		}
	}*/
	var docanchors=document.getElementsByTagName("a");
//	document.getElementById("sitemap").style.left=document.body.scrollWidth/2-215;
	window.defaultStatus=document.title;

// update images 
	for (f=0;f<document.images.length;f=f+1)
	{
// remove titles 'cos the tooltips are pretty annoying
		document.images[f].title="";
	}
	

	for (f=0;f<docanchors.length;f=f+1)if (docanchors[f].getAttribute("href"))
	{
	//	alert(docanchors[f].href);

		
   	//	if (docanchors[f].getAttribute("href"))
	//	{
			if((docanchors[f].getAttribute("rel") == "external")
				||(!(docanchors[f].getAttribute("href").match("operatingtheatre"))
			&&((docanchors[f].getAttribute("href").substr(0,4)=="http")
				||(docanchors[f].getAttribute("href").substr(0,3)=="www"))))
     			docanchors[f].target = "_blank";
	//	}
		if(docanchors[f].getAttribute("title"))
		{		
			docanchors[f].onmouseover=new Function
				("statusmessage('Click for "+docanchors[f].title+"');return true;");	
			docanchors[f].title = ""
		}
		else if(docanchors[f].href.substr(0,7)=="mailto:")
		{		
			docanchors[f].onmouseover=emailStatus;
		}
		else if(docanchors[f].firstChild.nodeValue)
		{		
			docanchors[f].onmouseover=new Function
				("statusmessage('Click for the \"" +docanchors[f].firstChild.nodeValue+"\" web page.');return true;");	
		}
		else if ((docanchors[f].href=="javascript:sendenquiry();")||(docanchors[f].href=="javascript:memberenquiry();"))docanchors[f].onmouseover=enquirystatus;
		else docanchors[f].onmouseover=clickmessage;
	}

}
function overload (){alert ("overloaded function");}

function startiframebody()
{
	document.write('<body onload="updateHTMLelements();" ><noscript>');
//	for (f=0;f<document.images.length;f=f+1) 
//	{
//		document.images[f].src="";
//		document.images[f].width=0;
//		document.images[f].height=0;
//	}
//	
//	document.onload=updateHTMLelements;
//	document.onscroll=overload;
//	document.onmove=overload;
//	document.onresize=overload;
}

function startbody()
{
	document.write('<img alt="The Operating Theatre Company" height="100" width="400" src="images/operatesmall.jpg" onmouseover="showsitemap();" onmouseout="hidesitemap();" /></div>');
	document.write('<div id="sitemap" onmouseout="hidesitemap()" onmouseover="showsitemap();"><img src="images/sitemap.jpg" id="sitemapimage" usemap="#sitemaparea" alt="Links within this site" />');
	document.write('<map name="sitemaparea" id="sitemaparea"><area shape = "rect" coords="66,5,202,21" id="sitemaplinkinfo"  href="info.htm" title="Information About The Operating Theatre Company" /><area id="sitemaplinkmembers" shape = "rect" coords="89,37,260,53" href="members.htm" title="Information for Company Members" /><area  shape = "rect" coords="17,70,181,87" href="performance.htm" title="Forthcoming attractions" /><area shape = "rect" coords="41,102,182,117" id="sitemaplinkprevious"href="pastshows.htm" title="Details of Our Past Shows" />');
	document.write('<area shape = "rect" coords="343,4,418,19" id="sitemaplinkimages" href="images.htm" title="Images and Video Clips" /><area shape = "rect"coords="361,37,442,52" id="sitemaplinktickets" href="performance.htm#tickets" title="Performance Details and Ticket Information" /><area shape = "rect" coords="36,71,430,85" id="sitemaplinkpress" href="press.htm" title="Press Releases and Contact Details" /><area shape = "rect" coords="358,102,420,117" id="sitemaplinkinternet" href="links.htm" title="Useful Internet Links" /></map>');
	document.write('</div><!--');
}

function writefooter()
{

document.write('<br /><a href="info.htm" title="Information About the Operating Theatre Company">info</a> | <a href="members.htm" title="Information for Company Members">members</a> | <a href="performance.htm" title="Forthcoming attractions">next performance</a> | <a href="pastshows.htm" title="Details of Our Past Shows" >previous productions</a> | <a href="images.htm" title="Images and Video Clips">images</a>  | <a href="performance.htm#tickets" title="Performance Details and Ticket Information">tickets</a>| <a href="press.htm" title="Press Releases and Contact Details">press</a> |  <a href="links.htm" title="Useful Internet Links">links</a>');
}

function sendenquiry()
{
	whereto="enquiries";
	whereto=whereto+"@operat";
	whereto="lto:"+whereto;
	whereto=whereto+"ingtheatre.org";
	whereto="mai"+whereto;
	location.href=whereto;
};

function memberenquiry()
{
	whereto="membership";
	whereto=whereto+"@operat";
	whereto="lto:"+whereto;
	whereto=whereto+"ingtheatre.org";
	whereto="mai"+whereto;
	location.href=whereto;
};