window.onscroll = function () {imageFullFit('bg');adjust_web()}
window.onload =  function() {imageFullFit('bg');adjust_web()}
window.onresize = function (){imageFullFit('bg');adjust_web()}

menu1 = new Image(); menu1.src="gfx/menu12.png"
menu2 = new Image(); menu2.src="gfx/menu22.png"
menu3 = new Image(); menu3.src="gfx/menu32.png"
menu4 = new Image(); menu4.src="gfx/menu42.png"
menu5 = new Image(); menu5.src="gfx/menu52.png"
flag1 = new Image(); flag1.src="gfx/flag12.png"
flag2 = new Image(); flag2.src="gfx/flag22.png"
flag3 = new Image(); flag3.src="gfx/flag32.png"
flag4 = new Image(); flag4.src="gfx/flag42.png"


function imageFullFit(id)
{
	xy = screenSize()
	ratio =  document.getElementById(id).offsetWidth/document.getElementById(id).offsetHeight


	document.getElementById('bg_wrap').style.width=xy[0]+"px"
	document.getElementById('bg_wrap').style.height=xy[1]+1500+"px"

	document.getElementById(id).style.height = xy[1];
	document.getElementById(id).style.width = "auto";

	if (document.getElementById(id).offsetWidth<xy[0])
	{
		document.getElementById(id).style.width = xy[0] + "px";
		document.getElementById(id).style.height = "auto"
	}

	if (document.getElementById(id).offsetHeight<xy[1])
	{
		document.getElementById(id).style.height = xy[1] + "px";
		document.getElementById(id).style.width = "auto"
	}

	document.getElementById(id).style.left = (xy[0] - document.getElementById(id).offsetWidth)/2 +"px"
	document.getElementById(id).style.top  = (xy[1] - document.getElementById(id).offsetHeight)/2 +"px"

	//iStuff
	if (browser()=="iPad" || browser()=="iPhone" || browser()=="iPod")
	{
		if(document.getElementById(id).offsetHeight<document.getElementById('el_cont').offsetHeight)
			document.getElementById(id).style.height = document.getElementById('el_cont').offsetHeight +"px"

		if(document.getElementById('bg_wrap').offsetWidth<1175)
			document.getElementById('bg_wrap').style.width = "1175px"
	}
}

function adjust_web()
{
	//width center
//	if (xy[0]<1175) document.getElementById('el_cont').style.left="0px"
//	else document.getElementById('el_cont').style.left = (xy[0]-980)/2 + "px"
//	document.getElementById('el_menu').style.left=document.getElementById('el_cont').offsetLeft+"px"
//	document.getElementById('el_logo').style.left=document.getElementById('el_cont').offsetLeft+"px"
//	document.getElementById('el_footer').style.left=document.getElementById('el_cont').offsetLeft+"px"
	
	//scroll patch
//	var sx = document.documentElement.scrollLeft
//	if (sx!=0) document.getElementById('el_menu').style.left=-sx+"px"
//	if (sx!=0) document.getElementById('el_logo').style.left=-sx+"px"
//	if (sx!=0) document.getElementById('el_footer').style.left=-sx+"px"

	//1024 width scroll
//	if (xy[0]<980) document.body.style.overflowX="auto"
//	else document.body.style.overflowX="hidden"

/*
	//iStuff
	if (browser()=="iPad" || browser()=="iPhone" || browser()=="iPod")
	{
		document.getElementById('el_footer').style.position="absolute"
		document.getElementById('el_footer').style.top=document.getElementById('el_cont').offsetHeight -55 +"px"
	}
*/
}

