var id=0;
var site=0;
var oInterval="";
var s;
function get_php(url)
{

        doc=null;
        if (window.XMLHttpRequest)
        {
                doc=new XMLHttpRequest()
        }
        else if (window.ActiveXObject)
        {
                doc=new ActiveXObject("Microsoft.XMLHTTP")
        }
        if (doc!=null)
        {
                doc.open("GET",url,false);
                doc.send(null);
                return doc.responseText;
        }
}

function go(a)
{
   window.parent.parent.hoofdframe.location=a;
   location="zwart.html";
}

function fnStartInterval(tid,tsite)
{
	id=tid;
	site=tsite;

        if(oInterval=="")
                oInterval=window.setInterval("fnRecycle()",10000);
}

function fnRecycle()
{
	var result=0;
	window.clearInterval(oInterval);
	result = get_php("checkn.php?id="+id+"&random="+Math.random());
	if(result>1000) 
	{
		id=result;
		tijd=2000;
		oInterval=window.setInterval("fnRecycle()",8000);
	}
	else if(result==3) 
	{
		s="/nieuw/verbroken2.php?site="+site+"&id="+id;
		go(s);
	}
	else if(result<0)
	{
		oInterval=window.setInterval("fnRecycle()",8000);
	}
	else oInterval=window.setInterval("fnRecycle()",2000);
}


