"use strict";

// will not be obfuscated
var Modules = {
	"all": {
		frameproperties: {
			allowtransparency: "false",
			scrolling: "no",
			width: "400",
			height: "300"
		},
		properties: {
			closeOnNextStep: "true",
			levelOffsetX: "20",
			levelOffsetY: "20"
		},
		customizedButtons: {
			dialogIcon: {
				show: "true", onmousedown: function (e) {
					e.cancelBubble = true;
					e.returnValue = false;
					return false;
				},
				ondblclick: function (e) {
					TTAPI.objMFControl.CloseModule("", e);
					e.cancelBubble = true;
					e.returnValue = false;
					return false;
				},
				imgSrc: "content/player/wbt/img/modularframe.icon.gif"
			},
			closeIcon: {
				show: "true",
				onmousedown: function (e) {
					e.cancelBubble = true;
					e.returnValue = false;
					return false;
				},
				onmouseup: function (e) {
					TTAPI.objMFControl.CloseModule("", e);
				},
				cursor: "pointer",
				tooltip: {
					all: TTAPI.objTextpool.heap["cbtcontrol"]["ttweViewsBtnClose"]["_attrtitle"]
				},
				imgSrc: "content/player/wbt/img/closeIcon.png"
			},
			FooterBtn1: {show: "false"},
			FooterBtn2: {show: "false"},
			FooterBtn3: {show: "false"},
			FooterBtn4: {show: "false"},
			FooterBtn5: {
				show: "true",
				cursor: "pointer",
				content: {
					all: TTAPI.objTextpool.heap["cbtcontrol"]["ttweViewsBtnClose"]["_attrtitle"]
				},
				tooltip: {
					all: TTAPI.objTextpool.heap["cbtcontrol"]["ttweViewsBtnClose"]["_attrtitle"]
				},
				onclick: function (e) {
					TTAPI.objMFControl.CloseModule("", e);
				}
			}
		},
		styles: {
			modularContent: "width:392px;height:250px;"
		}
	},
	sitemap: {
		frameproperties: {
			width: "500", height: "450"
		},
		styles: {
			modularContent: "width:492px;height:400px;"
		}
	},
//	,contact : {}
//	,imprint : {}
//	,jumplist : {}
//	,breadcrumb : {}
//	,bypasses : {}
	stdwarning: {
		frameproperties: {
			width: "370", height: "140"
		},
		properties: {
			modal: "true"
		},
		customizedButtons: {
			FooterBtn3: {
				show: "true",
				content: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularNo"]["_text"]
				},
				onclick: function (e) {
					TTAPI.objMFControl.CloseModule("", e);
				},
				cursor: "pointer",
				tooltip: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularNo"]["_text"]
				}
			},
			FooterBtn4: {
				show: "true",
				content: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularYes"]["_text"]
				},
				cursor: "pointer",
				tooltip: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularYes"]["_text"]
				}
			},
			FooterBtn5: {show: "false"}
		},
		styles: {
			modularFooterA: "width:100%;",
			modularFooterB: "width:0px;",
			modularFooterC: "width:0px;",
			modularFooterD: "width:0px;",
			modularFooterE: "width:0px;",
			modularFooterBtn5: "display:none;",
			modularContent: "width:362px;height:90px;"
		}
	},
	glossary: {
		frameproperties: {
			width: "600", height: "450"
		},
		styles: {
			modularContent: "width:592px;height:400px;"
		}
	},
	help: {
		frameproperties: {
			width: "600", height: "450"
		},
		styles: {
			modularContent: "width:592px;height:400px;"
		}
	},
	close: {
		frameproperties: {
			width: "370", height: "140"
		},
		customizedButtons: {
			FooterBtn3: {
				show: "true",
				content: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularNo"]["_text"]
				},
				onclick: function (e) {
					TTAPI.objMFControl.CloseModule("", e);
				},
				cursor: "pointer",
				tooltip: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularNo"]["_text"]
				}
			},
			FooterBtn4: {
				show: "true",
				content: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularYes"]["_text"]
				},
				onclick: function () {
					TTAPI.Exit();
				},
				cursor: "pointer",
				tooltip: {
					all: TTAPI.objTextpool.heap["static_texts"]["modularYes"]["_text"]
				}
			},
			FooterBtn5: {show: "false"}
		},
		styles: {
			modularFooterA: "width:100%;",
			modularFooterB: "width:0px;",
			modularFooterC: "width:0px;",
			modularFooterD: "width:0px;",
			modularFooterE: "width:0px;",
			modularFooterBtn5: "display:none;",
			modularContent: "width:362px;height:90px;"
		}
	}
};
window.onload = function () {
	if (TTAPI == null) {
		return;
	}
	g_objCrossBrowserModel.AddEventListener(document.body, "dragstart", g_objCrossBrowserModel.EventPreventDefault);
	g_objCrossBrowserModel.AddEventListener(document.body, "selectstart", g_objCrossBrowserModel.EventPreventDefault);
	g_objCrossBrowserModel.AddEventListener(document, "contextmenu", g_objCrossBrowserModel.EventPreventDefault);

	// fixed: KF-7663
	var sCSSFile = TTAPI.GetProperty("modularframecss"),
		sJSFile = TTAPI.GetProperty("modularframejs");

	if (g_objBrowser["isIE"]) {
		g_objCrossBrowserModel.AppendCSSClass(document.getElementsByTagName("html")[0], "ie" + parseInt(g_objBrowser["ieBrowserVersion"], 10));
	}

	if (sJSFile) {
		// In Modul-Frame anpassbare JS laden:
		g_objCrossBrowserModel.LoadJavaScriptFile(TTAPI.GetPathByProperty("modularframejs") + sJSFile);
	}
	if (sCSSFile) {
		// In Modul-Frame anpassbare CSS laden:
		g_objCrossBrowserModel.LoadCSSFile(TTAPI.GetPathByProperty("modularframecss") + sCSSFile, window, ContinueMFOnLoad_02);
	} else {
		ContinueMFOnLoad_02();
	}
};

function ContinueMFOnLoad_02() {
	// draggable header
	var objElem = document.getElementById("modularHeader");
	if (objElem) {
		g_objCrossBrowserModel.AddEventListener(objElem, "mousedown", TTAPI.objMFControl.OnModularMouseDown);
		g_objCrossBrowserModel.AddEventListener(objElem, "keydown", TTAPI.objMFControl.OnModularKeyDown);
	}

	var frameId = window.frameElement && window.frameElement.id ? window.frameElement.id : "";
	TTAPI.FireEvent(TTEventType["ModuleFrameLoaded"], {"id": frameId}, true);
}
