// JavaScript Document
function resizeBanner(){
	
	if(screen.height <= 768){
		getSWF("logo").height = 200;
		getSWF("content").height = 380;
	}
	else{
		if((screen.height - getSWF("logo").height - getSWF("content").height) < 155){
			getSWF("content").height = screen.height - 155 - getSWF("logo").height;
		}
	}
}





/**
 * Funcion que crea el objeto Ajax en funcion del navegador.
 * Devuelve el objeto creado.
 */
function creaAjax(){
	
	var objetoAjax=false;
	
	try {
	
		// Para navegadores distintos a internet explorer
		objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
		
	 } 
	 catch (e) {
	  	
		try {
			   // Para explorer
			   objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (E) {
			objetoAjax = false;
	  	}
	 }

	 if (!objetoAjax && typeof XMLHttpRequest!='undefined') {
	 	objetoAjax = new XMLHttpRequest();
	 }
	 
	 return objetoAjax;
}


/* 
 * Funcion que realiza la llamada y carga la respuesta en el contenido.
 */
function Open(url,capa,valores,metodo)
{
	
	//alert(url+" "+capa+" "+valores+" "+metodo);
	
	var ajax=creaAjax();
	var capaContenedora = document.getElementById(capa);


	// Creamos y ejecutamos la instancia si el metodo elegido es distinto de POST
	if(metodo.toUpperCase()!='POST'){
		
		ajax.open('GET', url, true);
		
        ajax.onreadystatechange = function() {
			
        	if (ajax.readyState==1) {
            	capaContenedora.innerHTML="<font style='font: 10px Verdana; color: #666666;'>Cargando.......</font>";
         	}
         	else 
				if (ajax.readyState==4){
                	if(ajax.status==200){
                    	document.getElementById(capa).innerHTML=ajax.responseText;
                   	}
                   	else 
						if(ajax.status==404){
							capaContenedora.innerHTML = "La direccion no existe";
                        }
                        else{
                            capaContenedora.innerHTML = "Error: ".ajax.status;
                        }
                }
        }
		
		
		
		ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.send(null);
	
		return;
	
	}
	else{
	
	
		ajax.open ('POST', url, true);
		
		ajax.onreadystatechange = function() {
			
        	if (ajax.readyState==1) {
            	capaContenedora.innerHTML="<font style='font: 10px Verdana; color: #666666;'>Cargando.......</font>";
         	}
         	else 
				if (ajax.readyState==4){
                	if(ajax.status==200){
                    	document.getElementById(capa).innerHTML=ajax.responseText;
                   	}
                   	else 
						if(ajax.status==404){
							capaContenedora.innerHTML = "La direccion no existe";
                        }
                        else{
                            capaContenedora.innerHTML = "Error: ".ajax.status;
                        }
                }
        }
			
		ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.send(valores);
		
		return;		
	}
}