function messageConfirm(message) {
	if (document.all) {
		var elements = document.all;
		
		for (i = 0; i < elements.length; i++) {
			elements[i].style.filter = 'Alpha(Opacity=70)';
		}
	}
	
	if (window.confirm(message)) {
		if (document.all) {
			for (i = 0; i < elements.length; i++) {
				elements[i].style.filter = 'none';
			}
		}
			
		return true;
	} else {
		if (document.all) {
			for (i = 0; i < elements.length; i++) {
				elements[i].style.filter = 'none';
			}
		}
		
		return false;
	}
}

function euro_format(amount) {
	amount = roundNumber(amount, 2);
	amount = '&euro; ' + amount.replace('.', ',');
	
	return amount;
}

function datasize(bytes, type) {
	var value = bytes;
	var res;
	if (!isNaN(value)) {
		if(type == "KB") {
			value = Math.round((bytes / 1024) * 100) / 100;
			res = value+" KB";
		}
		if(type == "MB") {
			value = Math.round((bytes / [Math.pow(1024, 2)]) * 1000000) / 1000000;
			res = value+" MB";
		}
		if(type == "GB") {
			value = Math.round((bytes / [Math.pow(1024, 3)]) * 1000000) / 1000000;
			res = value+" GB";
		}
		return res;
	} else {
		return "Error";
	}
}

function randomPassword() {
	chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
	pass = "";
	var length = "8";
		for(x = 0; x<length; x++) {
			i = Math.floor(Math.random() * 62);
			pass += chars.charAt(i);
		}
	return pass;
}

function makePassword() {
	add_user.password.value = randomPassword();
	return false;
}

function img_status(img, art) {
	t = new Image;
	t.src = img;
	document.getElementById(art).innerHTML = (t.width + " x " + t.height);
	if (t.width < 600) {
		document.getElementById(art).className = ("txt_error");
		window.alert ("Gekozen afbeelding voldoet niet aan minimale resolutie.\nVoor optimaal resultaat, gebruik een resolutie van minimaal 600 x 500 pixels.")
	} else if (t.height < 500) {
		document.getElementById(art).className = ("txt_error");
		window.alert ("Gekozen afbeelding voldoet niet aan minimale resolutie.")
	}
}

function selectArt(pcconfig_grp) {
	var url   = 'http://www.goris.nl/new/inc/body/computersystemen/select_art.php?pgid=' + pcconfig_grp;
	var wnd   = window.open(url, '_blank', 'toolbar=no, location=no, menubar=no, scrollbars=yes, width=500, height=600, resizeable=no, status=no');
	wnd.focus();
}

function insertArt(pcconfig_art, art_id, art_name, art_price, int_price) {
	opener.document.getElementById('name_'+pcconfig_art).innerHTML = art_name;
	opener.document.getElementById('price_'+pcconfig_art).innerHTML = '<b>'+art_price+'</b>';
	opener.document.config.price[pcconfig_art-1].value = int_price;
	totalPrice();
	window.close();
}
