var nav4 = window.Event ? true : false;
function acceptNum(evt){
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 13 || (key>= 48 && key <= 57));
}


//function usuexistente()
//{
//	makeRequest("/metros/bancomer/anunciate/verifica_usu.m3?email="+document.frman_reg.crm_email.value, modulo2);
//}

function validaTerminos(obj)
{
	if(obj.checked)
	{
		obj.value=1;
	}else{
		obj.value=0;
	}
}

function valida_contban(){
	if(document.frmconban.nombre_alp.value!="")
	{
		if(document.frmconban.lada_alp.value!="")
		{
			if(document.frmconban.tel_alp.value!="")
			{
				if(validateEmail(document.frmconban.email_alp.value))
				{
   var i
    for (i=0;i<document.frmconban.ent.length;i++){
       if (document.frmconban.ent[i].checked)
          break;
    }
    document.frmconban.ent.value= document.frmconban.ent[i].value;


strlinea="/metros/bancomer/inserconta.m3?idcanal="+document.frmconban.idcanal.value+"&nombre="+document.frmconban.nombre_alp.value+"&lada="+document.frmconban.lada_alp.value+"&tel="+document.frmconban.tel_alp.value+"&email1="+document.frmconban.email_alp.value+"&coment="+document.frmconban.comentariosp.value+"&ent="+document.frmconban.ent.value;
								makeRequest(strlinea, modulo2);
				}else{
					alert("El mail no puede ir en blanco");
				}
			}else{
				alert("El Telefono no puede ir en blanco");
			}
		}else{
			alert("El lada no puede ir en blanco");
		}
	}else{
		alert("El nombre no puede ir en blanco");
	}

}
function valida_reganun()
{
	if(document.frman_reg.chk1.value==1)
	{
		a=document.frman_reg.an_nombre.value;b=document.frman_reg.an_paterno.value;c=document.frman_reg.an_materno.value;
		d=document.frman_reg.an_estado.value;e=document.frman_reg.an_municipio.value;f=document.frman_reg.an_colonia.value;
		g=document.frman_reg.an_calle.value;h=document.frman_reg.an_calle.value;i=document.frman_reg.an_numext.value;j=document.frman_reg.an_numint.value;
		k=document.frman_reg.an_lada1.value;l=document.frman_reg.an_tel1.value;m=document.frman_reg.an_lada2.value;n=document.frman_reg.an_tel2.value;
		o=document.frman_reg.crm_email.value;p=document.frman_reg.crm_pass.value;q=document.frman_reg.crm_pass2.value;
		if (document.frman_reg.an_nombre.value != '')
		{
			if (document.frman_reg.an_paterno.value != '')
			{
				if (document.frman_reg.an_materno.value != '')
				{
					if(document.frman_reg.an_estado.selectedIndex>0)
					{
						if(document.frman_reg.an_municipio.selectedIndex>0)
						{
							if(document.frman_reg.an_colonia.selectedIndex>0)
							{
								if (document.frman_reg.an_calle.value != '')
								{
										if(document.frman_reg.an_numext.value != '')
										{
												if(document.frman_reg.an_lada1.value != '')
												{
													if(document.frman_reg.an_tel1.value != '')
													{
																if (validateEmail(document.frman_reg.crm_email.value))
																{
																	if(document.frman_reg.crm_pass.value != '')
																	{
																		if(document.frman_reg.crm_pass2.value != '')
																				{
												if(document.frman_reg.crm_pass.value==document.frman_reg.crm_pass2.value){
				makeRequest("/metros/bancomer/anunciate/inserta_p.m3?a="+a+"&b="+b+"&c="+c+"&d="+d+"&e="+e+"&f="+f+"&g="+g+"&h="+h+"&i="+i+"&j="+j+"&k="+k+"&l="+l+"&m="+m+"&n="+n+"&o="+o+"&p="+p+"&q="+q, regpart);}else{
				alert("La contraseña y confirmacion de contraseñas son diferentes");
				}
								//document.frman_reg.submit();

																		}else{
																		alert("Debe proporcionar nuevamente sus contraseña para verificación")
																		document.frman_reg.crm_pass2.focus();
																		}
																	}else{
																	alert("Debe proporcionar una Contraseña")
																	document.frman_reg.crm_pass.focus();
																	}
																}else{
																alert("Debe proporcionar un E-mail")
																	document.frman_reg.crm_email.focus();
																}

															}else{
														alert("Debe proporcionar un teléfono")
														document.frman_reg.an_tel1.focus();
														}
												}else{
												alert("Debe proporcionar una lada")
												document.frman_reg.an_lada1.focus();
												}
										}else{
										alert("Debe proporcionae un numero Exterior")
										document.frman_reg.an_numext.focus();
										}
										}else{
									alert("Debe proporcionar una calle");
									document.frman_reg.an_calle.focus();
								}
							}else{
							alert("Debe seleccionar una Colonia")
							}
						}else{
						alert("Debe seleccionar un Municipio")
						}
					}else{
					alert("Debe seleccionar un Estado")
					}
				}else{

					alert("Debe de proporsionar su Apellido materno");
					document.frman_reg.an_materno.focus();
				}
			}else{

				alert("Debe de proporsionar su Apellido paterno");
				document.frman_reg.an_paterno.focus();
			}
		}else{

			alert("Debe de proporsionar su nombre")
			document.frman_reg.an_nombre.focus();
		}
	}else{
		alert("Debe aceptar los términos y condiciones de uso para continuar");
		document.frman_reg.chk1.focus();
	}
}


