function Browser() {
var ua, s, i;
this.isIE = false; // Internet Explorer
this.isOP = false; // Opera
this.isNS = false; // Netscape
this.isFF = false; // Firefox
this.version = null;
ua = navigator.userAgent;
s = "Opera";
if ((i = ua.indexOf(s)) >= 0) {
this.isOP = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
// Treat any other "Gecko" browser as Netscape 6.1.
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isFF = true;
this.version = 6.1;
return;
}
s = "MSIE";
if ((i = ua.indexOf(s))) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
}
var browser = new Browser();
(function Feedback(){
var feedbackscreen;
var feedbackform;
var isactive;
var last_fbt_checked;
var url_root;
var sid;
}
(Feedback = {
Init : function(){
this.url_root="http://www.feedback24.net";
this.sid="78c4a20226ef3f700ac32948e7f750d0";
this.last_fbt_checked=null;
this.isactive=false;
this.LoadCSS();
this.CreateScreen();
this.GetFeedback();
this.CreateFeedbackButton();
},
CreateScreen : function(){
var win = document.createElement("div");
win.setAttribute("id","feedback24screen");
//win.setAttribute("onclick","Feedback.HideFeedback()");
win.style.position="absolute";
win.style.zIndex=999999;
win.style.textAlign="left";
win.style.background="url("+this.url_root+"/img/bg_screen.png) center center";
win.style.top="0px";
win.style.left="0px";
win.style.width="100%";
win.style.height=document.getElementsByTagName("html")[0].scrollHeight+"px";
win.style.visibility="hidden";
document.body.appendChild(win);
this.feedbackscreen=document.getElementById("feedback24screen");
},
CreateFeedbackButton : function(){
var win = document.createElement("div");
win.setAttribute("id","feedback24button");
win.style.position="fixed";
win.style.zIndex=999990;
win.style.bottom=0+"px";
win.style.right=0 +"px";
win.style.cursor="pointer";
win.style.float="right";
win.innerHTML = '
';
document.body.appendChild(win);
},
LoadCSS : function(){
if(document.createStyleSheet) {
document.createStyleSheet(this.url_root+"/layout.css");
}
else {
var styles = "@import url(\""+this.url_root+"/layout.css\");";
var newSS=document.createElement("link");
newSS.rel="stylesheet";
newSS.href="data:text/css,"+escape(styles);
document.getElementsByTagName("head")[0].appendChild(newSS);
}
},
ShowFeedback : function(fbt){
if(this.last_fbt_checked != null){
document.getElementById(this.last_fbt_checked).checked = false;
this.last_fbt_checked = null;
}
//Wenn FeedbackType angegeben, wird dieser automatisch gecheckt
if(fbt != null){
document.getElementById(fbt).checked = true;
this.last_fbt_checked = fbt;
}
this.CenterDialogWindow(this.feedbackform);
this.UpdateDialogWindow();
if (browser.isNS && browser.version == 4)
this.feedbackscreen.visibility="show";
else
this.feedbackscreen.style.visibility="visible";
this.isactive=true;
},
HideFeedback : function(){
if(browser.isNS && browser.version == 4)
this.feedbackscreen.visibility="hide";
else
this.feedbackscreen.style.visibility="hidden";
this.isactive=false;
},
getWinHeight : function(){
var winheight = 0;
if (window.innerHeight) winheight = window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
winheight = document.documentElement.clientHeight;
else if (document.body && document.body.clientHeight)
winheight = document.body.clientHeight;
return winheight;
},
getWinWidth : function(){
var winwidth = 0;
if (window.innerWidth)
winwidth = window.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
winwidth = document.documentElement.clientWidth;
else if (document.body && document.body.offsetWidth)
winwidth = document.body.offsetWidth;
return winwidth;
},
getDivHeight : function(obj){
var divheight = 0;
if(obj)
divheight = obj.offsetHeight;
return divheight;
},
getDivWidth : function(obj){
var divwidth = 0;
if(obj)
divwidth = obj.offsetWidth;
return divwidth;
},
CenterDialogWindow : function(obj){
var a=Math.round(this.getWinHeight()/2);
var b=Math.round(parseInt(this.getDivHeight(obj))/2);
var c=a-b;
obj.style.top=c+"px";
if(browser.isIE && browser.version < 7){
a=Math.round(this.getWinWidth()/2);
b=Math.round(parseInt(this.getDivWidth(obj))/2);
c=a-b;
obj.style.left=c+"px";
}
},
FeedbackTemplate : function(title){
var output;
output="
Feedback wurde erfolgreich übermittelt. Vielen Dank für Ihre Meinung!
"; }, UpdateFeedback : function(){ if(this.isactive == true){ this.feedbackscreen.style.width=this.getWinWidth()+"px"; this.feedbackscreen.style.height=document.getElementsByTagName("html")[0].scrollHeight+"px"; this.CenterDialogWindow(this.feedbackform); } }, UpdateDialogWindow : function(){ if(!this.feedbackform) return; var a=Math.round(this.getWinHeight()/2); var b=Math.round(parseInt(this.getDivHeight(this.feedbackform))/2); var c=(browser.isIE == true ? document.documentElement.scrollTop : window.pageYOffset)+(a-b); this.feedbackform.style.top=c+"px"; } })); //Init window.onload = function() { Feedback.Init(); } window.onresize = function() { Feedback.UpdateFeedback(); } window.onscroll = function() { Feedback.UpdateDialogWindow(); } SendForm = { frame : function(c) { var n = 'f' + Math.floor(Math.random() * 99999); var d = document.createElement('DIV'); d.innerHTML = ''; document.body.appendChild(d); var i = document.getElementById(n); if (c && typeof(c.onComplete) == "function") { i.onComplete = c.onComplete; } return n; }, form : function(f, name) { f.setAttribute('target', name); }, submit : function(f, c) { SendForm.form(f, SendForm.frame(c)); return true; }, loaded : function(id) { var i = document.getElementById(id); if (i.contentDocument) { var d = i.contentDocument; } else if (i.contentWindow) { var d = i.contentWindow.document; } else { var d = window.frames[id].document; } if (typeof(i.onComplete) == 'function') { i.onComplete(); } } }