function resizeWindow(fenster,setw,seth){
	setw = setw;
	seth = seth;
	return fenster.resizeTo(setw,seth),fenster.resizeTo(setw*2-((typeof fenster.innerWidth ==
	"undefined")?fenster.document.body.clientWidth:fenster.innerWidth),seth*2-((typeof fenster.innerHeight ==
	"undefined")?fenster.document.body.clientHeight:fenster.innerHeight));
}

function openPic(url,winName,winParams,width,height) {
	var theWindow = window.open(url,winName,winParams);
	if (theWindow) {
		theWindow.focus();
		theWindow.innerWidth = width;
		theWindow.innerHeight = height;
	}
	return false;
}

function logFile(tag,type) {
	var http = null;
	if (window.XMLHttpRequest) {
		http = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (http != null) {
		http.abort();
		if (type == 'pic') {
			var temp = "/fileadmin/log/logentry.php?pic=" + tag.getAttribute('name');
		}
		else if (type == 'page') {
			var temp = "/fileadmin/log/logentry.php?page=" + tag.document.URL;
		}
	
		http.open("GET", temp.toString() , false);
		http.send(null);
	}
}

function ChangePage() {	
	var pages=new Array("ocho","plantlampsmall","moloch","fredersen","bubblebaptism","chair",
	                    "chatterley","tesla","plantinstallation","planttable",
	                    "room","trapp","vitisvinifera","plantlamplarge","plantbench");

	for (var i = 0; i < pages.length; i++) {

		if ( location.href.substring(0,35) == "http://kranengille.gillegallery.nl/" && location.href.substring(35,location.href.length-1) == pages[i] ) {
			document.all.LeftArrow.style.visibility =		"visible";
			document.all.RightArrow.style.visibility =	"visible";
			if ( i == 0 )									document.all.LeftArrowA.href = pages[pages.length - 1] + "/";
			else 													document.all.LeftArrowA.href = pages[i - 1] + "/";
			if ( i == pages.length - 1 )	document.all.RightArrowA.href = pages[0] + "/";
			else													document.all.RightArrowA.href = pages[i+1] + "/";
		}
	}
}

//Written by Nathan Faubion: http://n-son.com
//Use this or edit how you want, just give me
//some credit!

function ConstructScroller() {
	var el = document.getElementById('outer-1');

	var self = this;
	var list = el.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className.indexOf("inner") > -1) {
			o = list[i];
			
			if (o.offsetHeight > 525) {
			  document.all.UpArrow.style.visibility = "visible";
			  document.all.DownArrow.style.visibility = "visible";

				window.scroller = new jsScroller(el, 800, 525);
			}
			
		}
	}
}

function jsScroller (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className.indexOf("inner") > -1) {
			o = list[i];
			
			if (o.offsetHeight > 525) {
			  document.all.UpArrow.style.visibility = "visible";
			  document.all.DownArrow.style.visibility = "visible";
			}
			
		}
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px";
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 10
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("inner") > -1) {
				o = list[i];
			}
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
};