function regpart()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			datos=http_request.responseText;
			eval(datos);
		}else{
			alert("no se encontraron datos");
		}
	}else{
	}
}

function muestraf()
{
	document.getElementById("flashc").style.visibility='visible';
}


function iniciando(valSesion)
{
	if(valSesion==0)
	{
		document.getElementById("flashc").style.visibility='hidden';
		sw(200,200,1);
		ss='<div id="carga_sec"><table bgcolor="#FFFFFF" width="250" height="175" border="0" cellpadding="0" cellspacing="0"><tr><td align="right" valign="top" height="10"><a class="tsess1" href="javascript:closewin(); muestraf();">Cerrar&nbsp;<img border="0" src="http://www.metroscubicos.com/m3/usuweb/close.png"></a></td></tr><tr><td height="120" valign="top"><form name="frmusl"><div id="logns"><table border="0" cellpadding="0" cellspacing="0" height="100"><tr><td colspan="3" class="tsess1" height="40">&nbsp;&nbsp;&nbsp;Inicia sesión</td></tr><tr><td colspan="3" class="tsess1">&nbsp;&nbsp;&nbsp;No eres usuario registrado, <a class="tsess1" href="/metros/bancomer/index.m3?idcanal=1&idsubcanal=1&pinta=0">regístrate</a><br><br></td></tr><td height="10"></td><td class="tsess1">Correo electrónico&nbsp;</td><td><input style="width:100px" name="l_usr" class="campos" type="text"></td></tr><tr><td width="10"></td><td class="tsess1">Contraseña&nbsp;</td><td><input style="width:100px" name="l_pw" class="campos" type="password"></td></tr><input type="hidden" name="idcanal" value="5"><input type="hidden" name="presenta" value="21"></div></form><tr><td height=10></td></tr><tr><td colspan="3" align="right" height="20"><a href="javascript:accsoBncmr(10058)"><img src="/metros/bancomer/imagenes/enviargen2.jpg" border=0></a><br></td></tr></table></td></tr></table>';
		document.getElementById(idFillbox).innerHTML=ss;
	}else{
		window.location.href='/metros/bancomer/usuweb/index.m3';
	}
}

ptaule=0;

