var win = null;

function NewWindow(mypage, myname, w, h, scroll, resize) {

	LeftPosition = (screen.width)?(screen.width-w)/2:0;

	TopPosition = (screen.height)?(screen.height-h)/2:0;

	settings = "height="+h+",width="+w+",top="+TopPosition+",left="+LeftPosition+",scrollbars="+scroll+",resizable="+resize;

	win = window.open(mypage, myname, settings);

}







function setGallery(pics, page) {

	max = (pics-page)*88;

	timer = 0;

	target = 88;

	scroll('l');

}



function scroll(d) {

	if (target < 0) target = 0;

	else if (target > max) target = max;

	

	if (d == "l") {

		if (target > 0) {

			target -= 88;

			if (timer == 0) timer = setTimeout("move()", 50);

		}

	}

	else if (d == "r") {

		if (target < max) {

			target += 88;

			if (timer == 0) timer = setTimeout("move()", 50);

		}

	}

}



function move() {

	if (target < 0) target = 0;

	else if (target > max) target = max;

	

	scrollDiv = document.getElementById('imageContainer');

	

	if (scrollDiv.scrollLeft < target) {

		scrollDiv.scrollLeft += 2;

		timer = setTimeout("move()", 20);

	}

	else if (scrollDiv.scrollLeft > target) {

		scrollDiv.scrollLeft -= 2;

		timer = setTimeout("move()", 20);

	}

	else {

		clearTimeout(timer);

		timer = 0;

	}

}




function decode(l, shift) {  

    g = ""; c = "";  
	
	for (i=0; i<l.length; i++) {
		
		c = l.charAt(i);
		
		g += String.fromCharCode(c.charCodeAt(0) - shift);
		
	}  
	
    window.location.href = g;  
	
}