function InitScript(Name, PrevText, NextText, ControlsShow, ControlsBefore, ControlsAfter, ControlsFade, FirstText, FirstShow, LastText, LastShow, Vertical, Speed, Auto, Pause, Continuous, Width, Height, PrevBtnClass, NextBtnClass, PrevBtnPos, NextBtnPos) {
	$(document).ready(function(){
	  $('#' + Name).easySlider({
	      prevId:         Name + '_prevBtn',
	      prevText:       PrevText,
	      nextId:         Name + '_nextBtn',
	      nextText:       NextText,
	      controlsShow:   ControlsShow,
	      controlsBefore: ControlsBefore,
	      controlsAfter:  ControlsAfter,
	      controlsFade:   ControlsFade,
	      firstId:        Name + '_firstBtn',
	      firstText:      FirstText,
	      firstShow:      FirstShow,
	      lastId:         Name + '_lastBtn',
	      lastText:       LastText,
	      lastShow:       LastShow,
	      vertical:       Vertical,
	      speed:          Speed,
	      auto:           Auto,
	      pause:          Pause,
	      continuous:     Continuous,
		  width:          Width,
		  height:         Height,
		  prevBtnClass:   PrevBtnClass,
		  nextBtnClass:   NextBtnClass,
		  prevBtnPos:     PrevBtnPos,
		  nextBtnPos:     NextBtnPos,
		  controlsId:     "#" + Name
	  });
	});
}

