//////  CONFIRMACION ANTES DE BORRAR	
	function confirma_delete(msg){   
		var respuesta_delete=confirm(msg);
		if (respuesta_delete==true){        
			return true;  
			            
		}
		else{      
			return false;        
		}
	}





	
/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var offsetxpoint; //Customize x offset of tooltip
var offsetypoint; //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all['dhtmltooltip'] : document.getElementById? document.getElementById('dhtmltooltip') : ''

function ietruebody(){
	return (document.compatMode && document.compatMode!='BackCompat')? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
	if (ns6||ie){
		if (typeof thewidth!='undefined') 
			tipobj.style.width=thewidth+'px'
		if (typeof thecolor!='undefined' && thecolor!='') 
			tipobj.style.backgroundColor=thecolor
		tipobj.innerHTML=thetext
		enabletip=true
		return false
	}
}

function positiontip(e){
	if (enabletip){
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
		//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+'px' : window.pageXOffset+e.clientX-tipobj.offsetWidth+'px'
		else if (curX<leftedge)
				tipobj.style.left='5px'
			 else
			 //position the horizontal position of the menu where the mouse is positioned
		tipobj.style.left=curX+offsetxpoint+'px'
		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight)
			tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+'px' : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+'px'
		else
			tipobj.style.top=curY+offsetypoint+'px'
		tipobj.style.visibility='visible'
	}
}

function hideddrivetip(){
	if (ns6||ie){
		enabletip=false
		tipobj.style.visibility='hidden'
		tipobj.style.left='-1000px'
		tipobj.style.backgroundColor=''
		tipobj.style.width=''
	}
}

document.onmousemove=positiontip;










///////pasa la primera letra de cada palabra de la frase a mayuscula (SIN CICLO)
		function changeCase(frmObj){
		
		var index;
		var tmpStr;
		var tmpChar;
		var preString;
		var postString;
		var strlen;
		tmpStr = frmObj.value.toLowerCase();
		strLen = tmpStr.length;
		if (strLen > 0){
			for (index = 0; index < strLen; index++){
				if (index == 0){
					tmpChar = tmpStr.substring(0,1).toUpperCase();
					postString = tmpStr.substring(1,strLen);
					tmpStr = tmpChar + postString;
				}
				else{
					tmpChar = tmpStr.substring(index, index+1);
					if (tmpChar == " " && index < (strLen-1)){
						tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
						preString = tmpStr.substring(0, index+1);
						postString = tmpStr.substring(index+2,strLen);
						tmpStr = preString + tmpChar + postString;
					}
				}
			}
		}
		frmObj.value = tmpStr;
	}

////////////ABRIR UNA VENTAN HIJA
// EJEMPLO LLAMADO ---> onclick="javascript:ventanaSecundaria('ing_img.php?codigo=55); return false;"
/*var ventana = null; 
function ventanaSecundaria (URL){ 
	ventana=window.open(URL,"ventana1","width="",height="",scrollbars=no,status=yes") 
	window.resizeTo(screen.availWidth/2, screen.availHeight); 
	window.moveTo(0,0); 
} 

function cerrar_hijo () { 
	if (ventana != null && !ventana.isclosed) { 
		ventana.close(); 
		ventana = null; 
	} 
}

*/

//////////////////SUBMIT CON ENTER
function iSubmitEnter(oEvento, oFormulario){ 
	var iAscii; 
	if (oEvento.keyCode) 
		iAscii = oEvento.keyCode; 
	else if 
		(oEvento.which) 
	iAscii = oEvento.which; 
	
     else 
         return false; 

     if (iAscii == 13) document.getElementById(oFormulario).submit(); 

     return true; 
} 


//////////////CAMBIA EL VALUE DE UN INPUT
function change_msg(aidi,msg1,msg2){
	if(document.getElementById(aidi).value==msg1){
		document.getElementById(aidi).value=msg2;
	}
	else{
		document.getElementById(aidi).value=msg1;	
	}
}

//////////////////hace un location
function location_url(url){
	window.location.href = url;

	
}


//////////////////////////  ONMOUSE PARA UN TR
/////       <tr onMouseOver=encima(this) onMouseOut=fuera(this,'ffffff')
 function encima(obj)
 {
  obj.style.cursor='hand';
  obj.style.backgroundColor='#C1C1C1';
 }
 function fuera(obj,cual)
 {
  obj.style.backgroundColor=cual;
 }



