﻿// SwapMenu
function SwapMenu(count,className,id) {
            for(var i=1;i<=count;i++){
	            var idNow = className+i;
	            var liIdNow = className+'_li_'+i;
	            document.getElementById(idNow).className = 'submenu_off';
	            document.getElementById(liIdNow).className = '';
		        if(i == id){
		            document.getElementById(idNow).className = className;
		        }
        }
}
function ActMenuSup(count,id) {
            for(var i=1;i<=count;i++){
	            var idNow = 'mnusup_'+i;
	            document.getElementById(idNow).className = 'acab';
		        if(i == id){
		            document.getElementById(idNow).className = 'acab_on';
		        }
        }
}
function ActMenuInf(count,id) {
            for(var i=1;i<=count;i++){
	            var idNow = 'mnuinf_'+i;
	            document.getElementById(idNow).className = 'asubcab';
		        if(i == id){
		            document.getElementById(idNow).className = 'asubcab_on';
		        }
        }
}
function ActLetraAlf(count,id) {
        if(id != ''){
            for(var i=1;i<=count;i++){
	            var idNow = 'alfa_'+i;
	            document.getElementById(idNow).className = 'alpha_off';
		        if(document.getElementById(idNow).title == id){
		            document.getElementById(idNow).className = 'alpha_on';
		        }
            }
        }
}

function ActPanelPalabra() {
var idNow = 'pnl_palabra';
var idNow2 = 'pnl_provincia';
var idNow3 = 'btnaz'; 
var idNow4 = 'btndir'; 
var idNow5 ='txt_alf';
var idNow6 ='txt_pal';
document.getElementById(idNow).className = 'dets_panelnaranja';
document.getElementById(idNow2).className = 'dets_panelnaranja hide';
document.getElementById(idNow3).className = 'divrel hide';
document.getElementById(idNow4).className = 'divrel';
document.getElementById(idNow5).className = 'hide';
document.getElementById(idNow6).className = '';
}
function ActPanelProvincia(cond) {
    if(cond == 'S'){
                    var idNow = 'pnl_provincia';
                    var idNow2 = 'pnl_palabra';
                    var idNow3 = 'btnaz'; 
                    var idNow4 = 'btndir'; 
                    var idNow5 ='txt_alf';
                    var idNow6 ='txt_pal';
                    document.getElementById(idNow).className = 'dets_panelnaranja';
                    document.getElementById(idNow2).className = 'dets_panelnaranja hide';
                    document.getElementById(idNow3).className = 'divrel';
                    document.getElementById(idNow4).className = 'divrel hide';
                    document.getElementById(idNow5).className = '';
                    document.getElementById(idNow6).className = 'hide';
                }
}
function ActBusqAvanzada() {
var idNow = 'divagenda_top';
var idNow2 = 'divagenda_top2';
document.getElementById(idNow).className = 'hide';
document.getElementById(idNow2).className = '';
}
function ActBusqCalendario() {
var idNow = 'divagenda_top';
var idNow2 = 'divagenda_top2';
document.getElementById(idNow).className = '';
document.getElementById(idNow2).className = 'hide';
}
function ActPanelBus(cond){
if(cond == 'A'){ActBusqAvanzada();}
if(cond == 'C'){ActBusqCalendario();}
}
function SwapLinAgenda(id,count){
    if(id != '0'){
        for(var i=1;i<=count;i++){
	        var idNow = 'lin_2_'+i;
	        var idNowG = 'pannar_'+i;
		    if(i == id){
		        switch(document.getElementById(idNow).className){
		            case 'divrel': {document.getElementById(idNow).className = 'divrel hide';formatearpanel(i,'closed');break;}
 		            case 'divrel hide': {document.getElementById(idNow).className = 'divrel';formatearpanel(i,'open');break;}
 		        }
            }
            else{
            document.getElementById(idNow).className = 'divrel hide';
            formatearpanel(i,'closed');
            }
        }
    }
}
function formatearpanel(i,est){
var idNowG = 'pannar_'+i;
var idNow1 = 'txtespec_'+i;
var idNow2 = 'txtcomp_'+i;
var idNow3 = 'txtfec_'+i;
var idNow4 = 'txthor_'+i;
var idNow5 = 'txtmes_'+i;
    if (est=='closed'){
            document.getElementById(idNowG).className='panelnaranja';
            document.getElementById(idNow1).className='amedcirculo';
            document.getElementById(idNow2).className='amedcirculo';
            document.getElementById(idNow3).className='amedcirculo';
            document.getElementById(idNow4).className='amedcirculo';
            document.getElementById(idNow5).className='amedcirculo';
    }
    else{
            document.getElementById(idNowG).className='panelabierto';
            document.getElementById(idNow1).className='amedcirculo_abierto';
            document.getElementById(idNow2).className='amedcirculo_abierto';
            document.getElementById(idNow3).className='amedcirculo_abierto';
            document.getElementById(idNow4).className='amedcirculo_abierto';
            document.getElementById(idNow5).className='amedcirculo_abierto';
    }
}
//function actpestform(i){
//var idNowG = 'form_subscripcion_escola';
//var idNow1 = 'form_subscripcion_particular';
//    if (i==1){
//            document.getElementById(idNowG).className='';
//            document.getElementById(idNow1).className='hide';
//    }
//    else{
//            document.getElementById(idNowG).className='hide';
//            document.getElementById(idNow1).className='';
//    }
//}