var activeLevelOne, activeLevelTwo;

function sliderOpen()
{
document.getElementById("galleriSlideer").style.display="none";
document.getElementById("galleriSlideerOpen").style.display="block";
}

function sliderClose()
{
document.getElementById("galleriSlideer").style.display="block";
document.getElementById("galleriSlideerOpen").style.display="none";
}

function hideAllLong() {
	var mySlider = document.getElementById("galleriSlideerOpen");
	if(mySlider!=null) {
		var myULs = mySlider.getElementsByTagName("UL");
		
		var ArrowShift = document.getElementById("subMenuHeading");
		var myIMGs = mySlider.getElementsByTagName("IMG");
		
		for(var i=0; i<myULs.length; i++) {
			if(myULs[i].className=="subNavigation") {		
				myULs[i].style.display="none";
			}
		}	
		
		for(var j=0; j<myIMGs.length; j++) {
			if(myIMGs[j].className=="openKollektion") {		
				myIMGs[j].src="files/Billeder/H2O/grey_arrow.gif";
			}
		}					
	}
}

function ShowSub(elmid) {
	hideAllLong();
	document.getElementById("ShowSub"+elmid).style.display="block";
	document.getElementById("openKollektion"+elmid).src="files/Billeder/H2O/red_arrow.gif";
}
	
function getWindowHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  //window.alert( 'Height = ' + myHeight );
  return(myHeight);
}

function resizeCollectionImage() {
	var winHeight = getWindowHeight()-122-132;
	document.getElementById("collectionHolder").height = (winHeight);
	var collectionImage = document.getElementById("collectionImage");
	var collectionImageHeight = winHeight - 38;
	var collectionImageWidth = 500;

	var collectionImageWidthReal = collectionImage.offsetWidth;
	var collectionImageHeightReal = collectionImage.offsetHeight;
	
	var myRatio = collectionImageWidthReal/collectionImageHeightReal;

	var newHeight = collectionImageHeight;
	var newWidth = newHeight*myRatio;

	if(parseInt(newWidth)>collectionImageWidth) {
		newWidth = parseInt(collectionImageWidth);
		newHeight = parseInt(collectionImageWidth/myRatio);
	}
	
	document.getElementById("collectionImage").height = newHeight;
	
	if(document.getElementById("collectionImage").offsetWidth>500) {
		document.getElementById("collectionImage").width = 500;
		document.getElementById("collectionImage").height = 500*myRatio;
	}
}

function setbackground() {
	var randomnumber=Math.floor(Math.random()*4)+1;
	document.getElementById("supersizeimg").src = "files/Billeder/H2O/bg/forside" + randomnumber +".jpg";
//	document.getElementById("supersizeimg").src = "files/Billeder/H2O/bg/forside6.jpg";
}