function ajaxInner(url,elemID,timetrue,timeoutmilli)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById(elemID).innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("POST",url,true);
    xmlHttp.send(null);
	
	if(timetrue){
		setTimeout("ajaxInner('"+url+"','"+elemID+"','"+timetrue+"','"+timeoutmilli+"')",timeoutmilli);
	}
	
}
  
function logout(utype){

if(confirm('Weet je zeker dan je wilt uitloggen?')){

ajaxInner('logout.php','logout',false,0);
alert('Je bent nu uitgelogd!');

if(utype == "cont"){
window.location.href="index.php";
} else {
window.location.href="admin.php";
}

}

}

function sendScore(){

core    = document.score.core.value;
mem     = document.score.mem.value;
fps     = document.score.fps.value;
cooling = document.score.cooling.value;

if(confirm('Je staat op het punt om de volgende gegevens te verzenden:\n\nCore: '+core+' Mhz\nMem: '+mem+' Mhz\nFPS: '+fps+'\nCooling: '+cooling+'\n\nKun je dit bevestigen?')){
return true;
} else {
return false;
}

}

function dummieCheck(){

document.score.fps.value = document.score.fps.value.replace(/,/,".");

}

function checkIfNumeric(x){

l = x.length;

check = true;
while(l >= 0){

if(x.charAt(l) != 0 && x.charAt(l) != 1 && x.charAt(l) != 2 && x.charAt(l) != 3 && x.charAt(l) != 4 && x.charAt(l) != 5 && x.charAt(l) != 6 && x.charAt(l) != 7 && x.charAt(l) != 8 && x.charAt(l) != 9){
check = false;
}

l = l - 1;
}

if(check == false){
return false;
} else {
return true;
}

}

function checkIfNumericFPS(x){

l = x.length;

check = true;
while(l >= 0){

if(x.charAt(l) != 0 && x.charAt(l) != 1 && x.charAt(l) != 2 && x.charAt(l) != 3 && x.charAt(l) != 4 && x.charAt(l) != 5 && x.charAt(l) != 6 && x.charAt(l) != 7 && x.charAt(l) != 8 && x.charAt(l) != 9 && x.charAt(l) != ',' && x.charAt(l) != '.'){
check = false;
}

l = l - 1;
}

if(check == false){
return false;
} else {
return true;
}

}

function numericCheckCore(y)
{

if(!checkIfNumeric(y.value))
{
y.value = lastcore;
alert('De ingevoerde waarde bij \'core\' is niet numeriek!');
} else {
lastcore = y.value;
}

}

function numericCheckMem(y)
{

if(!checkIfNumeric(y.value))
{
y.value = lastmem;
alert('De ingevoerde waarde bij \'mem\' is niet numeriek!');
} else {
lastmem = y.value;
}

}

function numericCheckFPS(y)
{

if(!checkIfNumericFPS(y.value))
{
y.value = lastfps;
alert('De ingevoerde waarde bij \'FPS\' is niet numeriek!');
} else {
lastfps = y.value;
}

}

function getContribPage()
{

id = document.getElementById('page').value;

if(id > 0)
{

document.getElementById('info').style.border = "1px #cccccc solid";

ajaxInner('get_contrib_info.php?id='+id,'info',false,0);

}

}

lastcore = lastmem = lastfps = null;