function onLoadPage( cfgString ) {
	searchBlur();
	newsletterBlur();

	try {
		var fwsCanvas = document.createElement( 'canvas' ).getContext( '2d' );
		initNavCloud();
	}
	catch( e ) {
		/* alert( "kein CANVAS" ); */
	}
	/*
	try {
		var testContainer = document.getElementById( 'containerBoxWrapper' ).style.width;
		setHeightContainer();
	} catch( e ) { }
	*/
	try {
		var testStartPage = document.getElementById( 'startPageCurrent' ).style.width;
		setHeightStartPage();
	} catch( e ) { }
}

/************************************/
/*****  INPUT: SUCHFELD         *****/
/************************************/
function searchFocus() {
	if( document.getElementById( 'searchValue' ).value == 'Suchbegriff eingeben' ) {
		document.getElementById( 'searchValue' ).value = '';
		document.getElementById( 'searchValue' ).style.color = 'black';
	}
	else {
		document.getElementById( 'searchValue' ).select();
	}
}
function searchBlur() {
	if( trim( document.getElementById( 'searchValue' ).value ) == '' ) {
		document.getElementById( 'searchValue' ).value = 'Suchbegriff eingeben';
		document.getElementById( 'searchValue' ).style.color = 'gray';
	}
	else {
		document.getElementById( 'searchValue' ).focus();
	}
}

/************************************/
/***** INPUT: NEWSLETTER-EMAIL  *****/
/************************************/
function newsletterFocus() {
	if( document.getElementById( 'nlEmail' ).value == 'E-Mail-Adresse' ) {
		document.getElementById( 'nlEmail' ).value = '';
		document.getElementById( 'nlEmail' ).style.color = 'black';
	}
	else {
		document.getElementById( 'nlEmail' ).select();
	}
}
function newsletterBlur() {
	try {
		document.getElementById( 'nlBox' ).style.offsetWidth;
		if( trim( document.getElementById( 'nlEmail' ).value ) == '' ) {
			document.getElementById( 'nlEmail' ).value = 'E-Mail-Adresse';
			document.getElementById( 'nlEmail' ).style.color = 'gray';
		}
		else {
			document.getElementById( 'nlEmail' ).focus();
		}
	}
	catch( e ) {
	}
}

/************************************/
/*****  SETBAR START-PAGE       *****/
/************************************/
function setHeightStartPage() {
	var pageBodyHeight = document.getElementById( 'startPageCurrent' ).offsetHeight;
	/* alert( "startPageCurrent=" + pageBodyHeight  + " vs. startPageOther" + document.getElementById( 'startPageOther' ).offsetHeight ); */
	if( document.getElementById( 'startPageOther' ).offsetHeight > pageBodyHeight ) {
		pageBodyHeight = document.getElementById( 'startPageOther' ).offsetHeight;
	}
	pageBodyHeight = pageBodyHeight - 21;
	document.getElementById( 'startPageCurrent' ).style.height = pageBodyHeight + 'px';
	document.getElementById( 'startPageOther' ).style.height = pageBodyHeight + 'px';
}

/************************************/
/*****  SETBAR CONTAINER-PAGE   *****/
/************************************/
function setHeightContainer() {
	var pageBodyHeight = document.getElementById( 'contentBoxWrapper' ).offsetHeight;
	if( document.getElementById( 'navMenuWrapper' ).offsetHeight > pageBodyHeight ) {
		pageBodyHeight = document.getElementById( 'navMenuWrapper' ).offsetHeight;
	}
	if( document.getElementById( 'containerBoxWrapper' ).offsetHeight > pageBodyHeight ) {
		pageBodyHeight = document.getElementById( 'containerBoxWrapper' ).offsetHeight;
	}
	
	/*
	alert( 
		"pageBodyHeight=" + pageBodyHeight +
		" navMenuWrapper=" + document.getElementById( 'navMenuWrapper' ).offsetHeight +
		" contentBoxWrapper=" + document.getElementById( 'contentBoxWrapper' ).offsetHeight +
		" containerBoxWrapper=" + document.getElementById( 'containerBoxWrapper' ).offsetHeight
	);
	*/
	var containerArticlesHeight = pageBodyHeight - ( document.getElementById( 'containerBoxWrapper' ).offsetHeight - document.getElementById( 'containerArticles' ).offsetHeight );
	document.getElementById( 'containerArticles' ).style.height = ( containerArticlesHeight - 27 ) + 'px';
}

