// here we define global variable
var ajaxdestination="";

function getdata(what,where) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 document.getElementById(where).innerHTML ="<table width=100%><tr><td width=100%><center><img src='/images/loading.gif'></center><br><br><br></td></tr></table>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
  return false;
}

function postdata(what,where,datainput) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 var datalink = document.getElementById(datainput).value;
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what+datalink);
 xmlhttp.send(null);
  return false;
}


function storetext(what,where,datainput1,datainput2,datainput3) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 var datalink1 = document.getElementById(datainput1).value;
 var datalink2 = document.getElementById(datainput2).value;
 var datalink3 = document.getElementById(datainput3).value;
 var tlink = what + 'title=' + datalink1 + '&description=' + datalink2 + '&keywords=' + datalink3;
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", tlink);
 xmlhttp.send(null);
  return false;
}



function getsilent(what,where) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
  return false;
}


function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) 
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}



function ClearInput(value, id){ // This calls our function ClearInput, and the two variables we will need for it to function the original value and the id.
 var input = document.getElementById(id); // Gets the input field based on its id.

 if(value == input.value){ // If the default value is equal to the current value.
	input.value = ''; // Empty It.
 }else{ // Else the value is not equal to the current input field value.
	input.value = input.value; // Leave it the same.
 } // End Else.
} // Close Function.


function togglem(eId){
var divn1 = document.getElementById(eId);
if (divn1.style.display == "none") { divn1.style.display = "block"; }
else { divn1.style.display = "none"; }
}

