All pastes #421056 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-02 15:59 UTC
rendered paste body
var httpTitle = getHTTPObject();
var urlTitle = "/ajax/photo_title.php?id=";

function handleHttpResponseTitle() {
	if (httpTitle.readyState == 4) {
		if (httpTitle.responseText.indexOf('invalid') == -1) {
			results = httpTitle.responseText;
			
			if (results != "") {
				data = results.split("||");
				
				document.getElementById('title-'+data[1]).innerHTML = data[2];
				
				add_title = false;
				photo_id = entry_id = "";
				
				if (data[2] == "") {
					document.getElementById('title-'+data[1]).className = "img_title_box-add";
					document.getElementById('title-'+data[1]).innerHTML = "Add Title";
				}
				else document.getElementById('title-'+data[1]).className = "img_title_box";
			}
		}
	}
}

function addTitle(id, img_id) {
	title = document.getElementById('img_title-'+img_id).value;
	httpTitle.open("GET", urlTitle + id + "&img="+ img_id + "&title="+ encodeURIComponent(title), true);
	httpTitle.onreadystatechange = handleHttpResponseTitle;
	httpTitle.send(null);

}