
//*************
//*** POPUP ***
//*************
function popup(theURL, winName, W, H){
	var x = (window.screen.width  - W) / 4;
	var y = (window.screen.height - H) / 2;
	//W = window.screen.width;
	//H = window.screen.height;
	windowProps = 'width='+W+',height='+H+',status=no,menubar=no,resizable=no,location=no,directories=no,scrollbars=no,toolbar=no,left='+x+',top='+y;
	theMovieWindow = window.open(theURL, winName, windowProps);
	theMovieWindow.focus();
	theMovieWindow.moveTo(x,y);
	//return theMovieWindow;
}
//*************

//**************
//*** MAILTO ***
//**************
function mailTo(){
	str = "mailto:";
	str += "vgl";
	str += "@";
	str += "vglcph";
	str += ".dk";
	location.href = str;
}
//**************

//*********************
//*** TOGGLE ACTIVE *** (className)
//*********************
function toggleActive(id){
	if(document.getElementById( id ).className == 'item_inactive'){
		document.getElementById( id ).className = 'item_active';
	}else{
		document.getElementById( id ).className = 'item_inactive';
	}
	//alert(document.getElementById( id ).className);
}
//*********************

//***************
//*** HIDE ALL *** (style.display)
//***************
function hideAll(){
	var i;
	var im;
	var imgID;
	// cat 1
	for(i=0; i<cat1Array.length; i++){
		imgID = cat1Array[i]+"_img";
		document.getElementById( imgID ).src = "img/arrow_closed.png";
		document.getElementById( cat1Array[i] ).style.display = 'none';
	}
	// cat 2
	for(i=0; i<cat2Array.length; i++){
		imgID = cat2Array[i]+"_img";
		document.getElementById( imgID ).src = "img/arrow_closed.png";
		document.getElementById( cat2Array[i] ).style.display = 'none';
	}
	// sider
	for(i=0; i<sideArray.length; i++){
		imgID = sideArray[i]+"_img";
		document.getElementById( imgID ).src = "img/arrow_closed.png";
		document.getElementById( sideArray[i] ).style.display = 'none';
	}
	// images
	for(i=0; i<imgArray.length; i++){
		for(im=0; im<imgArray[i].length; im++){
			document.getElementById( imgArray[i][im] ).style.display = 'none';
		}
	}
}
//***************

//****************
//*** SHOW ALL *** (style.display)
//****************
function showAll(){
	var i;
	var im;
	var imgID;
	// cat 1
	for(i=0; i<cat1Array.length; i++){
		imgID = cat1Array[i]+"_img";
		document.getElementById( imgID ).src = "img/arrow_opened.png";
		document.getElementById( cat1Array[i] ).style.display = 'block';
	}
	// cat 2
	for(i=0; i<cat2Array.length; i++){
		imgID = cat2Array[i]+"_img";
		document.getElementById( imgID ).src = "img/arrow_opened.png";
		document.getElementById( cat2Array[i] ).style.display = 'block';
	}
	// sider
	for(i=0; i<sideArray.length; i++){
		imgID = sideArray[i]+"_img";
		document.getElementById( imgID ).src = "img/arrow_opened.png";
		document.getElementById( sideArray[i] ).style.display = 'block';
	}
	// images
	//for(i=0; i<imgArray.length; i++){
	//	for(im=0; im<imgArray[i].length; im++){
	//		document.getElementById( imgArray[i][im] ).style.display = 'block';
	//	}
	//}
}
//****************

//**********************
//*** TOGGLE DISPLAY *** (style.display)
//**********************
function toggleDisplay(id){
	var imgID = id+"_img";
	if(document.getElementById( id ).style.display == 'block'){
		if( imgID.substr(0,3) != "img") document.getElementById( imgID ).src = "img/arrow_closed.png";
		document.getElementById( id ).style.display = 'none';
	}else{
		if( imgID.substr(0,3) != "img") document.getElementById( imgID ).src = "img/arrow_opened.png";
		document.getElementById( id ).style.display = 'block';
	}
	//alert(document.getElementById( id ).style.display);
}
//**********************

//****************************
//*** TOGGLE IMAGE DISPLAY *** (style.display)
//****************************
function toggleImageDisplay(contID, i){
	var im;
	if(imgArray[i].length > 0){
		var str = "460px";
		// if it is to be opened, set width of container (page_img class)
		if(document.getElementById( imgArray[i][0] ).style.display == 'none') str = ( (imgArray[i].length+1) * (460 + 20) ) +"px";
		document.getElementById( contID ).style.width = str;
	}
	for(im=0; im<imgArray[i].length; im++){
		toggleDisplay( imgArray[i][im] );
	}
	//alert(document.getElementById( id ).style.display);
}
//****************************

//*************************
//*** OPEN DEFAULT PAGE ***
//*************************
function openDefaultPage(){
	var imgID;
	// cat 1
	imgID = cat1Array[0]+"_img";
	document.getElementById( imgID ).src = "img/arrow_opened.png";
	document.getElementById( cat1Array[0] ).style.display = 'block';
	// cat 2
	imgID = cat2Array[0]+"_img";
	document.getElementById( imgID ).src = "img/arrow_opened.png";
	document.getElementById( cat2Array[0] ).style.display = 'block';
	// page
	imgID = sideArray[0]+"_img";
	document.getElementById( imgID ).src = "img/arrow_opened.png";
	document.getElementById( sideArray[0] ).style.display = 'block';
}
//*************************

//******************
//*** RESET PAGE ***
//******************
function resetPage(){
	hideAll();
	//openDefaultPage();
}
//******************

window.onscroll = placeTopBarOnScroll;
//******************************
//*** PLACE TOP BAR ON SCROLL ***
//******************************
function placeTopBarOnScroll(){
	var toTop = 0;
	if(document.body.scrollTop) toTop = document.body.scrollTop;
	if(window.pageYOffset) toTop = window.pageYOffset;
	if(document.documentElement.scrollTop) toTop = document.documentElement.scrollTop;
	//alert( toTop );
	// top bar
	document.getElementById('topBar').style.top = toTop +'px';
	document.getElementById('topBar').style.left = '0px';
	// open close bar
	document.getElementById('openCloseBar').style.top = (toTop + 80) +'px';
	document.getElementById('openCloseBar').style.left = '-27px';
}
//******************************


// start by hiding all
//hideAll();

//alert( cat1Array[2] );
//alert( cat2Array[2] );
//alert( sideArray[2] );