// JavaScript Document
$(document).ready(function() {
	
	
	$('#overlayAJAX').jqm({trigger: 'a.overlayAJAX'});  
	$('.overlayAJAX').click(function() {
		doAJAXoverlay($(this).attr("id"));
		return false;
	  });
	
	
});

var http = getHTTPObject();

function getHTTPObject() {
  var xmlhttp;
  if (typeof XMLHttpRequest == 'undefined') {
  	XMLHttpRequest = function() { return new ActiveXObject('Microsoft.XMLHTTP') }
  }
  
  
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
	  xmlhttp = new XMLHttpRequest();
	} catch (e) {
	  xmlhttp = false;
	}
  }
  return xmlhttp;
}

function doAJAXoverlay(Content) {
  http.open("GET", "/gammacart/gammacart-ajax.php?Content=" + escape(Content) + "&cache=" + Math.random(), true);
  http.onreadystatechange = handleAJAXResponse;
  http.send(null);
}

function handleAJAXResponse() {
  if (http.readyState == 4) {
	document.getElementById('AJAXcart').src = http.responseText;
  }
}


