﻿function loader()
{
	this.myMainImage = new mainImage();
	this.myMainContainer = new mainContainer();
}

function mainImage()
{
	this.myDiv = new Div('main_img_div_id','main_img_div_class',document.body);
	this.imgUrl = "img/mugre_logo.png";
	this.imgId = "main_img_id";
	this.tituloImg = '';

	this.init = function(){

		this.tituloImg = document.createElement('img');
		this.tituloImg.setAttribute("id", this.imgId);
		this.tituloImg.setAttribute("src", this.imgUrl);
		this.tituloImg.setAttribute("class", "home");
		
		this.myDiv.appendChild(this.tituloImg);
		return this.tituloImg;
	}
	return this.init();	
}

function mainContainer()
{
	this.myDiv = new Div('main_cnt_div_id','main_cnt_div_class',document.body);
	this.myDiv.innerHTML = "<br>";
	this.myTitleContainer = new titleContainer(this.myDiv);
	this.myVideoContainer = new videoContainer(this.myDiv);
	this.myYshoutContainer = new yshoutContainer(this.myDiv);
	this.myMDDContainer = new MDDContainer(this.myDiv);
	
	this.init= function(){
	
	}
}

function videoContainer(dad)
{
	this.myDiv = new Div('video_div_id','video_div_class',dad);
	this.imgUrl = "img/videoError.png";
	this.imgId = "video_id";
	this.videoImg = '';
	
	this.init = function(){

		this.videoImg = document.createElement('img');
		this.videoImg.setAttribute("id", this.imgId);
		this.videoImg.setAttribute("src", this.imgUrl);
	
		this.myDiv.appendChild(this.videoImg);
		return this.myDiv;
	}
	return this.init();	
}

function yshoutContainer(dad)
{
	this.myDiv = new Div('yshout_div_id','yshout_div_class',dad);
	this.myDivInside = new Div('yshout','yshout_div_inside_class',this.myDiv);

	this.init = function(){
	
		new YShout({yPath: 'yshout/'});
		return this.myDiv;
	}
	return this.init();	
}

function MDDContainer(dad)
{
	this.myDiv = new Div('mdd_div_id','mdd_div_class',dad);
	this.myDivTitle = new Div('mdd_title_div_id','mdd_title_div_class',this.myDiv);
	this.myDivContent = new Div('mdd_content_div_id','mdd_content_div_class',this.myDiv);
	this.myDivContent.innerHTML = "aaaa";
	this.tituloImg = '';

	this.init = function(){
	
		this.tituloImg = document.createElement('img');
		this.tituloImg.setAttribute("src", "img/mdd_title.png");
		this.tituloImg.setAttribute("id", "mdd_title_img_id");

		this.myDivTitle.appendChild(this.tituloImg);
		//this.myDiv.innerHTML = "abcdefghijklmnÃ±opqrstuvwxyz";
		return this.myDiv;
	}
	return this.init();	
}


function titleContainer(dad)
{
	this.myDiv = new Div('title_img_div_id','title_img_div_class',dad);
	this.imgUrl = "img/lbdd_title.png";
	this.imgId = "title_img_id";
	this.tituloImg = '';
	
	this.init = function(){

		this.tituloImg = document.createElement('img');
		this.tituloImg.setAttribute("id", this.imgId);
		this.tituloImg.setAttribute("src", this.imgUrl);
		
		this.myDiv.appendChild(this.tituloImg);
		return this.tituloImg;
	}
	return this.init();	
}

function Div(divName,divClass,divDaddy)
{
	this.myNewDiv = null;
	this.divName = divName;
	this.divClass = divClass;
	this.divDad = divDaddy;
	
	this.init = function(){

		this.myNewDiv = document.createElement('div');
		this.myNewDiv.setAttribute("id", this.divName);
		this.myNewDiv.setAttribute("class", this.divClass);

		this.divDad.appendChild(this.myNewDiv);
		return this.myNewDiv;
	}
	return this.init();
}

function loadme2()
{
	getLastLink ({'target':'','onFinish':positionElements(response)});
}

function positionElements(strResponse)
{
	var responseElements = new Array();
	responseElements = strResponse.split("###");
	document.getElementById("video_div_id").innerHTML = responseElements[1];
	document.getElementById("mdd_content_div_id").innerHTML = responseElements[2];	
}

