
function getData(userID){
	document.getElementById('rightCol').innerHTML = "<div style=\"cursor: pointer; padding: 4px; height: 15px; background: #FF822C;\">Saving ...</div>";
	myVar = Sortable.serialize('RightBox');
	processCustom(myVar, userID);
}

function processCustom(myVar, userID){
	
	if (typeof document.body.style.maxHeight != "undefined") {
	  // IE 7, mozilla, safari, opera 9
		path = "users/customSidebar.php";
	} else {
	  // IE6, older browsers
		path = "../../users/customSidebar.php";
	}

	myVar = myVar.replace(/&/g,"");
	vars = "?sort="+myVar+"&id="+userID;
	//alert(path+vars);
	//only continue if xmlHttp isn't void
	//alert(xmlHttp.readyState);
	if(xmlHttp && (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)){
		//try to connect to the server
		try{
			// Initiate reading the async.txt file from the server
			xmlHttp.open("GET", path+vars, true);
			//Send the proper header information along with the request
			xmlHttp.onreadystatechange = handleRequestStateChangeCustom;
			xmlHttp.send(null);

		}catch(z){
			//Display the error in case of failure
			alert("Can't Connect to the server:\n"+ z.toString());
		}
		
	}
	
	
}// END Process Function



/*************************************
***** HANDLE REQUESTS START HERE *****
*************************************/

// Function that handles the http response
function handleRequestStateChangeCustom(){
	//alert("Handling");
	// Obtain a reference to the <div> element on the page
	myDiv = document.getElementById("rightCol");
			//Continue only if the server response if "OK"
			if(xmlHttp.readyState == 4){
				
				if(xmlHttp.status == 200){
				try{
					//Read the message from the server
					response = xmlHttp.responseText;
					// Display the result
					myDiv.innerHTML = response;
					
				}catch(z){
					alert("Error reading the response: "+ z.toString());
				}
				
			}else{
				// Display error message
				alert("There was an error getting the data:\n" + xmlHttp.statusText)
			}
			}
			
}


function changeStyleOver(div){
	div.style.background = '#FF822C';
}
function changeStyleOut(div){
	div.style.background = '#B55C11';
}
