function ajax(url,returnid){
	var doc = null;
	if (typeof window.ActiveXObject != 'undefined' ){
		doc = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		doc = new XMLHttpRequest();
	}
	if (doc){
		doc.open("GET", url, false);
		doc.send(null);
		if(returnid!=null)
			document.getElementById(returnid).innerHTML = doc.responseText;
	}
}
	
function addto(uid){
	if(uid!='') {
		ajax('ajax.php?op=add&id='+uid,'cart');
		message();
	}
}

function viewcart(){
	ajax('ajax.php?op=view','cart');
}

function remove(uid){
	if(uid!=''){
		ajax('ajax.php?op=off&id='+uid,'cart');
		message();	
	}
	viewcart();
}

function load_desc(val,returnid){
	var uid=val.value;
	if(uid!='') {
		ajax('ajax.php?op=desc&id='+uid,returnid);
	}
}

function message(){
	ajax('ajax.php?op=msg','messages');
}

function show(what,theother) {
	document.getElementById(what).style.display = 'block';
	document.getElementById(theother).style.display = 'none';
}

function checkdate(o) {
	if (document.all && typeof(window.XMLHttpRequest) == "function" && !window.opera) { $(this).parents("form").find("select").css("visibility","hidden"); }
	o = o.previousSibling;
	// it's just a plain calendar popup
	cal.clearDisabledDates();
	var yesterday = new Date();
	yesterday.setDate( yesterday.getDate() - 1 );
	cal.addDisabledDates( null, formatDate( yesterday, "MM/dd/yyyy" ) );
	cal.select( o,"form-cal-0", "MM/dd/yyyy", yesterday );
	return false;
}