function ArchivoCambiarEstado(url, estado)
{
	var fin = url.lastIndexOf("-");
	if (fin < 1)
	{
		return url;
	}
	var inicio = url.lastIndexOf("-", fin - 1);
	if (inicio < 0)
		return url;
	
	url = url.substr(0, inicio + 1) + estado + url.substr(fin);
	
	return unescape(url);
}

function CampoInicializar(obj, valor)
{
	if (obj.value == valor)
		obj.value = "";
}

function ClaseCambiar(objNombre, claseInicial, claseFinal, extensionClase)
{
	var obj = document.getElementById(objNombre);
	var clase = "";
	if (obj.className)
		clase = " " + obj.className + " ";

	if (extensionClase)
	{
		claseInicial += extensionClase;
		claseFinal += extensionClase;
	}

	if (claseInicial == "" || clase.indexOf(" " + claseInicial + " ") == -1)
		clase += " " + claseFinal + " ";
	else
	{
		var regexp = new RegExp(" " + claseInicial + " ", "g");
		clase = clase.replace(regexp, " " + claseFinal + " ");
	}

	clase = clase.replace(/  /g, " ");
	obj.className = clase;
}

function GetCurrentStyle(obj, style)
{
	if (typeof(obj) == "string")
		obj = document.getElementById(obj);

    if (obj.currentStyle)
		return obj.currentStyle[style];
	else
	{
		if (!document.defaultView.getComputedStyle)
			return "";
		
		var cssStyle = "";
		for(var i = 0; i < style.length; i++)
		{
			var code = style.charCodeAt(i);
			if (code < 97)
				cssStyle += "-" + String.fromCharCode(code + 32);
			else
				cssStyle += String.fromCharCode(code);
		}
		
		var value = document.defaultView.getComputedStyle(obj, "").getPropertyValue(cssStyle);
		return unescape(value)
	}
}

function Incrustar(code)
{
    document.write(code);
}
function Ir(url,externo)
{
url=unescape(url);
	 if(externo=="true")
	 {    	 
	 	window.open(url);		
	 }
	 else
	 {	
	 	 self.location.href = url;
	 }	
}

function PartidoMenuSeleccionar(obj)
{
	var menu = document.getElementById("PartidoMenu");

	var partido1 = document.getElementById("PartidoProximo");
	var partido2 = document.getElementById("PartidoUltimo");

	switch (obj.id)
	{
		case "PartidoMenu1":
			menu.className = "PartidoMenuActivo1";
			partido1.style.display = "block";
			partido2.style.display = "none";
			break;
		case "PartidoMenu2":
			menu.className = "PartidoMenuActivo2";
			partido2.style.display = "block";
			partido1.style.display = "none";
			break;
	}
}

function Precargar()
{
	for(var i = 0; i < arguments.length; i++)
	{
		var image = new Image();
		image.src = arguments[i];
	}
}

function Rollout(titulo, imagen, fondo, extensionClase)
{
	if (titulo)
		ClaseCambiar(titulo, "RolloverTitulo", "", extensionClase);
	
	if (imagen)
	{
	
		var obj = document.getElementById(imagen);
		switch (obj.tagName)
		{
			case "IMG":
			case "INPUT":
				var url = ArchivoCambiarEstado(unescape(obj.src), "Off");
				obj.src = url;	
				break;
			case "DIV":
				var url = ArchivoCambiarEstado(GetCurrentStyle(obj, "backgroundImage"), "Off");
				obj.style.backgroundImage = url;	
				break;
		}
	}
	
	if (fondo)
		ClaseCambiar(fondo, "RolloverFondo", "", extensionClase);
}
function Rollover(titulo, imagen, fondo, extensionClase)
{
	if (titulo)
		ClaseCambiar(titulo, "", "RolloverTitulo", extensionClase);
	
	if (imagen)
	{
		var obj = document.getElementById(imagen);
		switch (obj.tagName)
		{
			case "IMG":
			case "INPUT":
				var url = ArchivoCambiarEstado(unescape(obj.src), "On");
				obj.src = url;	
				break;
				
			case "DIV":
				var url = ArchivoCambiarEstado(GetCurrentStyle(obj, "backgroundImage"), "On");
				obj.style.backgroundImage = url;	
				break;
		}
	}
	
	if (fondo)
		ClaseCambiar(fondo, "", "RolloverFondo", extensionClase);
}
