//<!--

/*****************************************************/

function pintaImagen(u,a){
	if(document.all)
		document.writeln("<td><a href=\"javascript:chgImg('"+u+"');\"><img alt='"+a+"' src='images/resimg.php?foto="+u+"&amp;x=77&amp;y=64' style='filter:alpha(opacity=75);' onmouseover=\"this.style.filter='alpha(opacity=100)'\" onmouseout=\"this.style.filter='alpha(opacity=75)'\" /></a></td>");
	else
		document.writeln("<td><a href=\"javascript:chgImg('"+u+"');\"><img alt='"+a+"' src='images/resimg.php?foto="+u+"&amp;x=77&amp;y=64' style='opacity:0.75;' onmouseover=\"this.style.opacity='1.0'\" onmouseout=\"this.style.opacity='0.75'\" /></a></td>");
}

/*****************************************************/

function chgImg(u){
	document.getElementById('principal').src='images/resimg.php?foto='+u+'&x=350&y=458';
}

/*****************************************************/

var tgs = new Array( 'div','td','tr','p','span','h1','h2','h3');

var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function resizeTexto(inc){
if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( 'texto' ) ) ) cEl = d.getElementsByTagName( 'texto' )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}

function resizeTexto2(inc){
if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( 'news' ) ) ) cEl = d.getElementsByTagName( 'news' )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}

function resizeTexto3(inc){
if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( 'news2' ) ) ) cEl = d.getElementsByTagName( 'news2' )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}}

function resizeTexto4(inc){
if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( 'viviendas' ) ) ) cEl = d.getElementsByTagName( 'viviendas' )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}}

/*****************************************************/

var subMenu=-1;
var viendo=0;

function verPromociones(){
	var i,j;
	var tabla=document.getElementById('lista');
	
	if(viendo){
		while(tabla.rows.length>2)
			tabla.deleteRow(2);
		viendo=0;
		subMenu=-1;
	}else{
		for(i=0,j=2;i<promociones.length;i++,j++){
			tabla.insertRow(j);
			tabla.rows[j].className='men2';
			tabla.rows[j].insertCell(0);
			tabla.rows[j].cells[0].innerHTML=promociones[i];
		}
		viendo=1;
	}
}

function creaSubmenu(i,sitio){
	var tabla=document.getElementById('lista');
	if(subMenu!=i) {
		
		if(subMenu!=-1){
			tabla.deleteRow(subMenu+1);
			tabla.deleteRow(subMenu+1);
			tabla.deleteRow(subMenu+1);
			tabla.deleteRow(subMenu+1);
			tabla.deleteRow(subMenu+1);
			tabla.deleteRow(subMenu+1);
			tabla.deleteRow(subMenu+1);
		}
		
		tabla.insertRow(i+1);
		tabla.rows[i+1].className='men3';
		tabla.rows[i+1].insertCell(0);
		tabla.rows[i+1].cells[0].innerHTML="<a href='promocion.php?id="+sitio+"'>General features (location)</a>";
		
		tabla.insertRow(i+2);
		tabla.rows[i+2].className='men3';
		tabla.rows[i+2].insertCell(0);
		tabla.rows[i+2].cells[0].innerHTML="<a href='planos.php?id="+sitio+"'>Plans</a>";
		
		tabla.insertRow(i+3);
		tabla.rows[i+3].className='men3';
		tabla.rows[i+3].insertCell(0);
		tabla.rows[i+3].cells[0].innerHTML="<a href='memoria.php?id="+sitio+"'>Quality specifications</a>";
		
		tabla.insertRow(i+4);
		tabla.rows[i+4].className='men3';
		tabla.rows[i+4].insertCell(0);
		tabla.rows[i+4].cells[0].innerHTML="<a href='viviendas.php?id="+sitio+"'>Dwellings available</a>";
		
		tabla.insertRow(i+5);
		tabla.rows[i+5].className='men3';
		tabla.rows[i+5].insertCell(0);
		tabla.rows[i+5].cells[0].innerHTML="<a href='evolucion.php?id="+sitio+"'>Work progress</a>";

		tabla.insertRow(i+6);
		tabla.rows[i+6].className='men3';
		tabla.rows[i+6].insertCell(0);
		tabla.rows[i+6].cells[0].innerHTML="<a href='folleto.php?id="+sitio+"'>Brochure</a>";

		tabla.insertRow(i+7);
		tabla.rows[i+7].className='men3';
		tabla.rows[i+7].insertCell(0);
		tabla.rows[i+7].cells[0].innerHTML="<a href='visitar.php?id="+sitio+"'>Visit this development</a>";

		subMenu=i;
	}
}

