﻿<!--
var sUrlServidor = "/fundicionesHumanes";

function verCapaFrases(sCapa, sBoton){
	if(document.getElementById(sCapa).style.display=='none'){
		document.getElementById(sCapa).style.display='block';
	}
	else{
		document.getElementById(sCapa).style.display='none';
	}
}

function getTrim(cadena){
	for(i=0; i<cadena.length; )	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}

	for(i=cadena.length-1; i>=0; i=cadena.length-1)	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else
			break;
	}

	return cadena;
}

function abreteSesamo(miPagina, miNombre, w, h, misParams){
	var scroll='no', pos='center', win=null;
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',directories=no,status=no,menubar=no,toolbar=no, scrollbars=yes, ' + misParams;
	win=window.open(miPagina,miNombre,settings);
	if(win.focus){win.focus();}
}

function swapClass(el, class1, class2) { 
	if (el.className) 
	el.className = (el.className == class1) ? class2 : class1; 
} 

function aCesta(sProducto,sCantidad){
	var sUrl = "cesta.asp?sProducto=" + sProducto + "&sCantidad=" + sCantidad;
	abreteSesamo(sUrl,'CESTA',500,550,'status=no');
}

function compruebaCesta(){
	if(document.location!='eShop.asp'){
		document.location='eShop.asp';
	}
	
	aCesta(0,0);
}

function abreDetalle(idPrd){
	var sUrl = "prod_amp.asp?id=" + idPrd;
	abreteSesamo(sUrl,"PROD2",500,550,"scrollbars=yes");
}

function confirmaCesta(){
	var sUrl = "cesta.asp?sAccion=DATOS"
	this.window.document.location=sUrl;
}

function confirmaDatosCliente(){
	var sUrl = "cesta.asp?sAccion=CONFIRMAR"
	this.window.document.location=sUrl;
}

function descargaFichero(sPedidoId, boton){
	var sUrl = "descargaFichero.asp?sPedidoId=" + sPedidoId;
	this.window.document.location=sUrl;
}

function navegaNoticias(iNoticia){
	document.location = "news.asp?iNoticia=" + iNoticia;
}

function visualizaFlyer(sImg, sTipo){
	if(sImg!=""){
		var sUrl = "/nocToc/zoom.asp?imgId=" + sImg + "&sTipo=" + sTipo;
		abreteSesamo(sUrl, 'FLYER', 620, 450, ' scrollbars=yes, resizable=yes');
	}
}
function escondeLista(){
	document.all['divLista'].style.visibility='hidden';
	document.all['divLista'].style.display='none';
}
function zoom(sImg){
	if(sImg!=""){
		var sUrl = "/nocToc/zoom.asp?imgId=" + sImg;
		abreteSesamo(sUrl, 'IMAGEN', 800, 640, ' scrollbars=yes, resizable=yes, location=no, toolbars=no');
	}
}

function ordena(iCampo, iOrden){
	var sUrl = "inmuebles.asp?sOrden=" + iCampo + "&sDireccionOrden=" + iOrden;
	this.window.document.location.href=sUrl;
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function getColor(bEstado, obj){
	if(bEstado)
		obj.style.background='#cccccc';
	else
		obj.style.background='';
}

function getLink(inmId){
	var sUrl = "inmueblesDetalle.asp?inmId=" + inmId;
	document.location=sUrl;
}

function setFullScreen(){
	if (document.all) {
		var iWidth = window.screen.availWidth;
		var iHeight = window.screen.availHeight;
	}
	window.moveTo(0, 0);
	window.resizeTo(iWidth, iHeight);
}	

function isEmail(valor, bValida){
	if(bValida){
		if (valor==""){
			alert("Debe introducir una dirección de email.");
			return (false);
		} 
	}
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
		return (true)
	} 
	else {
		alert("La dirección de email es incorrecta.");
		return (false);
	}
}

function isEmailValor(valor){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
		return (1)
	} 
	else {
		return (0);
	}
}

