// ==========================================================================================// Add function to window.onload// ==========================================================================================(function (window) {	"use strict";	var thisEvent, thisFunction;	thisEvent = (window.addEventListener) ? "load" : "onload";	thisFunction = (StartSession);	if (window.addEventListener) {		window.addEventListener(thisEvent, thisFunction, false);	} else if (window.attachEvent) {		window.attachEvent(thisEvent, thisFunction);	}}(window));function StartSession() {	"use strict";	var Testtext, GWD_RandomPicChangerPath, GWD_PromotionPath;//	console.log("Use the GWD Console to\noutput some text, variables or\nsomething else using console.log\n\nSyntax:\nconsole.log(\"Your content here\")");	GWD_StayCounter('Fuss_3', 'Auf dieser Seite seid:');	Testtext = "Herzlich willkommen auf der Seite www.Gobianweb.de. " +		"Wie an der Versionsnummer nur unschwer zu erkennen entseht hier " +		"eine neue Internetseite. Zu finden ein wenig Freude und Unterhaltung. " +		"Mit der Zeit werden noch hoffentlich einige Projekte hinzukommen. " +		"Naja, erstmal muss die Seite komplett funktionieren...";	GWD_Textwriter('Rechts_1', Testtext, 40);	GWD_RandomPicChangerPath = [		// Bildergroesse b x h: 221 x 329		"Pic_Blank.gif",		"Pic_Favo_01.jpg",		"Pic_Favo_02.jpg",		"Pic_Favo_03.jpg",		"Pic_Mietze_01.jpg",		"Pic_Mietze_02.jpg",		"Pic_Norm_01.jpg",		"Pic_Norm_02.jpg",		"Pic_Norm_03.jpg",		"Pic_Strong_01.jpg",		"Pic_Strong_02.jpg",		"Pic_Strong_03.jpg"];//	GWD_RandomPicChanger(GWD_RandomPicChangerPath, "Pics/", 0, "1000");	GWD_PromotionPath = [		// Bildergroesse b x h: 510 x 364		"Pics/",		"Promotion_GWD_Console.jpg",		"Pic_Norm_01.jpg",		"Pic_Norm_02.jpg",		"Pic_Norm_03.jpg",		"Pic_Strong_01.jpg",		"Promotion_GWD_Console.jpg",		"Pic_Norm_01.jpg",		"Pic_Norm_02.jpg",		"Pic_Norm_03.jpg",		"Pic_Strong_01.jpg",		"Promotion_GWD_Console.jpg",		"Pic_Norm_01.jpg",		"Pic_Norm_02.jpg",		"Pic_Norm_03.jpg",		"Pic_Strong_01.jpg",		"Promotion_GWD_Console.jpg",		"Pic_Norm_01.jpg",		"Pic_Norm_02.jpg",		"Pic_Norm_03.jpg",		"Pic_Strong_01.jpg"];	GWD_Promotion(GWD_PromotionPath, 0, "3000");}// ==========================================================================================// GWD_Textwriter// Version: 1.00// Date: 2011/07/01// JSLint verified and approved// ==========================================================================================function GWD_Textwriter(idElement, strText, intSpeed) {	"use strict";	var Textwriter = {		intPos: 0,		intEnd: strText.length,		init: function () {			if (document.getElementById(idElement).hasChildNodes()) {				Textwriter.write();			} else {				document.getElementById(idElement).appendChild(document.createTextNode(strText.charAt(this.intPos)));				this.intPos += 1;				if (this.intPos < this.intEnd) {					window.setTimeout(function () {						Textwriter.write();					}, intSpeed);				}			}		},		write: function () {			document.getElementById(idElement).firstChild.data += strText.charAt(this.intPos);			this.intPos += 1;			if (this.intPos < this.intEnd) {				window.setTimeout(function () {					Textwriter.write();				}, intSpeed);			}		}	};	if (idElement && strText && intSpeed) {		Textwriter.init();	}}// ==========================================================================================// GWD_StayCounter();// Version: 1.00// Date: 2011/07/01// JSLint verified and approved// ==========================================================================================function GWD_StayCounter(idElement, strText) {	"use strict";	var intAsec, intBsec, intAmin, strSec, strMin, StayCounter;	StayCounter = {		strMessage: strText + "&nbsp;&nbsp;00:00&nbsp;&nbsp;&nbsp;min:sec",		intStart: strText.length + 2,		timeStart: new Date().getTime(),		timeNow: 0,		strElapsed: 0,		init: function () {			document.getElementById(idElement).innerHTML = this.strMessage;			this.calculate();		},		calculate: function () {			this.timeNow = ((new Date().getTime() - this.timeStart) / 1000);			intAsec = Math.round(this.timeNow);			intBsec = intAsec % 60;			intAmin = Math.abs(Math.round((intAsec - 30) / 60));			strSec = (intBsec > 9) ? String(intBsec) : "0" + String(intBsec);			strMin = (intAmin > 9) ? String(intAmin) : "0" + String(intAmin);			this.strElapsed = strMin + ":" + strSec;			document.getElementById(idElement).firstChild.replaceData(this.intStart, this.strElapsed.length, this.strElapsed);			window.setTimeout(function () {				StayCounter.calculate();			}, 1000);		}	};	if (idElement && strText) {		StayCounter.init();	}}// ==========================================================================================// GWD_Promotion// Version: 1.00// Date: 2011/07/01// JSLint verified and approved// ==========================================================================================function GWD_Promotion(arrNewPics, idElement, intSpeed) {	"use strict";	if (!idElement) {		idElement = "GWD_Promotion";	}	idElement = document.getElementById(idElement);	if (!intSpeed) {		intSpeed = 2000;	}	var Promotion = {		arrPics: [],		intPicsQTY: arrNewPics.length - 1,		intPicsNo: 0,		idViewport: "Prom_1",		intViewportWidth: parseInt((idElement.currentStyle) ? idElement.currentStyle.width : window.getComputedStyle(idElement, null).width, 10),		intViewportHeight: parseInt((idElement.currentStyle) ? idElement.currentStyle.height : window.getComputedStyle(idElement, null).height, 10),		ptrTimer: null,		preload: function () {			var i, loading,  domNode, domElement;			domNode = idElement;			domElement = document.createElement('div');			domElement.style.width = String(this.intViewportWidth / 2) + "px";			domElement.style.height = "23px";			domElement.style.border = "1px solid black";			domElement.style.cursor = "progress";			domElement.style.position = "absolute";			domElement.style.top = String(Math.ceil((this.intViewportHeight - 23) / 2)) + "px";			domElement.style.left = String(Math.ceil(this.intViewportWidth / 4)) + "px";			domNode.appendChild(domElement);			domNode = domNode.lastChild;			domElement = document.createElement('img');			domElement.id = "Loadingbar";			domElement.src = arrNewPics[0] + "GUI_Loadingbar.gif";			domElement.width = 1;			domElement.height = 23;			domElement.alt = "Loading...";			domElement.title = "Loading...";			domElement.style.cursor = "progress";			domElement.style.position = "absolute";			domElement.style.top = "0";			domElement.style.left = "0";			domNode.appendChild(domElement);			loading = function (i) {				Promotion.loading(i);			};			for (i = 1; i < arrNewPics.length; i += 1) {				this.arrPics[i] = new Image();				this.arrPics[i].onload = loading;				this.arrPics[i].src = arrNewPics[0] + arrNewPics[i];			}		},		loading: function () {			this.intPicsNo += 1;			var domElement = document.getElementById("Loadingbar");			domElement.style.width = String(parseInt(parseInt(domElement.parentNode.style.width, 10) / this.intPicsQTY * this.intPicsNo, 10)) + "px";			if (this.intPicsNo === this.intPicsQTY) {				this.intPicsNo = 1;				while (idElement.hasChildNodes()) {					idElement.removeChild(idElement.lastChild);				}				this.init();			}		},		init: function () {			var i, domNode, domElement;			domNode = idElement;			for (i = 1; i < this.arrPics.length; i += 1) {				domElement = document.createElement('img');				domElement.id = "Prom_" + String(i);				domElement.src = this.arrPics[i].src;				domElement.width = this.arrPics[i].width;				domElement.height = this.arrPics[i].height;				domElement.alt = "Promotion";				domElement.style.cursor = "progress";				domElement.style.position = "absolute";				domElement.style.top = "0";				domElement.style.left = "510px";				domNode.appendChild(domElement);			}			this.ptrTimer = setInterval(function () {				Promotion.moveInPic(document.getElementById(Promotion.idViewport));			}, 20);		},		moveInPic: function (domElement) {			var left, x;			left = Number(domElement.style.left.substr(0, domElement.style.left.length - 2));			x = 1 + Math.round(left / 10);			left -= x;			if (left < 0) {				left = 0;			}			if (left >= 0) {				domElement.style.left = String(left) + "px";			}			if (left < 1) {				clearInterval(this.ptrTimer);				window.setTimeout(function () {					Promotion.ptrTimer = setInterval(function () {						Promotion.moveOutPic(domElement);					}, 20);				}, intSpeed);			}		},		moveOutPic: function (domElement) {			var top, max, x;			top = Number(domElement.style.top.substr(0, domElement.style.top.length - 2));			max = this.intViewportHeight;			x = 1 + Math.round(top / 10);			top += x;			if (top <= max) {				domElement.style.top = String(top) + "px";			}			if (top > (max - 1)) {				domElement.style.left = String(this.intViewportWidth) + "px";				domElement.style.top = "0px";				clearInterval(this.ptrTimer);				this.intPicsNo = (this.intPicsNo === this.intPicsQTY) ? 1 : this.intPicsNo + 1;				this.idViewport = "Prom_" + String(this.intPicsNo);				this.ptrTimer = setInterval(function () {					Promotion.moveInPic(document.getElementById(Promotion.idViewport));				}, 20);			}		}	};	if (arrNewPics && idElement && intSpeed) {		Promotion.preload();	}}// ==========================================================================================// GWD_RandomPicChanger// Version: 1.00// Date: 2011/07/01// JSLint verified and approved// <img id="GWD_RandomPicChanger" alt="GWD_RandomPicChanger" src="Pics/GUI_Loading_1.gif" />// ==========================================================================================function GWD_RandomPicChanger(arrNewPics, strPath, idElement, intSpeed) {	"use strict";	if (!idElement) {		idElement = "GWD_RandomPicChanger";	}	if (!intSpeed) {		intSpeed = 2000;	}	var RandomPicChanger = {		intPicsQTY: arrNewPics.length - 1,		strPicsPath: strPath || "",		init: function () {			document.getElementById(idElement).src = arrNewPics[0];			window.setTimeout(function () {				RandomPicChanger.changePic();			}, intSpeed);		},		changePic: function () {			var x = Math.ceil(Math.random() * this.intPicsQTY);			document.getElementById(idElement).src = this.strPicsPath + arrNewPics[x];			window.setTimeout(function () {				RandomPicChanger.changePic();			}, intSpeed);		}	};	if (arrNewPics && idElement && intSpeed) {		RandomPicChanger.init();	}}// ==========================================================================================// Preferences// Version: 0.01// Date: 2011/07/01// ==========================================================================================function show_Toolbox(titel) {	"use strict";	var idElement, ClientW, ClientH;	idElement = document.getElementById("Toolbox_table");	if (((idElement.currentStyle) ? idElement.currentStyle.display : window.getComputedStyle(idElement, null).display) === "none") {		if (window.innerHeight) {								// all except Explorer			ClientW = window.innerWidth;			ClientH = window.innerHeight;		} else if (document.documentElement && document.documentElement.clientHeight) {			ClientW = document.documentElement.clientWidth;	// Explorer 6 Strict Mode			ClientH = document.documentElement.clientHeight;		} else if (document.body) {							// other Explorers			ClientW = document.body.clientWidth;			ClientH = document.body.clientHeight;		}		idElement.style.visibility = "hidden";		idElement.style.display = "block";		idElement.style.left = String(parseInt((ClientW - idElement.offsetWidth) / 2, 10)) + "px";		idElement.style.top = String(parseInt(((ClientH - idElement.offsetHeight) / 2) - (ClientH * 0.1), 10)) + "px";		idElement.style.visibility = "";		idElement = document.getElementById("Toolbox_topLineText");		idElement.firstChild.replaceData(0, idElement.firstChild.nodeValue.length, titel);	}}function proceed_Preferences(expression) {	"use strict";	var idElement, ziel;	switch (expression) {	case "init":		idElement = document.getElementById("Toolbox_closePic");		idElement.onclick = null;		idElement.onclick = function () {			proceed_Preferences('CANCEL');		};		idElement = document.getElementById("Toolbox_div");		idElement.style.width = "330px";		idElement.innerHTML = '<form id="TBform" name="TBform" action="" onsubmit="return proceed_Preferences(\'Enter\')">' +			' <table>' +			'  <tr>' +			'   <td style="width:330px; text-align:center; font-weight:bold;">' +			'     Please select a style</td>' +			' </table>' +			' <table>' +			'  <tr><td style="text-align:center;">' +			'    <input type="button" name="Verweis" value="standard - (default)" style="width:330px;"' +			'     tabindex="1" onclick="GWD_Styleswitcher(\'default\')" /></td>' +			'   <td style="text-align:center;"></tr>' +			'  <tr><td style="width:165px; text-align:center;">' +			'    <input type="button" name="Verweis" value="smooth green" style="width:330px;"' +			'     tabindex="2" onclick="GWD_Styleswitcher(\'green\')" /></td>' +			'   <td style="width:165px; text-align:center;"></tr>' +			' </table>' +			' <table>' +			'  <tr>' +			'   <td style="width:165px; text-align:center;">' +			'    <input type="button" name="Verweis" value="Use" style="width:94px;"' +			'     tabindex="3" onclick="proceed_Preferences(\'USE\')" /></td>' +			'   <td style="width:165px; text-align:center;">' +			'    <input type="button" name="Verweis" value="Save" style="width:94px;"' +			'     tabindex="4" onclick="proceed_Preferences(\'SAVE\')" /></td>' +			'   <td style="width:165px; text-align:center;">' +			'    <input type="button" name="Verweis" value="Cancel" style="width:94px;"' +			'     tabindex="5" onclick="proceed_Preferences(\'CANCEL\')" /></td>' +			'  </tr>' +			' </table>' +			'</form>';		show_Toolbox('Preferences');		break;	case "Enter":		return false;	case "USE":		GWD_Styleswitcher('use');		document.getElementById("Toolbox_table").style.display = "none";		break;	case "SAVE":		GWD_Styleswitcher('save');		document.getElementById("Toolbox_table").style.display = "none";		break;	case "CANCEL":		GWD_Styleswitcher('cancel');		document.getElementById("Toolbox_table").style.display = "none";		break;	default:		break;	}}
