function FixContentHeight(varHeight)
{
	var theWidth = 0, theHeight = 0;
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		theWidth = window.innerWidth;
		theHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		theWidth = document.documentElement.clientWidth;
		theHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		theWidth = document.body.clientWidth;
		theHeight = document.body.clientHeight;
	}
	if ( theHeight > varHeight )
	{
		var paddingHeight = (theHeight-varHeight)/2;
		paddingHeight = Math.round(paddingHeight);
		paddingHeight = paddingHeight+'px';
		document.getElementById('Content').style["marginTop"] = paddingHeight;
	}
}

function RandomTheme()
{
	var intRandomTheme = Math.floor(Math.random()*10);
	var strRandomTheme = 'url(Img/Theme/Theme'+intRandomTheme+'.jpg)'
	document.getElementById("Content").style.backgroundImage = strRandomTheme;
}

function ValidateContactForm()
{
	validationString = "";
	if ( document.getElementById('Name').value == "" )
	{
		validationString += "\nName is not optional";
	}
	if ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('Email').value) != true || document.getElementById('Email').value == ""  )
	{
		validationString += "\nEmail is not optional and has to be a valid address";
	}
	if ( document.getElementById('Message').value == "" )
	{
		validationString += "\nMessage is not optional";
	}
	if (validationString != "")
	{
		validationString = "The mail could not be sent because:\n" +
		validationString + "\n\nPlease correct the fields and try again.";
		alert(validationString);
	}
	else
	{
		document.getElementById('ContactForm').submit();
	}
}


function InitGallery()
{
	DisplayImage();
}
		
function PreviousImage()
{
	if(intCurrentImage < 2)
	{
		intCurrentImage = intTotalImage;
	}
	else
	{
		intCurrentImage -= 1;
	}
	DisplayImage();
}

function NextImage()
{
	if(intCurrentImage > intTotalImage-1)
	{
		intCurrentImage = 1;
	}
	else
	{
		intCurrentImage += 1;
	}
	DisplayImage();
}

function DisplayImage()
{
	document.getElementById("Content").style.backgroundImage = 'url('+strImagePath+intCurrentImage+strImageExtension+')';
	var strImageCounter = '';
	var strCurrentImage = '';
	var strTotalImage = '';
	if(intCurrentImage < 10)
	{
		strCurrentImage = '0'+intCurrentImage;
	}
	else
	{
		strCurrentImage = intCurrentImage;
	}
	if(intTotalImage < 10)
	{
		strTotalImage = '0'+intTotalImage;
	}
	else
	{
		strTotalImage = intTotalImage;
	}
	strImageCounter = 'Image '+strCurrentImage+'/'+strTotalImage;
	if(arrCopyright[intCurrentImage] != '')
	{
		document.getElementById('GalleryControlRight').innerHTML = '<div><span>'+arrCopyright[intCurrentImage]+'</span>'+strImageCounter+'</div>';
	}
	else
	{
		document.getElementById('GalleryControlRight').innerHTML = '<div>'+strImageCounter+'</div>';
	}
}