function activar(id) {
	document.getElementById("0").className = "page_item not_current_page_item";
	document.getElementById("1").className = "page_item not_current_page_item";
	document.getElementById("2").className = "page_item not_current_page_item";
	document.getElementById("3").className = "page_item not_current_page_item";
	document.getElementById(id).className = "page_item current_page_item";
}

// JavaScript Document
function nuevoAjax(){
	var xmlhttp=false;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp = false;
		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function peticion(operacion){
	var matriz=new Array();
	var devolucion=new Array();
	
	document.getElementById("content").className = "heightcero";
	activar(operacion.charAt(2));
	ajax=nuevoAjax();
	ajax.open("POST", "peticiones.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			devolucion = ajax.responseText.split('|||');
			if (navigator.appName != 'Microsoft Internet Explorer') {
				document.styleSheets[1].deleteRule(52);
				//document.styleSheets[1].deleteRule(119);
				document.styleSheets[1].insertRule(".heightnocero{height: "+devolucion[0]+"px;}",document.styleSheets[1].cssRules.length);
			} else {
				document.styleSheets[0].addRule("#content", "height:"+devolucion[0]+"px");
			}
			document.getElementById("content").className = "heightnocero";
			document.getElementById('content').innerHTML = devolucion[1];
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send(operacion);
}
