﻿function FK_InnerDscInput()
{
	this.FontBold;
	this.FontSize;
	this.FontColor;
	this.Font;
	this.BorderStyle;
	this.BorderWidth;
	this.BorderCol;
	this.Attribute;
	this.IsPassword;
	this.Size;
	this.MaxLength;
	this.InnerText;

	// Databinding for property Attribute
	this.SetAttribute = function(data)
	{
		///UserCodeRegionStart:[SetAttribute] (do not remove this comment.)
		this.Attribute = data;			
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property Attribute
	this.GetAttribute = function()
	{
		///UserCodeRegionStart:[GetAttribute] (do not remove this comment.)
		return document.getElementById(this.ContainerName +  "_cosa").value;			
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	this.show = function()
	{
		///UserCodeRegionStart:[show] (do not remove this comment.)
		//this.ContainerName

		if (this.Size == undefined) this.Size = 30;
		if (this.MaxLength == undefined) this.MaxLength = 35;
		if (this.BorderWidth== undefined) this.BorderWidth = 1;
		if (this.InnerText== undefined) this.InnerText = 'Coloque el texto aqui...';
		if (this.BorderStyle== undefined) this.BorderStyle = 'Solid';

		if (this.FontColor == undefined) this.FontColor = 'black';
		if (this.Font == undefined) this.Font = 'Arial';
		if (this.Bold == undefined) this.Bold = false;
		if (this.FontSize == undefined) this.FontSize = 12;
	
		if (this.Attribute == undefined) this.Attribute = '' ;
		if (this.IsPassword == undefined) this.IsPassword = false ;
		if (this.BorderCol == undefined) this.BorderColor = 'gray';
		
		
		var type = (this.IsPassword)?'password':'text';		
		var display =(this.Attribute == '')?'':'none';
		var Bold = (this.Bold)?'bold':'';
		
		var buffer;
	
		if (this.IsAttributeSupported("input", "placeholder")) {
			//soporta propiedad paceholder
			buffer = 	'<INPUT ID="' +this.ContainerName+ '_cosa" TYPE="'+ type +'" placeholder="'+this.InnerText+'" style="background-color: transparent;border-width:' + this.BorderWidth + ';border-style:'+ this.BorderStyle +
								';color: '+ this.FontColor.Html +'; font-family: '+ this.Font +'; font-weight:'+ Bold +'; font-size: '+this.FontSize+ 'px;border-Color:'+ this.BorderCol.Html +';"'+
								'maxlength="'+this.MaxLength +'" size="'+this.Size+';" NAME="' +this.ContainerName+ '_IT_Texto" value="'+this.Attribute+'"'+
             					'onblur= "if (' + this.me() +'.OnBlur != undefined)' + this.me() + '.OnBlur();"'+ 
								'onkeyup="if (' + this.me() +'.OnKeyDown != undefined)' + this.me() + '.OnKeyDown();"' +
								'>';	
			this.setHtml(buffer);
			
		}else{
			//NO soporta propiedad paceholder
			
			//acorto al máximo de caracteres
			this.InnerText = this.InnerText.substring(0,this.Size);
			
			
			buffer =    '<table><Tr><td><div style="position:relative;" >'+
							'<table Id="' +this.ContainerName+ '_tabla" ><tr><td></td></tr></table>'+
							'<div id="' +this.ContainerName+ '_fondo" style="position:absolute;top:0;" >' + 
					 			'<div id="' +this.ContainerName+ '_mostrarOcultar" style="position:absolute;top:0;z-index:0;display:'+display+ '"' +
								'onclick="document.getElementById(' +"'"+ this.ContainerName + '_mostrarOcultar' + "'" +').style.display =' +"'none'" + ';document.getElementById(' +"'"+ this.ContainerName + '_cosa' +"'" + ').focus();">' +
									'<table width="100%" border="'+ this.BorderWidth +'" cellpadding="0" cellspacing= "0" BORDERCOLOR="transparent"><tr><td NOWRAP>'+
									'<font style="background-color:transparent;color:gray; font-family: '+ this.Font +'; font-weight: '+ Bold +'; font-size:'+this.FontSize+ 'px;">'+this.InnerText+'</font>'+
									'</td></tr></table>'+
								'</div>'+
	  			 				'<div id="' +this.ContainerName+ '_texto" style="position:absolute;top:0;z-index:2;" >'+
				 					'<INPUT ID="' +this.ContainerName+ '_cosa" TYPE="'+ type +'" style="background-color: transparent;border-width:' + this.BorderWidth + ';border-style:'+ this.BorderStyle +
										';color:'+this.FontColor.Html+'; font-family: '+ this.Font +'; font-weight:'+ Bold +'; font-size: '+this.FontSize+ 'px;border-Color:'+ this.BorderCol.Html +';"'+
										'maxlength="'+this.MaxLength +'" size="'+this.Size+';" NAME="' +this.ContainerName+ '_IT_Texto" value="'+this.Attribute+'"'+
		             					'onfocus="document.getElementById(' + "'" +this.ContainerName+  "_mostrarOcultar'" + ').style.display =' +"'none'" + '"' +
					 					'onblur= "document.getElementById(' + "'" +this.ContainerName+  "_mostrarOcultar'" + ').style.display = (document.getElementById(' +
					 					"'" + this.ContainerName +  "_cosa'" + ').value==' + "''"+ ')?'+"''" +':'+"'" + 'none' + "'" + ';if (' + this.me() +'.OnBlur != undefined)' + this.me() + '.OnBlur();"'+ 
										'onkeyup="if (' + this.me() +'.OnKeyDown != undefined)' + this.me() + '.OnKeyDown();"' +
										'>'+
								'</div>' +
				 			'</div>' + 
						'</div></td></Tr></Table>';
						
			this.setHtml(buffer);
			
			//Tabla
			document.getElementById(this.ContainerName+ '_tabla').style.width = document.getElementById(this.ContainerName+ '_texto').offsetWidth;
			document.getElementById(this.ContainerName+ '_tabla').style.height = document.getElementById(this.ContainerName+ '_texto').offsetHeight;
			//fondo
			document.getElementById(this.ContainerName+ '_fondo').style.width = document.getElementById(this.ContainerName+ '_texto').offsetWidth;
			document.getElementById(this.ContainerName+ '_fondo').style.height = document.getElementById(this.ContainerName+ '_texto').offsetHeight;			
			//Mostrar Ocultar
			document.getElementById(this.ContainerName+ '_mostrarOcultar').style.width = document.getElementById(this.ContainerName+ '_texto').offsetWidth;
			document.getElementById(this.ContainerName+ '_mostrarOcultar').style.height = document.getElementById(this.ContainerName+ '_texto').offsetHeight;
		}

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		///UserCodeRegionEnd: (do not remove this comment.)
	}
	///UserCodeRegionStart:[User Functions] (do not remove this comment.)
	this.IsAttributeSupported = function(tagName, attrName) {
    	var val = false;
    	// Create element
    	var input = document.createElement(tagName);
    	// Check if attribute (attrName)
    	// attribute exists
    	if (attrName in input) {
	        val = true;
	    }
    	// Delete "input" variable to
    	// clear up its resources
    	delete input;
	    // Return detected value
    	return val;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	///UserCodeRegionEnd: (do not remove this comment.):
}

