// Functie bestand Catalogus module

var Zoom=0;
var ZoomItem='';

function ViewImage(ifile) {

if (ifile == '')	ifile = document.getElementById('img_big').src;	

ititle='Simplybest'

ifile = ifile.replace("/items/thumb200/","/items/origineel/");
var win;
var sWidth;
var sHeight;
win = window.open("","imageviewer","width=100,height=100,scrollbars=no,status=no,resizable=yes");

win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("<script>");
win.document.write("function resize_window(){");
win.document.write("a=document.getElementById('imgbig');");
win.document.write("window.resizeTo(a.width+10,a.height+80); ");
win.document.write("}</script><style>BODY {margin:0px;}</style>");
win.document.write('</head><body onload="resize_window();">');
win.document.write('<img id="imgbig" src="'+ifile+'">');
win.document.write("</body></html>");

win.document.close();
}

function changeborder(color, id){
	a = document.getElementById(id);
	a.style.borderColor = color;
	return;
}

function getItem(id){
 location.href = '/cat/front/item_info.asp' + id;
}

function getimage(afbeelding,width,height){
	a = document.getElementById('img_big');
	a.src = afbeelding;
	
	a.width = width;
	a.height = height;

}

function numbersonly(){
 if (event.keyCode<48||event.keyCode>57)
  return false
}

function changeClass(id, klasse){
 document.getElementById(id).className = klasse;
}

function submitForm(formulier){
	document[formulier].submit();
}

/* Formulier check functies */

// Controleren van alleen getallen die ingevoerd mogen worden
function checkInteger(FormObject,melding){
	var checkOK = "0123456789";	
	var FieldFilled = true;
	for(var c=0; c <= FormObject.value.length -1; c++) {
		if (checkOK.indexOf(FormObject.value.charAt(c)) == -1) {
			FieldFilled = false;				
		}
	}
	if (FieldFilled == false){ 
		alert(melding);
		FormObject.select();
		FormObject.focus();
		return false;
	}
}


// Controleren van alleen prijzen die ingevoerd mogen worden
function checkPrice(FormObject,melding){
	var checkOK = "0123456789,";	
	var FieldFilled = true;
	for(var c=0; c <= FormObject.value.length -1; c++) {
		if (checkOK.indexOf(FormObject.value.charAt(c)) == -1) {
			FieldFilled = false;				
		}
	}
	if (FieldFilled == false){ 
		alert(melding);
		FormObject.select();
		FormObject.focus();
		return false;
	}
}

function setVerplicht(){
	td = document.getElementsByTagName('td');
	for (i = 0; i <= td.length-1; i++){
		if (td[i].id){
			if (td[i].id == 'form_verplicht'){
					td[i].className = 'form_verplicht_red';
			}
		}
	}
	
	return false;
}

function checkForm(id){
	a = document['itmFrm' + id].aantal;
	if (a.value == '' || parseInt(a.value) == 0){
	 alert('U dient een geldig aantal op te geven');
	 a.focus();
	 return;
	}
	
	document['itmFrm' + id].action = '/cat/front/item_to_bag.asp';
	document['itmFrm' + id].submit();
}
/* Einde Formulier check functies */


function bagDelete(txt){
	if (confirm(txt)){
	 location.href = '/cat/front/bag_item_delete.asp?id=all';
	}
	return;
}

function bagRecalc(){
 document.frmCheck.action = '/cat/front/bag_recalc.asp';
 document.frmCheck.submit();
 return;
}

function bagStep(page){
 location.href = page;
 return;
}

function bagNextStep(page){
 //document.frmCheck.action = page;
 if (document.frmCheck.onsubmit() == true){
	 document.frmCheck.action = page;
	 document.frmCheck.submit();
 }
}

function bagSend(){
	frmCheck.submit();
	return;
}