///////////////////////////////////////DOS FUNCIONES DE AJAX QUE MANEJAN LAS BARBARIDADES
function NuevoAjax(){
        var xmlhttp=false;
        try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
                try{
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(E){
                        xmlhttp = false;
                }
        }

        if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}
function Cargar(url,divicito){
        var juanes, preloader;
        juanes = document.getElementById(divicito);
        
        //creamos el objeto XMLHttpRequest
        ajax=NuevoAjax(); 
        //peticionamos los datos, le damos la url enviada desde el link
        ajax.open("ZZ", url,true); 
        ajax.onreadystatechange=function(){
                if(ajax.readyState==1){
                       
                }else if(ajax.readyState==4){
                        if(ajax.status==200){
                                //mostramos los datos dentro de la div
                                juanes.innerHTML = ajax.responseText; 
                           
                        }else if(ajax.status==404){
                               
                        }else{
                                //mostramos el posible error
                               
                        }
                }
        }
        ajax.send(null);
}

//////////////////convierte de texto plano a texto con etiquetas de espaciados de enter
	// EJEMPLO LLAMADO ---> ConvertBR(this.form.descripcion.value)
	
	function ConvertBR(input) 
	{
		// Converts carriage returns 
		// to <BR> for display in HTML
		var output = "";
		for (var i = 0; i < input.length; i++) 
		{
			if ((input.charCodeAt(i) == 13) && (input.charCodeAt(i + 1) == 10)) 
			{
				i++;
				output += "<BR>";
			}
			else 
			{
				output += input.charAt(i);
			}
		}
		return output;
	}



////////////QUE LAS DOS CONTRASEÑAS SEAN IGUALES
// EJEMPLO LLAMADO ---> onchange="validar_pass_same('pw1','pw2','Deben ser iguales las contraseñas.','btnEnviar')"
function validar_pass_same(campo1,campo2,msg,boton) {
	if (document.getElementById(campo1).value == document.getElementById(campo2).value&&document.getElementById(campo1).value!=''&&document.getElementById(campo2).value!=''){
		document.getElementById(boton).disabled = false;
	}
	else
		document.getElementById(boton).disabled = true;
	
}



//validacion no importa el numero de campos (VACIOS)
	function Validar_sin_i(form,msg){
		var i=0;
		while(i<document.getElementById(form).length){
			if (document.getElementById(form)[i].value==""){
				alert(msg); 
				document.getElementById(form)[i].focus();
				return; 
			}
			i++;
		}
		document.getElementById(form).submit();
	}
	
	

 




////////////QUITA espacios del pRINCIPIO DE LA FRASE de todos los elementos del formulario, sin importar cuantos hayan
// EJEMPLO LLAMADO ---> onclick="validar('formu')"
function quitar_ascii32_ppio(form){
	i=0;
	while(i<document.getElementById(form).length){
		while(document.getElementById(form)[i].value.charAt(0)==' ')
			document.getElementById(form)[i].value=document.getElementById(form)[i].value.substring(1,document.getElementById(form)[i].value.length);
		i++;
	}
}




/////////////////////////////ESPECIFICA PARA EL FESTIVAL
//// VALIDA CAMPOS VACIOS, especial, recibe cuales campos del form revisar y cuales no, y pregunta si es tipo hidden para no hacer el focus
/////   ejemplo de llamado       onclick="validar_esp('ing_artista',0,1,2,4,'Ha dejado campos vacios, hay unos que son obligatorios.')"     los que entran como parametros, excepto el primero y el ultimo, son los que no se pueden dejar vacios.
/////   1ro= id del form.   2do= desde el segundo argumento hasta el ultimo menos 1, .   Ultimo= msg.
	function validar_esp(){
		parametros=validar_esp.arguments;
		long_form=document.getElementById(parametros[0]).length;
		var i=0;
		while(i<long_form){
			if (document.getElementById(parametros[0])[i].value==""){
				j=1;
				while(j<parametros.length-1){
					cont=0;	
					if(parametros[j]!=i){
						
					}
					else{
						cont++;
						j=parametros.length;
					}
					j++;
				}
				if(cont){
					alert(parametros[parametros.length-1]); 
					if(!(document.getElementById(parametros[0])[i].type=='hidden'||document.getElementById(parametros[0])[i].style.display=='none'))
						document.getElementById(parametros[0])[i].focus();
					return; 
				}
			}
			i++;
		}
		document.getElementById(parametros[0]).submit();
	}
	

		/*	
		
		cadena = "uno dos tres cuatro dos";
trozos = cadena.split (" "); // el separador es el espacio
document.write (trozos[0]); // trozos[0] = 'uno'
	
	
	
	function Validar_sin_i(form,msg){
		var i=0;
		while(i<document.getElementById(form).length){
			if (document.getElementById(form)[i].value==""){
				alert(msg); 
				document.getElementById(form)[i].focus();
				return; 
			}
			i++;
		}
		document.getElementById(form).submit();
	}*/




