function AJAX(){
try{
xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
return xmlHttp;
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
return xmlHttp;
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
return xmlHttp;
}
catch (e){
alert("Your browser does not support AJAX.");
return false;
}

}
}
}

function cart_items(){
// Customise those settings
var divid = "shopping_cart";
var url = "cart_items.php";
// Create xmlHttp
var xmlHttp_two = AJAX();
// No cache
//var timestamp = fetch_unix_timestamp();
var nocacheurl = url;
// The code...
xmlHttp_two.onreadystatechange=function(){
if(xmlHttp_two.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp_two.responseText;
//setTimeout('refreshdiv_timeinwashington()',seconds*1000);

}

}
xmlHttp_two.open("GET",nocacheurl+'?bustcache='+new Date().getTime(),true);
xmlHttp_two.send(null);
}




$(document).ready(function()
{
$(".form_submit").click(function(){
var element = $(this);
var Id = element.attr("id");
var product_id = $("#product_id"+Id).val();
var unit_price = $("#unit_price"+Id).val();
var quantity = $("#quantity"+Id).val();
var session_id = $("#session_id"+Id).val();
var user = $("#user"+Id).val();
var division = $("#division"+Id).val();

var dataString = 'product_id='+ product_id + '&unit_price=' + unit_price + '&quantity=' + quantity + '&session_id=' + session_id + '&user=' + user + '&division=' + division + '&com_msgid=' + Id;
if(quantity=='')
{
alert("Please enter Quantity");
}
else
{
document.getElementById('loadplace'+Id).innerHTML = '';
document.getElementById('flash'+Id).innerHTML = '';
document.getElementById('slidepanel'+Id).innerHTML = '';
document.getElementById('shopping_cart').innerHTML = '';

$("#flash"+Id).show();
$("#flash"+Id).fadeIn(400).html('<img src="images/ajax-loader.gif" align="absmiddle"> loading.....');
$("#shopping_cart").fadeIn(400).html('<img src="images/ajax-loader.gif" align="absmiddle">');
$.ajax({
type: "POST",
url: "cart_entry_ajax.php",
data: dataString,
cache: false,
success: function(html){
$("#loadplace"+Id).append(html);
$("#flash"+Id).hide();
cart_items();
//$("#loadplace"+Id).html('');
}
});
}return false;});});

