var site_url = 'http://www.drumza.com';

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=site_url+"/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 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 info(str,lnk)
{
document.getElementById('info').innerHTML="<a href='"+site_url+"/category/"+lnk+"/' class='hlink'>"+str+" <img src='"+site_url+"/img/arrow.png' alt='' /></a>";
}

function availability(name)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url=site_url+"/availability.php";
url=url+"?name="+name;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=showPrices;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showPrices()
{
if (xmlHttp.readyState==4)
{
document.getElementById("prices").innerHTML=xmlHttp.responseText;
document.getElementById('r_price').innerHTML=document.getElementById('l_price').value;
document.getElementById('check_availability').innerHTML=document.getElementById('lowest_price_id').value;
fade_q();
}
else
{
document.getElementById('prices').innerHTML='<div class="in_progress" style="margin:15px 0 35px 0;">Checking Who\'s Got it In Stock... <small>This can take a minute. Please wait...</small></div>';
document.getElementById('check_availability').innerHTML='<img src="'+site_url+'/img/loading.gif" width="24" height="24" alt="" />';
}
}

function fade_q() {
	$("#price").delay(200).fadeTo(900, 0.2, function () {
		$("#price").fadeTo(60, 10);
	});
}
