function load() {
	if (GBrowserIsCompatible()) {
		//Sede Sevilla
        var map = new GMap2(document.getElementById("map"));

		map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(37.392400,-5.998867), 17);

		//marca puntual
		var bounds = map.getBounds();
		var southWest = bounds.getSouthWest();
		var northEast = bounds.getNorthEast();
		var lngSpan = northEast.lng() - southWest.lng();
		var latSpan = northEast.lat() - southWest.lat();
		var point = new GLatLng(southWest.lat() + latSpan/2  + 0.0005, southWest.lng() + lngSpan/2 );

		map.addOverlay(new GMarker(point));

		document.getElementById("map").style.display="none";
		
		//Sede Córdoba
		var map2 = new GMap2(document.getElementById("map2"));

		map2.addControl(new GSmallMapControl());
        map2.setCenter(new GLatLng(37.881382,-4.789249), 16);

		//marca puntual
		var bounds2 = map2.getBounds();
		var southWest2 = bounds2.getSouthWest();
		var northEast2 = bounds2.getNorthEast();
		var lngSpan2 = northEast2.lng() - southWest2.lng();
		var latSpan2 = northEast2.lat() - southWest2.lat();
		var point2 = new GLatLng(southWest2.lat() + latSpan2/2  + 0.0005, southWest2.lng() + lngSpan2/2 );

		map2.addOverlay(new GMarker(point2));
     
		document.getElementById("map2").style.display="none";
    }
}




/* funcion favoritos*/
function bookmarksite(title, url)
	{
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "");
}

function valida_login_portada(){
	if(document.getElementById("usuario").value.length<5){
		alert("Introduzca su nombre de usuario");
		document.getElementById("usuario").focus();
		return false;
	}

	if(document.getElementById("contrasena").value.length<5){
		alert("Introduzca su contraseña");
		document.getElementById("contrasena").focus();
		return false;
	}
}

function valida_recomendar_web(){
	if(document.getElementById("su_nombre").value.length<3){
		alert("Introduzca su nombre");
		document.getElementById("su_nombre").focus();
		return false;
	}

	if(document.getElementById("su_email").value.length<5){
		alert("Introduzca su email");
		document.getElementById("su_email").focus();
		return false;
	}else{
		var resu=emailCheck (document.getElementById("su_email").value);
		if(resu ==false){
			 document.getElementById("su_email").focus();
			 return resu;
		}
	
	}
	if(document.getElementById("nombre_amigo").value.length<3){
		alert("Introduzca el nombre de su amigo");
		document.getElementById("nombre_amigo").focus();
		return false;
	}

	if(document.getElementById("email_amigo").value.length<5){
		alert("Introduzca el email de su amigo");
		document.getElementById("email_amigo").focus();
		return false;
	}else{
		var resu=emailCheck (document.getElementById("email_amigo").value);
		if(resu ==false){
			 document.getElementById("email_amigo").focus();
			 return resu;
		}
	
	}

	if((document.getElementById("mensaje").value.length<3)||(document.getElementById("mensaje").value=="Introduzca su mensaje")){
		alert("Introduzca el mensaje");
		document.getElementById("mensaje").focus();
		return false;
	}

	

	if(document.getElementById("pass").value.length<5){
		alert("Introduzca los números de la imagen");
		document.getElementById("pass").focus();
		return false;
	}

	
}

function emailCheck (emailStr) 
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		alert("Email incorrecto")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) {
		alert("Email incorrecto")
		return false
	}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Email incorrecto")
			return false
			}
		}
		return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert("Email incorrecto")
		return false;
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) {
		 alert("Email incorrecto")
	   return false
	}

	if (len<2) {
	   var errStr="Email incorrecto"
	   alert(errStr)
	   return false
	}
}

