function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function

function mouseover(src,clearo) {
 if (!src.contains(event.fromElement)) {
	 src.style.cursor = 'hand';
	 src.bgColor = clearo;
	}
 }
 function mouseout(src,cleari) {
	if (!src.contains(event.toElement)) {
	 src.style.cursor = 'default';
	 src.bgColor = cleari;
	}
 }
 function mouseclick(src) {
 if(event.srcElement.tagName=='TD')
	 src.children.tags('A')[0].click();
 }
var nav ;
if (navigator.appName=="Netscape"){
	if (parseInt(navigator.appVersion) <=4 )
		{ nav = "N4";}
	else
		{ nav = "N5";}
}
else
    { nav = "I"; }


function ver (zona){
if (nav == "N4"){
	this.location = "/zoomfinal/mapafinalnet.asp?" + zona;
}
else{
	this.location = "/callejero.asp?"+zona;
}
}
function loginAf(){
	var loginw;
	loginw = window.open("/afiliados/void.asp","loginAfw","status=yes,scrollbars=1,width=618,height=300");
	loginw.focus();
}
function checkIntro(accion){
	if(this.event.keyCode==13){
		if(accion==0){
			loginAf();
		}
		else{
		document.accAf.passwd.focus();	
		}
	
	}
}
function contactar (){
	var ventana;
	ventana = window.open ("/contactar.asp","Contactar",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,maxbutton=0,width=480,height=390');
	ventana.focus();
}
function registro(){
var ventana;
	ventana = window.open ("/registro/index.asp","Registro",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,resizable=1,maxbutton=0,width=540,height=600');
	ventana.focus();
}
function isNum(dato){
  var digitos="0123456789";
  var i;var j;var ch
  for (i=0;i<dato.length;i++){
    ch = dato.charAt(i);
    for (j=0;j<digitos.length;j++) if (ch==digitos.charAt(j)) break;
    if (digitos.length==j) return false
  }
  return true
}
function chgBanner(){
	if(top.contenidos){
	top.bannersup.location.reload();
	top.bannermenu.location.reload();
	}
}
function AfAyuda(){
	var afayudaw;
	afayuda = window.open("/afiliados/afiliados_ayuda.asp","afayudahelp","width=420,height=180");
	afayuda.focus();
}
function checkIndex(){
   var pagina = "";
   var search = replaceSubstring(location.search,"&","*");
   search = replaceSubstring(search,"?","|");
   pagina = location.pathname
   if(!top.contenidos){
      top.location.search="";
      top.location.href="http://www.callejerosalamanca.com/index.asp?p="+pagina+"&q="+search;
   }
   else
   {
      chgBanner();
   }
}
function click(codsucursal){
var clickout;
clickout = window.open("/clickweb.asp?codsucursal="+codsucursal,"clickweb","");
clickout.focus();
}
function tarifas(){
	var tarifas;
	vertarifas=window.open("/registro/tarifas.asp","vertarifas","status=yes, width=540,height=600");
	vertarifas.focus();
}