function ptaul(idregion)
{
	if (ptaule==0)
	{
		document.getElementById('carga_sec').innerHTML='<div id=carga_sec><table bgcolor="#FFFFFF" width="250" height="175" border="0" cellpadding="0" cellspacing="0"><tr><td align="right" valign="top" height="10"><a class=tsess1 href="javascript:closewin(); muestraf();">Cerrar &nbsp;<img border=0 src=http://www.metroscubicos.com/m3/usuweb/close.png></a></td></tr><tr><td height="120" valign=top><form name="frmusl"><div id=logns><table border=0 cellpadding=0 cellspacing=0 height="100"><tr><td colspan=3 class="tsess1" height=40>&nbsp;&nbsp;&nbsp;Inicia sesión</td></tr><tr><td colspan=3 class="tsess1">&nbsp;&nbsp;&nbsp;No eres usuario registrado, <a class=tsess1 href="/metros/bancomer/index.m3?idcanal=1&idsubcanal=1&pinta=0">regístrate</a><br><br></td></tr><td height="10"></td><td class="tsess1">Correo electrónico&nbsp;</td><td><input style="width:100px" name="l_usr" class="campos" type="text"></td></tr><tr><td width="10"></td><td class="tsess1">Contraseña&nbsp;</td><td><input style="width:100px" name="l_pw" class="campos" type="password"></td></tr><input type=hidden name=idcanal value=5><input type=hidden name=presenta value=21></div></form><tr><td height=10></td></tr><tr><td colspan="3" align="right" height="20"><a href="javascript:accsoBncmr(10058)"><img src="/metros/bancomer/imagenes/enviargen2.jpg" border=0></a><br></td></tr></table></td></tr></table>';
		ptaule=1;
		document.frmusl.l_usr.focus();
	}else{
		document.getElementById('carga_sec').innerHTML="";
		ptaule=0;
	}
}

function accsoBncmr(idregion)
{
	us=document.frmusl.l_usr.value;
	up=document.frmusl.l_pw.value;
	ub=pasoa5("" + us + up);
	document.getElementById('carga_sec').innerHTML="<center><img src=/m3/images/spinner.gif></center>";

	us=Clase64.shadow(DespN(us));
	up=Clase64.shadow(DespN(up));

	strlinea="/metros/bancomer/valida.m3?us=" + us + "&up=" + up +"&ub=" + ub +"&idregion=10058";

	makeRequest(strlinea, modulo3_b)

	if (us!="" && up!="")
	{
		document.getElementById('carga_sec').innerHTML='<table bgcolor="#FFFFFF" width="200" height="200" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" class="tsess1" style="color: #ff0000">Validando usuario...<img src=/m3/images/spinner.gif></td></tr></table>';
	}else{
		document.getElementById('carga_sec').innerHTML='<table bgcolor="#FFFFFF" width="200" height="200" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" class="tsess1">Datos incorrectos!!!<br>Espere un momento...<img src=/m3/images/spinner.gif></td></tr></table>';
		setTimeout("ptaule=0;ptaul();",1000);
	}
}


function modulo3_b()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			datos=http_request.responseText;
			eval(datos);
		}else{
			alert("no se encontraron datos");
		}
	}

}

function val_promo()
{
	if(document.frmpromueve.nombre_alp.value!="")
	{
		if(document.frmpromueve.lada_alp.value!="")
		{
			if(document.frmpromueve.tel_alp.value!="")
			{
				if(validateEmail(document.frmpromueve.email_alp.value))
				{
					if (document.frmpromueve.estado_alp.selectedIndex>0)
					{
						if (document.frmpromueve.Municipio_alp.selectedIndex>0)
						{
							if (document.frmpromueve.colonia_alp.selectedIndex>0)
							{
								if(document.frmpromueve.comentariosp.value!="")
								{
											var s ="no";
											for ( var i = 0; i < document.frmpromueve.ent.length; i++ )
											{
												if ( document.frmpromueve.ent[i].checked )
												{
													s= "si";
													document.frmpromueve.ent.value= document.frmpromueve.ent[i].value;
													break;
												}
											}
												if ( s == "no" ){
												document.frmpromueve.ent.value=0;
												}
												strlinea="/metros/bancomer/promotores/insertpromo.m3?idcanal="+document.frmpromueve.idcanal.value+"&nombre="+document.frmpromueve.nombre_alp.value+"&lada="+document.frmpromueve.lada_alp.value+"&tel="+document.frmpromueve.tel_alp.value+"&email1="+document.frmpromueve.email_alp.value+"&email2="+document.frmpromueve.email_alp2.value+"&idestado="+document.frmpromueve.estado_alp.value+"&idmunicipio="+document.frmpromueve.Municipio_alp.value+"&idcolonia="+document.frmpromueve.colonia_alp.value+"&cp="+document.frmpromueve.CPp.value+"&coment="+document.frmpromueve.comentariosp.value+"&ent="+document.frmpromueve.ent.value+"&otra="+document.frmpromueve.otra.value;
												makeRequest(strlinea, modulo2);
								}else{
										alert("Por favor escriba su mensaje");
								}
							}else{
								alert("Debe Seleccionar una Colonia");
							}
						}else{
							alert("Debe Seleccionar un Municipio");
						}
					}else{
						alert("Debe Seleccionar un Estado");
					}
				}else{
					alert("El mail no puede ir en blanco");
				}
			}else{
				alert("El Telefono no puede ir en blanco");
			}
		}else{
			alert("El lada no puede ir en blanco");
		}
	}else{
		alert("El nombre no puede ir en blanco");
	}
}


