function importXML(xmlFile)
{
    var xmlDoc;
    
	if(document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = function(){parseXML(xmlDoc);};
	}
	else if(window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {if(xmlDoc.readyState == 4) parseXML(xmlDoc);};
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}
	
	xmlDoc.load(xmlFile);
}

function parseXML(xml)
{
    var items = xml.getElementsByTagName("item");
    var bFound = false;
    
    if(document.referrer == "") //if they just tried surfing directly to this page
    {
        window.location = "http://www.cyberbeta.com/jameserror/"; //change this
        return;
    }
    
    for(var i = 0; i < items.length; i++)
    {
        if(document.referrer.indexOf(items[i].childNodes[0].nodeValue) == 0)
        {
            bFound = true;
            break;
        }
    }
    
    if(!bFound) //if they came from a page that was not in the XML lfile
        window.location = "http://www.cyberbeta.com/jameserror/"; //change this
}

importXML("check_domain.xml");
