function showInvHint(str)
{
if (str.length==0)
{
document.getElementById("topHint").innerHTML="";
document.getElementById("topHint").style.display="none";
return;
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="http://www.drumza.com/includes/sfk.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("topHint").style.display="block";
document.getElementById("topHint").innerHTML=xmlHttp.responseText;
}
}

function showRelImg(str)
{
if (str.length==0)
{
document.getElementById("relImg").innerHTML="";
document.getElementById("relImg").style.display="none";
document.getElementById("iminfo").innerHTML="";
return;
}
xmlHttp=GetXmlHttpImg();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var g1c
for (var i=0; i<document.edit_form.rd.length; i++) {
if (document.edit_form.rd[i].checked) {
g1c = document.edit_form.rd[i].value
}
}

var url="http://www.drumza.com/includes/sfkimg.php";
url=url+"?q="+str;
url=url+"&rd="+g1c;
url=url+"&pn="+document.getElementById("name_orig").value;
url=url+"&im="+document.getElementById("image_url").value;
url=url+"&prid="+document.getElementById("prid").value;
url=url+"&rprid="+document.getElementById("rprid").value;
url=url+"&page="+document.getElementById("pgf").value;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateImgChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function GetXmlHttpImg()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

function stateImgChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("ldl").style.display="none";
document.getElementById("relImg").style.display="block";
document.getElementById("relImg").innerHTML=xmlHttp.responseText;
}
else
{
document.getElementById("ldl").style.display="block";
}
}

function shwRelName(str)
{
if (str.length==0)
{
document.getElementById("nmatch").style.display="none";
document.getElementById("nspc").style.display="block";
return;
}
xmlHttp=GetXmlHttpNam();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="http://www.drumza.com/includes/nfk.php";
url=url+"?qn="+str;
url=url+"&pn="+document.getElementById("name_orig_cl").value;
url=url+"&nid="+document.getElementById("nid").value;
url=url+"&sids="+Math.random();
xmlHttp.onreadystatechange=stateNamChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function GetXmlHttpNam()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

function stateNamChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("ldl").style.display="none";
document.getElementById("nspc").style.display="none";
document.getElementById("nmatch").style.display="block";
document.getElementById("nmatch").innerHTML=xmlHttp.responseText;
}
else
{
document.getElementById("ldl").style.display="block";
}
}

function invertAll(headerfield, checkform, mask)
{
for (var i = 0; i < checkform.length; i++)
{
if (typeof(checkform[i].name) == "undefined" || (typeof(mask) != "undefined" && checkform[i].name.substr(0, mask.length) != mask))
continue;
if (!checkform[i].disabled)
checkform[i].checked = headerfield.checked;
}
}

function surroundText(text1, text2, textarea)
{
if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
{
var caretPos = textarea.caretPos, temp_length = caretPos.text.length;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? text1 + caretPos.text + text2 + " " : text1 + caretPos.text + text2;
if (temp_length == 0)
{
caretPos.moveStart("character", -text2.length);
caretPos.moveEnd("character", -text2.length);
caretPos.select();
}
else
textarea.focus(caretPos);
}
else if (typeof(textarea.selectionStart) != "undefined")
{
var begin = textarea.value.substr(0, textarea.selectionStart);
var selection = textarea.value.substr(textarea.selectionStart, textarea.selectionEnd - textarea.selectionStart);
var end = textarea.value.substr(textarea.selectionEnd);
var newCursorPos = textarea.selectionStart;
var scrollPos = textarea.scrollTop;
textarea.value = begin + text1 + selection + text2 + end;
if (textarea.setSelectionRange)
{
if (selection.length == 0)
textarea.setSelectionRange(newCursorPos + text1.length, newCursorPos + text1.length);
else
textarea.setSelectionRange(newCursorPos, newCursorPos + text1.length + selection.length + text2.length);
textarea.focus();
}
textarea.scrollTop = scrollPos;
}
else
{
textarea.value += text1 + text2;
textarea.focus(textarea.value.length - 1);
}
}

function safety()
{
if(document.edit_form.safe.checked==false)
{
document.edit_form.sub.disabled=false;
days=3000;
myDate = new Date();
myDate.setTime(myDate.getTime()-(days*24*60*60*1000));
document.cookie = 'DrumZaAdmnSafe=1; expires=' + myDate.toGMTString();
document.edit_form.sub.className="searchButton";
document.getElementById("lock").src="http://www.drumza.com/img/lockoff.jpg";
}
if(document.edit_form.safe.checked==true)
{
document.edit_form.sub.enabled=false;
days=3000;
myDate = new Date();
myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
document.cookie = 'DrumZaAdmnSafe=1; expires=' + myDate.toGMTString();
document.edit_form.sub.disabled=true;
document.edit_form.sub.className="searchButtonD";
document.getElementById("lock").src="http://www.drumza.com/img/lockon.jpg";
}
}

function redir()
{
if(document.edit_form.DrumZaAdmnRedir.checked==false)
{
days=3000;
myDate = new Date();
myDate.setTime(myDate.getTime()-(days*24*60*60*1000));
document.cookie = 'DrumZaAdmnRedir=1; expires=' + myDate.toGMTString();
document.getElementById("back").src="http://www.drumza.com/img/backoff.jpg";
}
if(document.edit_form.DrumZaAdmnRedir.checked==true)
{
days=3000;
myDate = new Date();
myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
document.cookie = 'DrumZaAdmnRedir=1; expires=' + myDate.toGMTString();
document.getElementById("back").src="http://www.drumza.com/img/backon.jpg";
}
}

function info(str,lnk)
{
document.getElementById('info').innerHTML="<a href='http://www.drumza.com/category/"+lnk+"/' class='hlink'>"+str+" <img src='http://www.drumza.com/img/arrow.jpg' alt='' /></a>";
}

function getMerchants(name)
{
xmlHttp=GetXmlHttpMerch();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="http://www.drumza.com/includes/load_merch_nfk.php";
url=url+"?name="+name;
url=url+"&sids="+Math.random();
xmlHttp.onreadystatechange=stateMerchChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function GetXmlHttpMerch()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

function stateMerchChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("ldl").style.display="none";
document.getElementById("iminfo").innerHTML=xmlHttp.responseText;
}
else
{
document.getElementById("ldl").style.display="block";
}
}