function anmun()
{
	makeRequest("/metros/bancomer/anunciate/cargacomboxa.m3?idopcion=1&idestado="+document.frman_reg.an_estado.value, modulo2);
}
function ancol()
{
	makeRequest("/metros/bancomer/anunciate/cargacomboxa.m3?idopcion=2&idestado="+document.frman_reg.an_estado.value+"&idmunicipio="+document.frman_reg.an_municipio.value, modulo2);
}
function ancp()
{
	makeRequest("/metros/bancomer/anunciate/cargacomboxa.m3?idopcion=3&idestado="+document.frman_reg.an_estado.value+"&idmunicipio="+document.frman_reg.an_municipio.value+"&idcolonia="+document.frman_reg.an_colonia.value, modulo2);
}
function ancpp()
{
	makeRequest("/metros/bancomer/promotores/cargacombos.m3?idopcion=3&idestado="+document.frmpromueve.estado_alp.value+"&idmunicipio="+document.frmpromueve.Municipio_alp.value+"&idcolonia="+document.frmpromueve.colonia_alp.value, modulo2);
}


function municipio(){
	makeRequest("/metros/bancomer/alarma/cargacombos.m3?idopcion=1&idestado="+document.frmalarma.estado_al.value, modulo2);
}
function colonia(){
	makeRequest("/metros/bancomer/alarma/cargacombos.m3?idopcion=2&idestado="+document.frmalarma.estado_al.value+"&idmunicipio="+document.frmalarma.Municipio_al.value, modulo2);
}

function municipiop(){
	makeRequest("/metros/bancomer/promotores/cargacombos.m3?idopcion=1&idestado="+document.frmpromueve.estado_alp.value, modulo2);
}
function coloniap(){
	makeRequest("/metros/bancomer/promotores/cargacombos.m3?idopcion=2&idestado="+document.frmpromueve.estado_alp.value+"&idmunicipio="+document.frmpromueve.Municipio_alp.value, modulo2);
}



function valida_encuesta()
{

	var val = "";
	var val1 = "";
	var val2 = "";
	var val3 = "";
	var val4 = "";
	var val5 = "";


	var rad = document.frmsalida.motivo;
	for (i = 0; i < rad.length; i ++)
	{
	     if (rad[i].checked) {
	        val = rad[i].value;
	        //alert(val);
	       }

	}

	var rad1 = document.frmsalida.motivo_1;
	for (i = 0; i < rad1.length; i ++)
	{
	     if (rad1[i].checked) {
		val1 = rad1[i].value;
		//alert(val1);
	       }

	}

	var rad2 = document.frmsalida.calificas;
	for (i = 0; i < rad2.length; i ++)
	{
		     if (rad2[i].checked) {
			val2 = rad2[i].value;
			//alert(val2);
		       }

	}

	var rad3 = document.frmsalida.uso;
	for (i = 0; i < rad3.length; i ++)
	{
		     if (rad3[i].checked) {
	             val3 = rad3[i].value;
	             //alert(val1);
	             }

	}


	var rad4 = document.frmsalida.info_mostrada;
	for (i = 0; i < rad4.length; i ++)
	{
	      if (rad4[i].checked) {
		val4 = rad4[i].value;

	       }

	}

	var rad5 = document.frmsalida.contactado;
		for (i = 0; i < rad5.length; i ++)
		{
		      if (rad5[i].checked) {
			val5 = rad5[i].value;

		       }

	}



	//alert(val);
	//alert(val1);
	//alert(val2);
	//alert(val3);
	//alert(val4);
	//alert(val5);


	strlinea="/metros/bancomer/alarma/encuesta.m3?idalarma="+document.frmsalida.idalarma.value+"&reactivo1="+val+"&reactivo11="+val1+"&reactivo2="+val2+"&reactivo3="+val3+"&reactivo4="+val4+"&reactivo5="+val5+"&comentarios="+document.frmsalida.comentarios.value;
	//alert(strlinea);

	makeRequest(strlinea, modulo2);





}