function header()
{
	xy = screenSize()
	if (xy[1]>750) jump = "<tr><td><br></td></tr>";
	else jump = ""

	var header=''+
//	'	<table id="el_logo" style="position:fixed;z-index:1" cellpadding="0" cellspacing="0" width="980" align="center"><tr><td><a href="index.html"><img src="gfx/logo.png" style="margin-top:20px" border="0"/></a></td></tr></table>'+
	'<table id="el_menu" style="position:relative;z-index:3" cellpadding="0" cellspacing="0" width="310" height="100%" align="center" border="0"><tr><td valign="middle">'+
	'	<table cellpadding="0" cellspacing="0" align="center" border="0">'+
	'		<tr valign="top" align="center" height="253"><td><a href="index.html"><img src="gfx/logo.gif" style="margin-top:0px" border="0"/></a></td></tr>'+
	jump+
	'		<tr valign="middle" align="center"><td>'+
	'				<table style="position:relative;z-index:5;" cellpadding="0" cellspacing="0" width="239" height="320">'+
	'					<tr><td><img src="gfx/menu11.png" onclick="location.href=\'educacion.htm\'" style="cursor:pointer" onmouseover="this.src=\'gfx/menu12.png\'" onmouseout="this.src=\'gfx/menu11.png\'" alt="Educación" title="Educación"></td></tr>'+
	'					<tr><td><img src="gfx/menu21.png" onclick="location.href=\'gestioncultural.htm\'" style="cursor:pointer" onmouseover="this.src=\'gfx/menu22.png\'" onmouseout="this.src=\'gfx/menu21.png\'" alt="Gestión Cultural" title="Gestión Cultural"></td></tr>'+
	'					<tr><td><img src="gfx/menu31.png" onclick="location.href=\'espectaculos.htm\'" style="cursor:pointer" onmouseover="this.src=\'gfx/menu32.png\'" onmouseout="this.src=\'gfx/menu31.png\'" alt="Espectáculos" title="Espectáculos"></td></tr>'+
	'					<tr><td><img src="gfx/menu41.png" onclick="location.href=\'quienessomos.htm\'" style="cursor:pointer" onmouseover="this.src=\'gfx/menu42.png\'" onmouseout="this.src=\'gfx/menu41.png\'" alt="Quienes Somos" title="Quienes Somos"></td></tr>'+
	'					<tr><td><img src="gfx/menu51.png" onclick="location.href=\'contacto.htm\'" style="cursor:pointer" onmouseover="this.src=\'gfx/menu52.png\'" onmouseout="this.src=\'gfx/menu51.png\'" alt="Contacto" title="Contacto"></td></tr>'+
	'				</table>'+
	'		</td></tr>'+
	jump+
	'		<tr valign="bottom" align="center" height="100%"><td>'+
	'			<table cellpadding="0" cellspacing="0" border=0>'+
	'				<tr>'+
	'					<td><img src="gfx/flag11.png" onclick="alert(\'Proximamente\')" style="cursor:pointer" onmouseover="this.src=\'gfx/flag12.png\'" onmouseout="this.src=\'gfx/flag11.png\'" alt="Galego" title="Galego"></td>'+
	'					<td><img src="gfx/flag21.png" onclick="" style="cursor:pointer" onmouseover="this.src=\'gfx/flag22.png\'" onmouseout="this.src=\'gfx/flag21.png\'" alt="Español" title="Español"></td>'+
	'					<td><img src="gfx/flag31.png" onclick="alert(\'Coming soon\')" style="cursor:pointer" onmouseover="this.src=\'gfx/flag32.png\'" onmouseout="this.src=\'gfx/flag31.png\'" alt="English" title="English"></td>'+
	'					<td><img src="gfx/flag41.png" onclick="alert(\'Bientôt disponible\')" style="cursor:pointer" onmouseover="this.src=\'gfx/flag42.png\'" onmouseout="this.src=\'gfx/flag41.png\'" alt="Français" title="Français"></td>'+
	'					<td><img src="gfx/fb.png" onclick="window.open(\'http://es-es.facebook.com/pages/Katarsis-Educaci%C3%B3n-y-Teatro-SL/336142036419743\')" style="margin-left:20px;cursor:pointer;position:relative;top:2px" alt="Katarsis en Facebook" title="Katarsis en Facebook" height="30" /></td>'+
	'				</tr>'+
	'			</table>'+
	'		</td></tr>'+
	'		<tr valign="middle" align="left" height="1"><td style="padding-left:76px"><font size="1" color="#999999">web <font size="1" color="#8f4747"><b>&raquo;</b></font> <a href="http://www.alvaroramos.com" class="ar" target="_blank">alvaroramos.com</a></td></tr>'+
	'	</table>'+

	'</tr></td></table>'

	document.write(header)
}

function footer()
{
	var footer=''+
	'	<table id="el_footer" style="position:fixed;z-index:3;bottom:0px" cellpadding="0" cellspacing="0" width="980" align="center">'+
	'		<tr valign="top">'+
	'			<td width="310" align="center" valign="bottom"><font size="1" color="#999999">web <font size="1" color="#8f4747"><b>&raquo;</b></font> <a href="http://www.alvaroramos.com" class="ar" target="_blank">alvaroramos.com</a></td>'+
	'			<td>'+
	'				<table style="background:url(gfx/footerbg.png) no-repeat" cellpadding="0" cellspacing="0" width="688" height="55">'+
	'					<tr valign="bottom">'+
	'						<td width="62">&nbsp;</td>'+
	'						<td style="padding-bottom:7px;color:#888;font-size:12px"><b>www.katarsiseyt.com &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:info&#064;katarsiseyt.com" style="color:#888;text-decoration:none">info<font color="#990000">&#064;</font>katarsiseyt.com</a>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (981) 977746</b></td>'+
	'						<td><img src="gfx/flag11.png" onclick="alert(\'Proximamente\')" style="cursor:pointer" onmouseover="this.src=\'gfx/flag12.png\'" onmouseout="this.src=\'gfx/flag11.png\'" alt="Galego" title="Galego"></td>'+
	'						<td><img src="gfx/flag21.png" onclick="" style="cursor:pointer" onmouseover="this.src=\'gfx/flag22.png\'" onmouseout="this.src=\'gfx/flag21.png\'" alt="Español" title="Español"></td>'+
	'						<td><img src="gfx/flag31.png" onclick="alert(\'Coming soon\')" style="cursor:pointer" onmouseover="this.src=\'gfx/flag32.png\'" onmouseout="this.src=\'gfx/flag31.png\'" alt="English" title="English"></td>'+
	'						<td><img src="gfx/flag41.png" onclick="alert(\'Bientôt disponible\')" style="cursor:pointer" onmouseover="this.src=\'gfx/flag42.png\'" onmouseout="this.src=\'gfx/flag41.png\'" alt="Française" title="Française"></td>'+
	'						<td width="56">&nbsp;</td>'+
	'					</tr>'+
	'				</table>'+
	'			</td>'+
	'		</tr>'+
	'	</table>'

	document.write(footer)
}

function bg() {document.write('<div id="bg_wrap" style="position:fixed;top:0px;left:0px;width:100%;height:100%;overflow:hidden;z-index:0"><img id="bg" src="gfx/bg_blur3.jpg" onload="imageFullFit(this.id)"></div>')}	
