var type_xml = false;var delete_id = '';/* Switching Criteria */function makeFaveXMLRequest(url, parameters) {	type_xml = false;	if (window.XMLHttpRequest) { // Mozilla, Safari,...		type_xml = new XMLHttpRequest();		if (type_xml.overrideMimeType) {			type_xml.overrideMimeType('text/plain');		}	} else if (window.ActiveXObject) { // IE		try {			type_xml = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e) {			try {				type_xml = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e) {}		}	}	if (!type_xml) {		alert('Cannot make connection to server. Please upgrade or use a different browser.');		return false;	}	type_xml.onreadystatechange = changeType;	type_xml.open("POST", url, true);	type_xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	type_xml.setRequestHeader("Content-length", parameters.length);	type_xml.setRequestHeader("Connection", "close");	type_xml.send(parameters);}function changeType() {	if (type_xml.readyState != 4) return false;	if (type_xml.status != 200) return false;	var text = type_xml.responseText;	if (!text) return false;		if (text == 'saved') {		// Did the article get added?		alert('This page has been saved to your profile!');		//document.getElementById('save_to_profile').innerHTML = 'Saved!';	} else if (text == 'existing')  {		// Was the article not added?		alert('This page is already saved to your profile.');	} else if (text == 'deleted')  {		// Was the article deleted?		document.getElementById(delete_id).style.display = 'none';	} else if (text == 'session')  {		// Was the article not added?		alert('Please log in before saving to your profile.');	} else {		// Did we have an error		alert('We could not save to your profile. '+text);	}}function saveArticle(type,id) {	makeFaveXMLRequest('/', 'action=custom&swa=save_favorite&table='+type+'&id='+id);}function removeArticle(type,id) {	makeFaveXMLRequest('/', 'action=custom&swa=remove_favorite&'+type+'_'+id+'=1');	delete_id = 'li_'+type+'_'+id;}