
window.defaultStatus = "Viviendas 1ª Clase"

function ventana_comodin (pagina, ancho, largo, elscroll) {

     ventana_c=window.open(pagina,'miVentana_c','location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=' + elscroll + ',resizable=no,copyhistory=no,width=' + ancho + ', height=' + largo)
     ventana_c.focus();
}

function ventana_comodinR (pagina, ancho, largo, elscroll) {

     ventana_c=window.open(pagina,'miVentana_c','location=no,directories=no,status=yes,menubar=yes,toolbar=no,scrollbars=' + elscroll + ',resizable=yes,copyhistory=no,width=' + ancho + ', height=' + largo)
     ventana_c.focus();
}

function esnumerico(e)  {
  if ((((document.all)?e.keyCode:e.which)>"46")  &&  (((document.all)?e.keyCode:e.which)<"58") || (((document.all)?e.keyCode:e.which)=="44") || (((document.all)?e.keyCode:e.which)=="8") || (((document.all)?e.keyCode:e.which)=="45"))
       return;
     else
       if (document.all) {e.returnValue = null;}
         else{e.preventDefault();e.stopPropagation()}
}

function changecss(theClass,element,value) {
  var cssRules;
  var added = false;
  for (var S = 0; S < document.styleSheets.length; S++){

    if (document.styleSheets[S]['rules']) {
	  cssRules = 'rules';
	 } else if (document.styleSheets[S]['cssRules']) {
	  cssRules = 'cssRules';
	 } else {
	  //no rules found... browser unknown
	 }

	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    if(document.styleSheets[S][cssRules][R].style[element]){
	    document.styleSheets[S][cssRules][R].style[element] = value;
	    added=true;
		break;
	    }
	   }
	  }
	  if(!added){
	    try{
	      document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);

	    } catch(err){
	  try{document.styleSheets[S].addRule(theClass,element+': '+value+';');}catch(err){}
	  }
	  }
	 }
}


var Utf8 = {
 
	// public method for url encoding
	encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// public method for url decoding
	decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}

