var openElementId;

function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

	 
function closebox(){
try{
document.getElementById(openElementId).style.display="none";
if (openElementId.indexOf("aantalbox") != -1){
var temp = openElementId.split("aantalbox",1);
if(IsNumeric(document.getElementById(temp[0]+"aantal").value)){
document.getElementById(temp[0]+"aantalcontent").innerHTML = document.getElementById(temp[0]+"aantal").value;
}else{
alert("Alleen aantallen in cijfers zijn toegestaan!");
document.getElementById(temp[0]+"aantal").value = document.getElementById(temp[0]+"aantalcontent").innerHTML;
}
}
}catch(e){}
}

function openmaat(id)
{
closebox();
document.getElementById(id+"maatbox").style.display="block";
openElementId = id + "maatbox";
}

function openaantal(id)
{
closebox();
document.getElementById(id+"aantalbox").style.display="block";
openElementId = id + "aantalbox";
}

function wijzigMaat(id,size){
document.getElementById(id+"maat").value=size;
document.getElementById(id+"maatcontent").innerHTML = size;
closebox();
}

function wijzigAantal(id){
if(IsNumeric(document.getElementById(id+"aantal").value)){
document.getElementById(id+"aantalcontent").innerHTML = document.getElementById(id+"aantal").value;
}else{
alert("Alleen aantallen in cijfers zijn toegestaan!");
document.getElementById(id+"aantal").value = document.getElementById(id+"aantalcontent").innerHTML;
}
closebox();
}

var nextcounter = 1;

function doNextImage(id){
document.getElementById("img"+id).innerHTML = eval("productimages"+id+"["+eval("imagenr"+id)+"]");
}

function showBig(imgid){
var bigsrc = document.getElementById(imgid).getAttribute('bigsrc');
var fotoid = document.getElementById(imgid).getAttribute('fotoid');
pop('foto.php?fotoID='+fotoid,370,'no');
}

function pop(url,size,resize)
{
	parameters = 'height='+size+',width='+size+',dependent=yes,directories=no,location=no,menubar=no,resizable='+resize+',scrollbars='+resize+ ',status=no,toolbar=no';
	newwindow = window.open(url,'name',parameters);
	if (window.focus) {newwindow.focus()}
	return false;
}
