// JavaScript Document

var xmlhttp_right_content_title;
var xmlhttp_right_content;

function showClientProjectData(id_proyecto)
{
	resizeBrowser(-1);
	
	xmlhttp_right_content_title=GetXmlHttpObject();
	if (xmlhttp_right_content_title==null)
	{
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	
	var url_right_content_title = "ajax/getQueryResult.php";
	url_right_content_title=url_right_content_title + "?statement=SELECT nombre FROM proyectos WHERE id_proyecto = " + id_proyecto;
	url_right_content_title=url_right_content_title + "&sid=" + Math.random();
	xmlhttp_right_content_title.onreadystatechange = stateChanged_right_content_title;
	xmlhttp_right_content_title.open("GET", url_right_content_title, true);
	xmlhttp_right_content_title.send(null);	

	/////////////////////////////////////////////////////////

	xmlhttp_right_content=GetXmlHttpObject();
	if (xmlhttp_right_content==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url_right_content="ajax/getClientProjectData.php";
	url_right_content=url_right_content+"?id_proyecto="+id_proyecto;
	url_right_content=url_right_content+"&sid="+Math.random();
	xmlhttp_right_content.onreadystatechange=stateChanged_right_content2;
	xmlhttp_right_content.open("GET",url_right_content,true);
	xmlhttp_right_content.send(null);

}


function stateChanged_right_content_title()
{
	if (xmlhttp_right_content_title.readyState==4)
	{
		document.getElementById("right_content_title").innerHTML=xmlhttp_right_content_title.responseText;
	}
}

function stateChanged_right_content2()
{
	if (xmlhttp_right_content.readyState==4)
	{
		document.getElementById("right_content").innerHTML=xmlhttp_right_content.responseText;
		
		document.getElementById("link_regresar").style.display="block";
		
		resizeBrowser(1);
	}
}

/*
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}
*/

function GetXmlHttpObject()
{
	var req = null;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = null;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = null;
        	}
		}
    }
	  
	return req;
}


// We use this function to force browser to repaint the styled scroll.
function resizeBrowser(value){
	
	window.resizeBy(value,0);

}