/*****************************************************/
/*
function validaSuelo(){
	if(document.getElementById('superficie').value==''){
		alert('Por favor, indíquenos la superficie del solar.');
		document.getElementById('superficie').focus();
		return(false);
	}
	if(document.getElementById('edificabilidad').value==''){
		alert('Por favor, introduzca los metros cuadrados que se pueden construir. Si lo desconoce, indique 0.');
		document.getElementById('edificabilidad').focus();
		return(false);
	}
	if(document.getElementById('calificacion').value==''){
		alert('Por favor, introduzca la calificación urbanística de la parcela. Si lo desconoce, indique 0.');
		document.getElementById('calificacion').focus();
		return(false);
	}
	if(document.getElementById('dir').value==''){
		alert('Por favor, introduzca la dirección.');
		document.getElementById('dir').focus();
		return(false);
	}
	if(document.getElementById('pob').value==''){
		alert('Por favor, introduzca la población.');
		document.getElementById('pob').focus();
		return(false);
	}
	if(document.getElementById('prov').value==''){
		alert('Por favor, introduzca la provincia donde se encuentra el solar.');
		document.getElementById('prov').focus();
		return(false);
	}
	if(document.getElementById('precio').value==''){
		alert('Por favor, introduzca el precio del terreno.');
		document.getElementById('precio').focus();
		return(false);
	}
	
	if(!document.getElementById('negociable_si').checked&&!document.getElementById('negociable_no').checked){
		alert('Por favor, indíquenos si es precio es o no negociable.');
		return(false);
	}
	if(document.getElementById('calificacion').value==''){
		alert('Por favor, introduzca la información sobre la calificación urbanística');
		document.getElementById('calificacion').focus();
		return(false);
	}
	if(document.getElementById('nombre').value==''){
		alert('Indíquenos, por favor, su nombre para dirigirnos a Ud.');
		document.getElementById('nombre').focus();
		return(false);
	}
	if(document.getElementById('apll').value==''){
		alert('Por favor, introduzca sus apellidos');
		document.getElementById('apll').focus();
		return(false);
	}
	if(document.getElementById('tel').value==''){
		alert('Por favor, introduzca un teléfono de contacto');
		document.getElementById('tel').focus();
		return(false);
	}
	if(document.getElementById('mail').value==''){
		alert('Por favor, introduzca e-mail');
		document.getElementById('mail').focus();
		return(false);
	}
	if(!document.getElementById('politica').checked){
		alert('Debe aceptar la política de privacidad de datos.');
		return(false);
	}
	var cadena=document.getElementById('mail').value;
	var i,arroba=false,punto=false;
	
	for(i=0;i<cadena.length;i++){
		if(cadena.charAt(i)=='@')
			arroba=true;
		if(cadena.charAt(i)=='.')
			punto=true;
	}
	
	if(!(arroba&&punto)){
		alert('Por favor, introduzca un e-mail correcto');
		return(false);
	}
	
	return(true);
}


function validaContacta(){
	if(document.getElementById('nombre').value==''){
		alert('Por favor, introduzca su nombre');
		document.getElementById('nombre').focus();
		return(false);
	}
	if(document.getElementById('apll').value==''){
		alert('Por favor, introduzca sus apellidos');
		document.getElementById('apll').focus();
		return(false);
	}
	if(document.getElementById('tel').value==''){
		alert('Por favor, introduzca un teléfono de contacto');
		document.getElementById('tel').focus();
		return(false);
	}
	if(document.getElementById('mail').value==''){
		alert('Por favor, introduzca e-mail');
		document.getElementById('mail').focus();
		return(false);
	}
	
	if(document.getElementById('mensaje').value==''){
		alert('Por favor, indíquenos el motivo de su consulta.');
		document.getElementById('mensaje').focus();
		return(false);
	}
	if(!document.getElementById('politica').checked){
		alert('Debe aceptar la política de privacidad de datos.');
		return(false);
	}
	var cadena=document.getElementById('mail').value;
	var i,arroba=false,punto=false;
	
	for(i=0;i<cadena.length;i++){
		if(cadena.charAt(i)=='@')
			arroba=true;
		if(cadena.charAt(i)=='.')
			punto=true;
	}
	
	if(!(arroba&&punto)){
		alert('Por favor, introduzca un e-mail correcto');
		return(false);
	}
	
	return(true);
}

function validaInversores(){
	if(document.getElementById('user').value==''){
		alert('Por favor, introduzca su nombre de usuario');
		document.getElementById('user').focus();
		return(false);
	}
		if(document.getElementById('pwd').value==''){
		alert('Por favor, introduzca su contraseña');
		document.getElementById('pwd').focus();
		return(false);
	}
}
*/