////////////QUITA br DEL PRINCIPIO DE LA FRASE
// EJEMPLO LLAMADO ---> onClick="document.getElementById('dos').value = quitar_br(document.getElementById('dos').value);"
function quitar_br(input) {
var output = "";
for (var i = 0; i < document.getElementById(input).value.length; i++) {
if ((document.getElementById(input).value.charCodeAt(i) == 13) && (document.getElementById(input).value.charCodeAt(i + 1) == 10)) {
i++;
output += "";
} else {
output += document.getElementById(input).value.charAt(i);
   }
}
return output;
}


////////////QUITA ESPACIOS DEL PRINCIPIO DE LA FRASE
// EJEMPLO LLAMADO ---> onBlur="this.value=ignoreSpaces(this.value);"
function quita_esp_ppio(texto){
	while(document.getElementById(texto).value.charAt(0)==' ')
	document.getElementById(texto).value=document.getElementById(texto).value.substring(1,document.getElementById(texto).value.length);
}




//////PONE EN MAYUSCULAS TODO
//////    onChange="javascript:this.value=this.value.toUpperCase()"


///////////////////
////de acuerdo a necesidad de DON JAVIER////VALIDAR CONTINUAR SI ES PERMITE EL FORMATO A SUBIR
function continuar_subir_img(formu,ruta,descrp,autorizacion,msg_format_inval,msg_ruta_vacia){
		if (autorizacion.value == ""&&ruta.value!=''){
			alert(msg_format_inval);
			return; 
		}
		if (ruta.value == ""){
			alert(msg_ruta_vacia);
			return; 
		}
		if (descrp.value == ""){
			alert('Debe ingresarle una descripcion a la imagen que quire subir.');
			descrp.focus();
			return; 
		}
		formu.submit();
	}



// EJEMPLO LLAMADO ---> solo_imagenes(document.getElementById('cadena').value,document.getElementById('formu'))
/*
parametros
1ro --> trae la ruta
2do --> trae el id del formulario
3ro --> permiso para submit
*/
/////////FUNCION, FILTRA, SOLO IMAGENES BOTON BROWSER
function solo_imagenes(string,form,aut_sub,bandera){
		cadena = new String (string);
		extension = cadena.substr (cadena.length-3, 3); // subcadena = 'dos'
		if(extension=='jpg'||extension=='bmp'||extension=='JPG'||extension=='BMP'||extension=='png'||extension=='PNG'||extension=='gif'||extension=='GIF'){
			bandera.value='si';
			document.imagen.src='file:///' + string;
			if(aut_sub)
				document.getElementById(form).submit();
		}
		else{
			alert('Archivos con extension \'.'+extension+'\' no se puede subir a la Base de Datos.  Solo archivos de imagenes.');
			document.getElementById('img').src='imgs\\vpimg.bmp';
			bandera.value='';
		}
	}
	
	
	

// EJEMPLO LLAMADO ---> solo_imagenes(document.getElementById('cadena').value,document.getElementById('formu'))
/*
parametros
1ro --> trae la ruta
2do --> trae el id del formulario
3ro --> permiso para submit
*/
/////////FUNCION, FILTRA, SOLO IMAGENES BOTON BROWSER
function solo_imagenes_jpg(string,form,aut_sub,bandera){
		cadena = new String (document.getElementById(string).value);
		extension = cadena.substr (cadena.length-3, 3); // subcadena = 'dos'
		if(extension=='jpg'||extension=='JPG'){
			bandera.value='si';
			document.getElementById('img').src=document.getElementById(string).value;
			if(aut_sub)
				document.getElementById(form).submit();
		}
		else{
			alert('Archivos con extension \'.'+extension+'\' no se puede subir a la Base de Datos.  Solo archivos de imagenes jpg.  Leer Tabla de ayuda.  Ref 002.');
			document.getElementById('img').src='imgs\\vpimg.bmp';
			document.getElementById('msg_error_no_jpg').style.display='block';
			bandera.value='';
		}
	}




/////////////////////////SUBMIT A UN FORMULARIO CON UN BOTON
function form_submit(form){
	document.getElementById(form).submit();	
}