function validar(){
	if(document.getElementById("nombre").value.length<3){
		alert("Introduzca su nombre");
		document.getElementById("nombre").focus();
		return false;
	}
	/*
	if(document.getElementById("apellidos").value.length<3){
		alert("Introduzca sus apellidos");
		document.getElementById("apellidos").focus();
		return false;
	}
	*/
	if((document.getElementById("telefono").value.length>1)&&(document.getElementById("telefono").value.length>9)){
		alert("Su teléfono no es correcto");
		document.getElementById("telefono").focus();
		return false;
	}
	if(document.getElementById("email").value.length<1){
		alert("Introduzca su email");
		document.getElementById("email").focus();
		return false;
	}else{
		var resu=emailCheck (document.getElementById("email").value);
		if(resu ==false){
			 document.getElementById("email").focus();
			 return resu;
		}
	
	}

	if(document.getElementById("asunto").value=='no'){
		alert("Seleccione el asunto");
		document.getElementById("asunto").focus();
		return false;
	}


	if((document.getElementById("mensaje").value.length<3)||(document.getElementById("mensaje").value=="Introduzca su mensaje")){
		alert("Introduzca el mensaje");
		document.getElementById("mensaje").focus();
		return false;
	}
	
	if(document.getElementById("pass").value.length<5){
		alert("Introduzca los números de la imagen");
		document.getElementById("pass").focus();
		return false;
	}
	
	return true;
}



function validar_pagos(){
	
	if(document.getElementById("nombre").value.length<3){
		alert("Introduzca su nombre");
		document.getElementById("nombre").focus();
		return false;
	}

	if((document.getElementById("telefono").value.length>1)&&(document.getElementById("telefono").value.length>9)){
		alert("Su teléfono no es correcto");
		document.getElementById("telefono").focus();
		return false;
	}
	if(document.getElementById("email").value.length<1){
		alert("Introduzca su email");
		document.getElementById("email").focus();
		return false;
	}else{
		var resu=emailCheck (document.getElementById("email").value);
		if(resu ==false){
			 document.getElementById("email").focus();
			 return resu;
		}
	
	}
	
	if(document.getElementById("abono").value.length<1){
		alert("Introduzca la cantidad a abonar");
		document.getElementById("abono").focus();
		return false;
	}else if((document.getElementById("abono").value*1)!=document.getElementById("abono").value){
		alert("La cantidad a abonar debe ser un valor numérico. Utilice el punto como separador de comas");
		document.getElementById("abono").focus();
		return false;
	}else if(document.getElementById("abono").value<0){
		alert("La cantidad a abonar debe ser un valor numérico mayor que cero. Utilice el punto como separador de comas");
		document.getElementById("abono").focus();
		return false;
	}


	/*
	if(document.getElementById("asunto").value=='no'){
		alert("Seleccione el asunto");
		document.getElementById("asunto").focus();
		return false;
	}
	*/
	/*
	if((document.getElementById("mensaje").value.length<3)||(document.getElementById("mensaje").value=="Introduzca su mensaje")){
		alert("Introduzca el mensaje");
		document.getElementById("mensaje").focus();
		return false;
	}
	*/
	
	if(document.getElementById("pass").value.length<5){
		alert("Introduzca los números de la imagen");
		document.getElementById("pass").focus();
		return false;
	}
	
	return true;
}


function selec_asunto(capa,tipo,valor,sele){
	if(sele*1==sele){
		sele=sele;
	}else{
		sele="";
	}

	var div_carga=capa;
	if((tipo!="")&&(tipo!="no")&&(tipo!="inf_general")&&(tipo!="inf_dep_contabilidad")&&(tipo!="inf_cursos_fc")&&(tipo!="otro")){
		var xmlHttp=null;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}


		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				document.getElementById(div_carga).innerHTML=xmlHttp.responseText;
			}
		}
		var url="principales/ajax/selec_cursos.php" ;
		url=url+"?tipo_curso=" + tipo + "&valor="+valor + "&sele="+sele;
		url=url+"&sid="+Math.random();
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null); 	
	
	
	}else{
		document.getElementById(div_carga).innerHTML="";
	}		


}





