

<!-- CUENTA CARACTERES
<!-- Dynamic Version by: Nannette Thacker -->
<!-- http://www.shiningstar.net -->
<!-- Original by : Ronnie T. Moore -->
<!-- Web Site: The JavaScript Source -->
<!-- Use one function for multiple text areas on a page -->
<!-- Limit the number of characters per textarea -->
<!-- Begin
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else{

cntfield.value = maxlimit - field.value.length;

}
}
// End -->

//-->


//SUBMIT FORM ON ENTER
function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}




//ESTA FUNCION CAMBIA EL TAMAÑO DE UNA IMAGEN

function changeImgSize(objectId,newWidth,newHeight) {
	  imgString = 'theImg = document.getElementById("'+objectId+'")';
	  eval(imgString);
	  oldWidth = theImg.width;
	  oldHeight = theImg.height;
	  if(newWidth>0){
	   theImg.width = newWidth;
	  } 
	  if(newHeight>0){
	   theImg.height = newHeight;
	  } 
	
	}
	


//----------------------------------------------------------------------------------------------------------------------------------------
//SONIDOS



var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "../../images/start.wav";
aySound[1] = "../../images/stop.wav";
aySound[2] = "../../images/type.wav";

// DO NOT edit below this line
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;

function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }



//----------------------------------------------------------------------------------------------------------------------------------------

function GP_popupConfirmMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
}


// JavaScript Document

function actualiza()
{
	window.location.reload( false );

}


//CAMBIA EL CONTENIDO DE UN ID
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  Permission granted to use this code 
  as long as this entire notice is included.
*************************************************************************/

function changeContent(id,shtml) {
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
   }
}

//SHOW / HIDE



function faq(faq_){
	esconde_faq(faq_);
	if(document.getElementById(faq_).style.visibility=="visible"){
		document.getElementById(faq_).style.display="none";
		document.getElementById(faq_).style.visibility="hidden";
	}else{
		document.getElementById(faq_).style.display="";
		document.getElementById(faq_).style.visibility="visible";
	}
}
function esconde_faq(faq_){
var n, tmp
for (n=1;n<=parseInt(fi_num);n++) {
	tmp=String(faq_).substring(0,2)+n;
		document.getElementById(tmp).style.visibility="hidden";
		document.getElementById(tmp).style.display="none";		
	if (n==fi_num){
   break;} 
	}
}


function faq2(faq_){
	//esconde_faq(faq_);
	if(document.getElementById(faq_).style.visibility=="visible"){
		document.getElementById(faq_).style.display="none";
		document.getElementById(faq_).style.visibility="hidden";
	}else{
		document.getElementById(faq_).style.display="";
		document.getElementById(faq_).style.visibility="visible";
	}
}


/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}


<!--

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		boton1_over = newImage("images/boton1-over.gif");
		boton2_over = newImage("images/boton2-over.gif");
		bot_mas_tienda_over = newImage("images/bot_mas_tienda-over.gif");
		bot_cesta_tienda_over = newImage("images/bot_cesta_tienda-over.gif");
		preloadFlag = true;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var pulsado=false;

function validarDatos()
{
pulsado=false;
if (!validarNulo(document.form1.poblacion,"Población")) return false;
if (!validarNulo(document.form1.inmueble,"Tipo de Inmueble")) return false;
if (!validarNulo(document.form1.operacion,"Operación")) return false;

return true;
}

function validarDatosPulsar()
{
if (!validarNulo(document.form1.poblacion,"Población")) return false;
if (!validarNulo(document.form1.inmueble,"Tipo de Inmueble")) return false;
if (!validarNulo(document.form1.operacion,"Operación")) return false;

return true;
}

function validarNulo(campo,texto)
{
   if (campo.value.length==0)
   {
                        alert("ERROR: Has olvidado rellenar el campo "+texto+", que no puede dejarse en blanco en este formulario");
                        campo.focus();
                        return false;
   }
   return true;
}



function Aceptar()
        {
                if (!pulsado)
                {
                        if (validarDatos())
                        {
                                pulsado=true;
                                document.form1.submit();
                        }
                }
        }






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];}
}

// -->



//script para la barra de progreso del ASPUPLOAD
function ShowProgress(id, elarchivo)
{

//ID SE UTILIZA PARA ANEXARLO AL NUMERO ALEATORIO PID Y HACER QUE LA PAG SE CARGUE CORRECTAMENTE Y NO SE UTILICE LA CACHE
//ARCHIVO NOS VALE PARA SABER EL NOMBRE DEL CAMPO QUE SUBIMOS PARA VER SI ESTA VACIO O NO
  
  strAppVersion = navigator.appVersion;
  if (document.getElementById(elarchivo).value != "" )
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
		if( strAppVersion.indexOf("Macintosh") != -1 && strAppVersion.charAt(0) >= 3 )
		{
			window.open(barref+'&b=NN','','width=370,height=115', true);
		}
		else
		{
			winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
			window.showModelessDialog(barref+'&b=IE',null,winstyle);
		}
    }
    else
    {
      window.open(barref+'&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}


//FUnción para modificar el alt de las imágenes
//esto nos permite pasar por el alt la url del archivo
function mod_alt(id, txt)
{
	document.getElementById(id).alt = txt 
}

