var URI = new Class({
	Implements: [Options, Events],
	options: {
	},

	url: '',
	vars : [],
	
	initialize : function(url, options) {
		this.setOptions(options);
		this.url = url;
		this.splitVars();
		this.fixVars();
	},
	
	splitVars: function(){
		var str = this.url;
		var procVars;
		var procVar;
		if(str.indexOf('?') != -1)
		{
			procVars = str.split('?');
			//	Multi Var
			if(procVars[1].indexOf('&'))
			{
				procVar = procVars[1].split('&');
			}
			else
			{
				procVar = procVars;
			}
		}
		this.vars = procVar;
	},
	
	fixVars : function()
	{
		var result = new Array();
		for(var i = 0; i < this.vars.length; i++)
		{
			//	Separar la variable del valor
			var newVar = this.vars[i].split('=');
			result[newVar[0]] = newVar[1];
		}
		this.vars = result;
	}
});

function getLang()
{
	var url = window.location.toString();
	var section = url.split("/");
	if(section.indexOf("espanol") != -1)
		return 'es';
	return 'en';
}