function push_motivo()
{
	var val = "";
		var rad = document.frmsalida.motivo;
		for (i = 0; i < rad.length; i ++)
		{
		     if (rad[i].checked)
		     {
		        val = rad[i].value;
		       	//alert(val);
		        		if (val != 2)
					{
					var elemento = document.getElementById('motivo1');
					elemento.style.display = "none";
					document.frmsalida.motivo_1.value="";
					//alert(document.frmsalida.motivo_1.value);
					}



		     }
	        }



}

function regresaFloat(valPrecio)
{
	var newCad="";
	for(i=0;i<valPrecio.length;i++)
	{
		var char1=valPrecio.charAt(i);
		if(char1!=',' && char1!='$' && char1!=' ')
		{
			newCad=newCad+char1;
		}
	}
	valPrecio=newCad;
	return parseFloat(valPrecio);
}

function valida_alarma()
{
	if (document.frmalarma.nombre_al.value != "")
	{
		if (document.frmalarma.email_al.value != "")
		{
			if (validateEmail(document.frmalarma.email_al.value))
			{
				if (document.frmalarma.tel_al.value != "")
				{
					if (document.frmalarma.idcanal.selectedIndex>0)
					{
						if (document.frmalarma.idtipoinmueble.selectedIndex>0)
						{
							if (document.frmalarma.estado_al.selectedIndex>0)
							{
								if (document.frmalarma.Municipio_al.selectedIndex>0)
								{
									if (document.frmalarma.colonia_al.selectedIndex>0)
									{
										if ((document.frmalarma.precioinf.value != 0 || document.frmalarma.precioinf.value != null) && (document.frmalarma.preciosup.value != 0 || document.frmalarma.preciosup.value != null))
										{
											var a=regresaFloat(document.frmalarma.precioinf.value);
											var b=regresaFloat(document.frmalarma.preciosup.value);

											if ((a<=b) && (b>=a))
											{
												strlinea="/metros/bancomer/alarma/alarma.m3?lada="+document.frmalarma.lada_al.value+"&idcanal="+document.frmalarma.idcanal[document.frmalarma.idcanal.selectedIndex].value+"&nombre="+document.frmalarma.nombre_al.value+"&mail="+document.frmalarma.email_al.value+"&telefono="+document.frmalarma.tel_al.value+"&idtipoinmueble=" + document.frmalarma.idtipoinmueble[document.frmalarma.idtipoinmueble.selectedIndex].value+"&idestado="+document.frmalarma.estado_al.value+"&idmunicipio="+document.frmalarma.Municipio_al.value+"&idcolonia="+document.frmalarma.colonia_al.value+"&precioinf="+a+"&preciosup="+b+"&rec="+document.frmalarma.rec.value+"&ban="+document.frmalarma.ban.value+"&esta="+document.frmalarma.esta.value+"&id_ins=1";
												makeRequest(strlinea, modulo2);
											}else{
												alert("Debe escribir una cantidad menor en Precio Desde");
												document.frmalarma.precioinf.focus();
											}
										}else{
											//alert("no entro");
											strlinea="/metros/bancomer/alarma/alarma.m3?idcanal="+document.frmalarma.idcanal.value+"&nombre="+document.frmalarma.nombre_al.value+"&mail="+document.frmalarma.email_al.value+"&telefono="+document.frmalarma.tel_al.value+"&idtipoinmueble=" + document.frmalarma.idtipoinmueble[document.frmalarma.idtipoinmueble.selectedIndex].value+"&idestado="+document.frmalarma.estado_al.value+"&idmunicipio="+document.frmalarma.Municipio_al.value+"&idcolonia="+document.frmalarma.colonia_al.value+"&precioinf="+document.frmalarma.precioinf.value+"&preciosup="+document.frmalarma.preciosup.value+"&rec="+document.frmalarma.rec.value+"&ban="+document.frmalarma.ban.value+"&esta="+document.frmalarma.esta.value+"&id_ins=1";
											makeRequest(strlinea, modulo2);
										}
									}else{
										alert("Debe seleccionar una Colonia");
									}
								}else{
									alert("Debe seleccionar un Municipio");
								}
							}else{
								alert("Debe seleccionar un Estado");
							}
						}else{
							alert("Debe seleccionar un tipo de inmueble");
						}
					}else{
						alert("Debe seleccionar un tipo de vivienda");
					}
				}else{
					alert("Debe de proporcionar un télefono");
					document.frmalarma.tel_al.focus();
				}
			}else{
				alert("Debe proporcionar una dirección de correo electrónico válida!...");
				document.frmalarma.email_al.focus();
			}
		}else{
			alert("Debe de proporcionar una dirección de correo");
			document.frmalarma.email_al.focus();
		}
	}else{
		alert("Debe de proporcionar un Nombre");
		document.frmalarma.nombre_al.focus();
	}
}
function modulo2()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			datos=http_request.responseText;
			eval(datos);
		}else{
			alert("no se encontraron datos");
		}
	}else{
	}
}
function redireccionar()
{
	location.href="/metros/bancomer/index.m3";
}
function modulo2_alarma()
{
	if (http_request.readyState==4)
	{
	alarma2.innerHTML=http_request.responseText;
	alarma3.innerHTML="<img src=/metros/bancomer/imagenes/linea_alarma.jpg border=0>";
	}
}