function validaSuelo(){
	if(document.getElementById('superficie').value==''){
		alert('Please, enter the plot\'s surface.');
		document.getElementById('superficie').focus();
		return(false);
	}
	if(document.getElementById('edificabilidad').value==''){
		alert('Please, enter the buildable surface. If you do not know, enter 0.'); 
		document.getElementById('edificabilidad').focus();
		return(false);
	}
	if(document.getElementById('calificacion').value==''){
		alert('Please, enter the plot\'s development classification.'); 
		document.getElementById('calificacion').focus();
		return(false);
	}
	if(document.getElementById('dir').value==''){
		alert('Please, enter the plot\'s address');
		document.getElementById('dir').focus();
		return(false);
	}
	if(document.getElementById('pob').value==''){
		alert('Please, enter your town.'); 
		document.getElementById('pob').focus();
		return(false);
	}
	if(document.getElementById('prov').value==''){
		alert('Please, enter your town.'); 
		document.getElementById('prov').focus();
		return(false);
	}
	if(document.getElementById('precio').value==''){
		alert('Please, enter the plot\'s price.');
		document.getElementById('precio').focus();
		return(false);
	}
	
	if(!document.getElementById('negociable_si').checked&&!document.getElementById('negociable_no').checked){
		alert('Please, let us know if the price is negotiable.'); 
		return(false);
	}
	if(document.getElementById('calificacion').value==''){
		alert('Please, enter the information regarding the development classification.'); 
		document.getElementById('calificacion').focus();
		return(false);
	}
	if(document.getElementById('nombre').value==''){
		alert('Please, enter you name so that we can address to you.'); 
		document.getElementById('nombre').focus();
		return(false);
	}
	if(document.getElementById('apll').value==''){
		alert('Please, enter your surname.'); 
		document.getElementById('apll').focus();
		return(false);
	}
	if(document.getElementById('tel').value==''){
		alert('Please, enter a telephone number to contact you.'); 
		document.getElementById('tel').focus();
		return(false);
	}
	if(document.getElementById('mail').value==''){
		alert('Please, enter your e-mail address.'); 
		document.getElementById('mail').focus();
		return(false);
	}
	if(!document.getElementById('politica').checked){
		alert('By sending this form you agree to accept our Privacy Policy.'); 
		return(false);
	}
	var cadena=document.getElementById('mail').value;
	var i,arroba=false,punto=false;
	
	for(i=0;i<cadena.length;i++){
		if(cadena.charAt(i)=='@')
			arroba=true;
		if(cadena.charAt(i)=='.')
			punto=true;
	}
	
	if(!(arroba&&punto)){
		alert('Please, enter a correct e-mail address.'); 
		return(false);
	}
	
	return(true);
}


function validaContacta(){
	if(document.getElementById('nombre').value==''){
		alert('Please, enter your name'); 
		document.getElementById('nombre').focus();
		return(false);
	}
	if(document.getElementById('apll').value==''){
		alert('Please, enter your surname'); 
		document.getElementById('apll').focus();
		return(false);
	}
	if(document.getElementById('tel').value==''){
		alert('Please, enter a telephone number to contact you.'); 
		document.getElementById('tel').focus();
		return(false);
	}
	if(document.getElementById('mail').value==''){
		alert('Please, enter your e-mail address.');
		document.getElementById('mail').focus();
		return(false);
	}
	
	if(document.getElementById('mensaje').value==''){
		alert('Please, give us details of the information you require.'); 
		document.getElementById('mensaje').focus();
		return(false);
	}
	if(!document.getElementById('politica').checked){
		alert('By sending this form you agree to accept our Privacy Policy.'); 
		return(false);
	}
	var cadena=document.getElementById('mail').value;
	var i,arroba=false,punto=false;
	
	for(i=0;i<cadena.length;i++){
		if(cadena.charAt(i)=='@')
			arroba=true;
		if(cadena.charAt(i)=='.')
			punto=true;
	}
	
	if(!(arroba&&punto)){
		alert('Please, enter a correct e-mail address.'); 
		return(false);
	}
	
	return(true);
}

function validaInversores(){
	if(document.getElementById('user').value==''){
		alert('Please, enter your login name'); 
		document.getElementById('user').focus();
		return(false);
	}
		if(document.getElementById('pwd').value==''){
		alert('Please, enter your password');
		document.getElementById('pwd').focus();
		return(false);
	}
}

/*****************************************************/
	
function winz(url, w, h) {

  var l = (screen.availWidth-10 - w) / 2;
  var t = (screen.availHeight-20 - h) / 2;  

  var features = "width="+w+",height="+h+",left="+l+",top="+t;
  features += ",screenX="+l+",screenY="+t;
  features += ",scrollbars=0,resizable=0,location=0";
  features += ",menubar=0,toolbar=0,status=0";

  window.open(url, "", features);

}

/*****************************************************/

function changePicture(rute,title){
	document.getElementById("bo").innerHTML='<img src="images/resimg.php?foto='+rute+'&amp;x=390&y=390" title="'+title+'" alt="'+title+'">';	
}

//-->