function enviar_contacto(){
    if (document.getElementById('contacto').raz_soc.value == "") {
	    alert("Por favor ingrese su nombre.");
	    document.getElementById('contacto').raz_soc.focus();
	    return;
    }
    if (document.getElementById('contacto').mail.value == "" && document.getElementById('contacto').tel.value==""){
	    alert("Debe ingresar un tel�fono o email de contacto.");
	    document.getElementById('contacto').mail.focus();
	    return;
    }else{
	    if(!(document.getElementById('contacto').mail.value=="")){
		    if (!((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('contacto').mail.value)))){
			    alert("Ha ingresado una direcci�n de correo electr�nico no v�lida.");
			    document.getElementById('contacto').mail.focus();
			    return;
		    }
	    }
    }

    document.getElementById('contacto').submit();
}

function enviar(form){
	document.getElementById(form).submit();
}

function enviar_buscar(){
	document.getElementById('buscar').submit()
}


function enviar_buscar2(){
	document.getElementById('buscar2').submit()
}

function enviar_buscar3(){
	document.getElementById('buscar3').submit()
}

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function checkEnter(event,form)	{ 	
    var code = 0;
    if (isNS4)
	    code = event.which;
    else
	    code = event.keyCode;
    if (code==13)
	    form.submit();
	//eval('document.'+form).submit();
}

function abrir(prp_id,usr,usuario){
	window.open("includes/imprimir_ficha.php?usr_id="+usr+"&prp_id="+prp_id+"&usuario="+usuario,"vent","toolsbar=0,width=600,height=600,scrollbars=1");
}
function ampliar_foto(dir,foto){
	window.open(dir+foto,"Foto_Ampliada","toolsbar=0,width=700,height=500,scrollbars=0");
}
function ampliar_foto_ppal(usr_id,prp_id){	
	var nro=eval('document.formulario.nro_foto').value;
	var cadena="http://www.inmoclick.com.ar/ftp_inmohost/fotos/"+prp_id+"-"+usr_id+"-"+nro+".gif";
	window.open("inc/ampliar.php?foto="+cadena+"","Foto_Ampliada","top=0,left=0,toolsbar=0,width=700,height=510,scrollbars=1");
}
function abrir_ventana(url){
	window.open(url,"vent","toolsbar=0,width=600,height=600,scrollbars=1");
}


function enviar_amigo(){
		if (document.getElementById('enviar_amigo').rNombre.value == "") {
			alert("Por favor ingrese su nombre.");
			document.getElementById('enviar_amigo').rNombre.focus();
			return;
		}
		if (document.getElementById('enviar_amigo').rMail.value == "") {
			alert("Por favor ingrese su e-mail.");
			document.getElementById('enviar_amigo').rMail.focus();
			return;
		}else{
			if(!(document.getElementById('enviar_amigo').rMail.value=="")){
				if (!((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('enviar_amigo').rMail.value)))){
					alert("Ha ingresado una direccion de correo electronico no valida.");
					document.getElementById('enviar_amigo').rMail.focus();
					return;
				}
			}
		}
		if (document.getElementById('enviar_amigo').aNombre.value == "") {
			alert("Por favor ingrese nombre de destinatario.");
			document.getElementById('enviar_amigo').aNombre.focus();
			return;
		}
		if (document.getElementById('enviar_amigo').aMail.value == "") {
			alert("Por favor ingrese e-mail de destinatario.");
			document.getElementById('enviar_amigo').aMail.focus();
			return;
		}else{
			if(!(document.getElementById('enviar_amigo').aMail.value=="")){
				if (!((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('enviar_amigo').aMail.value)))){
					alert("Ha ingresado una direccion de correo electronico no valida.");
					document.getElementById('enviar_amigo').aMail.focus();
					return;
				}
			}
		}
		if (document.getElementById('enviar_amigo').aMensaje.value == "") {
			alert("Por favor ingrese un mensaje.");
			document.getElementById('enviar_amigo').aMensaje.focus();
			return;
		}
		document.getElementById('enviar_amigo').submit();
}

function ir_adelante(form,base){
	document.getElementById('base').value=base;
	document.getElementById(form).submit();	
}

function iniciarMapa(lat,lng){
	
	if (GBrowserIsCompatible()) {
		//mapa
		map = new GMap2(document.getElementById("ubicacionInmueble"));
		map.setCenter(new GLatLng(lat,lng), 17);
		map.disableDoubleClickZoom();
        map.addControl(new GMapTypeControl());
		map.addControl(new GSmallMapControl());
		
		
		point=new GLatLng(lat,lng);
		marker=new GMarker(point);
		map.clearOverlays(); 
		map.addOverlay(marker);
	
		
	}		
}

function matriculados(accion){
    if(accion === 'filtro'){
	$('matriculados').action = 'matriculados.php';
	$('matriculados').method = 'GET';
	$('abm').remove();
    }
}
