			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","index.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;
}

			function setBillCopy()
			{
				$BGCOL = "#c3c3c3";
				$RETBGCOL = "#000000";
				if (returnObjById('chkCopyBill').checked)
				{
					//alert("Enable");
					returnObjById('txtShipTitle').setAttribute('readonly','readonly');
					returnObjById('txtShipTitle').style.color = $BGCOL;
					returnObjById('txtShipFirstName').setAttribute('readonly','readonly');
					returnObjById('txtShipFirstName').style.color = $BGCOL;
					returnObjById('txtShipSurname').setAttribute('readonly','readonly');
					returnObjById('txtShipSurname').style.color = $BGCOL;
					returnObjById('txtShipAdd1').setAttribute('readonly','readonly');
					returnObjById('txtShipAdd1').style.color = $BGCOL;
					returnObjById('txtShipAdd2').setAttribute('readonly','readonly');
					returnObjById('txtShipAdd2').style.color = $BGCOL;
					returnObjById('txtShipSuburb').setAttribute('readonly','readonly');
					returnObjById('txtShipSuburb').style.color = $BGCOL;
					returnObjById('txtShipState').setAttribute('readonly','readonly');
					returnObjById('txtShipState').style.color = $BGCOL;
					returnObjById('txtShipPostcode').setAttribute('readonly','readonly');
					returnObjById('txtShipPostcode').style.color = $BGCOL;
					returnObjById('ddlShipCountry').setAttribute('readonly','readonly');
					returnObjById('ddlShipCountry').style.color = $BGCOL;
					returnObjById('txtShipPhone').setAttribute('readonly','readonly');
					returnObjById('txtShipPhone').style.color = $BGCOL;
					
					returnObjById('txtShipTitle').value = returnObjById('txtBillTitle').value;
					returnObjById('txtShipFirstName').value = returnObjById('txtBillFirstName').value;
					returnObjById('txtShipSurname').value = returnObjById('txtBillSurname').value;
					returnObjById('txtShipAdd1').value = returnObjById('txtBillAdd1').value;
					returnObjById('txtShipAdd2').value = returnObjById('txtBillAdd2').value;
					returnObjById('txtShipSuburb').value = returnObjById('txtBillSuburb').value;
					returnObjById('txtShipState').value = returnObjById('txtBillState').value;
					returnObjById('txtShipPostcode').value = returnObjById('txtBillPostcode').value;
					returnObjById('ddlShipCountry').selectedIndex = returnObjById('ddlBillCountry').selectedIndex;
					returnObjById('txtShipPhone').value = returnObjById('txtBillPhone').value;
				}
				else
				{
					//alert("Disable");
					returnObjById('txtShipTitle').removeAttribute('readonly');
					returnObjById('txtShipTitle').style.color = $RETBGCOL;
					returnObjById('txtShipFirstName').removeAttribute('readonly');
					returnObjById('txtShipFirstName').style.color = $RETBGCOL;
					returnObjById('txtShipSurname').removeAttribute('readonly');
					returnObjById('txtShipSurname').style.color = $RETBGCOL;
					returnObjById('txtShipAdd1').removeAttribute('readonly');
					returnObjById('txtShipAdd1').style.color = $RETBGCOL;
					returnObjById('txtShipAdd2').removeAttribute('readonly');
					returnObjById('txtShipAdd2').style.color = $RETBGCOL;
					returnObjById('txtShipSuburb').removeAttribute('readonly');
					returnObjById('txtShipSuburb').style.color = $RETBGCOL;
					returnObjById('txtShipState').removeAttribute('readonly');
					returnObjById('txtShipState').style.color = $RETBGCOL;
					returnObjById('txtShipPostcode').removeAttribute('readonly');
					returnObjById('txtShipPostcode').style.color = $RETBGCOL;
					returnObjById('ddlShipCountry').setAttribute('readonly','readonly');
					returnObjById('ddlShipCountry').style.color = $RETBGCOL;
					returnObjById('txtShipPhone').removeAttribute('readonly');
					returnObjById('txtShipPhone').style.color = $RETBGCOL;
				}
			}

