function TeaserController(sfn) {
	
	var T_TYPE_A = 1;	//Portrais
	var T_TYPE_B = 2;
	var T_TYPE_C = 3;
    var T_TYPE_D = 4;
	
	var self = this;
	
	this.BIG_VIEW = "1";
	this.SMALL_VIEW = "2";
	
	var iconHeight = 48;
	var iconWidth = 48;
	var iconBorder = 5;
        var linkOpenType = "_blank";
	
	var selfName = sfn;
	var view = null;
	var contentArray = null;
	var index = 0;
	
	var viewSet = this.BIG_VIEW;
	
	var imageDir = null;
	
	
	var container1 = null;
	var container2 = null;
	
	var teaserTmp = Array();
	
	this.setIconSize = function(w,h) {
		iconHeight = h;
		iconWidth = w;
	}

        this.setIconBorder = function(b) {
            iconBorder = b;
        }

        this.setLinkOpenType = function(typ) {
            linkOpenType = typ;
        }

	this.setViewType = function(v) {
		viewSet = v
	}
	
	
	this.setViewId = function(id) {
		view = $(id);
	}
	
	this.setContent = function(arr) {
		contentArray = arr;		
	}
	
	
	this.init = function() {
		setElements();
		generateTeaser();
		
	}
	
	this.getImageDir = function() {
		return imageDir;
	}
	
	this.setImageDir = function(dir) {
		imageDir = dir;
	}
	
	function setElements() {
		
		var cHeight = 280;//424;
		//if(viewSet==self.SMALL_VIEW) cHeight=160;
		
		//view.style.height = cHeight+"px";
		
		var cont = 	'<div id="container_1" style="overflow:hidden; width: 960px; height: '+cHeight+'px; position:absolute; top:0px; left:0px; "></div>';
					//'<div id="container_2" style="width: 960px; height: '+cHeight+'px; position:absolute; top:0px; left:960px; "></div>';
		
		view.innerHTML += cont;
		container1 = $("container_1");
		container2 = $("container_2");
	}
	
	
	function generateTeaser() {
		var cont = contentArray[index];
		
		switch(cont[0]) {
		case T_TYPE_A:
			
			if( (index+1)% 2 == 1) {
				var a = new Teaser_A(cont, container1, window[selfName]);
				a.setViewType(viewSet);
				a.init();
				teaserTmp.push(a);
			}else {
				container1.innerHTML = "else";
			}
			break;	
			
		case T_TYPE_B:
			
			if( (index+1)% 2 == 1) {
				var a = new Teaser_B(cont, container1, window[selfName]);
				a.setViewType(viewSet);
				a.setItemSize(iconWidth, iconHeight);
                                a.setItemBorder(iconBorder);
                                a.setLinkOpenType(linkOpenType);
				a.init();
				teaserTmp.push(a);
			}else {
				container1.innerHTML = "else";
			}	
			
			break;
			
		case T_TYPE_C:

			if( (index+1)% 2 == 1) {
				var a = new Teaser_C(cont, container1, window[selfName]);
				a.setViewType(viewSet);
				a.init();
				teaserTmp.push(a);
			}else {
				container1.innerHTML = "else";
			}

			break;
		
		case T_TYPE_D:

			if( (index+1)% 2 == 1) {
				var a = new Teaser_D(cont, container1, window[selfName]);
				a.setViewType(viewSet);
				a.init();
				teaserTmp.push(a);
			}else {
				container1.innerHTML = "else";
			}

			break;
		}
		
	}
	
	
	
}
