function ajaxFunction(elem, currpage, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11)
{

	var xmlHttp;
    try
    {    
	  // Firefox, Opera 8.0+, Safari    
	  xmlHttp=new XMLHttpRequest();    
	}
    catch (e)
    {   
	  // Internet Explorer    
	  try
    {      
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	}
    catch (e)
    {      
		try
      {       
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
	  }
      catch (e)
      {        
		alert("Your browser does not support AJAX!");        
		return false;        
	  }      
	}    
  }


  xmlHttp.onreadystatechange=function()
  {
    if(xmlHttp.readyState==4)
    {
	  if(elem){
	    document.getElementById(elem).innerHTML=xmlHttp.responseText;
	  }
	  else{
	    document.getElementById("mod_"+moduleid).innerHTML=xmlHttp.responseText;
	  }
    }
  }

url = "index.php?page=ajax"+currpage;
if(param1) url = url+"&"+param1;
if(param2) url = url+"&"+param2;
if(param3) url = url+"&"+param3;
if(param4) url = url+"&"+param4;
if(param5) url = url+"&"+param5;
if(param6) url = url+"&"+param6;
if(param7) url = url+"&"+param7;
if(param8) url = url+"&"+param8;
if(param9) url = url+"&"+param9;
if(param10) url = url+"&"+param10;
if(param11) url = url+"&"+param11;

  xmlHttp.open("GET",url, true);
	
  xmlHttp.send(null);  
}


function ClearObject(elem){
	 document.getElementById(elem).innerHTML='<br><br><br><br><br><br><img src="images/loading.gif">';
}


// JavaScript Document
function El(id)
{
	return document.getElementById(id);
}

function HideElem(elemId)
{
	var tmp = El(elemId);
	if (tmp) tmp.style.display = 'none';

}

function FixLocation(divId, w, h)
{
	var tmpDiv = El(divId);
	if (tmpDiv == null) return;

	var topDelta;
	if (self.pageYOffset)
		topDelta = self.pageYOffset;
	else if (document.documentElement && document.documentElement.scrollTop)
		topDelta = self.document.documentElement.scrollTop;
	else if (document.body)
		topDelta = document.body.scrollTop;
	else
		topDelta = Math.floor(h / 2);

	topDelta -= Math.floor(h / 2);

	if (window.innerHeight)
		tmpDiv.style.top = (window.innerHeight / 2 + topDelta) + "px";
	else if (document.documentElement.clientHeight)
		tmpDiv.style.top = (document.documentElement.clientHeight / 2  + topDelta) + "px";
	else
		tmpDiv.style.top = (300 + topDelta) + "px";

	if (window.innerWidth)
		tmpDiv.style.left = (window.innerWidth / 2 - Math.floor(w / 2)) + "px";
	else if (document.documentElement.clientWidth)
		tmpDiv.style.left = (document.documentElement.clientWidth / 2 - Math.floor(w / 2)) + "px";
}

function BlockBackgroundAccess()
{
	var tmpDiv = El("blankdiv");
	tmpDiv.style.opacity = 0.4;
	tmpDiv.style.filter = "alpha(opacity=40)";
	tmpDiv.style.top = "0px";
	tmpDiv.style.left = "0px";

	var h = 0;
	if (window.innerHeight)
		h = window.innerHeight;
	else if (document.documentElement.clientHeight)
		h = document.documentElement.clientHeight;

	if (document.body.scrollHeight > document.body.offsetHeight)
	{
		tmpDiv.style.width = document.body.scrollWidth + "px";
		tmpDiv.style.height = Math.max(h, document.body.scrollHeight) + "px";
	}
	else
	{
		tmpDiv.style.width = document.body.offsetWidth + "px";
		tmpDiv.style.height = Math.max(h, document.body.offsetHeight) + "px";
	}
	tmpDiv.style.display = "block";
}

function popup(divId, w, h)
{
	FixLocation(divId, w, h);

	var tmpDiv = El(divId);
	if (tmpDiv == null) return;
	tmpDiv.style.display = "block";
	BlockBackgroundAccess();
}


function KeepCenter(divId, w, h)
{
	FixLocation(divId, w, h);
	setTimeout("KeepCenter('" + divId + "', " + w + ", " + h + ")", 50);
}

function ShowElement(elem) {
    var id = document.getElementById(elem);
    id.style.visibility = "visible";
}

function ShowEl(elem) {
    var id = document.getElementById(elem);
    id.style.display = 'block';
}
