function handleResponse() {
    if(http.readyState == 4){

        var return_string = http.responseText;

        //window.alert(return_string);

        //if there's an error in the update
        if (return_string.substring(0,5) == 'error'){
            var broken_string = return_string.split("|");
            var id = broken_string[1];
            var old_value = broken_string[2];

            window.alert('Error updating content.');
            //alert(return_string);
            //display the display section, fill it with prior content
            document.getElementById(id+'_rg_display_section').innerHTML = old_value;
            document.getElementById(id+'_rg_display_section').style.display = '';
            //hide editing and saving sections
            document.getElementById(id+'_hv_editing_section').style.display = 'none';
            document.getElementById(id+'_hv_saving_section').style.display = 'none';
        }

        else{
            var broken_string = return_string.split("|");
            var id = broken_string[0];
            var replaceText = myStripSlashes(broken_string[1]);
            //window.alert(id);
            //window.alert(replaceText);

			//var replaceText = document.getElementById(return_string).value;
			//display the display section, fill it with new content
			if (replaceText != "{selectbox}"){
				document.getElementById(id+'_rg_display_section').innerHTML = replaceText;
			}
			else{
				var the_selectbox = document.getElementById(id);
				document.getElementById(id+'_rg_display_section').innerHTML = the_selectbox.options[the_selectbox.selectedIndex].text;
			}
            document.getElementById(id+'_rg_display_section').style.display = '';
            //hide editing and saving sections
            document.getElementById(id+'_hv_editing_section').style.display = 'none';
            document.getElementById(id+'_hv_saving_section').style.display = 'none';
        }
    }
}

function handleDelete() {
	if(http.readyState == 4){
		var return_string = http.responseText;

		//if there's an error in the delete
		if (return_string.substring(0,5) == 'error'){
			var broken_string = return_string.split("|");
			var id = broken_string[1];
		}
		else{
			var id = return_string;
			Effect.Fade('row_' + id);
		}
	}
}

function myAddSlashes(str) {
    str=str.replace(/\"/g,'\\"');
    return str;
}

function myStripSlashes(str) {
    str=str.replace(/\\'/g,'\'');
    str=str.replace(/\\"/g,'"');
    return str;
}

function hover(obj){
    obj.className='class_hover';
}

function unHover(obj){
    obj.className = 'class_no_hover';
}