// Functie bestand Catalogus module

PositionX = 100;
PositionY = 100;
defaultWidth  = 500;
defaultHeight = 500;
var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=120-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["Image"].width;');writeln('window.innerHeight=document.images["Image"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="Image" src="'+imageURL+'" style="display:block"></body></html>');
close();		
}}

function changePic(pic, picnr){
 a = document.getElementById('picture');
 a.src = '/images_items/500/' + pic;

 b = document.getElementById('picture_link');
 b.href = 'javascript:window.open("/images_items/500/'+pic+'","picture","width=520,height=520,scrollbars=no");void("");';
}

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){
	a = document.getElementById('img_big');
	a.src = afbeelding;
	
	b = document.getElementById('picture_link');
  b.href = 'javascript:window.open("'+afbeelding+'","picture","width=520,height=520,scrollbars=no");void("");';

	a.width = 200;
	a.Height = 200;
}

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 = 'bag_item_delete.asp?id=all';
	}
	return;
}

function bagRecalc(){
 document.frmCheck.action = '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;
}
