function VerInmueble(nCodigo)
{	
	document.forms[0].nAccion.value = 1;		
	document.forms[0].nCodigo.value = nCodigo;
	document.forms[0].submit();
}

function SelModelo(nCodigo) {
	document.forms[0].nCodigo.value = nCodigo;
	SubmitForm(2);
}

function ValDominio() 
{
	if (document.forms[0].sDominio.value == '')
	{
		alert('Introduzca el dominio');	
	}
	else
	{	
		SubmitForm(3);
	}
}

function SubmitForm(nAccion)
{	
	document.forms[0].nAccion.value = nAccion;		
	document.forms[0].submit();
}
function verFiltro()
{
	if (document.getElementById("contenedor_buscador").style.display == "inline" )
	{
		document.getElementById("contenedor_buscador").style.display = "none";
		document.getElementById("bFiltro").value = "Ver Filtro";		
		document.forms[0].nFiltro.value = 0;
	}
	else
	{
		document.getElementById("contenedor_buscador").style.display = "inline";
		document.getElementById("bFiltro").value = "Ocultar Filtro";
		document.forms[0].nFiltro.value = 1;
	}
}

function RowClicked(nCodigo) {
	document.forms[0].nCodigo.value = nCodigo;
	SubmitForm(1);
}

function GoToPage(nPagina)
{
	document.forms[0].nCodigo.value = 0;
	document.forms[0].nPaginaActual.value = nPagina;
	SubmitForm(1);
}
function ChangeOrder()
{				
	document.forms[0].nCodigo.value = 0;
	SubmitForm(1);				
}
function Reload()
{	
	document.forms[0].nRecarga.value = 1;	
	document.forms[0].submit();
}

function VentanaImagen2(sUrl)
{
		var ventana2;
		var Opciones2;
		var Ancho;
		var Alto;
		
		Ancho = 800;
		Alto = 600;
		
		Opciones2 = '';
		if (Ancho == 0 || Alto == 0) {
			Ancho = screen.availWidth - 10;
			Alto = screen.availHeight - 10;
			PosX = 0;
			PosY = 0;
		}
		else {
			PosX = (screen.availWidth - Ancho )/2;
			PosY = (screen.availHeight - Alto)/2;
		}
		Opciones2 = 'toolbar = 0,location = 0,directories = 0,status = 0,menubar = 0,scrollbars = 0'			    
		Opciones2 = Opciones2 + ', width =' + Ancho + ',height = ' + Alto + ', left = '+ PosX + ',top = ' + PosY
				
		ventana2=window.open(sUrl,'Imagen',Opciones2);

}
function showPic (whichpic) 
{
	if (document.getElementById) 
	{
		document.getElementById('placeholder').src = whichpic.src;
		return false;
	}
	else
	{
		return true;
	}
}

function AbrirVentana(sUrl,sTitulo,Ancho,Alto,bOpener,bOpciones)
{
		var ventana
		var Opciones
		
		Opciones = '';
		if (Ancho == 0 || Alto == 0) {
			Ancho = screen.availWidth - 10;
			Alto = screen.availHeight - 10;
			PosX = 0;
			PosY = 0;
		}
		else {
			PosX = (screen.availWidth - Ancho )/2;
			PosY = (screen.availHeight - Alto)/2;
		}
		if (bOpciones!=0)
		{
			Opciones = 'toolbar = 1,location = 1,directories = 1,status = 1,menubar = 1,scrollbars = 1'			    
			Opciones = Opciones + ', width =' + Ancho + ',height = ' + Alto + ', left = '+ PosX + ',top = ' + PosY
		}
				
		ventana=window.open(sUrl,sTitulo,Opciones);
		if (bOpener == true) 
			if ((window != null) && (!ventana.opener))			
				ventana.opener=window.self;
}

function informacion(sUrl)
{
	AbrirVentana(sUrl,'Informacion',950,600,true);	
}

function foto(sUrl)
{
	AbrirVentana(sUrl,'Informacion',860,650,true);	
}

