function createRequestObject() {
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
return ajaxRequest;
}
function sndReq(action, tag, post, format) {
var http = createRequestObject();
http.open('get', 'http://www.whatsonpodcast.com/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-ajax.php?action='+action+'&tag='+tag+'&post='+post+'&format='+format,true);
http.onreadystatechange = function() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById("tags-" + update[0]).innerHTML = update[1];
}
}
}
http.send(null);
}
function sndReqNoResp(action, tag, post) {
var http = createRequestObject();
http.open('get', 'http://www.whatsonpodcast.com/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-ajax.php?action='+action+'&tag='+tag+'&post='+post);
http.send(null);
}
function sndReqGenResp(action, tag, post, format) {
var http = createRequestObject();
http.open('get', 'http://www.whatsonpodcast.com/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-ajax.php?action='+action+'&tag='+tag+'&post='+post+'&format='+format);
http.onreadystatechange = function () {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
document.getElementById("ajaxResponse").innerHTML = response;
}
}
http.send(null);
}
function handleResponseGeneric() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
document.getElementById("ajaxResponse").innerHTML = response;
}
}
function handleResponse() {
if(http.readyState == 4){
alert(http.readyState);
var response = http.responseText;
var update = new Array();
if(response.indexOf('|' != -1)) {
update = response.split('|');
alert('tags-'+ update[0]);
document.getElementById("tags-" + update[0]).innerHTML = update[1];
}
}
}
function autoSuggestKeywords(post) {
var theField = document.getElementById("content");
var CurrentText = theField.value;
var content ='<\?xml version="1.0" ?>\n ';
var http = createRequestObject();
try {
http.open('POST','http://www.whatsonpodcast.com/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-ajax.php?action=autosuggest&post=' + post,true);
http.setRequestHeader('content-type', 'text/xml');
http.onreadystatechange = function () {
if(http.readyState == 4){
document.getElementById("AutoSuggestedTags").innerHTML = http.responseText;
}
};
http.send(content);
} catch (ex) {
alert("Something has gone wrong:" + ex);
}
}
function askYahooForKeywords() {
var theField = document.getElementById("content");
var CurrentText = theField.value;
var content ='<\?xml version="1.0" ?>\n ';
var http = createRequestObject();
try {
http.open('POST','http://www.whatsonpodcast.com/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-ajax.php?action=requestKeywords&service=yahoo',true);
http.setRequestHeader('content-type', 'text/xml');
http.onreadystatechange = function () {
if(http.readyState == 4){
document.getElementById("yahooSuggestedTags").innerHTML = http.responseText;
}
};
http.send(content);
} catch (ex) {
alert("Something has gone wrong:" + ex);
}
}
function askTagyuForKeywords() {
var theField = document.getElementById("content");
var CurrentText = theField.value;
var content ='<\?xml version="1.0" ?>\n ';
var http = createRequestObject();
try {
http.open('POST','http://www.whatsonpodcast.com/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-ajax.php?action=requestKeywords&service=tagyu',true);
http.setRequestHeader('content-type', 'text/xml');
http.onreadystatechange = function () {
if(http.readyState == 4){
document.getElementById("tagyuSuggestedTags").innerHTML = http.responseText;
}
};
http.send(content);
} catch (ex) {
alert("Something has gone wrong:" + ex);
}
}