/*------------------------------------------------------*
  *-------FUNCIONES JAVASCRIPT    ----*
  *------------------------------------------------------*/


/*1 Pop Up centrada inicio (utilizada por infos legales y páginas planos) */

function popup(page,largeur,hauteur,options)
{
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

/*1 Pop Up centrada FIN  */

/*----------------------------------------------------*/

/*2 Control del enlaces del Menú Lateral*/

/*----------------------------------------------------*/

function showperm(id){


//event.preventDefault(); //elimino el comportamiento por defecto del enlace
// Capturo el ID	
	
/*var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
theId=targ.id
*/
// Capturo el ID


                                   //Get the id of this clicked item
								   

                           
	//var target = jQuery(this).attr('id');

						//	alert(id);

		//var url=('http://www.autoescuelasfama.com/'+theId+'.html');//Uso el id como nombre de la página


		jQuery(document).scrollTop('0');

		 jQuery('#caja_derecha').html('<p><img src="images/indicator.gif"/> Cargando...</p>');   //El texto mientras carga

		
		var urlnew=id+'.html';

		//var urlw=target+'.html';
	
	jQuery(".menu_vertical li a").removeClass();
	      jQuery('#'+id).addClass("menu_actif");

	
/*	
	 jQuery(".menu_vertical li a").click(function () {
		      jQuery(this).addClass("menu_actif");
    });
*/
setTimeout(function() { //Hago esperar al las operaciones siguientes para que se vea el efecto de "Cargando"


 jQuery('#caja_derecha').load(urlnew);	


 if(id=="twit_json"){
   jQuery("html, body").scrollTop(0);
	jQuery('.menu_vertical li a', this).removeAttr('onclick');
 }
	
		
         return false;
	},500)//establezco el tiempo del "timeout"
	
}



/*----------------------------------------------------*/

/*2 Control del enlaces de la aplicación de la DGT*/

/*----------------------------------------------------*/

function showtest(tipoCuest){

        var winStr="fullscreen=1,directories=0,resizable=0,location=0,status=0,scrollbars=yes,toolbar=0,menubar=0"




	//	 jQuery('#caja_derecha').html('<p><img src="images/indicator.gif"/> Conectando con la DGT...</p>');   //El texto mientras carga
	
	 jQuery('.dgt').click(function () {
       jQuery(this).append('<p><img src="images/indicator.gif"/> Conectando con la DGT...</p>');   //El texto mientras carga
    });
	
	
		

		 

 		tipoCuest = tipoCuest.replace("+","%2B") ;

		var urltest=('http://aplch.dgt.es/aeDGTWeb/examen/login.jsp?tipoCuest='+tipoCuest,'login',winStr);  

	

setTimeout(function() { //Hago esperar al las operaciones siguientes para que se vea el efecto de "Cargando"

 		jQuery('#caja_derecha').load('test_online.html');
 
		window.open('http://aplch.dgt.es/aeDGTWeb/examen/login.jsp?tipoCuest='+tipoCuest,'login',winStr);  
		
		jQuery(document).scrollTop('0');

		
         return false;
	},1000)//establezco el tiempo del "timeout"
	
}
		
		
		
/*2 Control del Menú Lateral FIN*/

/*----------------------------------------------------*/
 
 <!-- Sricipt DGT-->
 
	function validarForm(){
		document.form_calificaciones.CEC_DNI.value = document.form_calificaciones.CEC_DNI.value.toUpperCase();		
		if(!validarDNI(document.form_calificaciones.CEC_DNI))
			return false;
		if(!validarFECHAEXAMEN())
			return false;
		if(!validarSelClasePermiso())
			return false;
		if(!validarFECHANAC())
			return false;
			
		document.form_calificaciones.submit();
	}

	function validarDNI(object){
		if(!validarNIF(object.value)){
			alert('El DNI/NIF no es correcto');	
			return false;		
		}
		return true;
		

	}
	function validarFECHAEXAMEN(){
		var formato = 'dd/MM/yyyy';
		fecha = document.form_calificaciones.CEC_FECHA_EXAM.value;
		if(comprobarFecha(fecha,formato)!=''){
			alert('La fecha de examen no es correcta');
			return false;	
		}		
		return true;		
	}
	function validarFECHANAC(){
		var formato = 'dd/MM/yyyy';
		fecha = document.form_calificaciones.CEC_FECHA_NAC.value;
		if(comprobarFecha(fecha,formato)!=''){
			alert('La fecha de nacimiento no es correcta');
			return false;	
		}		
		return true;		
	}
	function validarSelClasePermiso(){

		var clasePerm = document.form_calificaciones.CEC_CLASE_PERMISO.value;
		if(clasePerm=='*'){
			alert('Debe seleccionar una clase de permiso');
			return false;	
		}		
		return true;		
	}

  	function cleanMask(){
    	if (document.forms[0].CEC_FECHA_EXAM.value=="dd/mm/aaaa"){
      	document.forms[0].CEC_FECHA_EXAM.value="";
    	}

  	}
 
 
<!-- Script DGT FIN-->


/*----------------------------------------------------*/
 


/*----------------------------------------------------*/




