//
// Clear the html form element.
//
// output: Object/string id where output should be cleared.
//
function clearQuest(output) {
if (typeof(output) == 'string') {
output = document.getElementById(output);
}
output.innerHTML = '';
}
//
// Look up quest by giving the id of an html form element.
//
// id: String name of the id of the form element.
// output: Object/string id where output should be displayed.
//
function lookupQuestFromForm(id, output) {
var search = document.getElementById(id);
return lookupQuest(search, output);
}
//
// Look up quest by giving search string or html form element.
//
// search: Search string, or html form element with value.
// output: Object/string id where output should be displayed.
//
function lookupQuest(search, output) {
if (typeof(search) == 'object') {
search = search.value;
}
if (typeof(output) == 'string') {
output = document.getElementById(output);
}
if (search == null || search == '' || output == null) {
return;
}
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
output.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open('GET', '/quests/?q=' + escape(search) + '&p', true);
xmlHttp.send(null);
}
//
// Look up telescope by giving the id of an html form element.
//
// id: String name of the id of the form element.
// output: Object/string id where output should be displayed.
//
function lookupTelescopeFromForm(id, output) {
var search = document.getElementById(id);
return lookupTelescope(search, output);
}
//
// Look up telescope by giving search string or html form element.
//
// search: Search string, or html form element with value.
// output: Object/string id where output should be displayed.
//
function lookupTelescope(search, output) {
if (typeof(search) == 'object') {
search = search.value;
}
if (typeof(output) == 'string') {
output = document.getElementById(output);
}
if (search == null || search == '' || output == null) {
return;
}
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
output.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open('GET', '/quests/atp/?q=' + escape(search), true);
xmlHttp.send(null);
}
//
// Clear the html form element.
//
// output: Object/string id where output should be cleared.
//
function clearSpell(output) {
if (typeof(output) == 'string') {
output = document.getElementById(output);
}
output.innerHTML = '';
}
//
// Look up spell by giving the id of an html form element.
//
// id: String name of the id of the form element.
// output: Object/string id where output should be displayed.
//
function lookupSpellFromForm(id, output) {
var search = document.getElementById(id);
return lookupSpell(search, output);
}
//
// Look up spell by giving search string or html form element.
//
// search: Search string, or html form element with value.
// output: Object/string id where output should be displayed.
//
function lookupSpell(search, output) {
if (typeof(search) == 'object') {
search = search.value;
}
if (typeof(output) == 'string') {
output = document.getElementById(output);
}
if (search == null || search == '' || output == null) {
return;
}
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
output.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open('GET', '/spells/?q=' + escape(search) + '&p', true);
xmlHttp.send(null);
}
//
//
function lookupPlaqueDiffFromForm(old_plaque_id, new_plaque_id, sort_by_id, reverse_id, limit_id, output) {
var old_plaque = document.getElementById(old_plaque_id);
var new_plaque = document.getElementById(new_plaque_id);
var sort_by = document.getElementById(sort_by_id);
var reverse = document.getElementById(reverse_id);
var limit = document.getElementById(limit_id);
return lookupPlaqueDiff(old_plaque, new_plaque, sort_by, reverse, limit, output);
}
//
//
function lookupPlaqueDiff(old_plaque, new_plaque, sort_by, reverse, limit, output) {
if (typeof(old_plaque) == 'object') {
old_plaque = old_plaque.value;
}
if (typeof(new_plaque) == 'object') {
new_plaque = new_plaque.value;
}
if (typeof(sort_by) == 'object') {
sort_by = sort_by.value;
}
if (typeof(reverse) == 'object') {
reverse = reverse.checked;
}
if (typeof(limit) == 'object') {
limit = limit.value;
}
if (typeof(output) == 'string') {
output = document.getElementById(output);
}
if (new_plaque == null || new_plaque == '' ||
old_plaque == null || old_plaque == '' ||
sort_by == null || sort_by == '' ||
reverse == null ||
limit == null || limit == '' ||
output == null) {
return;
}
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
output.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open('GET', '/plaque/?old=' + escape(old_plaque) + '&new=' + escape(new_plaque) + '&sort=' + escape(sort_by) + (reverse ? '&reverse' : '') + '&limit=' + escape(limit) + '&p', true);
xmlHttp.send(null);
}
//
// Toggle display value on given arguments.
//
// id: Object/string of element to toggle.
// display: Type of display if it's displayed.
// onchange: Function to call when state is changed.
//
function toggleDisplay(id, display, onchange) {
if (typeof(id) == 'string') {
id = document.getElementById(id);
}
if (id == null || id == '') {
return;
}
if (display == null || display == '') {
display = 'block';
}
if (id.style.display == display || id.style.display == '') {
id.style.display = 'none';
if (typeof(onchange) == 'function') {
onchange(false);
}
} else {
id.style.display = display;
if (typeof(onchange) == 'function') {
onchange(true);
}
}
}