function ExtraSlider()
{
	this.PrevText;
	this.NextText;
	this.ControlsShow;
	this.ControlsBefore;
	this.ControlsAfter;
	this.ControlsFade;
	this.FirstText;
	this.FirstShow;
	this.LastText;
	this.LastShow;
	this.Vertical;
	this.Speed;
	this.Auto;
	this.Continuous;
	this.Pause;
	this.SliderContentsData;
	this.Width;
	this.Height;
	this.PrevBtnPos;
	this.PrevBtnClass;
	this.NextBtnPos;
	this.NextBtnClass;
	this.Loaded = false;

	// Databinding for property PrevBtnPos
	this.SetPrevBtnPos = function(data)
	{
		///UserCodeRegionStart:[SetPrevBtnPos] (do not remove this comment.)
		this.PrevBtnPos = data;
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property PrevBtnPos
	this.GetPrevBtnPos = function()
	{
		///UserCodeRegionStart:[GetPrevBtnPos] (do not remove this comment.)
		return this.PrevBtnPos;
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property NextBtnPos
	this.SetNextBtnPos = function(data)
	{
		///UserCodeRegionStart:[SetNextBtnPos] (do not remove this comment.)
		this.NextBtnPos = data;
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property NextBtnPos
	this.GetNextBtnPos = function()
	{
		///UserCodeRegionStart:[GetNextBtnPos] (do not remove this comment.)
		return this.NextBtnPos;
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property SliderContentsData
	this.SetSliderContentsData = function(data)
	{
		///UserCodeRegionStart:[SetSliderContentsData] (do not remove this comment.)
		this.SliderContentsData = data;
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property SliderContentsData
	this.GetSliderContentsData = function()
	{
		///UserCodeRegionStart:[GetSliderContentsData] (do not remove this comment.)
		return this.SliderContentsData;
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	this.show = function()
	{
		///UserCodeRegionStart:[show] (do not remove this comment.)
		if (!this.Loaded) {
			this.CreateControl();
			this.Loaded = true;
		}
		///UserCodeRegionEnd: (do not remove this comment.)
	}
	///UserCodeRegionStart:[User Functions] (do not remove this comment.)
	this.CreateControl = function() {
		/* Inicializaciones */
		var container = this.ContainerName;
		this.Name = container + "_slider";
		var browser = navigator.appName;

		var exist = $("#"+ this.Name).className != undefined; // Verifica que ya no ste insertado el control en la pagina web
		if (!exist) {
			buffer = '';
			buffer += '<div id="' + this.Name + '" class="slider" style="display: none;">';
			buffer += '	  <ul width="' + this.Width + ' " height="' + this.Height + '">'
			for(var i=0; this.SliderContentsData[i] != undefined; i++) {
				var src = this.SliderContentsData[i].ContentSrc;
				var typ = this.SliderContentsData[i].ContentType;
				buffer += '		<li width="' + this.Width + ' " height="' + this.Height + '">';
				buffer += '    		<div style="width: ' + this.Width + '; height: ' + this.Height + ';">'

				// Carga el contenido en un contenedor distinto dependiendo del tipo pasado.
				if (typ == "text/html") {
					// El contenido es codigo html que se quiere renderizar.
					buffer += src;
				} else if (typ == "application/x-shockwave-flash") {
					// El contenido es un video flash.
					if (browser == 'Microsoft Internet Explorer') {
						if (typ == "application/x-shockwave-flash") {
							buffer += ' <object data="' + src + '" type="' + typ + '" width="' + this.Width + '" height="' + this.Height + '" >';
							buffer += ' 	<param name="src" value="' + src + '" />';
							buffer += ' </object>';
						} else {
							buffer += ' <object data="' + src + '" type="' + typ + '" width="' + this.Width + '" height="' + this.Height + '" >';
							buffer += ' </object>';
						}
					 } else {
						buffer += '	<object data="' + src + '" width="' + this.Width + '" height="' + this.Height + '" >';
						buffer += ' </object>';
					 }					
				} else {
					buffer += '<img src="' + src + '" alt=""/>';// width="' + this.Width + '" height="' + this.Height + '" />';
				}

				buffer += '    		</div>';
				buffer += '		</li>';
			}
			buffer += '   </ul>';
			buffer += '</div';

			 if (browser == 'Microsoft Internet Explorer') {
				var divAux = document.createElement("div");
				divAux.id = this.Name + "_divAux";
				divAux.innerHTML = buffer;
				this.getContainerControl().appendChild(divAux);
				$("#" + this.Name + "_divAux").height(this.Height + "px");
				$("#" + this.Name + "_divAux").css("max-height", this.Height + "px");
				$("#" + this.Name + "_divAux").css("overflow", "hidden");
			} else {
				this.getContainerControl().innerHTML += buffer;
			}
			$("#" + this.ContainerName).height(this.Height + "px");
			$("#" + this.ContainerName).css("max-height", this.Height + "px");
			
			/* Inicializa el script del EasySlider.*/
			var controlsShow = this.ControlsShow == "true";
			var controlsFade = this.ControlsFade == "true";
			var firstShow    = this.FirstShow == "true";
			var lastShow     = this.LastShow == "true";
			var vertical     = this.Vertical == "true";
			var speed        = parseInt(this.Speed);
			var auto         = this.Auto == "true";
			var pause        = parseInt(this.Pause);
			var continuous   = this.Continuous == "true";
			var width        = parseInt(this.Width);
			var height       = parseInt(this.Height);
			// Compatibilidad hacia atras. En caso de no setearse valores para las nuevas propiedades agrega valores por defecto.
			var prevBtnPos   = (this.PrevBtnPos == "" ? undefined : this.PrevBtnPos);
			var nextBtnPos   = (this.NextBtnPos == "" ? undefined : this.NextBtnPos);
			var prevBtnClass = (this.PrevBtnClass == "" ? "prevBtn" : this.PrevBtnClass);
			var nextBtnClass = (this.NextBtnClass == "" ? "nextBtn" : this.NextBtnClass);
			InitScript(
				this.Name,
				this.PrevText,
				this.NextText,
				controlsShow,
				this.ControlsBefore,
				this.ControlsAfter,
				controlsFade,
				this.FirstText,
				firstShow,
				this.LastText,
				lastShow,
				vertical,
				speed,
				auto,
				pause,
				continuous,
				width,
				height,
				prevBtnClass,
				nextBtnClass,
				prevBtnPos,
				nextBtnPos
			);
		}
	}
}

