
window.onload = function() {

	var term1 = document.getElementById('term1');
	var term2 = document.getElementById('term2');
	var profiles = document.getElementById('profiles');
	if(term1) {
		term1.style.display = 'block';
	}
	
	if(term2) {
		term2.style.display = 'none';
	}
	
	if(profiles) {
		profiles.style.display = 'none';
	}
	

}


function resizeMe(width, height) {
	var NS = (navigator.appName=="Netscape")?true:false; 

	self.resizeTo(width, height);

	var iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
	var iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
	var iWidth = document.images[0].width - iWidth; 
	var iHeight = document.images[0].height - iHeight; 
	
	/*window.resizeBy(iWidth, iHeight); */
	
	var mijnbreedte = (window.screen.width/2) - (width/2);
    var mijnhoogte = (window.screen.height/2) - (height/2);
    self.moveTo(mijnbreedte, mijnhoogte);
    self.focus();
 	
}

function centerDiv() {
	screenWidth = document.body.clientWidth/2;
	obj1 = document.getElementById('menu');
	obj1.style.left = screenWidth-264;
	obj2 = document.getElementById('logo');
	obj2.style.left = screenWidth-27;
}	

function centerMe(width, height) {
	var mijnbreedte = (window.screen.width/2) - (width/2);
    var mijnhoogte = (window.screen.height/2) - (height/2);
    self.moveTo(mijnbreedte, mijnhoogte);
    self.focus();
}

function viewImage(welke)
{
	var mijnbreedte = (window.screen.width/2);
	var mijnhoogte = (window.screen.height/2);
 	window.open("image.php?id="+welke,"image","resizable=1,scrollbars=1,status=no,screenx="+mijnbreedte+",screeny="+mijnhoogte+",left="+mijnbreedte+",top="+mijnhoogte);
}

function CheckAuth() {
	
	if (document.formulier.authorization.value == "")
	{
		alert ("Please submit your authorization code.");
		document.formulier.authorization.focus();
		return false;
	} else 	{
		return true;
	}
}


function Goto(url) {
	document.location.href=url;
}



function TextScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;
	{
		if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {
				div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
				div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
				div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
            }
        }
    }

	this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

	this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

	this.scrollDown = function() {
		if (this.div_obj) {
			this.scrollCursor += this.speed;
			this.div_obj.scrollTop = this.scrollCursor;
			if (this.div_obj.scrollTop == this.scrollCursor) {
				this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
			} else {
				this.scrollCursor = this.div_obj.scrollTop;
			}
		}
	}

	this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}



function showDiv(div) {
	el = document.getElementById(div);
	visible = el.style.display;

	if(div=='term1') {
		document.getElementById('term1').style.display = 'block';
		document.getElementById('term2').style.display = 'none';
		document.getElementById('profiles').style.display = 'none';
	} else if(div=='term2') {
		document.getElementById('term1').style.display = 'none';
		document.getElementById('term2').style.display = 'block';
		document.getElementById('profiles').style.display = 'none';
	} else if(div=='profiles') {
		document.getElementById('term2').style.display = 'none';
		document.getElementById('term1').style.display = 'none';
		document.getElementById('profiles').style.display = 'block';
	} else if(div=='overlay') {
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
		document.getElementById('lightbox').style.top = lightboxTop;
		document.getElementById('lightbox').style.display = '';
		el.style.height = arrayPageSize[1]+"px";
	} else {
		if(visible=='block') {
			el.style.display = 'none';
		} else {
			el.style.display = 'block';
		}
	}
}

function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


