// header
function olympia_header(section, idioma){
	var total_im = 4;
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" width="980" height="270">');
    document.write('<param name="movie" value="header.swf?&section='+section+'&idioma='+idioma+'&total_im='+total_im+'">');
    document.write('<param name="quality" value="high">');
	document.write('<param name="allowFullScreen" value="false">');
	document.write('<param name="bgcolor" value="#F2F2F2">');
	document.write('<param name="scale" value="noscale">');
    document.write('<embed src="header.swf?&section='+section+'&idioma='+idioma+'&total_im='+total_im+'" width="980" height="270" bgcolor="#F2F2F2" quality="high" scale="noscale" allowFullScreen="false" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');			
    document.write('</object>');
}

//
function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// swap image restore
function swap_image() {
  var i,j=0,x,a=swap_image.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// swap image
function restore_image() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// Ajax object
function GetXmlHttpObject() {
if (window.XMLHttpRequest) {
	// code for IE7+, Firefox, Chrome, Opera, Safari
	return new XMLHttpRequest();
	}
if (window.ActiveXObject) {
	// code for IE6, IE5
	return new ActiveXObject("Microsoft.XMLHTTP");
	}
return null;
}

// contact script
var xmlhttp;
function sendForm() {
	xmlhttp = GetXmlHttpObject();
	if (xmlhttp == null) {
		alert ("Tu navegador no soporta esta función. (HTTP Request)");
		return;
	}
	var url = "send_form.asp";
	url = url + "?nombre=" + document.getElementById("nombre").value+ "&email=" + document.getElementById("email").value + "&direccion=" + document.getElementById("direccion").value + "&comentarios=" + document.getElementById("comentarios").value + "&idioma=" + document.getElementById("idioma").value + "&sending=ok";
	xmlhttp.onreadystatechange = stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function stateChanged() {
	if (xmlhttp.readyState < 4) {
		document.getElementById("left_column").innerHTML = '<br /><br /><div align="center"><img src="images/loading.gif" width="32" height="32" alt="Enviando..." title="Enviando..."></div><br /><br />';
	}	
	if (xmlhttp.readyState == 4) {
		document.getElementById("left_column").innerHTML = xmlhttp.responseText;
	}
}
