function MasterConf()
{
	this.actualiceElHistory = false;
	this.categoria = null;
	this.headerInicialId = null
	this.categoriaInicialId = null;
	this.playlistInicialId = null;
	this.cancionInicialId = null;
	this.noticiasIFrame = null;
	this.explorarIFrame = null;
	
	this.baseUrl = null;
	this.playerUrl = null;
	this.noticiasUrl = null;
	this.explorarUrl = null;
	this.videosUrl = null;
	this.thisUrl = null;
	
	this.menuUrl = "";
	this.submenuUrl = "";
	this.moduloUrl = "";
	
	this.idiomaManager = new IdiomaManager();
	
	this.chequearHistory = function()
	{
		return !!(window.history && history.pushState);	
	}
	
	this.actualizarUrl = function()
	{
		if(this.actualiceElHistory)
		{		
			if(masterPlayer.categoriaSeleccionada == null)
			{
				this.playerUrl = this.baseUrl + masterConf.idiomaManager.idioma;
			}
			else if(masterPlayer.categoriaSeleccionada == null)
			{
				this.playerUrl = this.baseUrl + masterConf.idiomaManager.idioma + "/" + "0" + "/" + "0" + "/" + "0";				
			}
			else if (masterPlayer.playlistSonando == null)
			{
				this.playerUrl = this.baseUrl + masterConf.idiomaManager.idioma + "/" + "0" + "/" + "0" + "/" + "0";				
			}
			else if(masterPlayer.cancionActual == null)
			{
				this.playerUrl = this.baseUrl + masterConf.idiomaManager.idioma + "/" + "0" + "/" + "0" + "/" + "0";
			}
			else
			{
				this.playerUrl = this.baseUrl + masterConf.idiomaManager.idioma + "/" + masterPlayer.categoriaSeleccionada + "/" + masterPlayer.playlistSonando.id + "/" + masterPlayer.cancionActual.id;				
			}
			
			var url = this.playerUrl;
			
			if(this.thisUrl == "player")
			{
				url += "/player";	
			}
			else if(this.thisUrl == "noticias")
			{
				url += "/noticias";
			}
			else if(this.thisUrl == "explorar")
			{
				url += "/explorar";
				
				if(this.menuUrl != "")
				{
					url += "/" + this.menuUrl;
					
					if(this.submenuUrl != "")
					{
						url += "/" + this.submenuUrl;
						
						if(this.moduloUrl != "")
						{
							url += "/" + this.moduloUrl;	
						}
					}
				}
			}	
			
			if(url != document.URL)
			{			
				history.pushState(url, "distrf", url);				
			}
			window.onpopstate = this.popstateHandler;
		}
	}
	
	this.popstateHandler = function(event)
	{
		window.location = event.state;
	}
	
	this.bajarConfiguracion = function(despuesDeBajar)
	{		
		masterConf.establecerIFrames();
		
		var masterData = new MasterData();
		masterData.phpLink = "/../player/php/bajarConfiguracion.php?json=";
		masterData.agregarAlJson("idioma", masterConf.idiomaManager.idioma);
		masterData.despuesDeProcesar = despuesDeBajar;
		masterData.correr();
	}
	
	this.establecerIFrames = function()
	{
		var explorarUrl = "/../explorar";
		
		if(masterConf.menuUrl != "")
		{
			explorarUrl += "/" + masterConf.menuUrl;
			
			if(masterConf.submenuUrl != "")
			{
				explorarUrl += "/" + masterConf.submenuUrl;
				
				if(masterConf.moduloUrl != "")
				{
					explorarUrl += "/" + masterConf.moduloUrl;
				}
			}				
		}
		
		if(explorarUrl == "/../explorar")
		{
			explorarUrl = "/../explorar/home"
		}
		//this.noticiasIFrame = "/../noticias/noticias.php?id=conciertos";
		this.explorarIFrame = explorarUrl;
		
		this.dimensiones();
	}
	
	this.dimensiones = function()	
	{
		var ancho = 0, altura = 0;
		if( typeof( window.innerWidth ) == 'number' ) 
		{
			//Non-IE
			ancho = window.innerWidth;
			altura = window.innerHeight;
		} 
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
		{
			//IE 6+ in 'standards compliant mode'
			ancho = document.documentElement.clientWidth;
			altura = document.documentElement.clientHeight - 2;
		} 
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
		{
			//IE 4 compatible
			ancho = document.body.clientWidth;
			altura = document.body.clientHeight - 2;
		}
		
		this.windowAltura = altura;
		this.windowAncho = ancho;
	}	
}
