// JavaScript Document

var xmlHttp

var params

var value = 0;


function listTotal() {
	
	
	for (var i=0; i < document.listing.business_upgrade.length; i++) {
   		if (document.listing.business_upgrade[i].checked) {
      		value = document.listing.business_upgrade[i].value;
      	}
   }

	
	var temp = '';
	
	for (i = 0; i < document.listing.cat_id.length; i++) {
		if (document.listing.cat_id[i].checked) {
																				
			temp = temp + "&cat_id[]=" + document.listing.cat_id[i].value;
					
		}
	}
	
	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
params = "listing=" + value+
			temp;
var url="getlistingtotal.php";
xmlHttp.onreadystatechange=stateChangedtotal;
xmlHttp.open("POST",url,true);
//Send the proper header information along with the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}

function stateChangedtotal() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtQuote").innerHTML=xmlHttp.responseText;
document.getElementById("total").value=xmlHttp.responseText;
if (document.getElementById("txtQuote").innerHTML != "0.00") {
	document.getElementById('advertise_head_billing').style.display = '';
	document.getElementById('billingrow').style.display = '';
	document.getElementById('billingrow2').style.display = '';
	document.getElementById('billingrow3').style.display = '';
	document.getElementById('billingrow4').style.display = '';
	document.getElementById('billingrow5').style.display = '';
	document.getElementById('billingrow6').style.display = '';
	document.getElementById('billingrow7').style.display = '';
	document.getElementById('billingrow8').style.display = '';
} else if (document.getElementById("txtQuote").innerHTML == "0.00") {
	document.getElementById('advertise_head_billing').style.display = 'none';
	document.getElementById('billingrow').style.display = 'none';
	document.getElementById('billingrow2').style.display = 'none';
	document.getElementById('billingrow3').style.display = 'none';
	document.getElementById('billingrow4').style.display = 'none';
	document.getElementById('billingrow5').style.display = 'none';
	document.getElementById('billingrow6').style.display = 'none';
	document.getElementById('billingrow7').style.display = 'none';
	document.getElementById('billingrow8').style.display = 'none';
}
}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

