

function updateBasket(id, action){
	var xmlhttp=false; //Clear our fetching variable
    try {
            xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
    } catch (e) {
            try {
                    xmlhttp = new
                    ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
        } catch (E) {
            xmlhttp = false;
                    }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
            xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
    }
    var file = '/shopping_basket_contents.php?id='+id; //This is the path to the file we just finished making *
    if ( action == 'remove') file = file+'&remove=yes';
    
    var d = new Date();
	var tm=d.getDate() + d.getHours() + d.getMinutes() + d.getMilliseconds();
	file += '&tm='+tm 
	
    xmlhttp.open('GET', file, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
                      document.getElementById('shopping_basket').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
    }
    xmlhttp.send(null) //Nullify the XMLHttpRequest
    if ( action == 'remove') window.location = "/pay.php"
	return;
}



var hasDom=true;
var hasAll=document.all;
var hasNSDom=document.layers;

function disguise() {
	var ary=disguise.arguments;
	for(a=0;a<ary.length;a++) {
			var name=ary[a];
			if (hasDom) {
					var lyrStyle=document.getElementById("lyr_"+name).style;
					lyrStyle.display="none";
			}
	}
}

function reveal() {
	var ary=reveal.arguments;
	for(a=0;a<ary.length;a++) {
	var name=ary[a];
			if (hasDom) {
				var lyrStyle=document.getElementById("lyr_"+name).style;
				lyrStyle.display="block";
			}

	}
}

function submitForm() {
	var errorMessage = "";
	if ( !document.pay_form.vpc_Card.value ) 
		errorMessage += "Please enter a card type.\n";
	if ( !document.pay_form.vpc_CardNum.value ) 
		errorMessage += "Please enter the card number.\n";
	if ( !(document.pay_form.vpc_CardExp_month.value && document.pay_form.vpc_CardExp_year.value)) 
		errorMessage += "Please enter the card expiry.\n";

	if (errorMessage == "") {
		document.pay_form.submit();
		return true;
	} else {
		window.alert(errorMessage);
		return false;
	}
}
	
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

