var xmlHttp

function attemptClaim()
{
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Cannot execute script. Browser does not support it.");
		return
	} 
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET", "http://neoboffins.com/s/cb/chkEntry.php?bb_name=" + document.getElementById("bb_name").value + "&bb_bcolour=" + document.getElementById("bb_bcolour").value + "&bb_icon=" + document.getElementById("bb_icon").value + "&bb_website=" + document.getElementById("bb_website").value + "&bb_block=" + document.getElementById("bb_block").value, true);
	xmlHttp.send(null);
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		execScript(xmlHttp.responseText); 
	}
} 

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
} 


function execScript(script)
{
	newScript = document.createElement('script');
	newScript.text = script;
	newScript.type = "text/javascript";
	document.getElementsByTagName('head')[0].appendChild(newScript);
}

function shDiv(divID, divState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[divID] :
   document.getElementById ?  document.getElementById(divID).style :
   document.all[divID].style;
   obj.visibility = document.layers ? (divState ? "show" : "hide") :
   (divState ? "visible" : "hidden");
}
function showBlock(event, infoNAME, infoURL, infoDATE)
{
	document.getElementById("infoBox").style.left = ((event.clientX + document.body.scrollLeft)+15) + "px";
 	document.getElementById("infoBox").style.top = ((event.clientY + document.body.scrollTop)+15) + "px";
	document.getElementById("infoBox").innerHTML = "<h1>" + infoNAME + "</h1><h2>" + infoURL + "</h2><h3>" + infoDATE + "</h3>";
	shDiv("infoBox", 1);
}
function hideBlock()
{
	shDiv("infoBox", 0);
}
function backout()
{
	shDiv("Overlay", 0);
	shDiv("OverlayClaim", 0);
}
function claimBlock(Bint)
{
	frameWidth = document.documentElement.clientWidth;
	frameWidth = ((frameWidth/2) - 200);
	document.getElementById("bb_block").value = Bint;
	document.getElementById("OverlayClaim").style.left = frameWidth + "px";
	shDiv("Overlay", 1);
	shDiv("OverlayClaim", 1);
}
function claimColour(colour)
{
	document.getElementById("bb_bcolour").value = colour;
	document.getElementById("bbPreview").style.backgroundColor = "#" + colour;
}
function claimIcon(cimg)
{
	document.getElementById("bb_icon").value = cimg;
	document.getElementById("bbPreview").style.backgroundImage = "url(i/default/" + cimg + ".gif)";
}
