nogoodname=false;
function loadimg(id,url){
	previousheight=document.getElementById('imgproduct').offsetHeight;
	document.getElementById('imgproduct').style.height='';
document.getElementById(id).src=url;
if(document.getElementById('imgproduct').offsetHeight<previousheight)document.getElementById('imgproduct').style.height=(previousheight-2)+'px';
}
function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   function insertAfter(parent, node, referenceNode) {	parent.insertBefore(node, referenceNode.nextSibling);}

function check(checking){
	notgood=false;
	message=true;
	for (i=0; i<document.getElementsByTagName('INPUT').length; ++i) {
		var sp2 = document.getElementsByTagName('INPUT')[i];
		if(nogoodname&&checking){
			message=false;
			document.getElementById('usrnaam').className='notfilledcorrect';
			notgood=document.getElementById('usrnaam');
			}
		if(sp2.id!='searching'&&sp2.type!='submit'&&sp2.value==''){
			if(checking){message=false;if(!notgood){notgood=sp2;}sp2.className='notfilledcorrect';}
			else{
			var sp1 = document.createElement("div");
			sp1.setAttribute("id", "test"+i);
			sp1.setAttribute("class", "infoinput");
			sp1.setAttribute("className", "infoinput");
			//sp1.setAttribute("style", "font-size:0.7em;color:red;");
			var sp1_content = document.createTextNode("* U dient dit veld in te vullen.");
			sp1.appendChild(sp1_content);
			
			var parentDiv = sp2.parentNode;
			parentDiv.insertBefore(sp1, sp2.nextSibling);
			document.getElementsByTagName('INPUT')[i].title='test'+i;
				document.getElementsByTagName('INPUT')[i].onchange=function(e){
					if(this.value==''){
					document.getElementById(this.title).innerHTML="* U dient dit veld in te vullen.";
					}
					else{
						if(this.id=='usrnaam'){
	var ajax = new GLM.AJAX();
	var pars='&value='+this.value;
	var url = 'inc/checkname.php';
ajax.callPage(url,  res, "POST", pars);
ajax.onError = myErrorHandler;
gebruiker=this.title			
							
							
							}
					document.getElementById(this.title).innerHTML="<br />";this.className='whitefilled';
					}
				}
			}
		}		
	}
	if(!message){alert('U heeft niet alles juist ingevuld.');document.documentElement.scrollTop=notgood.offsetTop-(screen.availHeight/2);}
}
function myErrorHandler(error){ 
alert('Er is een fout opgetreden.');
}
function res(response){
	if(response){
	document.getElementById(gebruiker).innerHTML='* De gebruikersnaam is al bezet.<br /> Kies alstublieft een andere gebruikersnaam.';
	nogoodname=true;notgood=document.getElementById('usrnaam');
	}
	else{
		nogoodname=false;
	}
}
function newpopup(URL,width,height){
	var id=Math.floor(Math.random()*1000)
	window.open(URL, id, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height);
}
