			var $currentPay="payinst0";

function setPaymentFields($payID)
{
	returnObjById($currentPay).style.visibility = "hidden";
	returnObjById($payID).style.visibility = "visible";
	$currentPay = $payID; 
}


function ajaxFunction($ajaxFunction, $additionalVars, $showWhileLoading, $loadResultsToID)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
  xmlhttp.onreadystatechange = function() {
  
  var mypage;
  
      if (xmlhttp.readyState == 4) {

          //Hide the loading element
          if ($showWhileLoading != null)
              returnObjById($showWhileLoading).style.visibility = 'hidden';
          //Show the destination control, in case hidden.
          returnObjById($loadResultsToID).style.visibility = 'visible';
          //Update it's output
          returnObjById($loadResultsToID).innerHTML = xmlhttp.responseText;
      }
      else {
          if ($showWhileLoading != null)
              returnObjById($showWhileLoading).style.visibility = 'visible';
      }
  }
xmlhttp.open("GET","index2.php?option=com_sebercart&view=ajax&func=" + $ajaxFunction + $additionalVars,true);
xmlhttp.send(null);
}



function returnObjById(id) 
{
	if (document.getElementById)
    	var returnVar = document.getElementById(id);
    else if (document.all)
    	var returnVar = document.all[id];
    else if (document.layers)
    	var returnVar = document.layers[id];
	return returnVar;
}


