function getHTTPObject() {
	var http = false;
	//Use IE's ActiveX items to load the file.
	if(typeof ActiveXObject != 'undefined') {
		try {http = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {http = new ActiveXObject("Microsoft.XMLHTTP");}
			catch (E) {http = false;}
		}
	//If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document.
	} else if (XMLHttpRequest) {
		try {http = new XMLHttpRequest();}
		catch (e) {http = false;}
	}
	return http;
}

function remove(category,subcategory,index){
	var http = getHTTPObject();
	var params = 'action=remove&category='+category+'&subcategory='+subcategory+'&index='+index;
	http.open("POST", "/includes/ajax.php", true);
	
	//Send the proper header infomation along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function(){
		switch(http.readyState){
			case 4:
				if(http.status == 200){
					window.location = '/order-a-sample/my-samples/';
				}
			break;
			case 3:
				// Processing/Loading
			break;
		}
	}
	http.send(params);
}

function toggleBox(id,el){
	var element = document.getElementById(id);
	if(element.style.display == 'none'){
		element.style.display = 'block';
		el.style.backgroundImage = "url(/images/down_arrow.gif)";
	}else{
		element.style.display = 'none';
		el.style.backgroundImage = "url(/images/side_arrow.gif)";
	}
}
