var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{   string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{   // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{     // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
var IE = BrowserDetect.browser == 'Explorer' ? true : false;
var IE7 = IE && BrowserDetect.version == '7' ? true : false;
function set_cookie(name,value,expires,path) {
if(!path) path = '/';
//document.cookie = name+'='+value; expires="+ablauf.toGMTString();
var c = name+'='+value+'; path='+path+'';
document.cookie = c;
}
function get_cookie(name) {
var c = document.cookie.split(/; /); // space is important!!
for(var i=0;i<c.length;i++) {
var cookie = c[i].split(/=/);
if(cookie[0] == name) {
return cookie[1];
}
}
return '';
}
function clear_cookie(name) {
document.cookie = name+'=""; expires:0';
}
var onload_stack = new Array();
function add_onload(fnc) {
onload_stack.push(fnc);
}
function run_onload() {
n = onload_stack.length;
for(var i=0;i<n;i++) {
fnc = onload_stack.pop();
fnc();
}
}
function InfoBubbleToggle(buttonId,elemId,posX,posY) {
var b = $(buttonId);
var e = $(elemId);
var bubbles = $$('.info-bubble');
for(var i=0;i<bubbles.length;i++) {
if(!bubbles[i].className.match(/info\-bubble/)) {
bubbles[i].display = 'none';
}
}
if(e.className.match(/info\-bubble/)) { 	
Position.absolutize(b);
Position.absolutize(e);
Position.clone(b,e);
e.style.top = '0px';
e.style.left = '0px';
e.style.width = '200px';
e.style.height = 'auto';
e.style.zIndex = 300;
/* 
e.style.position = 'absolute';
e.style.top  = parseInt(posY)+'px';
e.style.left = parseInt(posX)+'px';
*/
if(e.style.display == 'none') {
Effect.Appear(e, {duration:0.2});
} else {
Effect.Fade(e, {duration:0.2});
}
}
}
function AjaxFormCollect(formId) {
var values = '';
var inputs = $(formId).getElementsByTagName('input');
for(var i=0;i<inputs.length;i++) {
switch(inputs[i].type) {
case 'text':
case 'hidden': 
case 'password':
values += inputs[i].name+'='+encodeURIComponent(inputs[i].value)+'&';
break;
case 'radio':
case 'checkbox':
if(inputs[i].checked == true) {
values += inputs[i].name+'='+encodeURIComponent(inputs[i].value)+'&';
}
break;
}
}
var textareas = $(formId).getElementsByTagName('textarea');
for(var i=0;i<textareas.length;i++) {
if(textareas[i].className.match(/mceEditorEnabled/)) {
values += textareas[i].name+'='+encodeURIComponent(tinyMCE.getContent(textareas[i].id))+'&';
} else {
values += textareas[i].name+'='+encodeURIComponent(textareas[i].value)+'&';
}
}
var selects = $(formId).getElementsByTagName('select');
for(var i=0;i<selects.length;i++) {
switch(selects[i].multiple) {
case true:
for(var j=0;j<selects[i].options.length;j++) {
if(selects[i].options[j].selected == true) {
values += selects[i].name+'[]='+encodeURIComponent(selects[i].options[j].value)+'&';
}
}
break;
case false:
values += selects[i].name+'='+encodeURIComponent(selects[i].options[selects[i].selectedIndex].value)+'&';
break;
}
}
return values;
}
function StdAjax(url,vars) {
if(!vars.onFailure) {
vars.onFailure = function() {
//alert('Connectivity error!');
}
}
if(!vars.onSuccess) {
vars.onSuccess = function() { }
}
if(!vars.onError) {
vars.onError = function() { }
}
// onWhatever gets called on EVERY ajax call, as long as
// the server responded (AFTER onSuccess/onError)
if(!vars.onWhatever) {
vars.onWhatever = function() { }
}
if(!vars.parameters) {
vars.parameters = '';
}
// detect ssl in URL and adapt if necessary
if (window.location.protocol == 'https:' && url.indexOf('http') != 0)
{
url = 'https://'+window.location.hostname+url;
}
new Ajax.Request(
url,
{
method: 'post',
parameters: vars.parameters,
onSuccess: function(result) {
try
{
if (result.responseText == '')
{
vars.onFailure();
return;
}
eval('var res = '+result.responseText+'');
if (res.success)
{
if(document.getElementById('no_ajaxactions') == null) ajax_action(res.result);
vars.onSuccess(res.result);
}
else
{
vars.onError(res.result, res.errors);
}
vars.onWhatever(res.result);
}
catch (e)
{
// turn me off after developing
//console.log(e);
}
},
onFailure: vars.onFailure
}
);
}
function sFetchInlineScripts(node,targetNode) {
var scripts = $(node).getElementsByTagName('script');
var script = '';
for(var i=0;i<scripts.length;i++) {
if(scripts[i].innerHTML.match(/tinyMCE\.init/)) continue;
script += scripts[i].innerHTML;
}
return script;
}
function ajax_action( oAjaxResult ){
if( oAjaxResult.actions != null ){
var nHtmlContentCount = 0;
for( var loop = 0 ; loop < oAjaxResult.actions.length ; loop++ ){
var sActionString = oAjaxResult.actions[ loop ];
var sSeparator = sActionString.charAt( 0 );
var aParts = sActionString.split( sSeparator );
var sCommand = "";
try{
switch( aParts[ 1 ] ){
case 'func':
sCommand = aParts[ 2 ] + '(' + aParts[ 3 ] + ')';
eval( sCommand );
break;
case 'style':
document.getElementById( aParts[ 2 ] ).style[ aParts[ 3 ] ] = aParts[ 4 ];
break;
case 'class':
document.getElementById( aParts[ 2 ] ).className = aParts[ 3 ];
break;
case 'html':
document.getElementById( aParts[ 2 ] ).innerHTML = oAjaxResult.html_action_contents[ nHtmlContentCount ];
nHtmlContentCount++;
break;
case 'value':
document.getElementById( aParts[ 2 ] ).value = aParts[ 3 ];
break;
case 'redirect':
document.location.href = aParts[ 2 ];
break;
case 'imagesrc':
document.getElementById( aParts[ 2 ] ).src = aParts[ 3 ];
break;
}
}catch( exception ){
//alert( 'command: "' + sActionString + '" failed!\n' + exception );
}
}
}
}
AjaxOnCreateHook = function(oRequest)
{
oRequest.options.requestHeaders = { 'X-CT-AjaxRequest' : '1' }
/*oRequest.oTimeout = window.setTimeout('vShowLoading', 1000);*/
vShowLoading();
}
AjaxOnCompleteHook = function(oRequest)
{
if (oRequest.oTimeout)
window.clearTimeout(oRequest.oTimeout);
vHideLoading();
}
Ajax.Responders.register(
{
onCreate: AjaxOnCreateHook
,onComplete: AjaxOnCompleteHook
});
function vShowLoading()
{
if ($('MBLoader1'))
{
$('MBLoader1').show();
}
}
function vHideLoading()
{
if ($('MBLoader1'))
{
$('MBLoader1').hide();
}
}
function oDateToObject(sDate) {
var aDateTime = sDate.split(' ');
var aDate = aDateTime[0].split('-');
var aTime = aDateTime[1].split(':');
return {
year:lz(aDate[0]), month:lz(aDate[1]), day:lz(aDate[2]), hour:lz(aTime[0]), minute:lz(aTime[1]), second:lz(aTime[2])
};
}
function oDateToday() {
oDate = new Date();
return {
year:lz(oDate.getFullYear()), month:lz(oDate.getMonth()+1), day:lz(oDate.getDate()), hour:lz(oDate.getHours()), minute:lz(oDate.getMinutes()), second:lz(0)
};
}
function lz(num) { // leading zero
var str = ''+num+'';
if(str.length == 1) {
return '0'+str;
}
return num;
}
function sDateToday() {
oDate = new Date();
var sDate = lz(oDate.getFullYear())+'-'+lz(oDate.getMonth()+1)+'-'+lz(oDate.getDate())+' '+lz(oDate.getHours())+':'+lz(oDate.getMinutes())+':'+lz(0);
return sDate;
}
function vFocus(sField)
{
if ($(sField))
$(sField).focus();
}
function UpdateRegions(poSelector, piCountryId)
{
StdAjax(
'/registrierung',
{
parameters: { iCountryId: piCountryId, command: 'getRegions' },
onSuccess: function(result) 
{
poSelector.innerHTML = '';
var o = document.createElement('option');
o.value = 0;
o.appendChild(document.createTextNode('Auswahl'));
poSelector.appendChild(o);
$H(result).each(function(e)
{
var o = document.createElement('option');
o.value = e.key;
o.appendChild(document.createTextNode(e.value));
poSelector.appendChild(o);
});
},
onError: function(result, errors) {}
}
);
}
function ExchangeHint(oField)
{
if (!oField.sOldValue)
{
oField.sOldValue = oField.value;
}
if (oField.sOldValue == oField.value)
{
$(oField).removeClassName('Hint');
oField.value = '';
return;
}
if (!oField.value.length)
{
$(oField).addClassName('Hint');
oField.value = oField.sOldValue;
}
}
var InlineHelp = Class.create();
InlineHelp.prototype = {
oTrigger: null,
oHelp: null,
initialize: function(poTrigger, psText)
{
if (poTrigger.oHelp)
{
return;
}
poTrigger.oHelp = document.createElement('div');
poTrigger.oHelp.innerHTML = psText;
poTrigger.oHelp.style.display = 'none';
poTrigger.oHelp.className = 'InlineHelp';
poTrigger.parentNode.insertBefore(poTrigger.oHelp, poTrigger);
poTrigger.style.cursor = 'help';
poTrigger.style.verticalAlign = 'middle';
poTrigger.oHelp.style.cursor = 'help';
$(poTrigger.oHelp).clonePosition
(
poTrigger,
{ setWidth: false, 
setHeight: false, 
offsetLeft: Math.round(poTrigger.offsetWidth / 2),
offsetTop: Math.round(poTrigger.offsetHeight / 2)
}
);
Event.observe(poTrigger, 'mouseover', this._vShowHelp);
Event.observe(poTrigger, 'mouseout', this._vHideHelp);
Event.observe(poTrigger.oHelp, 'mouseover', function(e) { $(Event.element(e)).show(); });
Event.observe(poTrigger.oHelp, 'mouseout', function(e) { $(Event.element(e)).hide(); });
},
_vShowHelp: function(e)
{
if (!Event.element(e).oHelp)
{
return;
}
$(Event.element(e).oHelp).show();
},
_vHideHelp: function(e)
{
if (!Event.element(e).oHelp)
{
return;
}
$(Event.element(e).oHelp).hide();
}
}
//******* Aufklappmenue (mainnav) *******************************/
startList = function(navRoot) {
if (!navRoot || !navRoot.hasChildNodes())
{
return;
}
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
if ($(node.getElementsByTagName('A')[0]).hasClassName('active'))
{
$(node).addClassName('over');
}
node.onmouseover=function() {
var nds = this.parentNode.getElementsByTagName('li');
for (k=0; k<nds.length; k++)
$(nds[k]).removeClassName('over');
$(this).addClassName('over');
var sublist = this.getElementsByTagName('UL')[0];
if (sublist){
for (j=0; j<sublist.childNodes.length; j++){
subNode = sublist.childNodes[j];
if (subNode.nodeName!='LI') {
continue;
}
subNode.onmouseover=function() {
var nds = this.parentNode.getElementsByTagName('li');
for (k=0; k<nds.length; k++)
$(nds[k]).removeClassName('over');
$(this).addClassName('over');
}
subNode.onmouseout=function() {
}   
}
}
}
node.onmouseout=function() {
}
}
}
}
add_onload(function () { startList($$('.lvl1')[0]);  } );
add_onload(function () { startList($$('.lvl0')[0]);  } );
var Debug = Class.create();
Debug.prototype = {
oMsgWindow: null,
initialize: function()
{
if (!this.oMsgWindow)
{
var _this = this;
this.oMsgWindow = document.createElement('div');
this.oMsgWindow.oHeader = document.createElement('h1');
this.oMsgWindow.oHeader.appendChild(document.createTextNode('DEBUG'));
this.oMsgWindow.oTools = document.createElement('form');
this.oMsgWindow.oTools.innerHTML = 'AdKeys: <input type="text" id="NewAdKeys" /><input type="button" value="Reload Ads" onclick="vUpdateAds($(\'NewAdKeys\').value); ReloadBoxes($(\'NewAdKeys\').value); return false" />';
this.oMsgWindow.oContent = document.createElement('div');
this.oMsgWindow.oContent.style.display = 'none';
this.oMsgWindow.id = 'JSDebug';
this.oMsgWindow.appendChild(this.oMsgWindow.oHeader);
this.oMsgWindow.appendChild(this.oMsgWindow.oTools);
this.oMsgWindow.appendChild(this.oMsgWindow.oContent);
document.body.appendChild(this.oMsgWindow);
Event.observe(this.oMsgWindow.oHeader, 'click', function() { $(_this.oMsgWindow.oContent).toggle(); });
}
return this;
},
Clear: function()
{
this.oMsgWindow.oContent.innerHTML = '';
},
Show: function(psValue)
{
this.oMsgWindow.oContent.innerHTML += '<p>'+psValue+'</p>';
}
}
var oDebug = null;
function debug(psValue)
{
if (!window.bIsLoaded)
{
add_onload(function() { debug(psValue); });
return;
}
if (typeof __DEBUG == 'undefined')
{
return;
}
if (!oDebug)
{
oDebug = new Debug();
}
if (!psValue || psValue.length == 0)
{
oDebug.Clear();
return;
}
oDebug.Show(psValue);
}
var IVW = Class.create();
IVW.prototype = {
sIVWCode: null,
initialize: function()
{
return this;
},
// parameter IVWCode, update AddServer, load AGOF [true/false], 
// parameter reload_agf is depricated
Change: function(psIVWCode, no_update, no_agf, reload_agf)
{
var sIVWCode = psIVWCode;
if (!sIVWCode)
{
sIVWCode = typeof __ivw != 'undefined' ? __ivw : null;
}
if (!sIVWCode)
{
return;
} 
var no_update = no_update; 
no_update = typeof no_update != 'undefined' ? no_update : null;
// depricated variable reload_agf: if no_agf is null AGOF is reloaded
// var reload_agf = reload_agf;
// reload_agf = typeof reload_agf != 'undefined' ? reload_agf : null;
var no_agf = no_agf; 
no_agf = typeof no_agf != 'undefined' ? no_agf : null; 
if(typeof __DEBUG != 'undefined')
{
debug('IVW:' + sIVWCode);
if(no_agf == null)
{
debug('agof_reload'); 
}
}
else if($('ivw_img') && IVWURL)
{
$('ivw_img').style.display = 'block'; 
$('ivw_img').src=IVWURL+ sIVWCode+";comment?r="+escape(document.referrer)+"&d="+(Math.random()*100000); 
}
/* reload agof i-frame */
if((no_agf==null) && $('agofscript') && AGOFURL)
{ 
agofcode = sIVWCode; 
if(typeof($('agofscript').src) != 'undefined') {
$('agofscript').src = "/agof.php?agofcode="+agofcode;
}
if(typeof($('agofscript').location) != 'undefined') {
$('agofscript').location.href = "/agof.php?agofcode="+agofcode
}
// $('agofscript').contentWindow.location.reload();
}
if(no_update == null)
{
vUpdateAds();  
}
}
}
var oIVW = new IVW;
function ft_sendInfo(clickName,id,link){
if(typeof id != "undefined" && id)
{
clickName = clickName + "." + id; 
// var action = action.substr(7);
// var action = action.split("/",2);
// if(typeof action[1] != "undefined")
// { 
//  clickName = clickName + "." + action[1];
//} 
}
clickName = clickName + ".klick"; 
if (typeof(wt_sendinfo) != 'undefined') {
wt_sendinfo(clickName, link);
}
}
/* ads */
var Ads = Class.create();
Ads.prototype = {
_aTargets: [],
initialize: function()
{
this._aTargets = $$('.AdTarget');
return this;
},
_sCleanKeys: function(psKeys)
{
psKeys = psKeys.toLowerCase();
psKeys = psKeys.replace(/ä/g, 'ae');
psKeys = psKeys.replace(/ö/g, 'oe');
psKeys = psKeys.replace(/ü/g, 'ue');
psKeys = psKeys.replace(/ß/g, 'ss');
psKeys = psKeys.replace(/[^a-z0-9_\+]/g, '_');
psKeys = psKeys.replace(/_+/g, '_');
return psKeys;
},
/**
* 
* @param {string} psTarget - The id of the ad target element
* @param {string} psKeys - The keys for the ads
* @param {string} poSubKeys - New for Premium POI ads. This property contains 3 keys which contain the current category, city and country.
*                             This is only set if we reload a Premium POI ad.
*/
_vUpdate: function(psTarget, psKeys, poSubKeys)
{
var oTarget = $(psTarget);
var bIsIFrame = oTarget.tagName.toLowerCase() == 'iframe';
if (psKeys)
{
psKeys = this._sCleanKeys(psKeys);
}
debug('<b>New keys received for '+psTarget+': </b>'+psKeys);
if (!oTarget) return;
var oTmp;
if(bIsIFrame){
oTmp = oTarget;
}
else{
oTmp = oTarget.getElementsByTagName('script')[0];
}
if (!oTmp) return;
var sUrl = oTmp.src;
if(bIsIFrame){
sUrl = sUrl.replace(location.href.replace(location.pathname, ''), '');
}		
if (psKeys && psKeys.length > 0)
{
sUrl = sUrl.replace(/^(.*;key=)(.*)(;misc=)([0-9]+)(.*)$/, '$1'+psKeys+'$3'+(Math.floor(new Date().getTime() / 1000))+'$5')
}
if(poSubKeys){
// prevent passing 'null/undefined' to sub1
if(!poSubKeys.sActCategory){ poSubKeys.sActCategory = ''; }
var sSubKeys = ';sub1=' + poSubKeys.sActCategory + ';sub2=' + poSubKeys.sActCity + ';sub3=' + poSubKeys.sActCountry + ';';
sUrl = sUrl.replace(/;sub1=.*;sub2=.*;sub3=.*;/, sSubKeys);
this._vTriggerUpdate(oTarget, sUrl, true);
}
else {
this._vTriggerUpdate(oTarget, sUrl);
}
},
_vUpdateAll: function(psKeys)
{
var _this = this;
$A(this._aTargets).each(function(oTarget)
{
// in case we receive a premium poi ad we have to handle the key / sub key substitution in 
// a different way.
if(oTarget.hasClassName('Premium-POI')){
if(window.TORR && window.TORR.oPremiumPOI){
_this._vUpdate(oTarget.id, psKeys, window.TORR.oPremiumPOI.oGetData());
}
}
else{
_this._vUpdate(oTarget.id, psKeys);
}
});
},
/**
* 
* @param {Object} poTarget
* @param {String} psUrl
* @param {Boolean} pbForceReload - forces reloading for IEs. used to reload premium poi ad.
*/
_vTriggerUpdate: function(poTarget, psUrl, pbForceReload)
{
var bIsIFrame = poTarget.tagName.toLowerCase() == 'iframe';
var oTarget = $(poTarget);
if (!oTarget) return;
var oFrame;
if(!bIsIFrame){
var oFrame = $('f_'+oTarget.id);
if (!oFrame) return;
}
else {
oFrame = oTarget;
}
var isIE6 = IE && !IE7;
if(!isIE6 || bIsIFrame || pbForceReload){
debug('<b>Reloading Ad: '+oTarget.id+'</b><br />'+psUrl);
oFrame.src = (bIsIFrame) ? psUrl : '/_ad_iframe.php?target='+oTarget.id+'&url='+psUrl;
}
},
_vReloadAd: function(psTarget, psInnerHTML)
{
if (!$(psTarget)) return;
debug('<b>Moving Ad: </b>'+psTarget);
$(psTarget).innerHTML = psInnerHTML;
}
}
function vUpdateAds(psKeys)
{
if (!oAds)
{
return;
}
oAds._vUpdateAll(psKeys);
}
function vUpdateAd(psTarget, psKeys)
{
if (!oAds)
{
return;
}
oAds._vUpdate(psTarget, psKeys);
}
function vReloadAd(psTarget, psInnerHTML)
{
if (!oAds)
{
return;
}
oAds._vReloadAd(psTarget, psInnerHTML);
}
function vBounceAd(poTarget, psUrl)
{
if (!oAds)
{
return;
}
oAds._vTriggerUpdate(poTarget, psUrl);
}
var oAds = null;
add_onload(function() { oAds = new Ads; } );
window.onload = function()
{
window.bIsLoaded = true;
run_onload();
}
function clearHints(env) {
if (env) {
var e = $(env).select('.Hint');
} else {
var e = $$('.Hint');
}
for(i=0;i<e.length;i++) {
if(e[i].tagName == 'INPUT' && e[i].type == 'text') {
e[i].value = '';
}
}
}
function openPic(url,winName,winParams) {
var theWindow = window.open(url,winName,winParams);
if (theWindow)  {
theWindow.focus();  
}
}
/*
function webtrekk_id(url) {
var domain = '';
var path = '';
var curr_path = window.location.href.substr(0,window.location.href.lastIndexOf('/'));
curr_path = curr_path.substr(curr_path.indexOf('://')+3);
curr_path.substr(curr_path.indexOf('/')+1);
// full qualified, doesn't work yet !!
if(url.indexOf('://')>-1) {
url = url.substr(url.indexOf('://')+3);
url_parts = url.split('/');
domain = url[0];
path = url.substr(url.indexOf('/')+1);
// relative path
} else if(url.substr(0,1) != '/') {
path = curr_path+'/'+url;
// absolute path
} else {
path = url;
}
trekk_id = path.replace(/\./,'_');
if(domain) {
trekk_id = domain.replace(/\./,'_')+'.'+trekk_id;
}
trekk_id = trekk_id.replace(/\//,'.');
if(trekk_id.indexOf('.') == 0) {
trekk_id = trekk_id.substr(1);
}
alert("domain: "+domain+"\npath: "+path+"\ntrekk_id: "+trekk_id);
}
*/
/*
webtrekk_id('http://www.marcopolo.de/foo/bar');
webtrekk_id('http://www.marcopolo.de/foo/bar.html');
webtrekk_id('http://www.marcopolo.de/foo_bar.html');
webtrekk_id('/bla/foo_bar.html');
webtrekk_id('bla/foo_bar.html');
webtrekk_id('/foo_bar.html');
webtrekk_id('foo_bar.html');
*/
function ReloadBoxes(psTags)
{
if (!window.bIsLoaded)
{
add_onload(function() { ReloadBoxes(psTags); });
return;
}
$A($$('.Reloadable')).each(function(oBox)
{
var sId = $w(oBox.className)[0];
new Ajax.Request('/__containers__/'+sId,
{
method: 'post',
asynchronous: false,
parameters: { sContainerType: sId, sTags: psTags, sReferrer: window.location.pathname },
onSuccess: function(oResult) 
{
if (oResult.responseText.length == 0)
{
return;
}
var oTmp = document.createElement('div');
oTmp.innerHTML = oResult.responseText;
var aReloadables = $(oTmp).select('.Reloadable');
if (aReloadables.length == 0)
{
return;
}
var sNewContent = aReloadables[0].innerHTML;
oBox.innerHTML = sNewContent;
// boxcontrollers
$A($(oBox).select('.TabbedNav')).each(function(oBC)
{
Object.extend($(oBC), TabController);
$(oBC).initialize();
});
}
});
});
}
/* SWFObject v2 compatibility wrapper */
var SWFObject = Class.create();
SWFObject.prototype = {
swf: '',
id: '',
width: 0,
height: 0,
height: 7,
params: { menu: false, bgcolor: '#ffffff' },
variables: {},
attributes: {},
initialize: function(swf, id, width, height, version, bgcolor)
{
this.swf = swf;
this.width = width;
this.height = height;
this.version = version;
this.params.bgcolor = bgcolor;
return this;
},
write: function(id)
{
this.id = id;
var _this = this;
swfobject.embedSWF(this.swf, this.id, this.width, this.height, this.version, null, this.variables, this.params, this.attributes);
swfobject.addLoadEvent(function() { _this.forceRedraw(); });
},
forceRedraw: function()
{
var target = document.getElementById(SWFObject.id);
if (!target)
{
return;
}
target.style.display = 'block';
},
addParam: function(key, value)
{
this.params[key] = value;
},
addVariable: function(key, value)
{
this.variables[key] = value;
}
}
/**
* gettext.js ( http://code.google.com/p/gettext-js/ )
*
* @author     Maxime Haineault, 2007 (max@centdessin.com)
* @version    0.1.0
* @licence    M.I.T
* @example:
*
*   Gettext.lang = 'de';
*   Gettext.gettext('hello %s','world');
*   _('hello %s','world');
*
*/
var jsGettext = Class.create();
jsGettext.prototype = {
initialize: function(lang) {
this.lang         = lang || 'en';
this.debug        = true;
this.LCmessages   = {};
this.links        = [];
this.linksPointer = 0;
this.currentFetch = false;
var _this = this;
$$('link').each(function(link)
{
if (link.rel == 'gettext' && link.href && link.lang) 
{
_this.links.push([link.lang, link.href]);
}
});
new PeriodicalExecuter(function(pe) {
if (Gettext.linksPointer == Gettext.links.length) pe.stop();
else {
Gettext.include.apply(Gettext, Gettext.links[Gettext.linksPointer])
Gettext.linksPointer++;
}
}, 0.5);
},
log: function() {
if (typeof console != 'undefined' && console.log && this.debug) {
console.log.apply(this,arguments);
}
},
include: function(lang, href) {
if (!lang) return;
if (arguments[1].substring(0,7) == 'http://') {
onCompleteCallback = this.include_complete.bind(this);
this.currentFetch  = lang;
new Ajax.Request(arguments[1], {
onComplete: onCompleteCallback,
asynchronous: false
});
}
else {
this.LCmessages[lang] = new jsGettext.Parse(str);
Gettext.log('Loading language: ', lang.toUpperCase(), ' (',str,')');
}
this.log('Loading language: ', lang.toUpperCase(), ' (',href,')');
},
include_complete: function (t) {
this.log('Fetched language: ', this.currentFetch.toUpperCase(), ' ('+ t.responseText.length +' bytes)');
this.LCmessages[this.currentFetch] = this.parse(t.responseText);
this.log(_('Parsed: %d msgids, %d msgids-plurals, %d msgstrs, %d obsoletes, %d contexts, %d references %d flags, %d previous untranslateds, %d previous untranslated-plurals',[
this.LCmessages[this.currentFetch].msgid.length,
this.LCmessages[this.currentFetch].msgidplurals.length,
this.LCmessages[this.currentFetch].msgstr.length,
this.LCmessages[this.currentFetch].obsoletes.length,
this.LCmessages[this.currentFetch].contexts.length,
this.LCmessages[this.currentFetch].references.length,
this.LCmessages[this.currentFetch].flags.length,
this.LCmessages[this.currentFetch].previousUntranslateds.length,
this.LCmessages[this.currentFetch].previousUntranslatedsPlurals.length]));
this.currentFetch = false;
},
// This function based on public domain code. Feel free to take a look the original function at http://jan.moesen.nu/
// ---
// Changes made by Maxime Haineault (2007):
// - The function is now extended to Strings instead (using prototype)
// - The function now accept arrays as arguments, much easier to handle (using prototype)
// - The function throw error if argument lenght doesn't equal matches count (as specified in gettex file format documentation)	
// - Translations lookups
// Reference: http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
gettext: function() {
if (!arguments || arguments.length < 1 || !RegExp) return;
var str      = arguments[0];
arguments[0] = null;
arguments    = $A(arguments).compact();
if (arguments.length == 1 && typeof arguments[0] == 'object') {
arguments = $A(arguments[0]);
}
hasTokens = str.match('%','g');
if (hasTokens && hasTokens.length != arguments.length) {
Gettext.log('Gettext error: Arguments count ('+ arguments.length +') does not match replacement token count ('+ str.match('%','g').length +').');
return;
}
// Try to find translated string
if (Gettext.LCmessages[Gettext.lang] && Gettext.LCmessages[Gettext.lang].msgid.indexOf(str) != -1) {
str = Gettext.LCmessages[Gettext.lang].msgstr[Gettext.LCmessages[Gettext.lang].msgid.indexOf(str)];
}
var re  = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; //'
var a   = b = [], i = 0, numMatches = 0;		
while (a = re.exec(str)) {
var leftpart   = a[1], pPad  = a[2], pJustify  = a[3], pMinLength = a[4];
var pPrecision = a[5], pType = a[6], rightPart = a[7];
numMatches++;
if (pType == '%') subst = '%';
else {
var param = arguments[i];
var pad   = '';
if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
else if (pPad) pad = pPad;
var justifyRight = true;
if (pJustify && pJustify === "-") justifyRight = false;
var minLength = -1;
if (pMinLength) minLength = parseInt(pMinLength);
var precision = -1;
if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
var subst = param;
if (pType == 'b')      subst = parseInt(param).toString(2);
else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
else if (pType == 'u') subst = Math.abs(param);
else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
else if (pType == 'o') subst = parseInt(param).toString(8);
else if (pType == 's') subst = param;
else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
}
str = leftpart + subst + rightPart;
i++;
}
return str;
},
parse: function(str) {
// #  translator-comments
// #. extracted-comments
// #: reference...
// #, flag...
// #| msgid previous-untranslated-string
// msgid untranslated-string
// msgstr translated-string
rgx_msg   = new RegExp(/((^#[\:\.,~|\s]\s?)?|(msgid\s"|msgstr\s")?)?("$)?/g);
function clean(str) {
return str.replace(rgx_msg,'').replace(/\\"/g,'"');
}
po        = str.split("\n");
head      = [];
msgids    = [];
strings   = [];
obs       = [];
tpls      = [];
curMsgid  = -1;
output    = { header: [], contexts: [], msgid: [], msgidplurals: [], references: [], flags: [], msgstr: [], obsoletes: [], previousUntranslateds: [], previousUntranslatedsPlurals: [] };
for(x=0, cnt=po.length; x<cnt; ++x) {
if (po[x].substring(0,1) == '#') {
switch (po[x].substring(1,2)) {
// translator-comments
case ' ':
// top comments
if (curMsgid == 0) output.header.push(po[x]);
break;
// references
case ':':
if(typeof output.references[curMsgid] == 'undefined') output.references[curMsgid] = [];
output.references[curMsgid].push(clean(po[x]));
break;
// msgid previous-untranslated-string
case '|':
if(typeof output.previousUntranslateds[curMsgid] == 'undefined') output.previousUntranslateds[curMsgid] = [];
// previous-untranslated-string-plural
if (po[x].substring(3,15) == 'msgid_plural') {
output.previousUntranslateds[curMsgid].push(clean(po[x]));
}
else {
output.previousUntranslatedsPlurals[curMsgid].push(clean(po[x]));
}
break;
// flags
case ',':
if(typeof output.flags[curMsgid] == 'undefined') output.flags[curMsgid] = [];
output.flags[curMsgid].push(clean(po[x]));
break;
// obsoletes
case '~':
if (po[x].substring(3,9) == 'msgid ') {
curMsgid++;
if(typeof output.msgid[curMsgid] == 'undefined') output.msgid[curMsgid] = [];
output.msgid[curMsgid].push(clean(po[x]));
output.obsoletes.push(curMsgid);
}
else if (po[x].substring(3,10) == 'msgstr ') {
if(typeof output.msgstr[curMsgid] == 'undefined')    output.msgstr[curMsgid] = [];
output.msgstr[curMsgid].push(clean(po[x]));
}
break;
}
}
else {
// untranslated-string
if (po[x].substring(0,6) == 'msgid ') {
if (po[x].substring(6,8) != '""')  {
curMsgid++;
// if(typeof output.msgid[curMsgid] != 'object') output.msgid[curMsgid] = [];
// output.msgid[curMsgid].push(clean(po[x]));
output.msgid[curMsgid] = clean(po[x]);
}
}
// untranslated-string-plural
if (po[x].substring(0,13) == 'msgid_plural ') {
if (!output.msgidplurals[curMsgid]) output.msgidplurals[curMsgid] = [];
output.msgidplurals[curMsgid].push(clean(po[x]));
}
// translated-string
if (po[x].substring(0,6) == 'msgstr') {
if (po[x].substring(8,10) != '""')  {
// translated-string-case-n
if (po[x].substring(6,7) == '[') {}
else {
// if (!output.msgstr[curMsgid]) output.msgstr[curMsgid] = [];
// output.msgstr[curMsgid].push(clean(po[x]));
output.msgstr[curMsgid] = clean(po[x]);
}
}
}
// context
if (po[x].substring(0,7) == 'msgctxt ') {
if (!output.contexts[curMsgid]) output.contexts[curMsgid] = [];
output.contexts[curMsgid].push(clean(po[x]));
}
}
}
return output;
}
}
/*
Gettext = new jsGettext();
Gettext.debug = false;
function _() { return Gettext.gettext.apply(this,arguments); }
*/
function _() { return arguments[0]; }
/**
* TabController
* 
* @author Ralf Barth / 21TORR AGENCY gmbh
*/
var TabController = {
// functions that get called when a tab is switched, handy for defining custom actions on some tab boxes (eg. IVW counting on gateway tab box)
aSwitchActions: [],
/**
* Constructor
* @param (object) poOptions - An object containing all possible options for the tabcontroller.
*                 Currently implemented options:
*                 - oExcludeTabs (object) - An array containing the tabs which should not load their content through AJAX.
*                   The tabs are identified by their href eg ('#top5').
*/
initialize: function(poOptions)
{
var that = this;
this.aSwitches = $A(this.getElementsByTagName('a'));
this.sInitialClass = this.className;
this.sActiveTab = '';
// Look for a tab-to-activate in cookie
//var sOldTab = get_cookie('TCActiveTab');
var sOldTab = "";
// Look for a tab to active in
if (sOldTab.length <= 2)
{
var sOldTab = window.location.href.split('#')[1];
}
var bRemembered = false;
for (var i = 0; i < this.aSwitches.length; i++)
{
var oSwitch = this.aSwitches[i];
oSwitch.sTab = this.aSwitches[i].href.split('#')[1];
oSwitch.oLayer = $(oSwitch.sTab);
if (sOldTab && sOldTab.length > 2)
{
if (oSwitch.sTab == sOldTab)
{
$(oSwitch).addClassName('active');
bRemembered = true;
}
else
{
$(oSwitch).removeClassName('active').addClassName('tab_inactive');
}
}
$(oSwitch).hasClassName('active') ? $(oSwitch.oLayer).show() : $(oSwitch.oLayer).hide();
oSwitch.oController = this;
oSwitch.toggleLayer = function()
{
if (this.bActive)
{ 
this.oLayer.show();
this.removeClassName('tab_inactive').addClassName('active');
$(this.oController).addClassName(this.sTab+'_IsActive');
if(that.aSwitchActions.length !== 0){
that.aSwitchActions.each(function(fSwitchAction){
if(typeof(fSwitchAction) != 'function'){ return; }
fSwitchAction.call();
});
}
}
else
{
this.oLayer.hide();
this.removeClassName('active').addClassName('tab_inactive');
}
}
Event.observe(oSwitch, 'click', function(e)
{
Event.stop(e);
var oThisSwitch = Event.element(e);
if (oThisSwitch.bActive){
return;
}
var sCategoryHref = oThisSwitch.getAttribute('href');
var sActiveLayer = sCategoryHref.split('#')[1];
if(typeof(PremiumPOI) != 'undefined'){
if(!window.TORR || !window.TORR.oPremiumPOI){
window.TORR = window.TORR || {};
window.TORR.oPremiumPOI = new PremiumPOI();
}
window.TORR.oPremiumPOI.vSet('sActCategory', oCategoryMap[sCategoryHref] || '');
}
that.sActiveTab = '#' + sActiveLayer;
/*if(poOptions && poOptions.oExcludeTabs && !poOptions.oExcludeTabs[sCategoryHref] && !oThisSwitch.hasClassName('hasLoaded')){
StdAjax('/gmaps/volume/getpoisbycategory', {
parameters: {
sVolume : sVolume,
sMainCat: oCategoryMap[sCategoryHref],
aCats: sCat,
iPageId: 1
},
onSuccess: function(result){
oThisSwitch.addClassName('hasLoaded');
oThisSwitch.oLayer.innerHTML = result.html;
for(i=0; i<result.data.length;i++)
{
var oElem = $$('div#' + sActiveLayer + ' div#fed_poi_rate'+result.data[i].ID)[0];
oRating.vEmbeddRating(oElem, "fed_poi", result.data[i].ID);
} 
}						
});
}*/
var oController = oThisSwitch.oController;
$(oController).className = oController.sInitialClass;
oController.aSwitches.each(function(oSwitch)
{ 
oSwitch.bActive = oSwitch == oThisSwitch;
oSwitch.toggleLayer();
});
});
}
if (!bRemembered)
{
this.aSwitches[0].bActive = true;
this.aSwitches[0].toggleLayer();
}
},
vAddSwitchAction: function(pfAction){
if(typeof(pfAction) == 'function'){
this.aSwitchActions[this.aSwitchActions.length] = pfAction;
}
},
sGetActiveTab: function(){
return this.sActiveTab;
}
}
function jump(obj)
{
var sPath = obj.options[obj.selectedIndex].value;
if (sPath == '')
{
return false;
}
window.location.href = sPath;
}
function _vShowForumHint()
{
var oM = new Modal(2,400);
oM.Show('Bitte anmelden',
'Um Antworten zu können musst Du angemeldet sein. Falls Du noch kein Mitglied bist, kannst Du Dich <a href="/community/registrierung">hier registrieren</a>.'
);
oM.SetCancelButtonTitle('Schliessen');
}
/**
* Part of the lightbox project
* http://www.huddletogether.com/projects/lightbox2/
* Licence: http://creativecommons.org/licenses/by/2.5/
*/
// -----------------------------------------------------------------------------------
//
//	Lightbox v2.03.3
//	by Lokesh Dhakar - http://www.huddletogether.com
//	5/21/06
//
//	For more information on this script, visit:
//	http://huddletogether.com/projects/lightbox2/
//
//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//
//	Credit also due to those who have helped, inspired, and made their code available to the public.
//	Including: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), Thomas Fuchs(mir.aculo.us), and others.
//
//
// -----------------------------------------------------------------------------------
//
//	Additional methods for Element added by SU, Couloir
//	- further additions by Lokesh Dhakar (huddletogether.com)
//
Object.extend(Element, {
getWidth: function(element) {
element = $(element);
return element.offsetWidth;
},
setWidth: function(element,w) {
element = $(element);
element.style.width = w +"px";
},
setHeight: function(element,h) {
element = $(element);
element.style.height = h +"px";
},
setTop: function(element,t) {
element = $(element);
element.style.top = t +"px";
},
setLeft: function(element,l) {
element = $(element);
element.style.left = l +"px";
},
setSrc: function(element,src) {
element = $(element);
element.src = src;
},
setHref: function(element,href) {
element = $(element);
element.href = href;
},
setInnerHTML: function(element,content) {
element = $(element);
element.innerHTML = content;
}
});
// -----------------------------------------------------------------------------------
//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com
//
function getPageScroll(){
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
arrayPageScroll = new Array(xScroll,yScroll)
return arrayPageScroll;
}
// -----------------------------------------------------------------------------------
//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.com
// Edit for Firefox by pHaez
//
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);
if (self.innerHeight) {	// all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
//	console.log("pageWidth " + pageWidth)
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
// -----------------------------------------------------------------------------------
function showSelectBoxes(doc){
var selects = doc.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "visible";
}
}
// ---------------------------------------------------
function hideSelectBoxes(doc){
var selects = doc.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
}
// ---------------------------------------------------
function showFlash(doc){
var flashObjects = doc.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "visible";
}
var flashEmbeds = doc.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "visible";
}
}
// ---------------------------------------------------
function hideFlash(doc){
var flashObjects = doc.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "hidden";
}
var flashEmbeds = doc.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "hidden";
}
}
/**
* Custom code (not part of lightbox)
*/
function blurPageCheckResize() {
var arrayPageSize = getPageSize();
Element.setWidth('overlay', arrayPageSize[0]);
Element.setHeight('overlay', arrayPageSize[1]);
}
function showInputfields(doc){
var inputs = doc.getElementsByTagName("input");
for (i = 0; i != inputs.length; i++) {
inputs[i].style.visibility = "visible";
}
}
function hideInputfields(doc){
var inputs = doc.getElementsByTagName("input");
for (i = 0; i != inputs.length; i++) {
inputs[i].style.visibility = "hidden";
}
}
function hideAllForOverlay(doc) {
hideSelectBoxes(doc);
hideInputfields(doc)
hideFlash(doc);
}
function showAllForOverlay(doc) {
showSelectBoxes(doc);
showInputfields(doc)
showFlash(doc);
}
function blurPage(afterFinish) {
var arrayPageSize = getPageSize();
var objBody = document.getElementsByTagName("body").item(0);
var objOverlay = document.createElement("div");
if(!afterFinish) afterFinish = function() {};
objOverlay.setAttribute('id','overlay');
objOverlay.style.display = 'none';
objBody.appendChild(objOverlay);
hideAllForOverlay(document);
window.oldonresize = window.onresize;
window.onresize = blurPageCheckResize;
Element.setWidth('overlay', arrayPageSize[0]);
Element.setHeight('overlay', arrayPageSize[1]);
Effect.Appear('overlay', { duration: 0.5, from: 0.0, to: 0.1, afterFinish:afterFinish});
}
function focusPage() {
var objBody = document.getElementsByTagName("body").item(0);
var objOverlay = $('overlay');
window.onresize = window.oldonresize;
Effect.Fade(objOverlay, { duration: 0.5, afterFinish: function() {
if(objOverlay) {
objBody.removeChild(objOverlay);
showAllForOverlay(document);
}}}
);
}
function modalBoxShow(level,width,height) {
alert('Bitte die neue ModalBox nutzen.');
var objBody = document.getElementsByTagName('body').item(0);
var layer = document.createElement('div');
var layer_inner = document.createElement('div');
var table = document.createElement('table');
var rows = new Array();
var cells = new Array();
var smallWidths = [ 0,2,3,5,6,8 ];
var smallHeight = [ 0,1,2,6,7,8 ];
var bigWidth = [ 1,4,7 ];
var bgAppendix = [ 'tl','tc','tr','cl','','cr','bl','bc','br' ];
objBody.appendChild(layer);
layer.id = 'modalbox_'+level;
layer.className = 'modal-box';
if(width) {
layer.style.width = width;
}
layer.style.top = '100px';
// IE error
try {
layer.style.left = window.innerWidth/2-(width/2)+'px';
} catch(e) {
layer.style.left = document.documentElement.clientWidth/2-(width/2)+'px';
}
//layer.style.display = 'none';
layer_inner.className='modal-inner';
table.id = 'modalbox_table_'+level;
layer.style.zIndex = 100+level;
table.setAttribute('border', 0);
table.setAttribute('cellpadding',0);
table.setAttribute('cellspacing',0);
table.setAttribute('cellmargin', 0);
var k = 0;
for(var i=0;i<3;i++) {
rows[i] = document.createElement('tr');
for(j=0;j<3;j++) {
cells[k] = document.createElement('td');
rows[i].appendChild(cells[k]);
k++;
}
table.appendChild(rows[i]);
}
for(var i=0;i<smallWidths.length;i++) {
cells[smallWidths[i]].style.width = '10px';
}
for(var i=0;i<smallHeight.length;i++) {
cells[smallHeight[i]].style.height = '10px';
}
if(width) {
for(var i=0;i<bigWidth.length;i++) {
cells[bigWidth[i]].style.width = width+'px';
}
}
for(var i=0;i<bgAppendix.length;i++) {
if(bgAppendix[i]) {
if(bgAppendix[i].indexOf('c')==0) {
cells[i].style.background = 'url(/images/modalshadow_'+bgAppendix[i]+'.png) top left repeat-y';
} else if(bgAppendix[i].indexOf('c')==1) {
cells[i].style.background = 'url(/images/modalshadow_'+bgAppendix[i]+'.png) top left repeat-x';
} else {
cells[i].style.background = 'url(/images/modalshadow_'+bgAppendix[i]+'.png) top left no-repeat';
}
}
}
if(height) {
var heightImage = document.createElement('img');
heightImage.src = '/ADMIN/images/s.gif';
heightImage.width = 1;
heightImage.height = height;
cells[3].appendChild(heightImage);
}
cells[4].style.width = (width-10)+'px';
cells[4].style.backgroundColor = '';
cells[4].valign = 'top';
cells[4].appendChild(layer_inner);
layer.appendChild(table);
layer_inner.style.border = '';
layer.style.display = '';
layer.style.border = "2px solid blue";
table.style.border = "2px dashed red";
layer.style.height = "200px";
centerBox(layer,width);
return layer_inner;
}
function modalBoxDestroy(level) {
var box = $('modalbox_'+level);
if(box) {
box.parentNode.removeChild(box);
}
}
function centerBox(boxId,width) {
var layer = $(boxId);
layer.style.top = '100px';
try {
layer.style.left = window.innerWidth/2-(width/2)+'px';
} catch(e) {
layer.style.left = document.documentElement.clientWidth/2-(width/2)+'px';
}
}
function showDialog(sType, sTitle, sText, oOnClick)
{
alert('-y-OLD-y-');
/*
var oDialog = $('GlobalDialog');
if (!oDialog)
return;
oDialog.addClassName(sType);
var oHeader = $('GlobalDialogHeader');
var oText = $('GlobalDialogText');
var oAction = $('GlobalDialogAction');
oHeader.innerHTML = sTitle;
oText.innerHTML = sText;
if(!oOnClick) {
oOnClick = function() {
closeDialog();
}
}
oAction.onclick = oOnClick;
oDialog.show();
*/
}
function showConfirmDialog(sType, sTitle, sText, oOnYes, oOnNo, oAppendToContent)
{
alert('-x-OLD-x-');
/*
var oDialog = $('GlobalConfirmDialog');
if (!oDialog)
return;
oDialog.addClassName(sType);
var oHeader = $('GlobalConfirmDialogHeader');
var oText = $('GlobalConfirmDialogText');
var oActionYes = $('GlobalConfirmDialogActionYes');
var oActionNo = $('GlobalConfirmDialogActionNo');
oHeader.innerHTML = sTitle;
oText.innerHTML = sText;
if (oAppendToContent)
oText.appendChild(oAppendToContent);
oActionYes.onclick = oOnYes;
oActionNo.onclick = oOnNo;
oDialog.show();
*/
}
function closeDialog() { $('GlobalDialog').hide(); }
function closeConfirmDialog() { $('GlobalConfirmDialog').hide(); }
/* New modal box */
var oMBBlurLayer = null;
var iNumModalBoxes = 0;
var Modal = Class.create();
Modal.prototype = {
iLevel: 100,
iWidth: 400,
iHeight: 300,
sTitle: '',
aPageSize: null,
oFrame: null,
oRoot: null,
oCloseFunction: null,
oDOMParent: null,
oDOMNextSibling: null,
bHasTopAd: false,
fAbortAction: function(){},
initialize: function(iLevel, iWidth, iHeight, poDragHandle)
{
iNumModalBoxes++;
this.iLevel = iLevel;
this.iWidth = iWidth;
this.iHeight = iHeight;
this.oDragHandle = poDragHandle;
this.aPageSize = getPageSize();
//this.oRoot = document.getElementsByTagName('body')[0];
/*
* fix disappearing elements in IE6, see bug #6147
* add the modal box to the content container element, instead of directly 
* inserting it into the body, fix for FF2, modalbox disappearing behind the header
*/
this.oRoot = ( $('container') ) ? $('container') : document.getElementsByTagName('body')[0];
this._vConstruct();
},
vAddAbortAction: function(pfAction){
if(typeof(pfAction) == 'function'){
this.fAbortAction = pfAction;
}
},
_vBlurPage: function()
{ 
var _this = this;
// Hide select boxes 
if (IE && !IE7)
{
hideSelectBoxes(document);
showSelectBoxes(this.oFrame);
}
oMBBlurLayer = $('MBBlurLayer');
if (!oMBBlurLayer)
{
oMBBlurLayer = document.createElement('div');
oMBBlurLayer.id = 'MBBlurLayer';
oMBBlurLayer.style.display = 'none';
this.oRoot.appendChild(oMBBlurLayer);
}
oMBBlurLayer.style.width = this.aPageSize[0] + 'px';
oMBBlurLayer.style.height = this.aPageSize[1] + 'px';
Effect.Appear(oMBBlurLayer,
{
from: 0.0,
to: 0.45,
duration: 0.5,
afterFinish: function() { 
oMBBlurLayer.bBlurred = true; 
_this._vShowFrame(); 
if(typeof(XMLHttpRequest) != undefined){
oMBBlurLayer.height = document.viewport.getHeight() + 'px';
if(document.all && typeof(XMLHttpRequest) == 'undefined'){
oMBBlurLayer.style.position = 'absolute';
}
else{
oMBBlurLayer.style.position = 'fixed';
}
} 
}
});
//oMBBlurLayer.style.opacity = '0.5';
//oMBBlurLayer.style.display = '';
//oMBBlurLayer.style.filter = 'alpha(opacity=50)';
oMBBlurLayer.bBlurred = true; _this._vShowFrame();
},
_vConstruct: function()
{
var that = this;
this.oFrame = document.createElement('div');
this.oFrame.className = 'MBFrame';
// For Safari
this.oFrame.style.position = 'absolute';
this.oFrame.style.width = this.iWidth + 'px';
this.oFrame.style.height = this.iHeight ? this.iHeight + 'px' : 'auto';
this.oFrame.style.display = 'none';
this.oFrame.style.zIndex = 100 + this.iLevel;
this.oFrame.style.left = (Math.round(this.aPageSize[0] / 2) - Math.round(this.iWidth / 2)) + 'px';
var iTopPosition = Math.round(this.aPageSize[3] / 2)
- (this.iHeight ? Math.round(this.iHeight / 2) : 300)
+ getPageScroll()[1];
this.oFrame.style.top = iTopPosition < 0 ? 0 : iTopPosition + 'px';
this.oFrame.oTopAd = document.createElement('div');
this.oFrame.oTopAd.className = 'MBTopAd';
this.oFrame.appendChild(this.oFrame.oTopAd);
this.oFrame.oHeader = document.createElement('h1');
this.oFrame.oHeader.appendChild(document.createTextNode(this.sTitle));
this.oFrame.appendChild(this.oFrame.oHeader);
this.oFrame.oErrorHint = document.createElement('p');
this.oFrame.oErrorHint.className = 'MBErrorHint';
this.oFrame.oErrorHint.style.display = 'none';
this.oFrame.appendChild(this.oFrame.oErrorHint);
this.oFrame.oNotifications = document.createElement('p');
this.oFrame.oNotifications.className = 'MBNotifications';
this.oFrame.oNotifications.style.display = 'none';
this.oFrame.oNotifications.style.width = this.iWidth - 60 + 'px';
this.oFrame.appendChild(this.oFrame.oNotifications);
this.oFrame.oContent = document.createElement('div');
this.oFrame.oContent.className = 'MBContent';
this.oFrame.appendChild(this.oFrame.oContent);
this.oFrame.oFooter = document.createElement('div');
this.oFrame.oFooter.className = 'MBFooter';
this.AddButton('Abbrechen', function(e) { Event.element(e).oController.Close(); that.fAbortAction.call(); }, this, 'MBCancel');
this.oFrame.appendChild(this.oFrame.oFooter);
this.oFrame.oClose = document.createElement('a');
this.oFrame.oClose.className = 'MBClose';
this.oFrame.oClose.appendChild(document.createTextNode('Close'));
this.oFrame.oClose.oModal = this;
Event.observe(this.oFrame.oClose, 'click', function(e) { Event.element(e).oModal.Close(); });
//this.oFrame.oHeader.appendChild(this.oFrame.oClose);
this.oFrame.appendChild(this.oFrame.oClose);
if (!$('MBLoader'+this.iLevel))
{
this.oFrame.oLoader = document.createElement('img');
this.oFrame.oLoader.src = '/images/modalbox.ajax_loader.gif';
this.oFrame.oLoader.id = 'MBLoader'+this.iLevel;
this.oFrame.oLoader.style.display = 'none';
this.oFrame.appendChild(this.oFrame.oLoader);
}
this.oRoot.appendChild(this.oFrame);
// Draggable-ize our modal box
this.SetDragHandle(this.oFrame.oHeader);
},
_vShowFrame: function()
{
// disabled blinddown due to screen glitches 
/*Effect.BlindDown(this.oFrame, { duration: 0.5 });*/
$(this.oFrame).show();
},
SetDragHandle: function(poDragHandle)
{
if (this.oFrame.oDraggable)
{
this.oFrame.oDraggable.destroy();
}
this.oFrame.oDraggable = new Draggable(this.oFrame,
{ handle: poDragHandle, starteffect: null, endeffect: null }
);
$(poDragHandle).style.cursor = 'move';
},
DefineCloseFunction: function(oFunction)
{
this.oCloseFunction = oFunction;
},
ReloadOnExit: function(psUrl)
{
if (psUrl)
{
this.DefineCloseFunction(function() { window.location.href = psUrl; });
}
else
{
this.DefineCloseFunction(function() { window.location.reload(); });
}
},
MoveDOMContent: function(oDOMObject)
{
this.oDOMObject = oDOMObject;
this.oDOMParent = this.oDOMObject.parentNode;
this.oDOMNextSibling = this.oDOMObject.nextSibling;
$(this.oDOMObject).toggle(); // Switch between visible and invisible state
this.oFrame.oContent.innerHTML = '';
this.oFrame.oContent.appendChild(this.oDOMObject);
// Finishing commands to restore e.g tinyMCE functionality
if (typeof tinyMCE != 'undefined')
{
$A(this.oDOMObject.getElementsByTagName('textarea')).each(
function(oTextarea)
{
if (oTextarea.id)
tinyMCE.execCommand('mceAddControl', false, oTextarea.id);
}
);
}
},
RestoreDOMContent: function()
{
// Finishing commands to restore e.g tinyMCE functionality
if (this.oDOMObject)
{
if (typeof tinyMCE != 'undefined')
$A(this.oDOMObject.getElementsByTagName('textarea')).each(
function(oTextarea)
{
if (oTextarea.id)
tinyMCE.execCommand('mceRemoveControl', false, oTextarea.id);
}
);
// Restore original position of inserted DOM objects
if (this.oDOMNextSibling)
this.oDOMParent.insertBefore(this.oDOMObject, this.oDOMNextSibling);
else
this.oDOMParent.appendChild(this.oDOMObject);
$(this.oDOMObject).toggle();
this.oDOMObject = null;
}
},
Show: function(sTitle, mContentHTML)
{
this.HideErrorHint();
this.HideNotification();
this.SetTitle(sTitle);
this.oFrame.className = 'MBFrame';
this.RestoreDOMContent();
if (mContentHTML)
{
if (typeof mContentHTML == 'object')
this.MoveDOMContent(mContentHTML);
else
this.oFrame.oContent.innerHTML = mContentHTML;
}
else
{
this.oFrame.oContent.innerHTML = '';
}
if (!oMBBlurLayer || !oMBBlurLayer.bBlurred)
{
this._vBlurPage();
}
else
{
if (this.oFrame.style.display == 'none')
{
this._vShowFrame();
}
this.RemoveButtons();
}
this.SetFocus();
},
SetTitle: function(sTitle)
{
if (sTitle.length)
{
this.oFrame.oHeader.firstChild.nodeValue = sTitle;
$(this.oFrame.oHeader).show();
}
else
{
$(this.oFrame.oHeader).hide();
}
},
AddContent: function(mContentHTML)
{
this.HideNotification();
if (typeof mContentHTML == 'object')
this.oFrame.oContent.appendChild(mContentHTML);
else
this.oFrame.oContent.innerHTML += mContentHTML;
},
SetTopAd: function(mContentHTML)
{
if (!this.oFrame.oTopAd)
{
return;
}
if (typeof mContentHTML == 'object')
{
this.oFrame.oTopAd.innerHTML = '';
this.oFrame.oTopAd.appendChild(mContentHTML);
}
else
{
this.oFrame.oTopAd.innerHTML = mContentHTML;
}
this.bHasTopAd = true;
$(this.oFrame.oTopAd).show();
},
HideTopAd: function()
{
if (!this.oFrame.oTopAd)
{
return;
}
$(this.oFrame.oTopAd).hide();
},
ShowSuccess: function(sTitle, sContentHTML, oOnClick, iTimeout)
{
iTimeout ? this.ShowAutoClose(sTitle, sContentHTML, iTimeout) : this.Show(sTitle, sContentHTML);
$(this.oFrame).addClassName('MBFSuccess');
this.RemoveCancelButton();
oOnClick ? this.AddButton('OK', oOnClick, this) : this.AddButton('OK', this.Close, this);
},
ShowError: function(sTitle, sContentHTML, oOnClick)
{
this.Show(sTitle, sContentHTML);
$(this.oFrame).addClassName('MBFError');
this.RemoveCancelButton();
oOnClick ? this.AddButton('OK', oOnClick, this) : this.AddButton('OK', this.Close, this);
},
ShowAutoClose: function(sTitle, sContentHTML, iTimeout, oOnClick)
{
this.Show(sTitle, sContentHTML);
$(this.oFrame).addClassName('MBFSuccess');
this.RemoveCancelButton();
var _this = this;
if (oOnClick)
{
this.pe = new PeriodicalExecuter(function(oPE) { oPE.stop(); oOnClick(); }, iTimeout ? iTimeout : 3);
}
else 
{
this.pe = new PeriodicalExecuter(function(oPE) { oPE.stop(); _this.Close(); }, iTimeout ? iTimeout : 3);
}
},
ShowErrorHint: function(sContent)
{
this.oFrame.oErrorHint.innerHTML = sContent;
$(this.oFrame.oErrorHint).show();
},
HideErrorHint: function()
{
$(this.oFrame.oErrorHint).hide();
},
ShowNotification: function(sContent)
{
this.oFrame.oNotifications.innerHTML = sContent;
$(this.oFrame.oNotifications).show();
},
HideNotification: function()
{
$(this.oFrame.oNotifications).hide();
},
SetFocus: function(sField)
{
if (!sField)
{
var aFields = this.oFrame.oContent.getElementsByTagName('input');
if (!aFields[0] || !aFields[0].id)
return;
sField = aFields[0].id;
}
if (!$(sField))
return;
window.setTimeout("MBFocus('"+sField+"')", 1000);
},
Close: function(e)
{
var oController = this;
if (e && Event.element(e) && Event.element(e).oController)
var oController = Event.element(e).oController;
if (oController.oCloseFunction)
{
oController.oCloseFunction(oController);
return;
}
oController.Destroy();
},
Destroy: function(oAfterFinish, bLeaveBlurred)
{
if (this.pe)
{
this.pe.stop();
}
var _this = this;
iNumModalBoxes--;
Effect.BlindUp(_this.oFrame,
{
duration: 0.5,
afterFinish: function()
{
// restore ad tags
if (_this.bHasTopAd)
{
_this.oFrame.oTopAd.firstChild.hide();
document.body.appendChild(_this.oFrame.oTopAd.firstChild);
_this.bHasTopAd = false;
}
_this.RestoreDOMContent();
_this.oFrame.oDraggable.destroy();
_this.RemoveButtons();
_this.RemoveCancelButton();
$(_this.oFrame).remove();
if (oAfterFinish)
oAfterFinish();
if (!bLeaveBlurred && iNumModalBoxes < 1)
{
Effect.Fade(oMBBlurLayer,
{
duration: 0.5,
afterFinish: function()
{
oMBBlurLayer.bBlurred = false;
_this.oRoot.removeChild(oMBBlurLayer);
// Re-show select boxes on IE < 7.x
if (IE && !IE7)
showSelectBoxes(document);
}
});
}
}
});
},
AddButton: function(sTitle, oAction, oController, sId, sHref)
{
var oButton = document.createElement('a');
if (oController)
oButton.oController = oController;
if (sId)
{
oButton.Identifier = sId;
oButton.id = sId;
}
oButton.appendChild(document.createTextNode("» "+sTitle));
//oButton.className = 'link-button MBBtn_'+sButton;
oButton.className = 'link-button MBBtn_'+this.sGenerateClassName(sTitle);
this.oFrame.oFooter.insertBefore(oButton, this.oFrame.oFooter.lastChild);
if(sHref){
oButton.href = sHref;
}
else{
oButton.href = 'javascript:void(0)';
Event.observe(oButton, 'click', oAction);
}
},
sGenerateClassName: function(sTitle) 
{
return sTitle.replace(/\W/g, '').toLowerCase(); // no specialchars and all lowercase
},
RemoveButton: function(iButtonIdx)
{
switch (iButtonIdx)
{
case 'all':
$A(this.oFrame.oFooter.getElementsByTagName('a')).each(
function(oButton)
{
if (oButton.Identifier == 'MBCancel') return;
$(oButton).remove();
});
break;
case 'cancel':
$A(this.oFrame.oFooter.getElementsByTagName('a')).each(
function(oButton)
{
if (oButton.Identifier == 'MBCancel') $(oButton).remove();
});
break;
default:
var oButton = this.oFrame.oFooter.getElementsByTagName('a')[iButtonIdx];
if (oButton)
$(oButton).remove();
}
},
RemoveButtons: function()
{
this.RemoveButton('all');
},
RemoveCancelButton: function()
{
this.RemoveButton('cancel');
},
SetCancelButtonTitle: function(sTitle)
{
this.oFrame.oFooter.lastChild.firstChild.nodeValue = sTitle;
this.oFrame.oFooter.lastChild.className = 'link-button MBBtn_'+this.sGenerateClassName(sTitle);
}
}
function MBFocus(sField)
{
try
{
document.getElementById(sField).focus();
}
catch(e)
{}
}
var Comments = Class.create();
Comments.prototype = {
initialize: function ()
{
},
SaveMediaComment: function(iMediaId, sComment, oCallback)
{
_this = this;
StdAjax('/comments',
{
parameters: { comment: sComment, media_id: iMediaId, command: 'saveMediaComment' },
onSuccess: function(result)
{
if (typeof oCallback != 'undefined')
{
oCallback(result.comments);
}
},
onError: function(result,errors)
{
}
}
);
},
SaveEventComment: function(iEventId, sComment, oCallback)
{
_this = this;
StdAjax('/comments',
{
parameters: { comment: sComment, event_id: iEventId, command: 'saveEventComment' },
onSuccess: function(result)
{
_this.oLastComment.USERNAME = result.USERNAME;
_this.oLastComment.DATE = result.DATE;
_this.oLastComment.COMMENT = result.COMMENT;
},
onError: function(result,errors)
{
}
}
);
},
SavePageComment: function(iPageId, sComment, oCallback)
{
_this = this;
StdAjax('/__modules__/comments',
{
parameters: { comment: sComment, page_id: iPageId, command: 'savePageComment' },
onSuccess: function(result)
{
if (typeof oCallback != 'undefined')
{
oCallback(result.comments);
}
},
onError: function(result,errors)
{
}
}
);
},
SaveMPOTGComment: function(iId, sComment, oCallback)
{
_this = this;
StdAjax('/comments',
{
parameters: { comment: sComment, mpotg_id: iId, command: 'saveMPOTGComment' },
onSuccess: function(result)
{
_this.oLastComment.USERNAME = result.USERNAME;
_this.oLastComment.DATE = result.DATE;
_this.oLastComment.COMMENT = result.COMMENT;
},
onError: function(result,errors)
{
}
}
);
},
SaveFedPoiComment: function(iId, sComment, oCallback)
{
_this = this;
StdAjax('/comments',
{
parameters: { comment: sComment, fed_poi_id: iId, command: 'saveFedPoiComment' },
onSuccess: function(result)
{
if (typeof oCallback != 'undefined')
{
oCallback(result.comments);
}
},
onError: function(result,errors)
{
}
}
);
},  
SaveUserComment: function(iId, sComment, oCallback)
{
_this = this;
StdAjax('/comments',
{
parameters: { comment: sComment, user_id: iId, command: 'saveUserComment' },
onSuccess: function(result)
{
_this.oLastComment.USERNAME = result.USERNAME;
_this.oLastComment.DATE = result.DATE;
_this.oLastComment.COMMENT = result.COMMENT;
},
onError: function(result,errors)
{
}
}
);
},
RedrawTo: function(psTarget, paComments)
{
var oTarget = $(psTarget);
var oNumComments = $('nbr_'+psTarget);
if (!paComments || paComments.length == 0 || !oTarget || !oNumComments)
{
return;
}
oTarget.innerHTML = '';
$A(paComments).each(function(oC)
{
var oneComment = document.createElement('div');
var img = document.createElement('img');
img.src = oC.AUTHOR_PORTRAIT_IMAGE_SRC;
oneComment.appendChild(img);
var h = document.createElement('h3');
var sAuthorName = oC.AUTHOR_USERNAME
? oC.AUTHOR_USERNAME
: oC.AUTHOR_FIRSTNAME + ' ' + oC.AUTHOR_LASTNAME; 
h.appendChild
(
document.createTextNode(sAuthorName + ' schrieb am ' + oC.DISPLAY_DATE)
);
oneComment.appendChild(h);
var p = document.createElement('p');
p.appendChild(document.createTextNode(oC.CONTENT));
oneComment.appendChild(p);
oTarget.appendChild(oneComment);
});
$(oTarget).show();
$(oNumComments).innerHTML = paComments.length;
}
}
var oComments = new Comments();
/**
* Rating request helper class.
*/
var RatingRequest = function(oOptions){
this.oRating = {
bUserRated: null,
iAverage: 0,
iRating: 0
};
this.oDomObj = oOptions.domObj;
this.sType = oOptions.type;
this.sObjectId  = oOptions.objectId;
this.oCallBack = oOptions.oCallBack || null;
};
RatingRequest.prototype.toString = function(){
return this.sObjectId + '|' + this.sType;
}
var Rating = Class.create();
Rating.prototype = {
oModal: null,
oCallback: null,
aRatingResults: {},
aRatingReqStack: [],
initialize: function()
{
return this;
},
// add a rating request to the stack
vAddRatingRequest: function(domObj, type, objectId, oCallBack){
this.aRatingReqStack.push(new RatingRequest({
domObj: domObj,
type: type,
objectId: objectId,
oCallBack: oCallBack
}));
},
vSubmitRatingQueue: function(){
var that = this;
var sRatingIDs = this.aRatingReqStack.join(',');
var sURL = '/__modules__/rating/getMultiple/' + sRatingIDs;
StdAjax(sURL, {
onSuccess: function(result){
for(var i=0, len=that.aRatingReqStack.length, oDomObj=null, rating=null, bUserRated=false; i<len; i++){
var oRatingReq = that.aRatingReqStack[i];
if(!result[oRatingReq.sObjectId]){ continue; }
if(Object.isElement(oRatingReq.oDomObj)){
oDomObj = oRatingReq.oDomObj;
}
else{
oDomObj = $(oRatingReq.oDomObj);
}
oDomObj.innerHTML = '';
rating = result[oRatingReq.sObjectId].avg_rate;
bUserRated = result[oRatingReq.sObjectId]['user_voted'] ? result[oRatingReq.sObjectId]['user_voted'] == 1 ? true : result[oRatingReq.sObjectId]['user_voted'] : false;
oDomObj.appendChild(that._oCreateRatingBar(bUserRated, result[oRatingReq.sObjectId].average, oRatingReq.sType, oRatingReq.sObjectId));
if (oRatingReq.oCallBack)
{
oRatingReq.oCallBack(result);
}
}
that.aRatingReqStack = [];
},
onError: function(res, error){
that.aRatingReqStack = [];
}
});
},
vEmbeddRating: function(domObj, type, objectId, oCallBack) 
{
var bUserRated = false;
var bCreate = true;
var _this = this;
var oDomObj;
if(Object.isElement(domObj)){
oDomObj = domObj;
}
else{
oDomObj = $(domObj);
}
oDomObj.innerHTML = '';
StdAjax('/__modules__/rating/get/'+type+'/'+objectId,
{
onSuccess: function(result) 
{
rating = result.avg_rate;
bUserRated = result['user_voted'] ? result['user_voted'] == 1 ? true : result['user_voted'] : false;
oDomObj.appendChild(_this._oCreateRatingBar(bUserRated, result.average, type, objectId));
if (oCallBack)
{
oCallBack(result);
}
},
onError: function(result, errors) 
{
}
});
},
_oCreateRatingBar: function(user_voted, rating, type, objectId) {
var oBar = document.createElement('ul');
var _this = this;
this._vSetRating(type, objectId, rating);
oBar.className = 'star-rating';
for (var i = 1; i <= 5; i++) {
var li = document.createElement('li');
var a = document.createElement('a');
var t = document.createTextNode(String(i)+' Stern(e)');
a.href = '#';
a.title = 'Mit '+String(i)+' von 5 Sternen bewerten';
if(rating>=i) {
li.className = 'rating_on';
} else {
li.className = 'rating_off';
}
a.stars = i;
a.iId = type+'_'+objectId;
if(!user_voted) {
li.onmouseover = function() {
oRating._vHighlight(oBar,this);
};
li.onmouseout = function() {
if(rating > 0) {
// reset to initial value
rating = _this._iGetRating(type, objectId);
var nodes = oBar.childNodes;
_this._vHighlight(oBar,nodes[rating-1]);
} else { 
_this._vHighlight(oBar,0);
}
};
li.onclick = function() {
var nodes = oBar.getElementsByTagName('li');
var rating = 0;
for(var i=0;i<nodes.length;i++) {
if(nodes[i] == this) {
rating = i+1; break;
}
}
oRating.vDoRate(oBar, type, objectId, rating, function() {
var nodes = oBar.childNodes;
for(var i=0;i<nodes.length;i++) {
nodes[i].onmouseover = null;
nodes[i].onclick = null;
nodes[i].onmouseout = null;
}
});
};
} 
else
{
li.style.cursor = 'default';
a.style.cursor = 'default';
oBar.title = 'Du hast Deine Bewertung bereits abgegeben.';
if (user_voted < -1) 
{
oBar.title = 'Bewertungen sind nur nach Login möglich.';
/*var _this = this;
li.onclick = function() { _this._vShowHint(); };*/
}
else if (user_voted < 0) 
{
oBar.title = 'Eigene Inhalte können nicht bewertet werden.';
}
}
li.appendChild(a);
oBar.appendChild(li);
}
return oBar;
},
_vShowHint: function()
{
var oM = new Modal(2,400);
oM.Show('Bitte anmelden',
'Um Bewertungen abgeben zu können musst Du angemeldet sein. Falls Du noch kein Mitglied bist, kannst Du Dich <a href="/community/registrierung">hier registrieren</a>.'
);
oM.SetCancelButtonTitle('Schliessen');
},
_vSetRating: function(type, objectId, rating) {
this.aRatingResults[type+'|'+objectId] = rating;
},
_iGetRating: function(type, objectId) {
return this.aRatingResults[type+'|'+objectId];
},
_vHighlight: function(oBar, oStar) {
var nodes = oBar.getElementsByTagName('li');
var sClass = 'rating_on';
if(!oStar) sClass = 'rating_off';
for(var i=0;i<nodes.length;i++) {
nodes[i].className = sClass;
if(nodes[i] == oStar) {
sClass = 'rating_off';
}
}
},
vDoRate: function(domObj, type, object_id, rating, onFinish) {
var nodes = domObj.getElementsByTagName('li');
for(var i=0;i>=rating;i++) {
nodes[i].className = 'rating_off';
}
var _this = this;
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.confirmChangePassword.klick','click'); 
wt_sendinfo(sWebtrekkCode+'.Bild.Rating.klick','click');
}
sIVWCode = typeof sIVWCode != 'undefined' ? sIVWCode : null;
oIVW = typeof oIVW != 'undefined' ? oIVW : null;
if(sIVWCode && oIVW)
{
oIVW.Change(sIVWCode);
}
else if(typeof IVWCODE != 'undefined' && IVWCODE && oIVW)
{
oIVW.Change(IVWCODE); 
}
StdAjax(
'/__modules__/rating/rate/'+type+'/'+object_id,
{
parameters: "rating="+rating,
onSuccess: function(result) {
_this._vShowSuccess();
},
onError: function(result, errors) {
if(errors['not_logged_in']) {
_this._vShowError('Du bist nicht eingeloggt' );
}else if(errors['already_rated']) {
_this._vShowError('Du hast bereits abgestimmt' );
} else {
_this._vShowError('Ein unbekannter Fehler ist aufgetreten' );
}
}
}
);
onFinish();
},
_vShowSuccess: function()
{
if (this.oCallback)
{
return this.oCallback('Vielen Dank! Die Bewertung wird in Kürze verzeichnet', true);
}
var oModal = new Modal(1,500);
oModal.ShowSuccess('Vielen Dank!', 'Die Bewertung wird in Kürze verzeichnet',null,2 );
},
_vShowError: function(psMessage)
{
if (this.oCallback)
{
return this.oCallback(psMessage, false);
}
var oModal = new Modal(1,500);
oModal.ShowSuccess('Fehler!', psMessage,null,2 );
}  
}
oRating = new Rating();
var Abuse = Class.create();
Abuse.prototype = {
abuse_modalbox: null,
abuse_extra_data: null,
initialize: function() {
return this;
},
show: function( psExtraData, pfAbortAction ) {
this.abuse_extra_data = psExtraData;
StdAjax(
'/__modules__/abuse',
{
onSuccess: function(result) {
abuse_modalbox = new Modal( 1, 500 );
abuse_modalbox.Show( 'Missbrauch melden', result.contents );
abuse_modalbox.AddButton('Senden', function() { abuse_send('abuse_form'); });
if(pfAbortAction){
abuse_modalbox.vAddAbortAction(pfAbortAction);
}
modalbox.DefineCloseFunction
(
function(oModal)
{
oModal.Destroy();
}
);
},
onError: function(result, errors) {
}
}
);
},
user_abuse: function( psExtraData, pnUserId ){
this.abuse_extra_data = psExtraData;
StdAjax(
'/__modules__/abuse/user_abuse',
{
parameters: 'nUserId=' + pnUserId,
onSuccess: function(result) {
abuse_modalbox = new Modal( 1, 500 );
abuse_modalbox.AddButton('Senden', function() { abuse_user_send('abuse_user_form'); });
abuse_modalbox.Show( 'User melden', result.contents );
modalbox.DefineCloseFunction
(
function(oModal)
{
oModal.Destroy();
}
);
},
onError: function(result, errors) {
}
}
);
},	
send: function(form) {
var aValue = [];
for (var i = 0; i < $(form).elements.length; i++)
{
var oField = $(form).elements[i];
if (oField.type == 'radio' && oField.checked)
{
aValue.push(oField.value);
}
}
if ($('abuse_email') && $('abuse_email').value.length == 0)
{
$('abuse_email').addClassName('error');
abuse_modalbox.ShowErrorHint( 'Bitte füllen Sie die rot markierten Felder aus.' );
return;
}
if( $('description') != null && $('sonstiges'))
{
$('description').removeClassName('error');
$('sonstiges').removeClassName('error');
if( $('description').value == '' && $('sonstiges').value == '' )
{
if( $('description').value == '' && $('sonstiges_radio').checked ){
$('sonstiges').addClassName('error');
}else $('description').addClassName('error');
abuse_modalbox.ShowErrorHint( 'Bitte füllen Sie die rot markierten Felder aus.' );
return;
}else{
abuse_modalbox.HideErrorHint();
}	  
}else{	  
if( ($('abuse_body').value == '') && (!aValue.length)){
$('abuse_body').addClassName('error');
$('category_label1').addClassName('error'); 
$('category_label2').addClassName('error');
$('category_label3').addClassName('error');
$('category_label4').addClassName('error');
abuse_modalbox.ShowErrorHint( 'Bitte füllen Sie die rot markierten Felder aus.' );
return;
}
else{
$('category_label1').removeClassName('error'); 
$('category_label2').removeClassName('error');
$('category_label3').removeClassName('error');
$('category_label4').removeClassName('error');
$('abuse_body').removeClassName('error');
abuse_modalbox.HideErrorHint();
}
if(!aValue.length)
{
$('category_label1').addClassName('error'); 
$('category_label2').addClassName('error');
$('category_label3').addClassName('error');
$('category_label4').addClassName('error');
abuse_modalbox.ShowErrorHint( 'Bitte wählen Sie eine Kategorie' );
return; 
}
else{
$('category_label1').removeClassName('error'); 
$('category_label2').removeClassName('error');
$('category_label3').removeClassName('error');
$('category_label4').removeClassName('error');
abuse_modalbox.HideErrorHint();
}
if( $('abuse_body').value == ''){
$('abuse_body').addClassName('error');
abuse_modalbox.ShowErrorHint( 'Bitte füllen Sie die rot markierten Felder aus.' );
return;
}
else{
$('abuse_body').removeClassName('error');
abuse_modalbox.HideErrorHint();
}
}
StdAjax(
'/__modules__/abuse/send',
{
parameters: AjaxFormCollect(form) + '&extra_data=' + encodeURIComponent( this.abuse_extra_data ),
onSuccess: function(result) {
abuse_modalbox.ShowSuccess('Missbrauch gemeldet', 'Meldung wurde erfolgreich verschickt.',null,2 );
},
onError: function(result, errors) {
abuse_modalbox.ShowError('Missbrauch nicht gemeldet', 'Ihre Meldung konnte nicht verschickt werden. Möglicherweise sind Sie nicht angemeldet.' );
}
}
);
}
}
var oAbuse = new Abuse();
function abuse_show( psExtraData ){
sIVWCodeFooter = typeof sIVWCodeFooter != 'undefined' ? sIVWCodeFooter : null;
oIVW = typeof oIVW != 'undefined' ? oIVW : null;
if(sIVWCodeFooter && oIVW)
{
oIVW.Change(sIVWCodeFooter,null,null,true);
}
if( $('PageUrl') ){
psExtraData += "\n\nURL: " + $('PageUrl').innerHTML;
}
var fAbortAction = function(){
if(!oIVW){
var oIVW = new IVW();
}
oIVW.Change('1mp_int');
}
oAbuse.show( psExtraData, fAbortAction );
}
function abuse_send( form ){
if(typeof sWebtrekkCodeFooter != 'undefined' && typeof sWebtrekkCodeFooter != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'.text.editMedia.klick'); 
wt_sendinfo(sWebtrekkCodeFooter+'.text.abuse_send.klick','click');
}
oAbuse.send( form );
}
function abuse_user_send( form ){
oAbuse.send( form );
}
function abuse_user_show( psExtraData, pnUserId ){
if( $('PageUrl') ){
psExtraData += "\n\nURL:" + $('PageUrl').innerHTML;
} 
oAbuse.user_abuse(psExtraData,pnUserId);
}
var Recommend = Class.create();
Recommend.prototype = {
recommend_modalbox: null,
recommend_extra_data: null,
sTemplateId: 'recommend',
// limitations and counter for adding multiple recipients
iRcpCount: 5,
iTotalRcp: 5,
iMaxRcp: 15,
initialize: function() {
return this;
},
vShowModalBox: function(poConfig){
var that = this;
var fSendFunc = poConfig.sendFunc || function(){
recommend_send('recommend_form');
};
recommend_modalbox = new Modal( 1, poConfig.width );
recommend_modalbox.AddButton('Senden', fSendFunc);
recommend_modalbox.Show( poConfig.title, poConfig.content );
recommend_modalbox.DefineCloseFunction
(
function(oModal)
{
oModal.Destroy();
}
);
},
show: function( psExtraData, psTemplateId ) {
var that = this;
this.recommend_extra_data = psExtraData;
this.sTemplateId = psTemplateId ? psTemplateId : 'recommend';
StdAjax(
'/__modules__/recommend',
{
parameters: {
sTemplateId: this.sTemplateId
},
onSuccess: function(result) {
that.vShowModalBox({title: 'Seite weiterempfehlen', content: result.contents, width: 500});
},
onError: function(result, errors) {
}
}
);
},
showCompetition: function(psExtraData, piCompetitionUser){
var that = this;
this.recommend_extra_data = psExtraData;
this.sTemplateId = 'recommend_game';
StdAjax('/__modules__/recommend/competition/' + piCompetitionUser , {
parameters: {
sTemplateId: this.sTemplateId
},
onSuccess: function(result){
that.vShowModalBox({title: 'Gewinnspiel weiterempfehlen', content: result.contents, width: 650, sendFunc: function(){
recommend_send('recommend_form', piCompetitionUser);
}});
// init event handlers for adding and removing recipient items
$('addRecipient').observe('click', function(e){
that.iTotalRcp++;
that.iRcpCount++;
/*hide the add button if we reached the limit of rcps*/
if(that.iTotalRcp >= that.iMaxRcp){ Event.element(e).hide(); }
var oRcpItem = $('rcpItem0').cloneNode(true);
// we need to remove the input values..
$(oRcpItem).getElementsBySelector('input').each(function(n){
n.value = '';
});
$(oRcpItem).addClassName('added');
oRcpItem.setAttribute('id', oRcpItem.getAttribute('id') + that.iRcpCount);
$(oRcpItem).getElementsBySelector('a.RemoveButton')[0].observe('click', function(e){
that.iTotalRcp--;
$(oRcpItem).remove();
$('addRecipient').show();
Event.stop(e);
});
$('rcpContainer').appendChild(oRcpItem);
Event.stop(e);
});
}
});
},
sendRecommendation: function(form){
if( $('rcp_Name').value == '' ){
$('rcp_Name').addClassName('error');
}else{
$('rcp_Name').removeClassName('error');
}
if( $('rcp_email').value == '' ){
$('rcp_email').addClassName('error');
}
else{
$('rcp_email').removeClassName('error');
}  
if( $('sender_Name').value == '' ){
$('sender_Name').addClassName('error');
}else{
$('sender_Name').removeClassName('error');
} 
if( $('sender_email').value == '' ){
$('sender_email').addClassName('error');
}else{
$('sender_email').removeClassName('error');
}    
if($('recommend_privacy').checked == false){
$('recommend_privacy_label').addClassName('error');
}
else {
$('recommend_privacy_label').removeClassName('error');
}
if($('rcp_msg').value == '' || $('rcp_Name').value == '' || $('rcp_email').value == '' || $('sender_Name').value == '' || $('sender_email').value == '')
{
recommend_modalbox.ShowErrorHint( 'Bitte fülle die rot markierten Felder aus.' );
return;
}
// remove whitespaces
var rcp_email = $('rcp_email').value.replace(' ',''); 
// split email string
var aRcp_email = rcp_email.split(","); 
// trim name string an split it
var rcp_name = $('rcp_Name').value.replace(/^\s+/, '').replace(/\s+/, '');
var aName = rcp_name.split(",");
// check if recipient names = recipient email amount
if(aRcp_email.length != aName.length)
{
$('rcp_Name').addClassName('error'); 
$('rcp_email').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte geben Sie für jeden Empfänger eine E-mail Adresse sowie einen Namen an' );
return; 
}
for(var i = 0; i<aRcp_email.length; i++)
{
// trim string 
var rcp_emailvalue = aRcp_email[i].replace(/^\s+/, '').replace(/\s+$/, '');
var rcp_email_val = rcp_emailvalue.match(/^[a-z0-9_\-\.]+@[a-z0-9_\-\.]+\.[a-z\,]{2,6}$/gi) ? true : false;
if(rcp_email_val == false)
{
$('rcp_email').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte überprüfen Sie die Emailadresse' );
return;
}
}
var send_email = $('sender_email').value; 
var send_email_val = send_email.match(/^[a-z0-9_\-\.]+@[a-z0-9_\-\.]+\.[a-z]{2,6}$/gi) ? true : false;  
if(send_email_val == false)
{
$('sender_email').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte überprüfen Sie die Emailadresse' );
return;
}
if($('recommend_privacy').checked === false)
{
$('recommend_privacy').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte akzeptieren Sie die Datenschutzbestimmungen' );
return;
}
/* 
if($('rcp_msg').value.length > 250)
{
$('rcp_msg').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte geben Sie nicht mehr als 250 Zeichen ein.' );
return;
}
*/ 
StdAjax(
'/__modules__/recommend/send',
{
parameters: AjaxFormCollect(form) + '&sTemplateId=' + this.sTemplateId + '&extra_data=' + encodeURIComponent( this.recommend_extra_data ),
onSuccess: function(result) {
recommend_modalbox.ShowSuccess('Weiterempfehlung', 'Weiterempfehlung wurde erfolgreich verschickt.', null, 2 );
//recommend_modalbox.ShowNotification ('Weiterempfehlung wurde erfolgreich verschickt');
},
onError: function(result, errors) {
recommend_modalbox.ShowError('Weiterempfehlung', 'Ihre Weiterempfehlung konnte nicht verschickt werden. Überprüfen Sie die Sender und Empfänger Emailadressen.' );
//recommend_modalbox.ShowNotification ('Ihre Weiterempfehlung konnte nicht verschickt werden. Überprüfen Sie die Sender und Empfänger Emailadressen.');
}
}
);
},
send: function(form, piCompetitionUser) {
var bIsValid = true, aRcpNames = {}, sSenderEmail = $('sender_email').value.toLowerCase();
if( $('rcp_msg').value == '' ){
$('rcp_msg').addClassName('error');
}else{
$('rcp_msg').removeClassName('error');
}
if(!$('rcpContainer')){
return this.sendRecommendation(form);
}
$('rcpContainer').getElementsBySelector('div.rcp-row').each(function(n){
if(!bIsValid){return;}
var oInputs = {empty:[], set:[]};
$(n).getElementsBySelector('input').each(function(oInput){
if(oInput.value == ''){
oInputs['empty'].push(oInput);
}
else if(oInput.value != ''){
oInputs['set'].push(oInput);
}
if(oInputs['empty'].length == oInputs['set'].length){
oInputs['empty'][0].addClassName('error');
bIsValid = false;
recommend_modalbox.ShowErrorHint( 'Bitte überprüfen Sie die' + (oInputs['empty'][0].id == 'rcp_email' ? ' Emailadresse' : ' Eingaben'));
return;
}
else {
for(var sName in oInputs){
$(oInputs[sName]).each(function(i){
var oInput = $(i);
if(oInput.hasClassName('error')){
oInput.removeClassName('error');
}
});
}
}
//check the rcp email
if(oInput.getAttribute('id') == 'rcp_email' && oInput.value != ''){
var rcp_emailvalue = oInput.value.replace(/^\s+/, '').replace(/\s+$/, '');
var rcp_email_val = rcp_emailvalue.match(/^[a-z0-9_\-\.]+@[a-z0-9_\-\.]+\.[a-z\,]{2,6}$/gi) ? true : false;
if(rcp_email_val == false || aRcpNames[oInput.value.toLowerCase()] || rcp_emailvalue.toLowerCase() == sSenderEmail)
{
oInput.addClassName('error');
bIsValid = false;
recommend_modalbox.ShowErrorHint( 'Bitte überprüfen Sie die Emailadresse' );
return;
}
aRcpNames[oInput.value.toLowerCase()] = 1;
}
});
if(!bIsValid){return;}
});
// we need to check if the form is still valid, because we cant exit the send method through the traversing closure.
if(!bIsValid){ return; }
if( $('sender_Name').value == '' ){
$('sender_Name').addClassName('error');
}else{
$('sender_Name').removeClassName('error');
} 
if( $('sender_email').value == '' ){
$('sender_email').addClassName('error');
}else{
$('sender_email').removeClassName('error');
}    
if($('rcp_msg').value == '' || $('rcp_Name').value == '' || $('rcp_email').value == '' || $('sender_Name').value == '' || $('sender_email').value == '')
{
recommend_modalbox.ShowErrorHint( 'Bitte fülle die rot markierten Felder aus.' );
return;
}
var send_email = $('sender_email').value; 
var send_email_val = send_email.match(/^[a-z0-9_\-\.]+@[a-z0-9_\-\.]+\.[a-z]{2,6}$/gi) ? true : false;  
if(send_email_val == false)
{
$('sender_email').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte überprüfen Sie die Emailadresse' );
return;
}
if($('recommend_privacy').checked === false)
{
$('recommend_privacy').addClassName('error');
recommend_modalbox.ShowErrorHint( 'Bitte akzeptieren Sie die Datenschutzbestimmungen' );
return;
}
var sURL = piCompetitionUser ? '/__modules__/recommend/sendcompetition/' + piCompetitionUser : '/__modules__/recommend/send' ;
StdAjax(
sURL,
{
parameters: AjaxFormCollect(form) + '&sTemplateId=' + this.sTemplateId + '&extra_data=' + encodeURIComponent( this.recommend_extra_data ),
onSuccess: function(result) {
recommend_modalbox.ShowSuccess('Weiterempfehlung', 'Weiterempfehlung wurde erfolgreich verschickt.', null, 2 );
//recommend_modalbox.ShowNotification ('Weiterempfehlung wurde erfolgreich verschickt');
},
onError: function(result, errors) {
recommend_modalbox.ShowError('Weiterempfehlung', 'Ihre Weiterempfehlung konnte nicht verschickt werden. Überprüfen Sie die Sender und Empfänger Emailadressen.' );
//recommend_modalbox.ShowNotification ('Ihre Weiterempfehlung konnte nicht verschickt werden. Überprüfen Sie die Sender und Empfänger Emailadressen.');
}
}
);
}
}
var oRecommend = new Recommend();
function recommend_show( psExtraData, psTemplateId, piCompetitionUser )
{
var sExtraData = psExtraData || '';
sIVWCodeFooter = typeof sIVWCodeFooter != 'undefined' ? sIVWCodeFooter : null;
oIVW = typeof oIVW != 'undefined' ? oIVW : null;
if(sIVWCodeFooter && oIVW)
{
oIVW.Change(sIVWCodeFooter,null,null,true);
}
if ($('PageUrl'))
{
sExtraData += "link=" + $('PageUrl').innerHTML + "|";
}
switch(psTemplateId){
case 'recommend_game':
var iCompetitionUser = piCompetitionUser || 0;
oRecommend.showCompetition(sExtraData, iCompetitionUser);
break;
default: 
oRecommend.show(sExtraData, psTemplateId);
break;
}
}
function recommend_send( form, piCompetitionUser ){
if(typeof sWebtrekkCodeFooter != 'undefined' && typeof sWebtrekkCodeFooter != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'.text.editMedia.klick'); 
wt_sendinfo(sWebtrekkCodeFooter+'.text.recommend_send.klick','click');
}
if(piCompetitionUser){
oRecommend.send(form, piCompetitionUser);
}
else {
oRecommend.send( form );
}
}
var Visitors = Class.create();
Visitors.prototype = {
visitors_modalbox: null,
sTemplateId: 'all_visitors',
initialize: function() {
return this;
},
show: function(psTemplateId ) {
this.sTemplateId = psTemplateId ? psTemplateId : 'all_visitors';
StdAjax(
'/__modules__/visitors',
{
onSuccess: function(result) {
visitors_modalbox = new Modal( 1, 500 );
visitors_modalbox.RemoveCancelButton();
visitors_modalbox.AddButton('Schliessen', visitors_modalbox.Close, visitors_modalbox);
visitors_modalbox.Show( 'Alle Besucher meines Profils', result.contents );
modalbox.DefineCloseFunction
(
function(oModal)
{
oModal.Destroy();
}
);
},
onError: function(result, errors) {
}
}
);
}
}
var oVisitors = new Visitors();
function visitors_show(psTemplateId )
{  
sIVWCode = typeof sIVWCode != 'undefined' ? sIVWCode : null;
oIVW = typeof oIVW != 'undefined' ? oIVW : null;
if(sIVWCode && oIVW)
{
oIVW.Change(sIVWCode);
}
else if(typeof IVWCODE != 'undefined' && IVWCODE && oIVW)
{
oIVW.Change(IVWCODE); 
}
oVisitors.show(psTemplateId);
}
function search_doCheck( psSearchPhrase, psDefaultText, poSearchError ){
if( psSearchPhrase.length < 3 ){
poSearchError.innerHTML = '<b>Bitte mindestens 3 Zeichen eingeben</b>'
return false;
}
if( psSearchPhrase == psDefaultText ){
poSearchError.innerHTML = '<b>Bitte einen Suchbegriff eingeben</b>'
return false;
}
}
Event.observe(window, 'load', function(){
new Ajax.Autocompleter('query', 'autocompleteLayer', '/__modules__/search/ac/', {
paramName: 'searchTerm', 
parameters: 'command=autocomplete',
minChars: 3,
indicator: 'autocompleteSwirl'
});
});
var FriendsClass = Class.create();
FriendsClass.prototype = {
oModal: null,
oModal2: null,
User: null,
incr: 0,
FilterAssociations: null,
initialize: function() {
this.FilterAssociations = new Array();
return this;
},
Open: function(user) {
var _this = this;
StdAjax(
'/__modules__/friends/apply/'+user,
{
onSuccess: function(result) 
{
if(sIVWCode && oIVW)
{
oIVW.Change(sIVWCode);
}
else if(typeof IVWCODE != 'undefined' && IVWCODE)
{
oIVW.Change(IVWCODE); 
}
_this.oModal = new Modal(1, 500);
if (result.status == false) 
{
_this.oModal.AddButton
(
'Schließen',
function() { _this.oModal.Close(); }
);
_this.oModal.ShowError('Einladung fehlgeschlagen', 'Deine Einladung an <strong>'+result.displayname+'</strong> kann nicht verschickt werden. <br><br> Der Grund lautet: '+result.reason, function () {location.reload(true) } );
} 
else 
{
_this.oModal.AddButton(
'Senden',
function() { Friends.Send(user); }
);
_this.oModal.Show('Kontaktanfrage', result.contents);	
if ($('ff_description') && $('ff_num_chars'))
{
$('ff_description').counter = $('ff_num_chars');
$('ff_description').counter.maxChars = parseInt($('ff_description').counter.firstChild.nodeValue);
Event.observe($('ff_description'), 'keyup', 
function(e)
{
var t = Event.element(e);
var n = t.counter.maxChars - t.value.length;
if (n <= 0)
{
t.value = t.value.substr(0, t.counter.maxChars);
t.counter.firstChild.nodeValue = '0';
return;
}
t.counter.firstChild.nodeValue = n;
}
);
}
}
},
onError: function(result, errors) 
{
alert('error');
}
}
);
},
Revoke: function(user) {
var _this = this;
StdAjax(
'/__modules__/friends/revoke/'+user,
{
onSuccess: function(result) {
var oModal = new Modal(1,500);
oModal.ReloadOnExit();
oModal.ShowSuccess('Anfrage entfernt', 'Die Anfrage wurde gelöscht',null,2 );
},
onError: function(result, errors) {
alert('error');
}
}
);
},
Accept: function(user) {
var _this = this;
StdAjax(
'/__modules__/friends/accept/'+user,
{
onSuccess: function(result) {
var oModal = new Modal(1,500);
oModal.ReloadOnExit();
oModal.ShowSuccess('Anfrage angenommen', 'Die Anfrage wurde angenommen', null, 2 );	  			
//location.reload(true);                   // would reopen the friend request
//window.location.href = location.pathname;  // instead we only want to show the inbox
},
onError: function(result, errors) {
alert('error');
}
}
);
},
Remove: function(user, displayname) {
var _this = this;
var oModal = new Modal(1,500);
oModal.Show('Kontakt entfernen', 'Soll <strong>'+displayname+'</strong> wirklich von Deiner Kontaktliste entfernt werden?');
oModal.AddButton('OK', function(e)
{
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.delete.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.delete.klick','click');
}
StdAjax(
'/__modules__/friends/remove/'+user,
{
onSuccess: function(result) {
oModal.ReloadOnExit();
oModal.ShowSuccess('Kontakt entfernt', 'Der Kontakt wurde erfolgreich entfernt.', null, 2);
},
onError: function(result, errors) {
alert('error');
}
}
);
});
},
Reject: function(user) {
var _this = this;
StdAjax(
'/__modules__/friends/reject/'+user,
{
onSuccess: function(result) {
var oModal = new Modal(1,500);
oModal.ReloadOnExit();
oModal.ShowSuccess('Anfrage abgelehnt', 'Die Anfrage wurde abgelehnt', null, 2 );
},
onError: function(result, errors) {
alert('error');
}
}
);
},
Renew: function(user) {
var _this = this;
StdAjax(
'/__modules__/friends/renew/'+user,
{
onSuccess: function(result) {
var oModal = new Modal(1,500);
oModal.ReloadOnExit();
oModal.ShowSuccess('Anfrage wiederhergestellt', 'Die Anfrage wurde wiederhergestellt und kann nun angenommen werden', null, 2 );
},
onError: function(result, errors) {
alert('error');
}
}
);
},
Decline: function(user) {
var _this = this;
StdAjax(
'/__modules__/friends/decline/'+user,
{
onSuccess: function(result) {
var oModal = new Modal(1,500);
oModal.ReloadOnExit();
oModal.ShowSuccess('Anfrage entfernt', 'Die Anfrage wurde erflogreich von der Liste entfernt', null, 2 );
},
onError: function(result, errors) {
alert('error');
}
}
);
},
Close: function() {
this.oModal.Close();
},
Send: function(user) {
var sParam = AjaxFormCollect('friends_form');
var _this = this;
if ($F('ff_description').length == 0)
{
_this.oModal.ShowErrorHint('Bitte gib einen Grund für Deine Kontaktanfrage an.');
}
else
{
StdAjax(
'/__modules__/friends/send/'+user,
{
parameters: sParam,
onSuccess: function(result) {
if (result.invited == false) {
_this.oModal.ShowError('Einladung fehlgeschlagen', 'Deine Einladung an <strong>'+result.displayname+'</strong> konnte nicht verschickt werden. <br><br> Der Grund lautet: '+result.reason, function () {location.reload(true) } );
}
else {
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.invite.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.invite.klick','click');
}
_this.oModal.ShowSuccess('Einladung versendet!', 'Deine Einladung wurde erfolgreich an <strong>'+result.displayname+'</strong> verschickt.', function () {location.reload(true) }, 2);
}
},
onError: function(result, errors) {
}
}
);
}
},
Invite: function(paAssociations, noIvw)
{   
noIvw = typeof noIvw != 'undefined' ? noIvw : false;    
sIVWCode = typeof sIVWCode != 'undefined' ? sIVWCode : null;
oIVW = typeof oIVW != 'undefined' ? oIVW : null;
if(sIVWCode && oIVW && noIvw == false)
{
oIVW.Change(sIVWCode);
}
else if(typeof IVWCODE != 'undefined' && IVWCODE && noIvw == false)
{ 
oIVW.Change(IVWCODE); 
}
StdAjax('/__modules__/friends/invitemsg',
{
onSuccess: (function(result) 
{
var _this = this;
this.incr = 0;
this.oModal = new Modal(1,550);
this.oModal.Show('Freunde einladen', result.contents);
this.oModal.AddButton('senden', function() { _this._vSendInvitation(); });
}).bind(this),
onError: function(result, errors) 
{
}
});  
},
AddRecipient: function (iMax)
{
this.incr++;
//clone both p-tags within $Recipient
var rcpNameClone = $('Recipient').appendChild($('Recipient').select('.rcpName')[0].cloneNode(true));
var rcpEmailClone = $('Recipient').appendChild($('Recipient').select('.rcpEmail')[0].cloneNode(true));
//empty values
rcpNameClone.down().next().value = '';
rcpEmailClone.down().next().value = '';
//increment Ids and all
rcpNameClone.id = 'rcpName_'+this.incr;
rcpNameClone.down().htmlFor = 'rcp_name_'+this.incr;  //label name for-attr
rcpNameClone.down().next().id = 'rcp_name_'+this.incr; //input name id-attr
rcpNameClone.down().next().name = 'aRecipients['+this.incr+'][name]'; //input name name-attr
rcpEmailClone.id = 'rcpEmail_'+this.incr;
rcpEmailClone.down().htmlFor = 'rcp_email_'+this.incr; //label email for-attr
rcpEmailClone.down().next().id = 'rcp_email_'+this.incr; //input email id-attr
rcpEmailClone.down().next().name = 'aRecipients['+this.incr+'][email]'; //input email name-attr
if (this.incr >= iMax-1){
$('AddRecipientLink').style.display = 'none';
}
},
InviteAddressBook: function(paAssociationData, oCallback){
StdAjax(
'/__modules__/friends/addressbook',
{
onSuccess: (function(result) {    
aAddressBookAssociations = paAssociationData.clone();
this.oModal2 = new Modal(1,500);
this.oModal2.Show(
'Addressbuch', result.contents);
if ($('AssociationsTree') && Treepicker)
{
Object.extend($('AssociationsTree'), Treepicker);
$('AssociationsTree').initialize('/messages');
}
redrawTo( 'to_list', true );
var _this = this;
this.oModal2.AddButton('Empfänger übernehmen', function() { 
_this.oModal2.Destroy();
oCallback( aAddressBookAssociations.clone() );
});	
}).bind(this),
onError: function(result, errors) {
}
}
);  
},
_vSendInvitation: function()
{
var bError = false;
if ($('rcp_email_0').value.length == 0) {
bError = true;
$('rcp_email_0').addClassName('error');
} 
else if ($('rcp_email_0').hasClassName('error')) {
$('rcp_email_0').removeClassName('error');
}
if ($('rcp_name_0').value.length == 0) {
bError = true;
$('rcp_name_0').addClassName('error');
} 
else if ($('rcp_name_0').hasClassName('error')) {
$('rcp_name_0').removeClassName('error');
}
if ($('rcp_msg').value.length == 0) {
bError = true;
$('rcp_msg').addClassName('error');
}
else if ($('rcp_msg').hasClassName('error')) {
$('rcp_msg').removeClassName('error');
}
if (!$('privacy').checked) {
bError = true;
$('privacy_label').addClassName('error');
}
else if ($('privacy_label').hasClassName('error')) {
$('privacy_label').removeClassName('error');
}
if (bError) {
this.oModal.ShowErrorHint('Bitte fülle alle rot markierten Felder aus');
return;
}
var _this = this;
var params = AjaxFormCollect('InviteFriends');
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.invitation.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.invitation.klick','click');
}
StdAjax('/__modules__/friends/invite',
{
parameters: params,
onSuccess: function() { _this.oModal.ShowSuccess('Einladung versendet', 'Deine Einladung wurde versendet.', null , 2); },
onError: function(oRequest, aErrors)
{ 
$A(aErrors).each(function(e)
{
alert(e);
switch (e)
{
case 'INVALID_EMAIL':
$A($('InviteFriends').select('.IFRecipient')).invoke('addClassName', 'error');
alert('yo2');
_this.oModal.ShowErrorHint('Bitte achte auf gültige E-Mail-Adressen in deiner Eingabe.');
break;
case 'REGISTERED_EMAIL':
$A($('InviteFriends').select('.IFRecipient')).invoke('addClassName', 'error');
_this.oModal.ShowErrorHint('Es wurde eine E-Mail-Adresse eingegeben welche schon für einen Benutzer registriert ist.');
break;
case 'TOO_MANY_RECIPIENTS':
_this.oModal.ShowErrorHint('Es wurden mehr als die maximal erlaubten E-Mail-Adressen angegeben.');
break;              
default:
_this.oModal.ShowErrorHint('Bitte fülle alle rot markierten Felder aus');
}
});
}
});
},
vOpenFilter: function() {
var _this = this;
oMessages.addressbook( new Array(), _this.FilterAssociations,
function(paUserData, paAssociationsData) {
_this.FilterAssociations = paAssociationsData;
var assocs = new Array();
$('AssociationFilter').innerHTML = '';
for(var i=0;i<_this.FilterAssociations.length;i++) {
var assoc = _this.FilterAssociations[i];
assocs.push(assoc.name);
$('AssociationFilter').innerHTML = assocs.join(', ');
}
_this.vSetFilter();
},false,true,1,this.User
);
return;
},
vSetFilter: function() {
var sPath = '/profile/'+this.User+'/__modules__/friends/setfilter';
var assocs = '';
for(i=0;i<this.FilterAssociations.length;i++) {
assocs += '&assoc[]='+this.FilterAssociations[i].id;
}
StdAjax(
sPath,
{
parameters: '1=1'+assocs,
onSuccess: function(res) {
location.reload(true);
},
onError: function(res,err) {
}
}
);
}
}
Friends = new FriendsClass();
/**
address book
**/
function invite_show_address_book() {
Friends.InviteAddressBook( aAddressBookAssociations, function( paAssociationsList ){ aAssociations = paAssociationsList; redrawTo( 'to_list_invite' ); });
}
function onlinegames_reload( psKey1, psKey2, psKey3, psKey4 ){
if (!psKey1 && !psKey2 && !psKey3 && !psKey4) // check if we have destination country and city
{
return;
}
var sKeys  = '+'+psKey1+'+'+psKey2+'+'+psKey3+'+'+psKey4+'+'; 
vUpdateAds(sKeys);
//ReloadBoxes(psKey1+','+psKey3);
return;
}

