function getScript(texto)
{
	var p1=texto.split("<scrip",2);
	if (p1[1]) {
		var p2=p1[1].split(">",2);
		var p3=p2[1].split("</script",2)
		if (p3[0] && p3[0]!='')
		{
			eval(p3[0]);
			texto=p1[0]+p3[1]; 
			texto=getScript(texto); 
		}
	}
	return texto;	
}
function ajax(div,url)
{
	var xmlhttp;
	
	if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();}
	else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById(div).innerHTML=getScript(xmlhttp.responseText);
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp.send();
}
function fill(div,contenido)
{
	document.getElementById(div).innerHTML=contenido;
}
function loading(div)
{
	fill(div,'<img src="design/loading.gif" alt="" style="margin:70px;margin-top:100px;margin-bottom:100px;" />');
}
function v(id)
{
	return document.getElementById(id).value;
}
var hist = false;
var historial = Array(null);
var posHistorial = -1;
function c(url)
{
	if(hist == false)
	{
		posHistorial++;
		for(i = historial.length - 1 ; i > posHistorial - 1 ; i--)
		{
			delete historial[i];
		}
		historial[posHistorial] = url;
	}
	/*loading('display');*/
	document.location.href='index.php?'+url;
	/*ajax('display','display.php?'+url);*/
	hist = false;
}
function r()//regresar
{
	if(posHistorial == 0)return;
	posHistorial--;
	hist = true;
	c(historial[posHistorial]);
}
function s()//siguiente
{
	posHistorial++;
	if(posHistorial == historial.length)
	{
		posHistorial--;
		return;
	}
	hist = true;
	c(historial[posHistorial]);
}
