
function checkThinkers()
{
	var ok = 0; 
		
	if(ok)
	{
		document.getElementById("activate").innerHTML="test"; 
		
	}
	else
	{
			
	}
}

function updateReq(obj,id)
{
	var check = document.getElementById("checkthink").value;

		if( check == 1 )
		{
			//alert("binnen de check");
			 document.getElementById("thinker2").value = id;
			
			 //Activeren
			 obj.style.visibility="hidden";
			 document.getElementById("activate").innerHTML='<a href="request.php?thinkie1='+ document.getElementById("thinker1").value +'&thinkie2=' + document.getElementById("thinker2").value + '"><img src="img/here.jpg" ></img></a> <img class="light" src="img/greenlight.jpg"></img> '; 	
			
		}
		else
		{
			//alert("check staat op 0")
			document.getElementById("thinker1").value = id;
			obj.style.visibility="hidden";
			document.getElementById("checkthink").value ="1";
		}
			
	//alert("einde met check="+check+ "thinker1="+thinker1 + "thinker2="+thinker2);
		
}

function moreThinkers(obj,id,page)
{
	//alert(offset);
	
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("your browser doesn't support AJAX");
	}
	
	xmlHttp.onreadystatechange = function()
	{
		
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
		{	
			//alert(xmlHttp.responseText);
			obj.parentNode.parentNode.innerHTML =xmlHttp.responseText;
		}
	};
	
	url = 'moreThinkers.php';
	url = url + '?id=' + id;
	url = url + '&page='+ page; 
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function whyluck(reden)
{
	//alert(reden);
	
	var outp ='<p class="smalltxt">This person is getting Luck at this very moment for the folowing reason:</p><p class="reden">'+reden+'</p>';
	document.getElementById("outp").style.padding="10px";
	document.getElementById("outp").style.height="auto";
	document.getElementById("outp").innerHTML = outp;		
}

function clearoutp()
{
		document.getElementById("outp").innerHTML = "";
		document.getElementById("outp").style.padding="0px";
		document.getElementById("outp").style.height="0px";
		
}

function iwillthink(id)
{
	var req = "req_support"+id ;
	
	document.getElementById(req).innerHTML = '<p>First Name:  <INPUT id="inp1_'+id+'" type="text" name="firstname" > '
												+' Name:  <INPUT id="inp2_'+id+'" type="text" name="lastname"> Country:  <INPUT id="inp4_'+id+'" type="text" name="land"></p>'
												+'<p> Optional: Your Comment </p> '
												+' <p><textarea  id="inp3_'+id+'" rows="2" cols="50" name="comment"></textarea> <span class="addth" onClick="thinkeradd('+id+')"> -><u>I will think of You</u></span></p>' ;
}

function thinkeradd(id)
{
	var req1 = "inp1_"+id ;
	var req2 = "inp2_"+id ;
	var req3 = "inp3_"+id ;
	var req4 = "inp4_"+id ;
	
	var inp1 = document.getElementById(req1).value;
	var inp2 = document.getElementById(req2).value;
	var inp3 = document.getElementById(req3).value;
	var inp4 = document.getElementById(req4).value;
	
	//alert(inp1);
	
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("your browser doesn't support AJAX");
	}
	
	xmlHttp.onreadystatechange = function()
	{
		
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
		{	
			//alert(xmlHttp.responseText);
			
		}
	};
	
	url = 'addThinkers.php';
	url = url + '?firstname=' + inp1;
	url = url + '&lastname='+ inp2; 
	url = url + '&comment='+ inp3; 
	url = url + '&land='+ inp4; 
	url = url + '&id='+ id;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
	
	
	var req = "req_support"+id ;
	document.getElementById(req).innerHTML="";
	
}

function viewThinkers(id)
{
	//alert("over");
	var req = "com_"+id ;
	
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("your browser doesn't support AJAX");
	}
	
	xmlHttp.onreadystatechange = function()
	{
		
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
		{	
			
			
			document.getElementById(req).innerHTML= xmlHttp.responseText;
			//document.getElementById(req).style.visibility="visible";
			//alert(xmlHttp.responseText);
		}
	};
	
	url = 'comments.php';
	url = url + '?id=' + id;

	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);		
}

function clearComments(id, link)
{
	var req = "com_"+id ;
	//document.getElementById(req).style.visibility= "hidden";	
	document.getElementById(req).innerHTML="";
}

function luckNow()
{
	document.getElementById("lucknow").innerHTML= '<img id="bt" src="img/lucknow.jpg"></img>';	
	//alert("test");
}

function updateClick( sponsorid,weblink )
{
		
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("your browser doesn't support AJAX");
	}
	
	xmlHttp.onreadystatechange = function()
	{
		
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
		{	
			window.location=weblink; 
		}
	};
	
	url = 'updateSponsor.php';
	url = url + '?id=' + sponsorid;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}






