var xmlHttp,forms,fields,data,url;
var attribute,method;

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function price(url,data,attribute)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

url=url+"?" + attribute + "="+data;
xmlHttp.onreadystatechange=calculateTotal;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function calculateTotal() 
{ 
if (xmlHttp.readyState==4)
{ 
	var response	= xmlHttp.responseText;
	var splitter	= response.split(",");
	
	document.getElementById("total").innerHTML=splitter[0];
	document.getElementById("totalAmount").innerHTML=splitter[1];
	document.getElementById("totalDueAtTrip").innerHTML=splitter[2];
	
}
}


function putInSession(url,data,attribute)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

url=url+"?" + attribute + "="+data;
xmlHttp.onreadystatechange=getCharacter;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function getCharacter() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("sessionTxt").innerHTML=xmlHttp.responseText;
}
}

function countParks(url,data,attribute)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

url=url+"?" + attribute + "="+data;
xmlHttp.onreadystatechange=getCharacter;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
//Generic XML HTTP Object
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;
}