// JavaScript Document
var ie;
var selectedSize=0;
var altText='';
var backGround=[ "#dceeef url(images/background2008n.jpg) center left no-repeat",
	"#dceeef url(images/background2008.jpg) center left no-repeat" ]; 

if (document.all) {
  ie = true;
}

var win_width,win_height;
function dimensions() {
	if (ie) {
		win_width=document.body.clientWidth; 
		win_height=document.body.clientHeight;
	}
	else {
		win_width=innerWidth;
		win_height=innerHeight;
	}
}

function getElementsByClassName(tagname, classname) {
	if (!document.getElementById) return false;
	var TagElements = document.getElementsByTagName(tagname);
	var elementsByClassName = new Array();
	for (i=0; i<TagElements.length; i++) {
		if (TagElements[i].className == classname) {
			elementsByClassName[elementsByClassName.length] = TagElements[i];
		}
	}
	return elementsByClassName;
}

function changeclassstyle(tagname,classname,styleproperty,newstyle) {
	var tochange = getElementsByClassName(tagname,classname);
	for (k=0; k < tochange.length; k++) {
		eval("tochange[k].style." + styleproperty + " = " + "'" + newstyle + "'");
	}
}

var showHeight=[ 400, 650, 900, 1150 ];

function initialize () {
/*	if (ie) {
		document.all['tekstbox'].style.width=(win_width-offsets[selectedSize].textbox)+"px";
	}
	// Set the height of the images and the tekstbox bottom to scale the images under all browsers
	if (win_height < 500 ) {
		var maxHeight = win_height-offsets[selectedSize].maxheight;
		var maxWidth = (win_width - 240) / 5;
		changeclassstyle('img','productfoto','height', Math.min(maxHeight, maxWidth));
		document.getElementById('tekstbox').style.height="160px";
		document.getElementById('productfotos').style.left="190px";
		document.getElementById('productfotos').style.bottom="30px";
	} else {
		var maxHeight = win_height-offsets[selectedSize].maxheight-90;
		var maxWidth = (win_width - 120) / 5;
		changeclassstyle('img','productfoto','height',Math.min(maxHeight,maxWidth));
		document.getElementById('productfotos').style.bottom="50px";
	}*/
	document.getElementById('tekstbox').style.height=(win_height - 295)+"px";
	document.getElementById('tekstbox').style.width=(win_width - 620)+"px";
	nbthumbs=0;
	for (i=0; i< showHeight.length; i++) {
		if (win_height > showHeight[i] && i < prodImg.length) {
			document.getElementById('pf'+i).style.display='block';
			nbthumbs++;
		}
	}
	if (nbthumbs) shiftLeft();
	if (prodImg.length > nbthumbs) {
		document.getElementById('uparrow').style.display='block';
		document.getElementById('downarrow').style.display='block';
	}
}

// Functions to scroll the array of images in the product area. Requires definition of the prodImg array in the page loading this Java script
var curImg=1;
function shiftLeft() {
	curImg--;
	if (curImg < 0)
		curImg += prodImg.length;
	for (i=0; i<4; i++) {
		document.images['pf'+i].src=prodImg[(i+curImg) % prodImg.length].src;	// Image itself
		document.images['pf'+i].alt=prodImg[(i+curImg) % prodImg.length].alt;	// Alt text of image
	}
}
function shiftRight() {
	curImg++;
	for (i=0; i<4; i++) {
		document.images['pf'+i].src=prodImg[(i+curImg) % prodImg.length].src;	// Image itself
		document.images['pf'+i].alt=prodImg[(i+curImg) % prodImg.length].alt;	// Alt text of image
	}
}
var w;
function setStyle() {
	if (w) {
		w.document.body.style.margin='0px';
		w.document.title=altText;
		w.focus();
	}
}
function ShowImage(x) {
	altText=prodImg[(curImg+x) % prodImg.length].alt;
	if (prodImg[(curImg+x) % prodImg.length].large != null) {
		w=window.open(prodImg[(curImg+x) % prodImg.length].large,"Plaatje","height=400,width=401");
		if (!w) {
			window.alert("Kan de pop-up met de foto niet openen. Heeft u een pop-up blocker aanstaan, houdt dan  de <Ctrl> toets ingedrukt en klik nogmaals op de link.");
		} else {
			setTimeout(setStyle,100);
			w.document.title=altText;
		}
	}
}
function indexinitialize () {
	dimensions();
	cellheight = Math.floor((win_height-80)/2);
	cellwidth = Math.floor((win_width / 2));
	if (cellheight < cellwidth) {
		changeclassstyle('img','celruimte','height',cellheight+'px');
		changeclassstyle('img','celruimte','width',cellheight+'px');
	} else {
		changeclassstyle('img','celruimte','height',cellwidth+'px');
		changeclassstyle('img','celruimte','width',cellwidth+'px');
	}
}

function adjustToWindowSize() {
	dimensions();
	if (win_width >= 950) {
		selectedSize=1;
		document.body.style.background=backGround[selectedSize];
	}
}

//Disable right mouse click Script

var message="© DUO-URN®. DUO-URN® is een registered trademark.";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")



