var  componente = {
	compHorizontales : [
		'c0302_600_a', 
		'c0302_600p_a', 
		'c0302_600_b', 
		'c0302_600p_b', 
		'c0302_600_c', 
		'c0302_600p_c', 
		'c0302_448_a', 
		'c0302_448p_a', 
		'c0302_448_b', 
		'c0302_448p_b', 
		'c0302_296_a', 
		'c0302_296p_a', 
		'c0302_296_b', 
		'c0302_296p_b', 
		'c0302_220', 
		'c0302_220p'
		],

	getElementsByClass : function(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;
	},		
	addClass : function(esteComponente){
		if(esteComponente.getElementsByTagName("DIV")[0].className == "textos" || esteComponente.getElementsByTagName("DIV")[0].className == "textos clearfix"){
			esteComponente.getElementsByTagName("DIV")[0].className +=" textosSinImg";
		}		
	},
	noImgChangeClass : function(){
		for(var i = 0; i < this.compHorizontales.length; i++){
			var divs = this.getElementsByClass(this.compHorizontales[i]);
			if(divs.length > 0){
				for(var j = 0; j < divs.length; j++){
					var esteComponente = divs[j];
					this.addClass(esteComponente);
				}
			}
		}
	}
	
}


Object.registraClase = function(tag, clase, args){
	if (!this._tags){
		this._tags = new Array();
	}

	var tags;
	
	if (typeof tag == "string"){
		if (!document.getElementsByTagName || !document.getElementById){
			return false;
		}

		if (tag.charAt(0) != "#" && tag.charAt(0) != "%"){
			this._tags[tag] = {clase:clase,args:args};
		}

		if (!args){
			args = [];
		
		}	

		if (tag.charAt(0) == "#"){
			tags = [document.getElementById(tag.substr(1))];
		} else {
			if (tag.charAt(0) == "%"){
				tags = document.getElementsByName(tag.substr(1));
			} else {
				tags =  document.getElementsByTagName(tag);		
			}

		}
	
	} else {
		tags = [tag];
	}
	
	var obj;
	for (var i = 0; i < tags.length; i++){
		obj = tags[i];
		for (var p in clase.prototype){
			obj[p] = clase.prototype[p];
		}
		if (clase.apply){
			clase.apply(obj);
		} else {
			obj.__RCinit = clase;
			obj.__RCinit(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
		}
	}

	return true;
}


function AsignarComportamiento() {
	var objForm = document.forms
	for (i = 0; i < objForm.length; i++)  {
		for(k = 0; k < objForm[i].elements.length; k++) {

			if(objForm[i].elements[k].type == "text" || objForm[i].elements[k].type == "textarea"|| objForm[i].elements[k].type == "select-one") {
				Object.registraClase(objForm[i].elements[k], MetodoInput);	
			}
		}
	}
		var objLabel = document.getElementsByTagName("label");
		for (i = 0; i < objLabel.length; i++)  {
			
			if (objLabel[i].className == "ActivarCajetin") {
				for(w = 0; w < objLabel[i].parentNode.parentNode.childNodes.length; w++){
					if (objLabel[i].parentNode.parentNode.childNodes[w].tagName == "INPUT"){
						
						Object.registraClase(objLabel[i].parentNode.parentNode.childNodes[w], MetodoFirmaActivar);
					}
				}
			}
			else if (objLabel[i].className == "DesactivarCajetin") {
				for(w = 0; w < objLabel[i].parentNode.parentNode.childNodes.length; w++){
					if (objLabel[i].parentNode.parentNode.childNodes[w].tagName == "INPUT" || objLabel[i].parentNode.parentNode.childNodes[w].tagName == "SELECT"){
						Object.registraClase(objLabel[i].parentNode.parentNode.childNodes[w], MetodoFirmaDesactivar);
					}
				}
			}
		}
	
	}

function MetodoInput(){
	this.onfocus = this._onfocus
}  
MetodoInput.prototype._onfocus = function () {
	if (Element.hasClassName(this, 'campoEspecial')){
		var clase = new String(this.className);
		
			if (this.type != "select-one" && (this.readOnly == false && this.disabled == false) ) {
				var clase = this.id;
				var arrElemWithClase = document.getElementsByClassName(clase,"contenedor");
				if (arrElemWithClase.length>0){
					var textLabel = arrElemWithClase[0].innerHTML.substring(0,this.value.length);
					if(textLabel == this.value)
						this.value = "";
				}
			}
			this.className = this.className + " " + "colorCampoNegro"

	}
	else{
		var clase = new String(this.className);
		if(clase.indexOf("colorCampoNegro") == -1){ 
			if (this.type != "select-one") {
				this.value = "";
			}
			this.className = this.className + " " + "colorCampoNegro"
		};
	}
}

function MetodoFirmaActivar(){
	this.onfocus = this._onfocus
}  
MetodoFirmaActivar.prototype._onfocus = function () {
	ActivarCapa(this.id)
}
function MetodoFirmaDesactivar(){
	this.onfocus = this._onfocus
}  
MetodoFirmaDesactivar.prototype._onfocus = function () {
DesactivarCapa()
}

function llamarFuncion() {

	componente.noImgChangeClass();
}




function ols(){}function addOnLoad(newFunction){var j=0;while(eval('ols.f'+j)){j++;}eval('ols.f'+j+'=' + newFunction);}
function eOls(){var j = 0;while(eval('ols.f'+j))	{eval('ols.f'+j+'()');j++;}}window.onload = eOls;


addOnLoad(llamarFuncion)