function MM_preloadImages() { //v3.0
			  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
			    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validaForm(miFrm){
	if(miFrm.txtUser.value==""){
		alert("introduzca usuario");
		miFrm.txtUser.select();
		return false;
	}
	if(miFrm.txtPass.value==""){
		alert("introduzca contraseña");
		miFrm.txtPass.select();
		return false;
	}
	else{
		return true;
	}
}

function setNuevaOpcion(var1Tipo, var1RelacionValor, var1RelacionTipo,f){
	var sUrl = "/nocToc/setVariable.asp?var1Tipo=" + var1Tipo;
		sUrl += "&var1RelacionValor=" + var1RelacionValor;
		sUrl += "&var1RelacionTipo=" + var1RelacionTipo;
		sUrl += "&sForm=" + f;
	if(var1Tipo==2 && var1RelacionValor==''){
		alert('Debe seleccionar un pais antes de introducir una nueva ciudad');
		return false;
	}
	abreteSesamo(sUrl,'setOpcion',400,220,'status=yes');
}

function miEstiloControl(evento, control, color){
	if(evento=='ON'){
		control.bgColor='#CCCCCC';
	}
	else{
		control.bgColor=color;
	}
}
//AC_FL_RunContent = 0;
function getFlashXP(){
	if (AC_FL_RunContent == 0) {
		alert("Esta página requiere el archivo AC_RunActiveContent.js. En Flash, seleccione \"Aplicar actualización de contenido activo\" en el menú Comandos para copiar el archivo AC_RunActiveContent.js en la carpeta de salida HTML.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0',
			'width', '330',
			'height', '170',
			'src', 'banner01',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', 'banner01',
			'bgcolor', '#ffffff',
			'name', 'banner01',
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'movie', 'banner01',
			'salign', ''
			); //end AC code
	}
}

function getFlv(i){
	var sUrl = sUrlServidor + "flvPlayer.asp?i=" + i;
	abreteSesamo(sUrl, "FLVPlayer", 400, 400, '');
}


function getFullFlvPlayer(med1Fichero){
	var sUrl = "getVideo.asp?s=" + med1Fichero
	abreteSesamo(sUrl, 'FLV', 655, 492, 'scrollbars=no;status=no;');
}

function getFlvPlayer(med1Fichero){
	var s1 = new SWFObject("../flvplayer.swf","single","192","156","7");
//	var sFichero = "../videos/151Frases01/" + med1Fichero;
	var sFichero = "http://inglesgratis.morethanenglish.com/videos/151Frases01/" + med1Fichero;
	s1.addVariable("file",sFichero);
	s1.addVariable("image","../images/misc/piVideo.jpg");
	s1.addVariable('showdownload','true'); 
	s1.addVariable('autostart','true'); 
	s1.addParam("allowfullscreen","true");
	s1.write("player1");
}

function getAudio(tema){
	//cargamos audio
	var s3 = new SWFObject("../mp3player.swf", "mpl", "240", "20", "7");
	s3.addVariable("file","../audios/151Frases01/" + tema);
	s3.addVariable("file","http://64.16.193.40/audios/151Frases01/" + tema);
	s3.addVariable("repeat","false");
	s3.addVariable("showdigits","true");
	s3.addVariable("autostart","true");
//			document.getElementById('player3').innerHTML = s3.write("player3");
	s3.write("player3");
}


function alertaSistema(sCmd){
	if(sCmd=="OPEN"){
		if(document.getElementById("divMsg")){
			document.getElementById("divMsg").style.visibility="visible";
			document.getElementById("divMsg").style.display="block";
		}

		if(document.getElementById("divCuerpo")){
			document.getElementById("divCuerpo").style.visibility="visible";
			document.getElementById("divCuerpo").style.display="block";
		}
		
		if(document.getElementById("divCerrar1")){
			document.getElementById("divCerrar1").focus();
		}
		
	}
	else if(sCmd=="CLOSE"){
		if(document.getElementById("divMsg")){
			document.getElementById("divMsg").style.visibility="hidden";
			document.getElementById("divMsg").style.display="none";
		}
			
		if(document.getElementById("divCuerpo")){
			document.getElementById("divCuerpo").style.visibility="hidden";
			document.getElementById("divCuerpo").style.display="none";
		}
	}

}


/**********************************************************************
 * Software:	JS Embedded Content
 * Versión:	1.1 Final (Oct 13, 2006)
 * Autor:	Raspu (donraspu arroba gmail punto com)
 * Copyleft 2006, Raspu - Algunos derechos reservados. 
 *
 * "JS Embedded Content" es software libre. Se otorga permiso para copiar,
 * distribuir y/o modificar este programa bajo los términos de la Licencia
 * Pública General de GNU, versión 2.0 o cualquier otra versión posterior
 * (a su elección) publicada por la Free Software Foundation.
 * 
 * Puedes consultar una copia de la licencia en http://www.gnu.org/copyleft/gpl.html
 *
 *
 * DESCRIPCIÓN:
 * ------------
 * "JS Embedded Content" es una pequeña aplicación desarrollada
 * mediante Javascript no intrusivo ni obstructivo, que permite la
 * activación automática de todos los elementos incrustados en un
 * documento HTML mediante las etiquetas OBJECT, EMBED y/o APPLET.
 *
 * NAVEGADORES COMPATIBLES:
 * ------------------------
 * - Ópera 9 final o superior (para versiones anteriores no es requerido)
 * - Internet Explorer 5 o superior (Windows, en MAC no he probado)
 * El resto de navegadores no es compatible debido al uso outerHTML,
 * pero como por el momento no lo requieren no es mayor problema.
 *
 * INSTRUCCIONES DE USO:
 * ---------------------
 * Sólo debes incluir el archivo "embeddedcontent.js" colocando el siguiente 
 * código entre las etiquetas <HEAD> y </HEAD> de tus documentos HTML:
 * 
 * <script type="text/javascript" src="embeddedcontent.js" defer="defer"></script>
 *
 * NOTA: el uso del atributo DEFER es imprescindible para poder emular en 
 * I. Explorer el evento DOMContentLoaded.
 **********************************************************************/
var embeddedContent = 
{

	isMSIE : (document.all && !window.opera) ? true : false,
	
	
	/**
	 * Reinserta en el documento HTML los elementos que han sido incrustados mediante
	 * las etiquetas OBJECT, EMBED y/o APPLET, redefiniendo su propiedad outerHTML
	 */
	reinsertContent : function()
	{	
	var totalNodes = new Array(3);
		totalNodes['OBJECT'] = document.getElementsByTagName('OBJECT').length;
		totalNodes['EMBED'] = document.getElementsByTagName('EMBED').length;
		totalNodes['APPLET'] = document.getElementsByTagName('APPLET').length;
		for(var tagName in totalNodes)
		{
			var counter = totalNodes[tagName] - 1;
			for(var node; node = document.getElementsByTagName(tagName)[counter]; counter--)
			{
				sourceCode = embeddedContent.getSourceCode(node);
				if(sourceCode)
				{
					node.outerHTML = sourceCode;
				}
			}
		}
		embeddedContent.isMSIE = null;
	},
	
	
	/**
	 * Obtiene el código HTML completo de un determinado nodo.
	 * @param	node (object) - El nodo analizado
	 * @return	sourceCode (string) - El código HTML obtenido
	 */
	getSourceCode : function(node)
	{
		var sourceCode = node.outerHTML;
		switch(node.nodeName)
		{
			case 'EMBED':
				return sourceCode;
			break;
			case 'OBJECT':
			case 'APPLET':
				var openTag = sourceCode.substr(0, sourceCode.indexOf('>') + 1).toLowerCase();
				var closeTag = sourceCode.substr(sourceCode.length - 9).toLowerCase();
				if(closeTag != '</object>' && closeTag != '</applet>')
				{
					/* Si el nodo está mal formado (etiquetas de apertura y cierre) se debe 
					anular el script ya que podría devolver un resultado incorrecto */
					return null;
				}
				if(embeddedContent.isMSIE)
				{
					/* Para I. Explorer se debe obtener aparte el código HTML de los nodos hijos,
					ya que la propiedad outerHTML en ocasiones devolverá un resultado incompleto */
					var innerCode = embeddedContent.getInnerCode(node);
					sourceCode = openTag + innerCode + closeTag;
				}
				return sourceCode;
			break;
		}
	},
	
	
	/**
	 * Obtiene el código HTML de los nodos hijos de un determinado nodo. No se debe utilizar directamente
	 * la propiedad innerHTML ya que en ciertos casos I. Explorer devolverá un resultado incompleto.
	 * @param	node (object) - El nodo padre que será analizado
	 * @return	innerCode (string) - El código HTML obtenido
	 */
	getInnerCode : function(node)
	{
		var innerCode = '';
		var totalChilds = node.childNodes.length - 1;
		for(var counter = totalChilds, child; child = node.childNodes[counter]; counter--)
		{
			innerCode += child.outerHTML;
		}
		return innerCode;
	}
	
}


/**
 * Activación:
 * -----------
 * Detectamos el soporte de attachEvent() como filtro para I. Explorer y Ópera.
 * Para ejecutar el script sólo necesitamos que el DOM (Document Object Model); para
 * ello en Ópera recurrimos al evento DOMContentLoaded, mientras que en I. Explorer
 * emulamos dicho evento apoyándonos en el atributo DEFER de la etiqueta SCRIPT
 * con la que estamos cargando este archivo.
 */
if(document.attachEvent)
{
	if(window.opera)
	{
		document.attachEvent("DOMContentLoaded", embeddedContent.reinsertContent);
	}
	else
	{
		embeddedContent.reinsertContent();
	}
}

-->

