function abreHijo(n){
padreLi=n.parentNode
	if(padreLi.className=='activo'){
	padreLi.className='oculto'
	}
	else{
	padreUL=padreLi.parentNode
	todosLI=padreUL.getElementsByTagName('li')
		for(p=0;p<todosLI.length;p++){
			if(todosLI[p].className=='activo'){
			todosLI[p].className=todosLI[p].className.replace('activo','oculto')
			}
		}
	padreLi.className=padreLi.className.replace('oculto','activo')
	}
}

function carrusel(id,arr,intervalo){
cual=document.getElementById(id)
this.id=id
	if(cual.style.filter){this.opacidad=cual.style.filter}
	else{this.opacidad=cual.style.opacity}
this.tam=arr.length
this.matriz=arr
this.intervalo=intervalo
this.init=carRotar
}
			
function carRotar(id,cada,cual){
hid=this.id;
inte=this.intervalo;
mat=this.matriz;
pos=0
vamos(hid,mat,pos,inte)
}
			
function vamos(id,arr,posArr,inte){
	if(posArr>arr.length-1){posArr=0}
	transicion(id,arr,posArr)
	posArr++
	id2=id
	arr2=arr
	posArr2=posArr
	inte2=inte
	setTimeout("vamos(id2,arr2,posArr2,inte2)",inte2)
}
			
function transicion(id,arr,posArr,valor){
	if(valor==undefined) {valor=100}
	harr=arr
	posHarr=posArr
	valor-=10
	cual=document.getElementById(id)
		if(cual.style.filter){
		cual.style.filter='alpha(opacity='+Math.abs(valor)+')'
		}
		else{
		cual.style.opacity=Math.abs(valor)/100
		}
	if(valor!=-100){
		if(valor==0){
		nuevaImg=arr[posArr]
		cual.src=nuevaImg
		}
	val=valor
	rotaTrans=setTimeout("transicion(cual.id,harr,posHarr,val)",10)
	}
	else{clearTimeout(rotaTrans);}
}

function activaForm(){
	if(document.getElementById('formularios')){
	todosInput=document.getElementsByTagName('input')
	todosTxtArea=document.getElementsByTagName('textarea')
		for(n=0;n<todosInput.length;n++){
			if(todosInput[n].type=='text'||todosInput[n].type=='password'){
				todosInput[n].onfocus = function(){
				this.className=this.className.replace('campoTexto','campoTexto1')
				}
				todosInput[n].onblur = function(){
				this.className=this.className.replace('campoTexto1','campoTexto')
				}
			}
		}
		for(n=0;n<todosTxtArea.length;n++){
			todosTxtArea[n].onfocus = function(){
			inputOver(this)
			}
			todosTxtArea[n].onblur = function(){
			inputOut(this)
			//this.className=this.className.replace('campoTexto1','campoTexto')
			}
		}
	}
}

function inputOver(n){
n.className=n.className.replace('campoTexto','campoTexto1')
}

function inputOut(n){
n.className=n.className.replace('campoTexto1','campoTexto')
}

function sacaAsistentes(n){
quien=document.getElementById(n)
cuantos=quien.value
lista=document.getElementById('listaAsistentes').innerHTML
cual=document.getElementById('listaAsistentes')
tenemos=cual.getElementsByTagName('li')
    if(tenemos.length>cuantos) {
    maximo=tenemos.length-1
        for(f=maximo;f>=cuantos;f--){
        cual.removeChild(tenemos[f]);
        }
    precio=parseInt(precioUnitario)*cuantos
    ivaPrecio=precio*(iva/100)
    totalPrecio=precio+ivaPrecio
    txtPrecio='<strong>TOTAL IMPORTE:</strong> '+totalPrecio+' €'
    document.getElementById('totImporte').innerHTML=txtPrecio
    }
    else{
        if(cuantos>0 || !isNaN(cuantos)){
            if(tenemos.length==0) {
            minimo=0;maximo=cuantos
            }
            else{
            minimo=tenemos.length;maximo=cuantos
            }
            for(p=minimo;p<maximo;p++){
                if(p==cuantos-1) estilo=' class="sinBorde"'
                else{estilo=''}
                losRadios=''
                for(pe=0;pe<valorRadio.length;pe++){
	               	// Alicia
					noMarcarRadio = ''
					if  (valorRadio[pe].search("(COMPLETA)")  > -1) noMarcarRadio = 'disabled'
					// fin Alicia
				 
			    losRadios+='<input type="radio" ' + noMarcarRadio + ' class="radio" name="mesa'+p+'" value="'+valorRadio[pe]+'" />'+valorRadio[pe]+'&nbsp;'
                }
				
            lista+='<li'+estilo+'><br class="clear" /><strong>Asistente '+(p+1)+'</strong><br /><input type="text" name="asistente'+p+'" class="campoTexto tam370" onfocus="inputOver(this)" onblur="inputOut(this)" /><br class="clear" /><br class="clear" />'+losRadios+'<br class="clear" /></li>'
            }
        document.getElementById('listaAsistentes').innerHTML=lista
        document.getElementById('F_asistentes').className='vis'
        precio=parseInt(precioUnitario)*cuantos
        ivaPrecio=precio*(iva/100)
        totalPrecio=precio+ivaPrecio
        txtPrecio='<strong>TOTAL IMPORTE:</strong> '+totalPrecio+' €'
        document.getElementById('totImporte').innerHTML=txtPrecio
		document.getElementById('total').value=totalPrecio
        }
        else{
        document.getElementById('listaAsistentes').innerHTML=''
        document.getElementById('F_asistentes').className='novis'
        }
    }
}


function muestra(n){

if(n=='noAs'){precioUnitario=precioNoSocio}
else{precioUnitario=precioSocio}

cual2='F_'+n
document.getElementById('F_noAs').className='novis'
document.getElementById('F_As').className='novis'
document.getElementById(cual2).className='vis'
document.getElementById('condiciones').className='vis'
document.getElementById('No_numero').value=''
document.getElementById('Si_numero').value=''
document.getElementById('F_asistentes').className='novis'
document.getElementById('listaAsistentes').innerHTML=''
document.getElementById('totImporte').innerHTML=''
if (n =='As')
	{
		precioUnitario=precioSocio
	}else{
	
		precioUnitario=precioNoSocio
	}

}

function muestra2(n){
  cual2='F_'+n
    document.getElementById('F_noAs').className='novis'
    document.getElementById('F_As').className='novis'
    document.getElementById(cual2).className='vis'
}

function muestra3(n){
	falso=document.getElementById('F_falso')
    cual3='F_'+n
	if(falso.className=='alinCen' || falso.className=='alinCen novis'){
	nov='alinCen novis'
	vi='alinCen vis'
	}
	else{
	nov='novis'
	vi='vis'
	}
	falso.className=nov
    document.getElementById('F_Empr').className=nov
    document.getElementById('F_Prov').className=nov
    document.getElementById(cual3).className=vi
}


function compruebaChecks(){
	if(document.getElementById('empresa')){
		if(document.getElementById('empresa').checked==true){muestra3('Empr')}
		if(document.getElementById('proveedor').checked==true){muestra3('Prov')}
	}
}

function inicia(){

	if(document.getElementById('ORGAN')) {
	cualID=document.getElementById('ORGAN')
	cursivas=cualID.getElementsByTagName('em')	
	//alert(cursivas.length)
		for(p=0;p<cursivas.length;p++){
		cursivas[p].parentNode.className='em'
		}

	cualID.style.display='block'
	}
}


window.onload= inicia


