// JavaScript Document
function getHTTPObject() {
  var xmlhttp;
 
  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    } 
}
  return xmlhttp;
}
var http = getHTTPObject(); // We created the HTTP Object
function requestInfo(url,id,redirectPage) {      
		var temp=new Array();
		var url=url+"&sid="+Math.random()
			http.open("GET", url, true);
			http.onreadystatechange = function() {
				if (http.readyState == 4) { 
				  if(http.status==200) {
			  		var results=http.responseText;
					//alert(results);
					if(redirectPage=="") {
						
						var temp=id.split("~"); // To display on multiple div 
						//alert(temp.length);
						var r=results.split("~"); // To display multiple data into the div 
						//alert(temp.length);
						if(temp.length>1) {
							for(i=0;i<temp.length;i++) {	
								//alert(temp[i]);
								document.getElementById(temp[i]).innerHTML='';
								document.getElementById(temp[i]).innerHTML=r[i];
							}
						} else {
							//document.getElementById(id).innerHTML = '';							
							document.getElementById(id).innerHTML = results;
						}
					} else {
							
							//window.location.href=redirectPage;
							document.getElementById(id).innerHTML = results;
							}
				  }
  				}
			};
			http.send(null);
       }

function part_list(MODE,START)
{
		if(START == 'NULL')
		{
			START = 0;
		}
		document.getElementById("partenaires").innerHTML='<img src="images/loading.gif" width="100px" height="25px" />';
		requestInfo('includes/part_PublicAjax.php?mode='+MODE+'&start='+START,'partenaires','');
}
//function for partenaires group
function show_partenaires(id,start,mode)
{
	for(i=1;i<=6;i++)
	{
		document.getElementById(i).innerHTML='';
	}
	document.getElementById(id).innerHTML='<div id="load" style = "text-align:center; vertical-align:middle;" ><img src="images/loading.gif" border="0px" align="loading" /></div>';
	requestInfo('includes/part_PublicAjax.php?gid='+id+'&start='+start+'&mode='+mode,id,'');
}

function showPart(id,MODE,eid)
{
	
	var total = document.getElementById('total').value;
	for(i=1;i<total;i++)
	{	
		document.getElementById('print'+i).innerHTML='';
	}
	document.getElementById(eid).innerHTML='<img src="images/loading.gif" width="100px" height="25px" />';
	requestInfo('includes/part_PublicAjax.php?mode='+MODE+'&ID='+id+'&EID='+eid,eid,'');	
}
//Function for closing the article view
function closPart(eid)
{
	document.getElementById(eid).innerHTML='';
}