/*
Option				Default			Description
------				-------			-----------
interval			20 				Interval between animation frames, in milliseconds

maxSpeed			0.05 			Maximum speed of rotation
minSpeed			0.0 			Minimum speed of rotation when mouse leaves canvas

decel				0.95 			Deceleration rate when mouse leaves canvas
minBrightness		0.1 			Brightness of tags at farthest point (0.0-1.0)

depth				0.5 			Controls the perspective (0.0-1.0)
initial				null			Initial rotation, with horizontal and vertical as an array, e.g. [0.8,-0.3]. Values are multiplied by maxSpeed.
txtOpt				true 			Text optimisation, converts text tags to images for better performance.
txtScale			2 				Scaling factor of text when converting to image in txtOpt mode.
reverse				false 			Set to true to reverse direction of movement relative to mouse position.
hideTags			false 			Set to true to automatically hide the tag list element if TagCanvas is started successfully.

zoom				1.0 			Adjusts the relative size of the tag cloud in the canvas. Larger values will zoom into the cloud, smaller values will zoom out.
wheelZoom			true 			Enables zooming the cloud in and out using the mouse wheel or scroll gesture.
zoomStep			0.05 			The amount that the zoom is changed by with each movement of the mouse wheel.
zoomMax				3.0 			Maximum zoom value.
zoomMin				0.3 			Minimum zoom value.

lock				null 			A value of "x" limits rotation of the cloud to the (horizontal) x-axis, and a value of "y" limits rotation to the (vertical) y-axis. (These are strings, so the quotes are required)
*/
function initNavCloud() {
	var tagCloudArrPosHtmlWithCanvas = new Array();
	/* 600px
	tagCloudArrPosHtmlWithCanvas[1]  = "90";
	tagCloudArrPosHtmlWithCanvas[2]  = "230";
	tagCloudArrPosHtmlWithCanvas[3]  = "370";
	tagCloudArrPosHtmlWithCanvas[4]  = "20";
	tagCloudArrPosHtmlWithCanvas[5]  = "160";
	tagCloudArrPosHtmlWithCanvas[6]  = "300";
	tagCloudArrPosHtmlWithCanvas[7]  = "440";
	tagCloudArrPosHtmlWithCanvas[8]  = "90";
	tagCloudArrPosHtmlWithCanvas[9]  = "230";
	tagCloudArrPosHtmlWithCanvas[10] = "370";
	*/
	
	/* 690px */
	tagCloudArrPosHtmlWithCanvas[1]  = "90";
	tagCloudArrPosHtmlWithCanvas[2]  = "280";
	tagCloudArrPosHtmlWithCanvas[3]  = "450";
	tagCloudArrPosHtmlWithCanvas[4]  = "5";
	tagCloudArrPosHtmlWithCanvas[5]  = "175";
	tagCloudArrPosHtmlWithCanvas[6]  = "345";
	tagCloudArrPosHtmlWithCanvas[7]  = "515";
	tagCloudArrPosHtmlWithCanvas[8]  = "90";
	tagCloudArrPosHtmlWithCanvas[9]  = "280";
	tagCloudArrPosHtmlWithCanvas[10] = "450";

	var setCanvas = false;
			
	try {
		TagCanvas.shape = 'sphere';		// sphere, hcylinder, vcylinder
		TagCanvas.lock = null;			// null, 'x', 'y'
		TagCanvas.textFont = 'Helvetica, Arial, sans-serif'; // Verdana: abgeschnitten
		TagCanvas.textHeight = 12;
		TagCanvas.textColour = 'white';
		//shadow				"#000000" 		Colour of the shadow behind each tag.
		//shadowBlur			0 				Amount of tag shadow blurring, in pixels.
		//shadowOffset		[0,0] 			X and Y offset of the tag shadow, in pixels.
		TagCanvas.shadow = '#CCCCCC';
		TagCanvas.shadowBlur = 3;
		TagCanvas.shadowOffset = [ 1, 1 ];
		TagCanvas.outlineTickness = 3;
		TagCanvas.outlineOffset = 0;
		TagCanvas.outlineColour = '#6FA0BE';
		TagCanvas.pulsateTo = 1.0;		// bis opacity
		TagCanvas.pulsateTime = 0.0;	// rate in sekunden
		TagCanvas.freezeActive = true;	// hover: animation anhalten
		TagCanvas.frontSelect = true;	// hover nur tags im vordergrund
		TagCanvas.weight = true;		// gewichtung einschalten
		TagCanvas.weightMode = 'size';	// size, colour, both
		// TagCanvas.weightFrom = 'data-weight';	// wird aus style geholt
		TagCanvas.weightSize = 1.5;		// multiplikator für vergrößerung
		// weightGradient
		//		{0:'#f00', 0.33:'#ff0', 0.66:'#0f0', 1:'#00f'}
		//		The colour gradient used for colouring tags when using a weight mode of colour or both.
		// TagCanvas.depth='0.95';
		/*
		TagCanvas.zoomMax = '5.0';
		TagCanvas.zoomMin = '0.2';
		*/
		TagCanvas.reverse = true;
		TagCanvas.minSpeed = 0.0;
		TagCanvas.maxSpeed = 0.02;
		TagCanvas.Start( 'navCloudCanvas', 'navCloudTags' );
		setCanvas = true;
		/* alert( "tagCloud läuft" ); */
	}
	catch( e ) {
		document.getElementById( 'navCloudCanvas' ).style.display = 'none';
		document.getElementById( 'navCloudTags' ).style.display = 'none';
		/* alert( "kein Canvas-Support" ); */
	}
	if( setCanvas == true ) {
		document.getElementById( 'navCloudHtml' ).style.width = "690px";
		for( i = 1; i < tagCloudArrPosHtmlWithCanvas.length; i++ ) {
			document.getElementById( "tag_" + i ).style.width = "160px";
			document.getElementById( "tag_" + i ).style.left = tagCloudArrPosHtmlWithCanvas[ i ] + "px";
		}
		document.getElementById( 'navCloudCanvas' ).style.width = "300px";
		document.getElementById( 'navCloudCanvas' ).style.display = 'block';
	}
}

/************************************/
/*****  JS-Erweiterung          *****/
/************************************/
function trim( trimString ) {
	if( !( trimString == '' ) ) {
		while( trimString.substring( 0, 1 ) == ' ' ) {
			trimString = trimString.substring( 1, trimString.length );
		}
		while( trimString.substring( trimString.length - 1, trimString.length ) == ' ') {
			trimString = trimString.substring( 0, trimString.length - 1 );
		}
	}
	return trimString;
}

