
/* - focos.js - */
// http://www.once.es/empresasatuservicio/portal_javascripts/focos.js?original=1
function collapse(id){collapsible=document.getElementById(id);collapsible.className='novisible';return false}
function jscss(a,o,c1,c2){switch(a){case 'swap':o.className=!jscss('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);break;case 'add':if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1}
break;case 'remove':var rep=o.className.match(' '+c1)?' '+c1:c1;o.className=o.className.replace(rep,'');break;case 'check':return new RegExp('\\b'+c1+'\\b').test(o.className)
break}}
function focoin(elemento){if(elemento.style!=null){elemento.style.background="#37576C";elemento.style.color="#FFFFFF"}
var nodeName=elemento.nodeName;if(nodeName=='SELECT'){var child=elemento.firstChild;while(child!=null){if(child.className=='letraroja') child.className='letrarojaB';child=child.nextSibling}}}
function no_focoin(elemento){var toElem;try{toElem=window.event.toElement}
catch(error){toElem=null}
if(navigator.userAgent.indexOf('Firefox')!=-1){elemento.style.background="#FFFFFF";elemento.style.color="";var nodeName=elemento.nodeName;if(nodeName=='SELECT'){var child=elemento.firstChild;while(child!=null){if(child.className=='letrarojaB') child.className='letraroja';child=child.nextSibling}}}
else{if(toElem!=null||window.event.type=='blur'){elemento.style.background="#FFFFFF";elemento.style.color="";var nodeName=elemento.nodeName;if(nodeName=='SELECT'){var child=elemento.firstChild;while(child!=null){if(child.className=='letrarojaB') child.className='letraroja';child=child.nextSibling}}}}}
function focoin2(elemento){if(elemento.style!=null){jscss('add',elemento,'selectActive')}}
function no_focoin2(elemento){var toElem;try{toElem=window.event.toElement}
catch(error){toElem=null}
if(navigator.userAgent.indexOf('Firefox')!=-1){jscss('remove',elemento,'selectActive')}
else{if(toElem!=null||window.event.type=='blur'){jscss('remove',elemento,'selectActive')}}}
function focob(elemento){elemento.style.background="#0C480A";elemento.style.color="#F1F4DF";elemento.style.border="1px solid #E4FFA4"}
function no_focob(elemento){elemento.style.color="#0C480A";elemento.style.border="1px solid #0D0E67"}
function foco(elemento){elemento.style.border="1px solid #37576C";elemento.style.backgroundColor="#CEDFCF";elemento.style.color="#000000"}
function no_foco(elemento){elemento.style.border="1px solid #CCCCCC";elemento.style.backgroundColor="#FFFFFF";elemento.style.color="#000000"}
function focointhis(e){if(!e){e=(typeof window!="undefined"&&window&&window.event)}
if(e){var elemento;if(document.all) elemento=event.srcElement;else elemento=e.target;focoin(elemento)}}
function no_focointhis(e){if(!e){e=(typeof window!="undefined"&&window&&window.event)}
if(e){var elemento;if(document.all) elemento=event.srcElement;else elemento=e.target;no_focoin(elemento)}}
function focoin2this(e){if(!e){e=(typeof window!="undefined"&&window&&window.event)}
if(e){var elemento;if(document.all) elemento=event.srcElement;else elemento=e.target;focoin2(elemento)}}
function no_focoin2this(e){if(!e){e=(typeof window!="undefined"&&window&&window.event)}
if(e){var elemento;if(document.all) elemento=event.srcElement;else elemento=e.target;no_focoin2(elemento)}}
function focothis(e){var elemento;if(document.all) elemento=event.srcElement;else elemento=e.target;foco(elemento)}
function no_focothis(e){var elemento;if(document.all) elemento=event.srcElement;else elemento=e.target;no_foco(elemento)}
function addListener(element,type,expression,bubbling){bubbling=bubbling||false;if(window.addEventListener){element.addEventListener(type,expression,bubbling);return true} else if(window.attachEvent){element.attachEvent('on'+type,expression);return true} else return false}
function init_form(){var inputs=document.getElementsByTagName('input');var type;for(var i=0;i<inputs.length;i++){type=inputs[i].getAttribute('type');if(type=='submit'){addListener(inputs[i],'focus',focothis,false);addListener(inputs[i],'mouseover',focothis,false);addListener(inputs[i],'mouseout',no_focothis,false);addListener(inputs[i],'blur',no_focothis,false)}
if(type=='text'){addListener(inputs[i],'focus',focointhis,false);addListener(inputs[i],'mouseover',focointhis,false);addListener(inputs[i],'mouseout',no_focointhis,false);addListener(inputs[i],'blur',no_focointhis,false)}}
var selects=document.getElementsByTagName('select');for(var i=0;i<selects.length;i++){addListener(selects[i],'focus',focoin2this,false);addListener(selects[i],'mouseover',focoin2this,false);addListener(selects[i],'mouseout',no_focoin2this,false);addListener(selects[i],'blur',no_focoin2this,false)}
var textareas=document.getElementsByTagName('textarea');for(var i=0;i<textareas.length;i++){addListener(textareas[i],'focus',focointhis,false);addListener(textareas[i],'mouseover',focointhis,false);addListener(textareas[i],'mouseout',no_focointhis,false);addListener(textareas[i],'blur',no_focointhis,false)}}
function init_datePicker(){var datePicker=document.getElementsByTagName('datePicker');jscss('add',datePicker,'activado')}
registerPloneFunction(init_datePicker);if(window.attachEvent){registerPloneFunction(init_form)}
function getElementsByClass(searchClass,node,tag){var classElements=new Array();if(node==null)
node=document;if(tag==null)
tag='*';var els=node.getElementsByTagName(tag);var elsLen=els.length;var pattern=new RegExp("(^|\\s)"+searchClass+"(\\s|$)");for(i=0,j=0;i<elsLen;i++){if(pattern.test(els[i].className)){classElements[j]=els[i];j++}}
return classElements}


