var scrollTimer;
var imprCount = 16;
totImprWidth = 192*imprCount;
hiddenWidthNeg = 744 - totImprWidth;
step = 6;
interval = 25;

var myImages = new Array();


function calculateLeftmargin() {
	if(window.innerWidth) {
		width = window.innerWidth;		
	}
	else if(document.body) {
		width = document.body.offsetWidth;
	}
	
	if(width < 820) {
		width = 820;
	}
	leftmargin = (width-800)/2;		
	leftmargin -= 10; //scrollbar	
	/*
	if(showscroll()) {
		leftmargin -= 10;		
	}
	*/	
	return(leftmargin);
}

function setLeftmargin() {
	leftMargin = calculateLeftmargin();
	document.getElementById("mainbox").style.left = leftMargin;
	document.getElementById("mainbox").style.display = "";
}


function naviOver(i) {
	document.getElementById("navimg"+i).src = "img/navimg"+i+"act.jpg";
}

function naviOut(i) {
	document.getElementById("navimg"+i).src = "img/navimg"+i+".jpg";
}

function resizeImprBox() {	
	document.getElementById("imprboxinner").style.width = totImprWidth;
}


function scrollRighty() {
	left = document.getElementById("imprboxinner").style.left;

	if(left=="") {
		left = 0;
		document.getElementById("scrollButtonLeft").src = "img/arr_left_inact.gif";
	}
	else {
		document.getElementById("scrollButtonLeft").src = "img/arr_left_act.gif";
		leftArray = left.split("p");
		left = leftArray[0];
	}
	if(left>(hiddenWidthNeg)) {		
		left = left - step;
		document.getElementById("imprboxinner").style.left = left+"px";
		scrollTimer = setTimeout("scrollRighty()",interval);
	}
	else {
		document.getElementById("scrollButtonRight").src = "img/arr_right_inact.gif";
	}
}

function scrollLefty() {
	left = document.getElementById("imprboxinner").style.left;

	if(left=="") {
		left = 0;
	}
	else {
		document.getElementById("scrollButtonLeft").src = "img/arr_left_act.gif";
		leftArray = left.split("p");
		left = leftArray[0];
	}
	
	left = parseInt(left);
	
	if(left < 0) {		
		left = left + step;
		document.getElementById("imprboxinner").style.left = left+"px";
		scrollTimer = setTimeout("scrollLefty()",interval);
		document.getElementById("scrollButtonRight").src = "img/arr_right_act.gif";
	}
	else {
		document.getElementById("scrollButtonLeft").src = "img/arr_left_inact.gif";
	}
}

function scrollStop() {
	clearTimeout(scrollTimer);
}


function bigImpr(filename) {
    imgWindow = window.open("bigimg.html?filename="+filename,"bigImgWin","width=20,height=20,top=50,left=100,scrollbars=no");
    imgWindow.focus();
}

function disclaimer() {
	window.open("disclaimer.html","discl_win","width=450,height=570,top=50,left=100,scrollbars=yes");
}

function preloadImages() {
    for (i=0;i<preloadImages.arguments.length;i++) {
        myImages[i] = new Image();
        myImages[i].src = preloadImages.arguments[i];
    }
}