function validateEmail(emailAddress) {
   var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress);
   return match;
}
function closecess()
{
	makeRequest("/metros/bancomer/cerrar.m3", modulo3_b)

}

function solonumeroscarga(e)
{
 var key;

 if(window.event) // IE
 {
  key = e.keyCode;
 }
  else if(e.which) // Netscape/Firefox/Opera
 {
  key = e.which;
 }

 if (key < 48 || key > 57)
    {
      return false;
    }

 return true;
}

var tooltip=function(){

	var id = 'tt';
	var top = 100;
	var left = 3;
	var maxw = 300;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){

			if(tt == null){

				tt = document.createElement('div');
				tt.setAttribute('id',id);


				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}

			tt.style.display = 'block';

			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		border:function(obj){


			var id_ajax=obj.id;

			document.getElementById(id_ajax).border="2 px";
			document.getElementById(id_ajax).borderStyle="solid";
			document.getElementById(id_ajax).style.borderColor="red";


		},
		hide_border:function(obj){

					obj.setAttribute("border", "0px ");


		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();


var theObj="";
var theObj2="";

function toolTip(text,me) {

       theObj=me;
       theObj.onmousemove=updatePos;
       document.getElementById('toolTipBox').innerHTML=text;
       document.getElementById('toolTipBox').style.display="block";
       window.onscroll=updatePos;
}
function updatePos() {
       var ev=arguments[0]?arguments[0]:event;
       var x=ev.clientX;
       var y=ev.clientY;
       diffX=24;
       diffY=0;
       document.getElementById('toolTipBox').style.top  = y-2+diffY+document.body.scrollTop+ "px";
       document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+"px";
       //theObj.onmouseout=hideMe();
}

function hideMe() {
       document.getElementById('toolTipBox').style.display="none";
}

function toolTip2(text,me2) {

       theObj2=me2;
       theObj2.onmousemove=updatePos2;
       document.getElementById('toolTipBox2').innerHTML=text;
       document.getElementById('toolTipBox2').style.display="block";
       window.onscroll=updatePos2;
}
function updatePos2() {
       var ev=arguments[0]?arguments[0]:event;
       var x=ev.clientX;
       var y=ev.clientY;
       diffX=24;
       diffY=0;
       document.getElementById('toolTipBox2').style.top  = y-2+diffY+document.body.scrollTop+ "px";
       document.getElementById('toolTipBox2').style.left = x-2+diffX+document.body.scrollLeft+"px";
       //theObj.onmouseout=hideMe();
}

function hideMe2() {
       document.getElementById('toolTipBox2').style.display="none";
}


function toolTip3(text,me3) {

       theObj3=me3;
       theObj3.onmousemove=updatePos3;
       document.getElementById('toolTipBox3').innerHTML=text;
       document.getElementById('toolTipBox3').style.display="block";
       window.onscroll=updatePos3;
}
function updatePos3() {
       var ev=arguments[0]?arguments[0]:event;
       var x=ev.clientX;
       var y=ev.clientY;
       diffX=24;
       diffY=0;
       document.getElementById('toolTipBox3').style.top  = y-2+diffY+document.body.scrollTop+ "px";
       document.getElementById('toolTipBox3').style.left = x-2+diffX+document.body.scrollLeft+"px";
       //theObj.onmouseout=hideMe();
}

function hideMe3() {
       document.getElementById('toolTipBox3').style.display="none";
}


function letras(texto, contador, limite)
{
	if(texto.value.length>limite)
	{
	texto.value=texto.value.substring(0, limite);
	}else{
	contador.value=limite-texto.value.length;
	}
}
function cambiacolor(a)
{
	//alert(a);
	document.getElementById(a).style.color="#7895C1";
}

function regresacolor(a)
{
	//alert(a);
	document.getElementById(a).style.color="#064F8a";
}
function inseralabsq()
{
	if(document.frmbsqavanala.nombre.value != "")
	{
		if(validateEmail(document.frmbsqavanala.email.value) != "")
		{
			if(document.frmbsqavanala.telefono.value != "")
			{
				a=regresaFloat(document.frmbsqavanala.precioinf.value);
				b=regresaFloat(document.frmbsqavanala.preciosup.value);
				if ((a <= b) && (b >= a) || (a==0) || (b==0))
				{
					//if(document.frmbusca.idmunicipio.value!=0 ||  document.frmbsqavanala.idmunicipio21.value !=0)
					if(document.frmbsqavanala.idmunicipio.value >0)
					{
					strlinea="/metros/bancomer/alarma/alarma.m3?idcanal="+document.frmbsqavanala.idcanal.value+"&nombre="+document.frmbsqavanala.nombre.value+"&mail="+document.frmbsqavanala.email.value+"&telefono="+document.frmbsqavanala.telefono.value+"&idtipoinmueble=" + document.frmbsqavanala.idtipoinmueble.value+"&idestado="+document.frmbsqavanala.idestado.value+"&idmunicipio="+document.frmbsqavanala.idmunicipio.value+"&idcolonia="+document.frmbsqavanala.idcolonia.value+"&precioinf="+a+"&preciosup="+b+"&rec="+document.frmbsqavanala.rec.value+"&ban="+document.frmbsqavanala.ban.value+"&esta="+document.frmbsqavanala.esta.value+"&id_ins=1";		makeRequest(strlinea, modulo2);
					}else{
					alert("Debe de seleccionar un Municipio");
					}
				}
			}else{
				alert("Debe de proporcionar un telefono");
			}
		}else{
			alert("Debe de proporcionar un correo electrónico");
		}
	}else{
		alert("Debe de proporcionar su nombre")
	}
}

function cargatipinm(obj)
{
	if(obj.selectedIndex>0)
	{
		var txtHTML=makeRequestSync("/metros/bancomer/alarma/cargatipoinm.m3?idopcion="+obj.value);
		//document.getElementById('idtipoinmu').innerHTML=txtHTML;
		eval(txtHTML);
	}
}
function validarEmailBancomer(emailAddress)
{
   var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress);
   return match;
}

function registra(idcanal, idsubcanal, idtipo, enviado)
{
	var insertaesta=makeRequestSync("/metros/bancomer/estadisticas/insertaesta.m3?otro=1&idcanal="+idcanal+"&idsubcanal="+idsubcanal+"&idtipoacceso="+idtipo+"&enviado="+enviado);
	datos=http_request.responseText;
}
