function initialize(capa, al,la) {	
	        var map = new GMap2(document.getElementById(capa));        
	        map.setCenter(new GLatLng(al, la), 16);           
	        var point = new GLatLng(al, la);           
	        map.addOverlay(new GMarker(point));
	        map.setMapType(G_HYBRID_MAP);        
	        var mapControl = new GSmallMapControl();
	        map.addControl(mapControl);
	    }


function isNoCampoVacio (theElement){
	if (theElement.value == ''){
        document.getElementById('error_form').innerHTML="Por favor, rellene todos los campos obligatorios";
        theElement.focus();
        return false;        
    }
	else{
		return true;
	}
		
}

function isEmailAddress(theElement){
    var email = theElement.value;
    var filter=/^[A-Za-z][.A-Za-z0-9_]*@[A-Za-z0-9_]+.[A-Za-z0-9_.]+[A-za-z]$/;
    if (filter.test(email))
        return true;
    document.getElementById('error_form').innerHTML="Proporcione una dirección de eMail válida";
    theElement.focus();
    return false;
}

function isPhoneNumber(theElement){
    var filter = /[0-9]{3}[-]?[0-9]{3}[-]?[0-9]{3}/;
    if (!filter.test(theElement.value)){
   	 document.getElementById('error_form').innerHTML="Proporcione un teléfono válido";
   	 theElement.focus();
     return false;
    }
    return true;
}

function isAcepted(theElement){
    if (!theElement.checked){
   	 document.getElementById('error_form').innerHTML="Acepte la política de protección de datos";
   	 theElement.focus();
        return false;
    }
    return true;
}


function pideCita(f){
	frm=document.getElementById(f);
	if (isAcepted(frm.acepto)){
		if (isEmailAddress(frm.mail)){
			if (isPhoneNumber(frm.telefono)){
				if (isNoCampoVacio(frm.nombre) && isNoCampoVacio(frm.marca) && isNoCampoVacio(frm.modelo)){
					xajax_mailPideCita(xajax.getFormValues(frm));
				}
			}
		}
	}
	return false;
}


function contacto(f){
	frm=document.getElementById(f);
	if (isAcepted(frm.acepto)){
		if (isEmailAddress(frm.mail)){
			if (isNoCampoVacio(frm.nombre)){				
					xajax_mailContactoCentro(xajax.getFormValues(frm));
			}
		}
	}
	return false;
}


function megane_madrid(){
	document.location.href = '/rn_promociones.php?promo=madrid';
}

function meganecabrio_barcelona(){
	document.location.href = '/rn_resultados_vo.php?precioVal=16200&precioMax=45000&precioMin=7700&cuota=200&entrada=200&precio_hasta=44200&marca=RENAULT&ano_desde=-1&ano_hasta=-1&puertas=-1&modelo=MEGANE&km_desde=-1&km_hasta=-1&combustible=-1&provincia=Barcelona&centro=-1&priceAmountField=16200&finaAmountField=2000&monthAmountField=200&carroceria=4';
}

function dist_c_neucupon(){
	window.open("../../rn_cupon.php?tc=24&centro=2004",'Renault','toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=650,height=530');
}

