
onload=function() 
{
}


function strEndsWith(str, suffix) {
    return str.match(suffix+"$")==suffix;
}


function muestraLoadNeumativo()
{
	document.getElementById("divItemSelLoad").style.display="block";
}

function ocultarLoadNeumativo()
{
	document.getElementById("divItemSelLoad").style.display="none";
}

function clickNeumatico(indice){
	muestraLoadNeumativo();
	var ajax=nuevoAjax();
	ajax.open("POST", "php/neumaticos_ajax.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("accion=ClickNeumatico&indice="+indice);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==4)
		{
			divListado = document.getElementById('itemSel');
			divListado.innerHTML = ajax.responseText;
			ocultarLoadNeumativo();
		}
	}
}

function muestraLoadPaginado()
{
	document.getElementById("divListadoLoad").style.display="block";
}

function ocultarLoadPaginado()
{
	document.getElementById("divListadoLoad").style.display="none";
}

function clickPagina(pagina){
	muestraLoadPaginado();
	var ajax=nuevoAjax();
	ajax.open("POST", "php/neumaticos_ajax.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("accion=ClickPagina&pagina="+pagina);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==4)
		{
			divListado = document.getElementById('listado');
			divListado.innerHTML = ajax.responseText;
			ocultarLoadPaginado();
		}
	}
}

function nuevoAjax()
{ 
	var xmlhttp=false; 
	try 
	{ 
		// No IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
}