function form_submit_prev(form,cual){
	if(document.getElementById(cual).value!=''){
		
		document.getElementById(form).submit();	
	}
	else
		alert('Debe seleccionar un logo. (Archivo de imagen)');
}


////////////////////////////TOOL TIPS
	var offsetx = 15;
var offsety = 10;
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);

function newelement(newid){ 
	if(document.createElement){
		var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style){ 
			display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 

function getmouseposition(e){
	if(document.getElementById){
		var iebody=(document.compatMode && document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;
	    var fstooltip = document.getElementById('tooltip');
		if ((mousex+offsetx+fstooltip.clientWidth+5) > document.body.clientWidth) {
				fstooltip.style.left = ((document.body.scrollLeft+document.body.clientWidth) - (fstooltip.clientWidth*2));
		}
		else {
			fstooltip.style.left = (mousex+pagex+offsetx); 
		}
		if ((mousey+offsety+fstooltip.clientHeight+5) > document.body.clientHeight) {
			fstooltip.style.top = ((document.body.scrollTop+document.body.clientHeight) - (fstooltip.clientHeight*2));
		}
		else {
			fstooltip.style.top = (mousey+pagey+offsety); 
		}
	}
}

function tooltip(tiptitle,tipbold,tipnormal){
	if(!document.getElementById('tooltip'))
		newelement('tooltip');
    var fstooltip = document.getElementById('tooltip');
    fstooltip.innerHTML = '<table class="fstooltips" cellpadding="2" cellspacing="0"><tr><td class="tipheader">' + tiptitle + '</td></tr><tr><td class="tipcontent"><b>' + tipbold + '</b><br>' + tipnormal + '</td></tr></table>';
    fstooltip.style.display = 'block';
    fstooltip.style.position = 'absolute';
    fstooltip.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70) progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color=gray, Positive=true)';
    document.onmousemove = getmouseposition;
}

function exit(){
	document.getElementById('tooltip').style.display = 'none';
}
//////////////////////////////TERMINA SCRIPT DE LOS TOOLTIPS



///////////////////
////de acuerdo a necesidad de clips////PODER EJECUTAR UN ARBOL
	function si_vacio_else_no_apto(){
		if(document.getElementById('recibe_ejec').value==''){
			valida_un_campo_vacio(document.getElementById('mod'),document.getElementById('recibe_ejec'),'Debe seleccionar un nodo para poder ejecutarlo.   (ERROR: 005)',0,1);
			return;
		}
		else{
			if(document.getElementById('recibe_ejec').value=='no_puede'){
				alert('Este arbol no se puede ejecutar.');
				return; 
			}
			
		}
		document.getElementById('mod').submit();
	}
	
	
////de acuerdo a necesidad de clips////PARA PODER BORRAR UN NODO	
	
	
	



//////////////////////////PREGUNTA CONFIRMACION, con ayuda de un campo, para que no salgan dos alertas en un solo onclick
	function pregunta_confirm(campo_ayuda,msg,form){
		if(campo_ayuda.value==''){
		}
		else{
			var answer = confirm(msg)
			if (answer)
				form.submit();
			else
				return false;
		}
	}
	
	

//////////////////MUESTRA O ESCONDE SEGUN EL CASO
	function ShowHide(id) {
    	if(document.getElementById(id).style["display"] != "none"){
       		document.getElementById(id).style["display"] = "none";
		}
		else {
			document.getElementById(id).style["display"] = "block";
		}
	}



/*ABAJO******************************************************************************************************/
/////// empiezan scripts para trabajar en show.php, que es donde se le colocan los formatos y la imagen a las caratulas a imprimir
	
	///////En el onload, da el tamaño, por si no se mueven las flechas de tamaño de letra, para que se valla con esos parametros de tamaño a "para impresion.php"
	function tamanizar(cual_tamano,tam){
		if(document.getElementById('tipo').value=='frontal')
			document.getElementById(cual_tamano).value=tam+9;	
		else
		document.getElementById(cual_tamano).value=tam;
	}

	//////Al seleccionar una de las herramientas de formato, se le quita el chulo a los otros checkbox de las otras herramientas
	function switchAll(entrante) {
		for (var j = 0; j <document.myform.lista.length; j++) {
			document.myform.lista[j].checked = false;
		}
		entrante.checked=true;
	}
		
	/////PARA EMPEZAR A CONTROLAR EL TAMAÑO DE LAS LETRAS, CADA QUE SE HACE EL SWITCHEO DE TITULO A PIE DE PAGINA
	function reset_cont(cual){
		document.getElementById('valor').value=document.getElementById(cual).style.fontSize;
		
	}
	
	/////PONE EN UN TEXTBOX SI SE ESTA TRABAJANDO CON PIE O CON TITULO
	function cual_letra(cual){
		document.getElementById('cual_letra2').value=cual;
		}
	
	
	/////MIRA SI ESTA ACTIVADA LA OPCION DE B_N, PARA PODER O NO PONER EL NUEVO COLOR, Y PONE EL HEXADECIMAL EN UNOS CAJONES DESTINADOS A CONTENER LOS COLORES QUE VIAJAN A LA SGTE PAGINA
	function setcolor(campo,color){
		
		if(document.getElementById('b_n').checked==true){
			alert('No puede aplicar un color mientras este activada la opcion de  \"Imprimir a blanco y negro\".');
		}
		else{
			if(campo=='titulo'){
				document.getElementById('hex_c_t').value=color;
			}
			else{
				document.getElementById('hex_c_pi').value=color;
			}
			document.getElementById(campo).style.color=color;
		}
	}

	///////En el onload, da el TIPO DE LETRA, por si no se ASIGNA UN TIPO DE LETRA DIFERENTE AL DE POR DEFECTO, para que se valla con esos parametros de TIPO DE LETRA a "para impresion.php"
	function fuentiar(cual,fuente){
		document.getElementById(cual).style.fontFamily=fuente;
		if(cual=='titulo')
			document.getElementById('tipo_let_titulo').value=fuente;
		else
			document.getElementById('tipo_let_pie').value=fuente;
	}
	
	/////ASIGNA EL NOMBRE DE LA IMAGEN A UN CAJON QUE VIAJA A LA SGTE PAGINA
	function asig_nomb_img(nombre){
		if(document.getElementById('tipo').value=='frontal'){
			document.getElementById('nombre_img').value=nombre;
			document.getElementById('imagen1').src=nombre;
		
	}
	}
	
	/////AUMENTA EL TAMAÑO DE LA LETRA, CON PARAMETRO DE PIE O DE TITULO
	function aumentar(cual_tamano){
		var tam=parseInt(document.getElementById(cual_tamano).style.fontSize);
		if(document.getElementById('tipo').value=='posterior' && document.getElementById('cual_letra2').value!='titulo')
			tam+=1;
		else
			tam+=6;
		document.getElementById(cual_tamano).style.fontSize=tam;
		document.getElementById('valor').value=tam;
		if(cual_tamano=='titulo')
			document.getElementById('tam_titulo').value=tam;
		else
			document.getElementById('tam_pie').value=tam;	
		}	

	/////DISMINUYE EL TAMAÑO DE LA LETRA, CON PARAMETRO DE PIE O DE TITULO, CONTROLA QUE NO SE DISMINUYA A UN NUMERO NEGATIVO, PARA QUE SAQUE ERROR
	function mermar(cual_tamano){
		if(parseInt(document.getElementById(cual_tamano).style.fontSize)>0){
			var tam=parseInt(document.getElementById(cual_tamano).style.fontSize);
			if(document.getElementById('tipo').value=='posterior' && document.getElementById('cual_letra2').value!='titulo')
				tam-=1;
			else
				tam-=6;
			document.getElementById(cual_tamano).style.fontSize=tam;
		}
		else{
			alert('No se puede mermar mas.  Error 002')
		}
		document.getElementById('valor').value=tam;
		if(cual_tamano=='titulo')
			document.getElementById('tam_titulo').value=tam;
		else
			document.getElementById('tam_pie').value=tam;
	} 
	
	
	/////GESTIONA EL SWITCHEO DEL CHECKBOX DE ACTIVACION PARA IMPRESION A BLANCO Y NEGRO
	function bl_ng(){
		if(document.getElementById('b_n').checked==true){
			document.getElementById('hex_c_t').value='black';
			document.getElementById('hex_c_pi').value='black';
			document.getElementById('pie_pagina').style.color='black';
			document.getElementById('titulo').style.color='black';
			if(document.getElementById('tipo').value=='frontal')
				document.getElementById('imagen1').style.filter='gray()';
		}
		else{
			if(document.getElementById('tipo').value=='frontal')
				document.getElementById('imagen1').style.filter='';
		}
		
	}


/////// terminan scripts para trabajar en show.php, que es donde se le colocan los formatos y la imagen a las caratulas a imprimir
/*ARRIBA******************************************************************************************************/


/////VALIDA QUE SE MARQUE AL MENOS UN RADIO
	function comprobar_radio_checked(formu,bandera,msg){
		var i=0;
		while(i<document.getElementById(formu).length){
			if(document.getElementById(formu)[i].checked==true)
				bandera.value=i;
			i++;
		}
		if (bandera.value == ""){
			alert(msg); 
			return; 
		}
		document.getElementById(formu).submit();
	}




// EJEMPLO LLAMADO ---> onclick="valida_un_campo_vacio(document.getElementById('form_new_ar'),document.getElementById('name_arb'),'Debe ingresar un nombre de arbol.   (ERROR: 001)',1,1)"
/////valida que un campo no este vacio
 	function valida_un_campo_vacio(formu,campo,mensaje,autoriz_focus,autoriz_submit){
		if (document.getElementById(campo).value == ""){
			alert(mensaje);
			if(autoriz_focus)
				document.getElementById(campo).focus(); 
			return; 
		}
		if(autoriz_submit)
			document.getElementById(formu).submit();
	}

	/////AYUDA A QUE NO SE AVANCE SIN QUE SE HAYA SELECCIONADO ALGO EN UN SELECT
	function llevar_algo_txt(donde,que){
		document.getElementById(donde).value=que;
			
	}


	////////////////   no se puede ingresar un numero mayor a 25 (para el numero de temas a ingresar en 'uno a uno')
	function no_mas_de_25(){
		if (tema.cantidad.value == ""){
			alert("No deje el campo vacìo.  (ERROR: 001)"); 
			tema.cantidad.focus(); 
			return; 
		}
		if (tema.cantidad.value > 26){
			alert("No puede exceder los 26 temas.  (ERROR: 005)"); 
			tema.cantidad.focus(); 
			return; 
		}
		tema.submit();
			
	}




	


/////////////////////////VALIDACIÒN DE CAMPOS VACÌOS (ESPECIFICO)
	function Validar_frontal()
	{
		if (frontal.titulo.value == "")
		{
			alert("No deje el campo vacìo.  (ERROR: 001)"); 
			frontal.titulo.focus(); 
			return; 
		}
	
	
	}

	
	
	
	
	/*
		//Lleva mayusculas a las primeras letras de cada palabra de las frasese sin importar el numero de inputs del form
	function primera_letra_mayus_sin_i(form){
		var control=form.length;
		var formulario=form;
		var i=0;
		while(i<control){
			var index;
			var tmpStr;
			var tmpChar;
			var preString;
			var postString;
			var strlen;
			tmpStr = form[i].value.toLowerCase();
			strLen = tmpStr.length;
			if (strLen > 0){
			for (index = 0; index < strLen; index++){
				if (index == 0){
					tmpChar = tmpStr.substring(0,1).toUpperCase();
					postString = tmpStr.substring(1,strLen);
					tmpStr = tmpChar + postString;
				}
				else{
					tmpChar = tmpStr.substring(index, index+1);
					if (tmpChar == " " && index < (strLen-1)){
						tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
						preString = tmpStr.substring(0, index+1);
						postString = tmpStr.substring(index+2,strLen);
						tmpStr = preString + tmpChar + postString;
					}
				}
			}
		}
		form[i].value = tmpStr;
		i++;
		}
	}
	*/

	
	

	
	
//////  CONFIRMACION ANTES DE BORRAR	
	
	
	
	

	///////////////   OBJETO AJAX
	function objetoAjax(){
		var xmlhttp=false;
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (E) {
				xmlhttp = false;
			}
		}
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		return xmlhttp;
	}
	
	
	
	

						
	function enviarDatosImpresion(){
		//donde se mostrará lo resultados
		divResultado = document.getElementById('resultado');
		divResultado.innerHTML= '<center><img src="anim.gif"></center><br>';
		//valores de las cajas de texto
		opc_imp=document.impresiones.opc_imp.value;
		//instanciamos el objetoAjax
  		ajax=objetoAjax();
  		//uso del medoto POST
  		//archivo que realizará la operacion
  		//registro.php
  		ajax.open("POST","gestor_sel_impresion.php",true);
  		ajax.onreadystatechange=function() {
  									if (ajax.readyState==4) {
  										//mostrar resultados en esta capa
  										divResultado.innerHTML = ajax.responseText
  										//llamar a funcion para limpiar los inputs
  										
  									}
  								}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
  		ajax.send("opc_imp="+opc_imp)
	}	
	
	
	function enviarDatosFormatoFrontal(codigo){
		//donde se mostrará lo resultados
		divResultado = document.getElementById('resultado');
		divResultado.innerHTML= '<center><img src="anim.gif"></center><br>';
		//valores de las cajas de texto
		//instanciamos el objetoAjax
  		cod=codigo;
		ajax=objetoAjax();
		
  		//uso del medoto POST
  		//archivo que realizará la operacion
  		//registro.php
  		ajax.open("POST","gestor_formato_car_frontal.php",true);
  		ajax.onreadystatechange=function() {
  									if (ajax.readyState==4) {
  										//mostrar resultados en esta capa
  										divResultado.innerHTML = ajax.responseText
  										//llamar a funcion para limpiar los inputs
  										
  									}
  								}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
  		ajax.send("cod="+cod)
	}
	
	
	
	function enviarDatosFrontal(){
		//donde se mostrará lo resultados
		divResultado = document.getElementById('resultado');
		divResultado.innerHTML= '<center><img src="anim.gif"></center><br>';
		//valores de las cajas de texto
		titulo=document.frontal.titulo.value;
		pie=document.frontal.pie.value;
		tipo=document.frontal.tipo.value;
		//instanciamos el objetoAjax
  		ajax=objetoAjax();
  		//uso del medoto POST
  		//archivo que realizará la operacion
  		//registro.php
  		ajax.open("POST", "oper_bd.php",true);
  		ajax.onreadystatechange=function() {
  									if (ajax.readyState==4) {
  										//mostrar resultados en esta capa
  										divResultado.innerHTML = ajax.responseText
 									}
  								}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
  		ajax.send("titulo="+titulo+"&pie="+pie+"&tipo="+tipo)
		
	}
	
	
	/*
	function enviarDatosPdfConvertido(){
		//donde se mostrará lo resultados
		divResultado = document.getElementById('resultado');
		divResultado.innerHTML= '<center><img src="anim.gif"></center><br>';
		//valores de las cajas de texto
		mamotreto=document.formPegarPdf.dos.value;
		//instanciamos el objetoAjax
  		ajax=objetoAjax();
  		//uso del medoto POST
  		//archivo que realizará la operacion
  		//registro.php
  		ajax.open("POST", "gestor_ing_temas_pdf.php",true);
  		ajax.onreadystatechange=function() {
  									if (ajax.readyState==4) {
  										//mostrar resultados en esta capa
  										divResultado.innerHTML = ajax.responseText
 									}
  								}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
  		ajax.send("mamotreto="+mamotreto)
		
	}
	*/
	
	/*
	function enviarDatosPosterior(){
		//donde se mostrará lo resultados
		divResultado = document.getElementById('resultado');
		divResultado.innerHTML= '<center><img src="anim.gif"></center><br>';
		//valores de las cajas de texto
		cantidad=document.tema.cantidad.value;
		//instanciamos el objetoAjax
  		ajax=objetoAjax();
  		//uso del medoto POST
  		//archivo que realizará la operacion
  		//registro.php
  		ajax.open("POST", "gestor_frm_temas.php",true);
  		ajax.onreadystatechange=function() {
  									if (ajax.readyState==4) {
  										//mostrar resultados en esta capa
  										divResultado.innerHTML = ajax.responseText
 									}
  								}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
  		ajax.send("cantidad="+cantidad)
	}
	*/

	/////ESCONDE UNA CAPA
	function esconder(parametro){
		document.getElementById(parametro).style.display="none";
	}

	/////MUESTRA UNA CAPA
	function mostrar_ocultar(parametro){
		if(document.getElementById(parametro).style.display=="block"){
			document.getElementById(parametro).style.display='none';
		}
		else{
			document.getElementById(parametro).style.display='block';
		}
		
	}
	
	/*
	function handleClick(bloque1) {
		if (document.getElementById(bloque1).style.display!="none"){
			document.getElementById(bloque1).style.display="block";
		}
	}
	*/
	
	/////DESHABILITAN BOTONES DE MENU
	function deshabilita1(){ 
		document.frm2.frontal.disabled=true;	
		document.frm3.posterior.disabled=true;
		document.frm4.duplicar.disabled=true;
		document.frm5.modificar.disabled=true;
		document.frm6.eliminar.disabled=true;
		document.frm7.post2.disabled=true;
	} 
	
	function deshabilita2(){ 
		document.frm1.Impresiones.disabled=true;
		document.frm3.posterior.disabled=true;
		document.frm4.duplicar.disabled=true;
		document.frm5.modificar.disabled=true;
		document.frm6.eliminar.disabled=true;
		document.frm7.post2.disabled=true;
	} 
	
	function deshabilita3(){ 
		document.frm1.Impresiones.disabled=true;
		document.frm2.frontal.disabled=true;	
		document.frm4.duplicar.disabled=true;
		document.frm5.modificar.disabled=true;
		document.frm6.eliminar.disabled=true;
		document.frm7.post2.disabled=true;
	} 
	
	function deshabilita4(){ 
		document.frm1.Impresiones.disabled=true;
		document.frm2.frontal.disabled=true;
		document.frm3.posterior.disabled=true;
		document.frm5.modificar.disabled=true;
		document.frm6.eliminar.disabled=true;
		document.frm7.post2.disabled=true;
	} 
	
	function deshabilita5(){ 
		document.frm1.Impresiones.disabled=true;
		document.frm2.frontal.disabled=true;
		document.frm3.posterior.disabled=true;
		document.frm4.duplicar.disabled=true;
		document.frm6.eliminar.disabled=true;
		document.frm7.post2.disabled=true;
	} 
	
	function deshabilita6(){ 
		document.frm1.Impresiones.disabled=true;
		document.frm2.frontal.disabled=true;
		document.frm3.posterior.disabled=true;		
		document.frm4.duplicar.disabled=true;
		document.frm5.modificar.disabled=true;
		document.frm7.post2.disabled=true;
	} 
	
	
	function deshabilita7(){ 
		document.frm1.Impresiones.disabled=true;
		document.frm2.frontal.disabled=true;
		document.frm3.posterior.disabled=true;		
		document.frm4.duplicar.disabled=true;
		document.frm5.modificar.disabled=true;
		document.frm6.eliminar.disabled=true;
	} 	
	




		
	/////////  FUNCION PASTE EN JAVASCRIPT
	function pegar(theField) {
			var tempval=eval("document."+theField)
			therange=tempval.createTextRange()
			therange.execCommand("Paste")
	}


	function continuar(form){
		//elimina las comas
		var texto=document.getElementById('uno').value;
		var cadenaBuscada=",";
		var nuevaCadena="";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('uno').value=texto;
		
		document.getElementById('dos').value=texto.split('\n');
		
		
		
		//eliminar 'Page 1,'
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="Page 1,";
		var nuevaCadena="";
		posicion=texto.indexOf(cadenaBuscada);
		texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		document.getElementById('dos').value=texto;
		//eliminar 'Lista de reproducciones actual,'
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="Lista de reproducciones actual,";
		var nuevaCadena="";
		posicion=texto.indexOf(cadenaBuscada);
		texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		document.getElementById('dos').value=texto;
		
		
	
		//PARA PONER EN NEGRILLA EL 'POR'
		var texto=document.getElementById('dos').value;
		var cadenaBuscada=String.fromCharCode(34)+" por";
		var nuevaCadena=" <b>POR</b>";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;
		
		
	
		//ELIMINA COMILLA DOBLE
		
		var texto=document.getElementById('dos').value;
		var cadenaBuscada=String.fromCharCode(34);
		var nuevaCadena="";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;
		
		
		
		//eliminar a con tilde
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="á";
		var nuevaCadena="a";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;	
		//eliminar e con tilde
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="é";
		var nuevaCadena="e";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;
		//eliminar i con tilde
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="í";
		var nuevaCadena="i";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;	
		//eliminar o con tilde
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="ó";
		var nuevaCadena="o";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;
		//eliminar u con tilde
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="ú";
		var nuevaCadena="u";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;
		//eliminar ñ
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="ñ";
		var nuevaCadena="n";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;	
		//eliminar ñ MAYUSCULA
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="Ñ";
		var nuevaCadena="N";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;
		//eliminar '
		var texto=document.getElementById('dos').value;
		var cadenaBuscada="'";
		var nuevaCadena=" ";
		while (texto.indexOf(cadenaBuscada)>-1){
			posicion=texto.indexOf(cadenaBuscada);
			texto=texto.substring(0,posicion)+nuevaCadena+texto.substring(posicion+cadenaBuscada.length,texto.length);
		}
		document.getElementById('dos').value=texto;	
		
}
//////////////////////////////////////////////////////termina, PARA TRABAJAR CON EL PDF


//////////////////////////VALIDA DIRECCION DE CORREO
function validaEmail(email){ 
	var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/; 
	if (!re.test(email)) { 
		alert ("Dirección de email inválida"); 
		return false; 
	} 
	return true; 
} 



//////
