	function on(obj){
		obj.style.backgroundColor="#deff76"
		obj.style.color="#222222"
	}
	function off(obj){
		obj.style.backgroundColor="#ffffff"
		obj.style.color="#555555"
	}
	function Foco(obj){
		obj.style.border = "1px solid #000000"; 
		obj.style.backgroundColor = "#EAEDDD"; 
		obj.style.color = "#222222"; 
	}
	function noFoco(obj){
		obj.style.border = "1px solid #aaaaaa"; 
		obj.style.backgroundColor = "#ffffff"; 
		obj.style.color = "#7C613C"; 
	}
	function Foco2(obj){
		obj.style.border = "1px solid #000000"; 
		obj.style.backgroundColor = "#EAEDDD"; 
		obj.style.color = "#222222"; 
		obj.style.font = "bold 10px Verdana;";
	}
	function noFoco2(obj){
		obj.style.border = "1px solid #aaaaaa"; 
		obj.style.backgroundColor = "#ffffff"; 
		obj.style.color = "#666666"; 
		obj.style.font = "bold 10px Verdana;";
	}

	function linkear(obj){		
		var input = obj
		
		if(typeof document.selection != 'undefined' && document.selection) {
			var str = document.selection.createRange().text;
			input.focus();
			var my_link = prompt("Introduce la URL:","http://");
			
			if (my_link != null) {
				if(str.length==0){
					str=my_link;
				}
				var sel = document.selection.createRange();
				sel.text = "<a href=\"" + my_link + "\">" + str + "</a>";
				sel.select();
			}
			return;
			
		}else if(typeof input.selectionStart != 'undefined'){
			var start = input.selectionStart;
			var end = input.selectionEnd;
			var insText = input.value.substring(start, end);
			var my_link = prompt("Introduce la URL:","http://");
			if (my_link != null) {
				if(insText.length==0){
					insText=my_link;
				}
				input.value = input.value.substr(0, start) +"<a href=\'" + my_link +"\' target=\'_blank\'>" + insText + "</a>"+ input.value.substr(end);
				input.focus();
				input.setSelectionRange(start+11+my_link.length+insText.length+4,start+11+my_link.length+insText.length+4);
			}
			return;
			
		}else{
			var my_link = prompt("Introduce la URL:","http://");
			var my_text = prompt("Introduce el texto del enlace:","");
			input.value+=" <a href=\'" + my_link + "\' target=\'_blank\'>" + my_text + "</a>";
			return;
		}
	}
	
	function formatear(tag, obj){
		var input = obj
		
		if(typeof document.selection != 'undefined' && document.selection) {
			var str = document.selection.createRange().text;
			input.focus();
			var sel = document.selection.createRange();
			sel.text = "<" + tag + ">" + str + "</" +tag+ ">";
			sel.select();
			return;
		}else if(typeof input.selectionStart != 'undefined'){
			var start = input.selectionStart;
			var end = input.selectionEnd;
			var insText = input.value.substring(start, end);
			input.value = input.value.substr(0, start) + '<'+tag+'>' + insText + '</'+tag+'>'+ input.value.substr(end);
			input.focus();
			input.setSelectionRange(start+2+tag.length+insText.length+3+tag.length,start+2+tag.length+insText.length+3+tag.length);
			return;
		}else{
			input.value+=' ['+tag+']Reemplace este texto[/'+tag+']';
			return;
		}
	}
	function validar(objVal, obj, tipo, tam){
		var texto=""
		var longitud=obj.value.length
		var fecha = new Date()
		
		if(tipo=='T'){
			if(longitud==0){
				texto="¡El campo no puede estar vacio!";
			}
		}else if(tipo=='F'){
			if(longitud==0){
				texto="Debes especificar una fecha";
			}else if(longitud<10){
				texto="El formato de fecha no es válido";
			}else if(longitud==10){
				//dia (de 1 a 31)
				if(obj.value.substring(0,2)<1 || obj.value.substring(0,2)>31){
					texto="El día es incorrecto";
				//mes (de 1 a 12)
				}else if(obj.value.substring(3,5)<1 || obj.value.substring(3,5)>12){
					texto="El mes es incorrecto";
				//año (de 1990 al actual)		
				}else if(obj.value.substring(6,10)<1990 || obj.value.substring(6,10)>fecha.getFullYear()){
					texto="El año es incorrecto";
				//Barras de formato
				}else if(obj.value.substring(2,3)!='/' || obj.value.substring(5,6)!='/'){
					texto="El formato de fecha no es válido";
				}
			}
		}else if(tipo=='A'){
			if(tam==0){
				if((obj.value<1990 || obj.value>fecha.getFullYear()+1) && longitud>0 ){
					texto="El año es incorrecto";
				}
			}else{
				if(longitud==0){
					texto="Debes especificar un año";
				}else{
					if(obj.value<1990 || obj.value>fecha.getFullYear()+1){
						texto="El año es incorrecto";
					}
				}
			}
		}
		objVal.value=texto
	}
	
	/*
	function deshabilitar(e){return false}
	function habilitar(){return true}
		
	//Si el navegador es IE4+
	document.onselectstart=new Function ("return false")
		
	//Si el navegador es NS6
	if (window.sidebar){
		document.onmousedown=deshabilitar
		document.onclick=habilitar
	}
	
	
	function addCss(cssCode) {
		var styleElement = document.createElement("style");
		styleElement.type = "text/css";
		if (styleElement.styleSheet) {
			styleElement.styleSheet.cssText = cssCode;
		} else {
			styleElement.appendChild(document.createTextNode(cssCode));
		}
		document.getElementsByTagName("head")[0].appendChild(styleElement);
	}
		
	function noseleccionar(){
		for(i=0;i<document.body.childNodes.length;i++){
		if(document.body.childNodes[i].nodeType!=1 || document.body.childNodes[i].nodeName=='FORM')continue;
		alert(document.body.childNodes[i].nodeName)
		document.body.childNodes[i].setAttribute('unselectable','on');
		cssCode=document.body.childNodes[i].nodeName+'{-moz-user-select:none}'
		addCss(cssCode);
		}
	}
	document.onselectstart=noseleccionar; 
*/
	