function imprimirPdf(sPage,sUrl)
{	
	sUrl = sUrl + '&nWi=' + screen.width;
	sUrl = sUrl + '&sPage=' + sPage ;
	AbrirVentana(sUrl,'Imprimir',1000,750,true,0);
}
/*function VerFavoritos()
{	
	document.forms[0].nAccion.value = 9;
	document.forms[0].nCodigo.value = 0;
	document.forms[0].nFavoritos.value = 1;
	document.forms[0].submit();
}*/

function EliminaFavoritos(nCodigo) {
	document.forms[0].nCodigo.value = nCodigo;
	document.forms[0].nAccion.value = 12;
	document.forms[0].submit();
}

function SubmitFormValida(nAccion)
{	
	if (Validar())
	{
		document.forms[0].nAccion.value = nAccion;	
		document.forms[0].submit();
		return true;
	}
	else
		return false;	
}



function popmenu(menu)
{
	if (document.getElementById)
	{
		document.getElementById(menu).style.visibility = "visible";
	}
	else
	{
		document[menu].visibility = "visible";
	}
}
function shut(menuname)
{
	if (document.getElementById)
	{
		document.getElementById(menuname).style.visibility = "hidden";
	}
	else
	{
		document[menuname].visibility = "hidden";
	}
}

function vermapa(menuname,mapaname,surl)
{
	if (document.getElementById)
	{
		document.getElementById(mapaname).src=surl;	
		document.getElementById(menuname).style.visibility = "visible";
	}
	else
	{
		document[mapaname].src=surl;
		document[menuname].visibility = "visible";
	}
}


function incluir_flash(sURL, nHeight,nWidth, sColor)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
	document.write('width="'+nWidth+'" ');
	document.write('height="'+nHeight+' ');
	document.write('id="flashMovie"> '); 	
	document.write('<param name="movie" value="'+sURL+'" /> ');
    document.write('<param name="quality" value="high" /> ');
    document.write('<param name="bgcolor" value="'+sColor+'" /> ');
	document.write('<embed src="'+sURL+'" quality="high" bgcolor="'+sColor+'" ');
    document.write('width="'+nWidth+'" ');
    document.write('height="'+nHeight+'" ');
    document.write('name="flashMovie" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');	

	//createFlashMarkup(nWidth,nHeight,sURL,'replaced-by-flash',sColor);
}


function createFlashMarkup(width,height,uri,replaceid,sColor)
{
	var obj = document.createElement('object');
	obj.setAttribute('type','application/x-shockwave-flash');
	obj.setAttribute('classid','clsid:D27CDB6E-AE6D-11cf-96B8-444553540000');
	obj.setAttribute('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0');
	obj.setAttribute('id','flash_forum');	
	obj.setAttribute('width',width);
	obj.setAttribute('height',height);
	
	var p_m = document.createElement('param');
	p_m.setAttribute('name','movie');
	p_m.setAttribute('value',uri);
	obj.appendChild(p_m);

	
	var p_m2 = document.createElement('param');
	p_m2.setAttribute('name','quality');
	p_m2.setAttribute('value','high');
	obj.appendChild(p_m2);


	var p_m3 = document.createElement('param');
	p_m3.setAttribute('name','bgcolor');
	p_m3.setAttribute('value',sColor);
	obj.appendChild(p_m3);
	

	var div = document.getElementById(replaceid);
		
	if (obj.outerHTML)
	{		
		div.innerHTML = obj.outerHTML;		
	}
	else
	{		
		var p_m4 = document.createElement('embed');		
		p_m4.setAttribute('src',uri);
		p_m4.setAttribute('type','application/x-shockwave-flash');
		p_m4.setAttribute('width',width);
		p_m4.setAttribute('height',height);
		p_m4.setAttribute('bgcolor',sColor);
		p_m4.setAttribute('pluginspage','http://www.macromedia.com/go/getflashplayer');
		obj.appendChild(p_m4);
		div.appendChild(obj);
	}	
}
function CambiaImagen(obj,img)
{
	obj.src=img;
}
