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;
}
}
/**
* 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;
}
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
/**
* IMAGE EDITOR
* ----------------------------------------------------------------------------- */
var ImageEditor = Class.create();
ImageEditor.prototype = {
oModal: null,
sUrl: '',
sBaseMediaUrl: '',
iBaseMediaId: 0,
sTitle: '',
sText: '',
oPayload: {},
initialize: function(sUrl)
{
this.sUrl = sUrl;
return this;
},
Show: function(sTitle, sText)
{
this.sTitle = sTitle;
this.sText = sText;
var _this = this;
this.oModal = new Modal(1,500);
// Ads
this.oAd = $('MODAL_468X60');
if (this.oAd)
{
this.oModal.SetTopAd(this.oAd);
this.oAd.show();
}
var _this = this;
this._vFetchBaseImageUrl();
},
AddPayload: function(oPayload)
{
this.oPayload = oPayload;
},
_vShowImageEditor: function()
{
this.oModal.Show(this.sTitle, this.sText);
this.oModal.AddButton('Auswahl speichern', ImageClipperGetData);
this.oClipper = document.createElement('div');
this.oClipper.id = 'imageClipper';
this.oClipper.innerHTML = 'Flash Player nicht installiert. Du benötigst für die Ansicht dieser Seiten das Macromedia Flash-Plugin in einer Version ab 7, bitte folge den Anweisungen deines Browsers oder klicke auf folgenden Link: <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German">FlashPlayer laden</a>';
this.oModal.AddContent(this.oClipper);
var so = new SWFObject('/images/image_clipper.swf', 'imageClipper', '460', '500', '7', '#F9F5EC');
so.addParam("allowScriptAccess", "sameDomain");
so.addParam("quality", "high");
so.addParam("scale", "noscale");
so.addParam("salign", "lt");
so.addParam('wmode', 'transparent');
so.addVariable('imageId', this.iBaseMediaId);
so.addVariable('picUrl', this.sBaseMediaUrl);
so.addVariable('clippingMinWidth', 76);
so.addVariable('clippingMinHeight', 53);
so.addVariable('aspectRatioX', 10);
so.addVariable('aspectRatioY', 7);
so.addVariable('plusMinusColor', 'aa2222');
so.addVariable('useJavaScriptApi', 'yes');
so.write('imageClipper');
},
_vFetchBaseImageUrl: function()
{
var _this = this;
Object.extend(this.oPayload, { command: 'getEditorBaseImageUrl' });
StdAjax(this.sUrl,
{
parameters: this.oPayload,
onSuccess: function(oRequest)
{
_this.sBaseMediaUrl = oRequest.sMediaUrl;
_this.iBaseMediaId = oRequest.iMediaId;
_this._vShowImageEditor();
},
onError: function(oRequest)
{
_this.oModal.ShowError('Fehler', 'Beim Bearbeiten deines Bildes ist ein Fehler aufgetreten');
}
});
},
Save: function(piX1, piY1, piX2, piY2, piRotate, imageId)
{
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.save.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.save.klick','click');
}
var _this = this;
Object.extend(this.oPayload,
{
command: 'editImage',
p1x: piX1,
p1y: piY1,
p2x: piX2,
p2y: piY2,
rot: piRotate,
id: imageId
});
StdAjax(this.sUrl,
{
parameters: this.oPayload,
onSuccess: function(oRequest)
{
_this.oModal.ReloadOnExit();
_this.oModal.ShowSuccess('Bild bearbeitet', 'Die Änderungen an Deinem Bild wurden gespeichert', null, 2);
},
onError: function(oRequest)
{
_this.oModal.ShowError('Fehler', 'Beim Bearbeiten Deines Bildes ist ein Fehler aufgetreten');
}
});
}
}
/* Image clipper callbacks - leave'em */
function ImageClipperReceiveData(piX1, piY1, piX2, piY2, piRotate, imageId)
{
oImageEditor.Save(piX1, piY1, piX2, piY2, piRotate, imageId);
}
function ImageClipperGetData()
{
// trigger flash movie to call 'ImageClipperReceiveData'
oGetFlashMovie('imageClipper').ImageClipperGetData();
}
function oGetFlashMovie(sMovieName)
{
if (navigator.appName.indexOf("Microsoft") != -1)
return window[sMovieName];
else
return document[sMovieName];
}
var oImageEditor = new ImageEditor('/__modules__/media');
/**
* MEDIA DISPLAY
* ----------------------------------------------------------------------------- */
var MediaDisplay = Class.create();
MediaDisplay.prototype = {
iMediaId: 0,
iAlbumId: 0,
iShowSeconds: 5,
oPayload: new Object(),
aMedia: new Array(),
aView: new Object(),
oAlbumInfo: null,
oModal: null,
oOnChangeCallback: null,
sUrl: '',
initialize: function(psUrl)
{
this.sUrl = psUrl;
return this;
},
SetCallback: function(oCallback)
{
if (!oCallback)
{
this.oOnChangeCallback = null;
return;
}
this.oOnChangeCallback = oCallback;
},
Show: function(piMediaId, bSimple)
{
this._vReset();
this.iMediaId = piMediaId;
this._vLoadMedia(this.iMediaId);
this.bSimple = bSimple ? true : false;
},
ShowAlbum: function(piAlbumId)
{
this._vReset();
this.iAlbumId = piAlbumId;
var _this = this;
StdAjax(this.sUrl,
{
parameters: { command: 'getAlbumInfo', iAlbumId: this.iAlbumId },
onSuccess: function(oRequest)
{
_this.oAlbumInfo = oRequest.oAlbumInfo;
_this._vLoadMedia(_this.oAlbumInfo.MAIN_MEDIA_ID);
},
onError: function()
{
_this.oModal.Close();
}
});
},
_vReset: function()
{
var _this = this;
this.iMediaId = 0;
this.iAlbumId = 0;
this.bSimple = false;
this.oAlbumInfo = null;
this.oModal = null;
this.oDSButton = null;
this.oDiashowWidget = null;
this.oInterface = null;
if (this.oTimeout)
{
window.clearTimeout(this.oTimeout);
}
this.oTimeout = null;
this.aMedia = new Array();
this.aView = new Array();
this.oModal = new Modal(1,595);
this.oModal.Show('', _('Bitte warten - Medien werden geladen'));
this.oModal.DefineCloseFunction(function()
{
_this.StopDiashow();
_this.oInterface = null;
_this.oDSButton = null;
_this.oDiashowWidget = null;
_this.oModal.Destroy();
});
// Ads
this.oAd = $('MODAL_468X60');
if (this.oAd)
{
this.oModal.SetTopAd(this.oAd);
this.oAd.show();
}
},
AddPayload: function(oPayload)
{
this.oPayload = oPayload;
},
ShowFullscreen: function()
{
return; // not needed in MP
if (this._bEffectActive || !this.aView.current['fullscreen'])
{
return;
}
var _this = this;
this._bEffectActive = true;
if (!_this.oInterface.oCurrentImage.bFullscreen)
{
Effect.Fade(this.oInterface.oInfo,
{
duration: 0.5,
afterFinish: function()
{
_this.oInterface.oPreview.sOldWidth = _this.oInterface.oPreview.style.width;
_this.oInterface.oPreview.style.width = '100%';
_this.oInterface.oCurrentImage.parentNode.style.width = 
(parseInt(_this.aView.current['fullscreen']['width']) + 10) + 'px';
_this.oInterface.oCurrentImage.parentNode.style.height = 
(parseInt(_this.aView.current['fullscreen']['height']) + 10) + 'px';
_this._vRepositionSpots(true);
_this.oInterface.oCurrentImage.Set(_this.aView.current['fullscreen']['url']);
_this.oInterface.oCurrentImage.bFullscreen = true;
_this._bEffectActive = false;
}
}
);
}
else
{
Effect.Appear(this.oInterface.oInfo,
{
duration: 0.5,
beforeStart: function()
{
_this.oInterface.oPreview.style.width = _this.oInterface.oPreview.sOldWidth;
_this.oInterface.oCurrentImage.parentNode.style.width = 
(parseInt(_this.aView.current['view']['width']) + 10) + 'px';
_this.oInterface.oCurrentImage.parentNode.style.height = 
(parseInt(_this.aView.current['view']['height']) + 10) + 'px';
_this._vRepositionSpots(false);
_this.oInterface.oCurrentImage.Set(_this.aView.current['view']['url']);
_this.oInterface.oCurrentImage.bFullscreen = false;
_this._bEffectActive = false;
}
}
);
}
},
_vRepositionSpots: function(bBigger)
{
if (bBigger)
{
var iZoomFactorX = this.aView.current['fullscreen']['width'] / this.aView.current['view']['width'];
var iZoomFactorY = this.aView.current['fullscreen']['height'] / this.aView.current['view']['height'];
$A($(this.oInterface.oCurrentImage.parentNode).select('.MDSpot')).each(function(o)
{
o.posXDefault = o.style.left.replace(/px/, '');
o.posYDefault = o.style.top.replace(/px/, '');
o.style.left = Math.round(o.posXDefault * iZoomFactorX) + 5 + 'px';
o.style.top = Math.round(o.posYDefault * iZoomFactorY) + 12 + 'px';
});
}
else
{
$A($(this.oInterface.oCurrentImage.parentNode).select('.MDSpot')).each(function(o)
{
o.style.left = o.posXDefault + 'px';
o.style.top = o.posYDefault + 'px';
});
}
},
ToggleDiashow: function(oButton)
{
if (!this.aView.next)
return;
if (oButton)
{
this.oDSButton = oButton;
}
if (!this.oDSButton.bRunning)
{
this.ShowDiashowWidget();
this.oDSButton.firstChild.nodeValue = '» Diashow stoppen';
this.oDSButton.bRunning = true;
this.oTimeout = window.setInterval('oMediaDisplay._vSkipNext()', (this.iShowSeconds * 1000));
}
else
{
this.StopDiashow();
}
},
StopDiashow: function()
{
this.HideDiashowWidget();
if (this.oTimeout)
{
window.clearInterval(this.oTimeout);
}
if (this.oDSButton)
{
this.oDSButton.firstChild.nodeValue = '» Diashow starten';
this.oDSButton.bRunning = false;
}
this.oTimeout = null;
},
ShowDiashowWidget: function()
{
if (!this.oDiashowWidget)
{
var _this = this;
this.oDiashowWidget = document.createElement('div');
this.oDiashowWidget.id = 'MDDiashowWidget';
/*this.oDiashowWidget.innerHTML =
'<label>Anzeigedauer: </label>'
+ '<input id="mds3" class="radio" type="radio" name="mds" value="3" />'
+ '<label for="mds3"> 3</label>'
+ '<input checked="checked" id="mds5" class="radio" type="radio" name="mds" value="5" />'
+ '<label for="mds5"> 5</label>'
+ '<input id="mds7" class="radio" type="radio" name="mds" value="7" />'
+ '<label for="mds7"> 7</label>'
+ '<input id="mds10" class="radio" type="radio" name="mds" value="10" />'
+ '<label for="mds10"> 10 Sekunden</label>';*/
this.oDiashowWidget.innerHTML = 
'Bildwechsel alle ' 
+ '<select>'
+ '<option value="3" id="3">03</option>'
+ '<option value="5" id="3">05</option>'
+ '<option value="7" id="3">07</option>'
+ '<option value="10" id="3">10</option>'
+ '</select> Sek.'
$A(this.oDiashowWidget.getElementsByTagName('option')).each(function(o)
{
Event.observe(o, 'click',
function(e)
{
_this.StopDiashow();
_this.iShowSeconds = Event.element(e).value;
_this.ToggleDiashow();
});
});
//this.oModal.oFrame.oFooter.insertBefore(this.oDiashowWidget, this.oDSButton.nextSibling);
$('MDPrevsContainer').appendChild(this.oDiashowWidget);
$(this.oInterface.oPrevImageNav).hide();
$(this.oInterface.oNextImageNav).hide();
$('MDComments_Container').hide();
}
if (this.oDiashowWidget.style.display == 'none')
{
$(this.oInterface.oPrevImageNav).hide();
$(this.oInterface.oNextImageNav).hide();
$('MDComments_Container').hide();
$(this.oDiashowWidget).show();
}
},
HideDiashowWidget: function()
{
if (this.oDiashowWidget)
{
$(this.oDiashowWidget).hide();
$(this.oInterface.oPrevImageNav).show();
$(this.oInterface.oNextImageNav).show();
$('MDComments_Container').show();
}
},
_vLoadMedia: function(piMediaId)
{
var _this = this;
// Check if already cached
if (this.aMedia[piMediaId]
&& this.aMedia[piMediaId].prev
&& this.aMedia[this.aMedia[piMediaId].prev]
&& this.aMedia[piMediaId].next
&& this.aMedia[this.aMedia[piMediaId].next]
)
{
this.aView.prev = this.aMedia[this.aMedia[piMediaId].prev];
this.aView.current = this.aMedia[piMediaId];
this.aView.next = this.aMedia[this.aMedia[piMediaId].next];
this._vShowMedia();
return;
}
if (this.oAlbumInfo && this.aView.current && !this.aMedia[piMediaId].next) // prevent reload in album mode
{
this.aView.prev = this.aMedia[this.aMedia[piMediaId].prev];
this.aView.current = this.aMedia[piMediaId];
this.aView.next = null;
this._vShowMedia();
return;
}
if (this.oAlbumInfo && this.aView.current && !this.aMedia[piMediaId].prev) // prevent reload in album mode
{
this.aView.prev = null;
this.aView.current = this.aMedia[piMediaId];
this.aView.next = this.aMedia[this.aMedia[piMediaId].next];
this._vShowMedia();
return;
}
Object.extend(this.oPayload, { command: 'getMediaList', iMediaId: piMediaId, iAlbumId: this.iAlbumId });
//    this.oModal.ShowNotification('Bitte warten - Medien werden geladen');
StdAjax(this.sUrl,
{
parameters: this.oPayload,
onSuccess: function(oRequest)
{
_this.aView.prev = null;
_this.aView.next = null;
if (oRequest.current)
{
_this.aMedia[oRequest.current.media_id] = oRequest.current;
_this.aView.current = _this.aMedia[oRequest.current.media_id];
if (oRequest.prev)
{
_this.aMedia[oRequest.current.media_id].prev = oRequest.prev.media_id;
_this.aView.prev = oRequest.prev;
}
if (oRequest.next)
{
_this.aMedia[oRequest.current.media_id].next = oRequest.next.media_id;
_this.aView.next = oRequest.next;
}
}
else if (oRequest.albumMedia) // album mode
{
$A(oRequest.albumMedia).each(function(oMedia, iIdx)
{
_this.aMedia[oMedia.media_id] = oMedia;
if (iIdx > 0)
_this.aMedia[oMedia.media_id].prev = oRequest.albumMedia[(iIdx-1)].media_id;
if (oRequest.albumMedia[(iIdx+1)])
_this.aMedia[oMedia.media_id].next = oRequest.albumMedia[(iIdx+1)].media_id;
});
_this.aView.current = oRequest.albumMedia[0];
_this.aView.next = oRequest.albumMedia[1];
}
_this._vShowMedia();
},
onError: function(oRequest, oError)
{
_this.oModal.ShowError('Medium nicht verfügbar', 'Dieses Medium ist leider nicht verfügbar');
}
});
},
_vSkipNext: function()
{ 
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.newtimage.klick'); 
wt_sendinfo(sWebtrekkCode+'text.nextimage.klick','click');
}
this._vLoadMedia(this.aView.next['media_id']);
},
_vSkipPrev: function()
{
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.previmage.klick'); 
wt_sendinfo(sWebtrekkCode+'text.previmage.klick','click');
}
this.StopDiashow();
this._vLoadMedia(this.aView.prev['media_id']);
},
_vShowMedia: function()
{
try
{
if (!this.oInterface)
{
this._vConstruct();
return;
}
this.oModal.HideNotification();
$('MBMessage').hide();
if (this.bSimple)
{
$(this.oInterface.oInfo).hide();
}
else
{
if (this.oAlbumInfo)
{
//this.oModal.SetTitle(this.oAlbumInfo.TITLE+' ('+this.aView.current['title']+')');
//this.oInterface.oDescription.Set(this.oAlbumInfo.DESCRIPTION);
this.oInterface.oDescription.Set(this.aView.current['description']);
}
else
{
//this.oModal.SetTitle(this.aView.current['title']);
this.oInterface.oDescription.Set(this.aView.current['description']);
}
if (this.oInterface.oComment)
{
$(this.oInterface.oComment).innerHTML = '';
$(this.oInterface.oComment).value = '';
$(this.oInterface.oComment).removeClassName('error');
this.oModal.HideErrorHint();
}
this.oInterface.oComments.Set(this.aView.current.comments);
this.oInterface.oMeta.Set(this.aView.current);
}
// Image or video?!
$('MDLinksButton').hide();
this._vAddSpots();
if (this.aView.current.is_video)
{
this.StopDiashow();
$(this.oInterface.oCurrentImage).hide();
$(this.oInterface.oCurrentVideo).show();
this.oInterface.oCurrentVideo.Set(this.aView.current['view']['url']);
}
else
{
$(this.oInterface.oCurrentVideo).hide();
/*
* fixed bug #6146, videos continue playing in background in IE6.
* solution: completely remove the object containing the flash movie and adding an
* empty container with the standard text in it.
*/
var oVideoContainer = $('MDVideo');
var oVideoStage			= $('MDVideoStage');
var oVideoPlaceHolder = document.createElement('div');
oVideoPlaceHolder.setAttribute('id', 'MDVideoStage');
oVideoPlaceHolder.innerHTML = 'Flash Player nicht installiert. Du benötigst für die Ansicht dieser Seiten das Macromedia Flash-Plugin in einer Version ab 7, bitte folge den Anweisungen deines Browsers oder klicke auf folgenden Link: <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German">FlashPlayer laden</a>';
oVideoContainer.replaceChild(oVideoPlaceHolder, oVideoStage);
/*
* IMPORTANT : clear references to prevent IE Memory leaks
*/
oVideoContainer = oVideoStage = oVideoPlaceHolder = null;
$(this.oInterface.oCurrentImage).show();
this.oInterface.oCurrentImage.Set(this.aView.current['view']['url']);
/*
if (!this.aView.current['fullscreen'])
{
this.oInterface.oCurrentImage.style.cursor = 'default';
}
else
{
this.oInterface.oCurrentImage.style.cursor = 'pointer';
}
*/
}
$(this.oInterface.oCurrentImage.parentNode).style.width = 
(parseInt(this.aView.current['view']['width']) + 10) + 'px';
$(this.oInterface.oCurrentImage.parentNode).style.height = 
(parseInt(this.aView.current['view']['height']) + 10) + 'px';
if (this.aView.prev && this.aView.prev.thumb && this.aView.prev.thumb.url.length)
{
this.oInterface.oPrevImageNav.Set(this.aView.prev['thumb']['url'],
this.aView.prev['title'] + '<br />seit ' + this.aView.prev['upload_date']);
if (!this.oDSButton || !this.oDSButton.bRunning)
{
$(this.oInterface.oPrevImageNav).show();
}
}
else
{
$(this.oInterface.oPrevImageNav).hide();
}
if (this.aView.next && this.aView.next.thumb && this.aView.next.thumb.url.length)
{
$(this.oDSButton).show();
this.oInterface.oNextImageNav.Set(this.aView.next['thumb']['url'],
this.aView.next['title'] + '<br />seit ' + this.aView.next['upload_date']);
if (!this.oDSButton || !this.oDSButton.bRunning)
{
$(this.oInterface.oNextImageNav).show();
}
}
else
{
this.StopDiashow();
$(this.oDSButton).hide();
$(this.oInterface.oNextImageNav).hide();
}
if (this.oOnChangeCallback)
{
this.oOnChangeCallback(this.aView.current);
}
//      this.oModal.HideNotification();
}
catch (e)
{
//console.log(e);
}
},
ToggleSpots: function(oToggleButton)
{
if (!oToggleButton.bSpotsVisible)
{
$(this.oInterface.oCurrentImage.parentNode).removeClassName('HideSpots');
oToggleButton.bSpotsVisible = true;
oToggleButton.firstChild.nodeValue = 'Verlinkungen ausblenden';
}
else
{
$(this.oInterface.oCurrentImage.parentNode).addClassName('HideSpots');
oToggleButton.bSpotsVisible = false;
oToggleButton.firstChild.nodeValue = 'Verlinkungen anzeigen';
}
},
_vAddSpots: function()
{
try
{
$A($(this.oInterface.oCurrentImage.parentNode).select('.MDSpot')).each(function(o)
{
$(o).remove();
});
if (!this.aView.current.spots || !this.aView.current.spots.length)
{
return;
}
var _this = this;
$A(this.aView.current.spots).each(function(oSpotData)
{
var oSpot = document.createElement('div');
oSpot.className = 'MDSpot';
var lk = document.createElement('a');
lk.href = '/profile/'+oSpotData.USER_ID;
lk.appendChild(document.createTextNode(oSpotData.DISPLAYNAME));
oSpot.appendChild(lk);
var p = document.createElement('img');
p.src = '/images/bg.quickinfo.pointer.png';
oSpot.appendChild(p);
_this.oInterface.oCurrentImage.parentNode.appendChild(oSpot);
oSpot.style.left = (oSpotData.X - 5) + 'px';
oSpot.style.top = (oSpotData.Y - 30) + 'px'; // pull up to place pointer over face
Event.observe(lk, 'mouseover', function(e) { _this._vLiftSpot(Event.element(e).parentNode); });
});
$('MDLinksButton').show();
}
catch (e)
{
//console.log(e);
}
},
_vLiftSpot: function(oSpot)
{
if (this.oLiftedSpot)
{
$(this.oLiftedSpot).style.zIndex = 100;
}
$(oSpot).style.zIndex = 101;
this.oLiftedSpot = oSpot;
},
_vSetRating: function(oRating)
{
if (typeof oRating.total_votes != 'undefined' && $('MDMeta_sum_total_votes'))
{
$('MDMeta_sum_total_votes').innerHTML = '' + oRating.total_votes + '';
}
},
_vConstruct: function()
{
var _this = this;
StdAjax(this.sUrl,
{
parameters: { command: 'getMediaInterface', interface: 'default' },
onSuccess: function(oRequest)
{
// the whole enchilada
_this.oInterface = document.createElement('div');
_this.oInterface.id = 'MediaDisplay';
_this.oInterface.innerHTML = oRequest.html;
_this.oModal.Show(''/*_this.aView.current['title']*/, '');
_this.oModal.SetCancelButtonTitle('» ' + _('Schliessen'));
_this.oModal.AddContent(_this.oInterface);
_this.oInterface.oInfo = $('MDInfo');
// generate shortcuts to the interface
// description
_this.oInterface.oDescription = $('MDDesc');
_this.oInterface.oDescription.Set = function(x) 
{ 
if (x && x != 'null') 
{
this.innerHTML = x; 
}
else
{
this.innerHTML = ''; 
}
};
// prev image
_this.oInterface.oPrevImageNav = $('MDPrev');
_this.oInterface.oPrevImageNav.oImage = _this.oInterface.oPrevImageNav.getElementsByTagName('img')[0];
_this.oInterface.oPrevImageNav.oImage.title = 'Vorheriges Bild';
_this.oInterface.oPrevImageNav.oImage.parentNode.onclick = function(e) { _this._vSkipPrev(); };
_this.oInterface.oPrevImageNav.oTitle = _this.oInterface.oPrevImageNav.getElementsByTagName('span')[0];
_this.oInterface.oPrevImageNav.Set = function(src, desc)
{
this.oImage.src = src;
this.oTitle.innerHTML = desc;
}
// next image
_this.oInterface.oNextImageNav = $('MDNext');
_this.oInterface.oNextImageNav.oImage = _this.oInterface.oNextImageNav.getElementsByTagName('img')[0];
_this.oInterface.oNextImageNav.oImage.title = 'Nächstes Bild';
_this.oInterface.oNextImageNav.oImage.parentNode.onclick = function(e) { _this.StopDiashow(); _this._vSkipNext(); };
_this.oInterface.oNextImageNav.oTitle = _this.oInterface.oNextImageNav.getElementsByTagName('span')[0];
_this.oInterface.oNextImageNav.Set = function(src, desc)
{
this.oImage.src = src;
this.oTitle.innerHTML = desc;
}
// meta information
_this.oInterface.oMeta = $('MDMeta');
_this.oInterface.oComment = $('MDComment');
_this.oInterface.oMeta.Set = function(oImg)
{
$A(this.getElementsByTagName('strong')).each(function(s)
{
if (s.id)
{
var key = s.id.substr(_this.oInterface.oMeta.id.length + 1);
if (typeof oImg[key] != 'undefined')
{
switch (key)
{
case 'is_public':
s.innerHTML = oImg[key] == 1 ? 'Alle' : 'Mich';
break;
case 'author':
s.innerHTML = '<a href="/community/profile/'+oImg[key]['URL_USERNAME']+'">&raquo; '+oImg[key]['USERNAME']+'</a> ';
break;
case 'title':
s.innerHTML = oMediaDisplay.oAlbumInfo
? oMediaDisplay.oAlbumInfo.TITLE+' <br />('+oImg[key]+')'
: oImg[key];
break;
default:
s.innerHTML = oImg[key];
}
}
}
});
// rating
if ($('my_rating') && typeof oRating != 'undefined')
{
oRating.oCallback = function(psMessage, pbSuccess)
{
//_this.oModal.ShowNotification(psMessage);
$('MBMessage').innerHTML = psMessage;
$('MBMessage').show();
}
$('my_rating').innerHTML = '';
$('my_rating').appendChild(oRating._oCreateRatingBar
(
oImg.rating.user_voted, // user already rated this media
oImg.rating.average, // average rating
'media',  // type
oImg.media_id // object id
)
);
_this._vSetRating(oImg.rating);
}
}
// comments
_this.oInterface.oComments = $('MDComments');
_this.oInterface.oComments.oHeader = $('MDComments_Header');
_this.oInterface.oComments.Set = function(aCommentData)
{
if (!aCommentData || aCommentData.length == 0)
{
$(_this.oInterface.oComments).hide();
if (_this.oInterface.oComments.oHeader)
{
$(_this.oInterface.oComments.oHeader).hide()
}
return;
}
_this.oInterface.oComments.innerHTML = '';
$A(aCommentData).each(function(oC)
{
var oneComment = document.createElement('div');
var img = document.createElement('img');
img.src = oC.AUTHOR_PORTRAIT_IMAGE_SRC;
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)
);
if(oC.AUTHOR_USERNAME)
{
var h_link = document.createElement('a');
h_link.href = '/community/profile/'+oC.AUTHOR_URL_USERNAME; 
h_link.appendChild(img);
h_link.appendChild(h);
oneComment.appendChild(h_link); 
}
else
{
oneComment.appendChild(img);
oneComment.appendChild(h); 
}
var p = document.createElement('p');
p.appendChild(document.createTextNode(oC.CONTENT));
oneComment.appendChild(p);
_this.oInterface.oComments.appendChild(oneComment);
});
$(_this.oInterface.oComments).show();
if (_this.oInterface.oComments.oHeader)
{
$(_this.oInterface.oComments.oHeader).show()
}
$('MDNumComments').innerHTML = aCommentData.length;
}
// current image
_this.oInterface.oPreview = $('MDPreview');
_this.oInterface.oCurrentImage = _this.oInterface.oPreview.getElementsByTagName('img')[0];
_this.oInterface.oCurrentImage.Set = function(x) { this.src = x; }
_this.oInterface.oCurrentImage.onclick = function(x) { _this.ShowFullscreen(); }
// video
_this.oInterface.oCurrentVideo = document.createElement('div');
_this.oInterface.oCurrentVideo.id = 'MDVideo';
_this.oInterface.oCurrentVideo.Stage = document.createElement('div');
_this.oInterface.oCurrentVideo.Stage.id = 'MDVideoStage';
_this.oInterface.oCurrentVideo.Stage.innerHTML = 'Flash Player nicht installiert. Du benötigst für die Ansicht dieser Seiten das Macromedia Flash-Plugin in einer Version ab 7, bitte folge den Anweisungen deines Browsers oder klicke auf folgenden Link: <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German">FlashPlayer laden</a>';
_this.oInterface.oCurrentVideo.Set = function(x)
{
var so = new SWFObject('/images/videoplayer.swf', 'video_player', '340', '285', '7', '#F9F5EC');
so.addParam("wmode", "transparent"); // does not work in FF/OSX , but works for FF2 Windows!
so.addParam("allowScriptAccess", "sameDomain");
so.addParam("quality", "high");
so.addParam("scale", "noscale");
so.addParam("wmode", "transparent");
so.addParam("salign", "lt");
so.addVariable('videoSource', x);
so.addVariable('autoPlay', 'false');
so.write('MDVideoStage');
}
// _this.aView.current['preview']['height'] 
_this.oInterface.oCurrentVideo.appendChild(_this.oInterface.oCurrentVideo.Stage);
_this.oInterface.oPreview.insertBefore(_this.oInterface.oCurrentVideo, _this.oInterface.oPreview.firstChild);
if (!_this.bSimple)
{
_this.oModal.AddButton('Diashow starten', function(e) { _this.ToggleDiashow(Event.element(e)); }, null, 'MDDiashow');
_this.oDSButton = $('MDDiashow');
}
_this.oModal.AddButton('Verlinkungen ausblenden', function(e) { _this.ToggleSpots(Event.element(e)); }, null, 'MDLinksButton');
$('MDLinksButton').bSpotsVisible = true;
if (typeof __bUserIsOwner == 'undefined' || __bUserIsOwner == false)
{
_this.oModal.AddButton('Missbrauch melden', function(e) 
{
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text./abuse.klick'); 
wt_sendinfo(sWebtrekkCode+'text./abuse.klick','click');
}
abuse_show( _this.aView.current['view'].url );
});
}
_this.oInterface.oInfo.insertBefore(_this.oModal.oFrame.oTopAd, _this.oInterface.oInfo.firstChild);
_this.oModal.SetDragHandle('MDInfo');
// show first media
_this._vShowMedia();
},
onError: function(oRequest, oError)
{
// console.log(oError);
}
});
},
_vAddComment: function()
{
this.StopDiashow();
if (this.oInterface.oComment.value.length == 0)
{
this.oModal.ShowErrorHint('Bitte fülle alle rot markierten Felder aus.');
$(this.oInterface.oComment).addClassName('error');
return;
} 
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); 
}
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'.text.comment.klick'); 
wt_sendinfo(sWebtrekkCode+'.text.comment.klick','click');
}
var _this = this;
oComments.SaveMediaComment(this.aView.current.media_id, this.oInterface.oComment.value, this.oInterface.oComments.Set);
$(this.oInterface.oComment).innerHTML = '';
$(this.oInterface.oComment).value = '';
$(this.oInterface.oComment).removeClassName('error');
}
}
var oMediaDisplay = new MediaDisplay('/__modules__/media');
/**
* MEDIA EDITOR
* ----------------------------------------------------------------------------- */
var MediaEditor = Class.create();
MediaEditor.prototype = {
oModal: null,
iMediaId: 0,
oMedia: null,
sUrl: '',
initialize: function(psUrl)
{
this.sUrl = psUrl;
return this;
},
Show: function(piMediaId)
{
var _this = this;
this.iMediaId = piMediaId;
this.oModal = new Modal(1,500);
this.oModal.DefineCloseFunction
(
function()
{
if (_this.oAd)
{
_this.oAd.hide();
document.body.appendChild(_this.oAd);
_this.oAd = null;
}
_this.oInterface = null;
_this.oModal.Destroy();
}
);
this._vLoadMedia(this.iMediaId);
},
AddressBook: function()
{
oMessages.addressbook(aAddressBookUsers, aAddressBookAssociations, this._vReceiveFromAddressbook, false, true);
},
_vReceiveFromAddressbook: function(paUserData, paAssociationData)
{
redrawTo('MediaAddressBook');
},
_vLoadMedia: function(piMediaId)
{
var _this = this;
StdAjax(this.sUrl,
{
parameters: { command: 'getMediaInfo', iMediaId: piMediaId },
onSuccess: function(oRequest)
{
_this.oMedia = oRequest;
_this._vShowMedia();
},
onError: function(oRequest, oError)
{
_this.oModal.ShowError('Medium nicht verfügbar', 'Dieses Medium ist leider nicht verfügbar');
}
});
},
_vEdit: function()
{
var _this = this;
//    this.oModal.Destroy(function() { editImage(_this.iMediaId); }, true);
this.oModal.Close();
editImage(_this.iMediaId);
},
_vDelete: function(piMediaId)
{
var _this = this;
var oConfirmModal = new Modal(2, 400);
if (!piMediaId)
{
var piMediaId = this.oMedia.media_id;
}
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.delete.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.delete.klick','click');
}
oConfirmModal.Show(_('Medium löschen'),
_('<p><strong>ACHTUNG!</strong> Dieser Vorgang kann nicht rückgängig gemacht werden!</p>')
+ _('<p>Möchtest du dieses Medium wirklich löschen?</p>')
);
oConfirmModal.AddButton(_('Medium löschen'),
function()
{
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.deleteConfirm.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.deleteConfirm.klick','click');
}
StdAjax(_this.sUrl,
{
parameters: { command: 'deleteMedia', iMediaId: piMediaId },
onSuccess: function()
{
var sUrl = null;
var oEntry = $('MLEntry_'+piMediaId);
if (oEntry)
{
var oList = oEntry.parentNode;
}
if (oList && typeof __oPaging != 'undefined')
{
sUrl = __oPaging.BASE_URL + '/';
if (oList.getElementsByTagName('li').length == 1 && __oPaging.PAGE_CURRENT > 1)
{
sUrl += __oPaging.PAGE_CURRENT - 1;
}
else
{
sUrl += __oPaging.PAGE_CURRENT;
}
}
oConfirmModal.ReloadOnExit(sUrl)
oConfirmModal.Close();
},
onError: function(oRequest, oError)
{
//console.log(oError); // TODO: ERROR HANDLING
oConfirmModal.ShowError('Fehler', 'Das Medium konnte nicht gelöscht werden. Möglicherweise wird das Bild noch innerhalb eines Albums verwendet.');
}
});
});
},
_vLink: function()
{
try
{
oImageLinker.oMedia = this.oMedia;
oImageLinker.Show(this.oMedia.media_id);
}
catch (e)
{
//console.log(e);
this.oModal.ShowErrorHint('Diese Funktion steht derzeit nicht zur Verfügung');
}
},
_vShowMedia: function()
{
if (!this.oInterface)
{
this._vConstruct();
return;
}
this.oInterface.oCurrentImage.Set(this.oMedia['thumb']['url']);
this.oInterface.oTitle.Set(this.oMedia.title);
this.oInterface.oDescription.Set(this.oMedia.description);
if (this.oMedia.is_public == '1' && this.oInterface.oPublic)
{
this.oInterface.oPublic.Set();
}
if (this.oMedia.is_for_friends == '1' && this.oInterface.oForFriends)
{
this.oInterface.oForFriends.Set();
}
if (this.oMedia.tags && this.oInterface.oTags)
{
this.oInterface.oTags.Set(this.oMedia.tags);
}
if (this.oMedia.tags && this.oInterface.oOldTags)
{
this.oInterface.oOldTags.Set(this.oMedia.tags);
}
var _this = this;
if (this.oInterface.oCountrySelector && this.oMedia.country)
{
$A(this.oInterface.oCountrySelector.childNodes).each(function(oOpt)
{
if (oOpt.value == _this.oMedia.country)
{
oOpt.selected = true;
}
});
}
// association links
if (this.oMedia.associations && this.oMedia.associations.length)
{
vCleanUpAddressBook();
$A(this.oMedia.associations).each(function(a)
{
var oAssociation = new Object();
oAssociation.name = a.NAME_PATH;
oAssociation.id = a.ASSOCIATION_ID;
aAddressBookAssociations.push(oAssociation);
});
redrawTo('MediaAddressBook');
}
// tools
var _this = this;
if ($('MDTools'))
{
$('MDTools').innerHTML = '';
if (this.oMedia.bDeletable)
{
var li = document.createElement('li');
var lk = document.createElement('a');
lk.href = '#';
lk.className = 'link-button MBBtn_lschen';
li.appendChild(lk);
lk.appendChild(document.createTextNode('» Löschen'));
lk.onclick = function(e) { _this._vDelete(_this.oMedia.media_id); return false; };
$('MDTools').appendChild(li);
}
if (this.oMedia.bEditable && !this.oMedia.is_video)
{
var li = document.createElement('li');
var lk = document.createElement('a');
lk.href = '#';
lk.className = 'link-button MBBtn_editieren';
lk.appendChild(document.createTextNode('» Editieren'));
li.appendChild(lk);
lk.onclick = function(e) { _this._vEdit(); return false; };
$('MDTools').appendChild(li);
}
if (this.oMedia.bLinkable)
{
var li = document.createElement('li');
var lk = document.createElement('a');
lk.href = '#';
lk.className = 'link-button MBBtn_verlinken';
lk.appendChild(document.createTextNode('» Verlinken'));
li.appendChild(lk);
lk.onclick = function(e) { _this._vLink(_this.oMedia.media_id); return false; };
$('MDTools').appendChild(li);
}
}
if ($('md_tags_help'))
{
new InlineHelp($('md_tags_help'), _('Um Deine Bilder und Videos später leichter zu finden und sie einem Thema zuzuordnen, solltest Du sie mit eindeutigen Stichworten versehen. Zum Beispiel: Paris Eiffelturm Europareise 2006 (trenne mehrere Stichworte bitte mit einem Komma)'));
}
},
_vConstruct: function()
{
var _this = this;
StdAjax(this.sUrl,
{
parameters: { command: 'getMediaInterface', interface: 'editor' },
onSuccess: function(oRequest)
{
// the whole enchilada
_this.oInterface = document.createElement('div');
_this.oInterface.id = 'MediaEditor';
_this.oInterface.innerHTML = oRequest.html;
_this.oModal.Show(_this.oMedia['title'], '');
_this.oModal.AddButton('Speichern', function() { _this._vSave(); });
_this.oModal.AddContent(_this.oInterface);
// current image
_this.oInterface.oPreview = $('MDPreview');
_this.oInterface.oCurrentImage = _this.oInterface.oPreview.getElementsByTagName('img')[0];
_this.oInterface.oCurrentImage.Set = function(x) { this.src = x; }
// Ads
_this.oAd = $('MODAL_180X150');
if (_this.oAd)
{
_this.oInterface.oPreview.appendChild(_this.oAd);
_this.oAd.show();
}
// form fields
_this.oInterface.oTitle = $('md_title');
_this.oInterface.oTitle.Set = function(x) { this.value = x; };
_this.oInterface.oDescription = $('md_desc');
_this.oInterface.oDescription.Set = function(x) 
{ 
if (x && x != 'null') 
{
this.innerHTML = x; 
}
else
{
this.innerHTML = ''; 
}
};
/*
_this.oInterface.oPublic = $('vis_all');
_this.oInterface.oPublic.Set = function() { this.checked = true; };
_this.oInterface.oForFriends = $('vis_friends');
_this.oInterface.oForFriends.Set = function() { this.checked = true; };
*/
_this.oInterface.oTags = $('md_tags');
_this.oInterface.oTags.Set = function(x) { this.value = x; };
_this.oInterface.oOldTags = $('md_old_tags');
_this.oInterface.oOldTags.Set = function(x) { this.innerHTML = x; };
_this.oInterface.oCountrySelector = $('md_country');
if (!_this.oInterface.oCountrySelector)
{
_this._vShowMedia();
return;
}
// Fetch countries
StdAjax('/tags',
{
parameters: { command: 'getCountries' },
onSuccess: function(oRequest)
{
_this.oInterface.oCountrySelector.innerHTML = '';
var option = document.createElement('option');
option.value = 0;
option.appendChild(document.createTextNode('- '+_('Bitte wählen')+' -'));
_this.oInterface.oCountrySelector.appendChild(option);
$H(oRequest).each(function(oPair)
{
option = document.createElement('option');
if(oPair.key >= 0)
{
option.value = oPair.value;
}
else
{
option.value = ""; 
}
option.appendChild(document.createTextNode(oPair.value));
_this.oInterface.oCountrySelector.appendChild(option);
});
window.setTimeout(function() { _this._vShowMedia() }, 100);
},
onError: function(oRequest)
{
}
});
},
onError: function(oRequest, oError)
{
// console.log(oError);
}
});
},
_vSave: function()
{ 
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'text.save.klick','click'); 
wt_sendinfo(sWebtrekkCode+'text.save.klick','click');
}
var _this = this;
var bError = false;
if (!this.oInterface.oTitle.value.length)
{
$(this.oInterface.oTitle).addClassName('error');
bError = true;
}
if (!this.oInterface.oTags.value.length)
{
$(this.oInterface.oTags).addClassName('error');
bError = true;
}
if (this.oInterface.oCountrySelector.options[this.oInterface.oCountrySelector.selectedIndex].value == 0)
{
$(this.oInterface.oCountrySelector).addClassName('error');
bError = true;
}
if (bError)
{
this.oModal.ShowErrorHint('Bitte fülle alle rot markierten Felder aus');
return;
}
var aTargets = [];
if (typeof aAddressBookAssociations != 'undefined')
{
$A(aAddressBookAssociations).each(function(oElem)
{
aTargets.push(oElem.id);
});
}
StdAjax(this.sUrl,
{
parameters: {
command: 'setMediaInfo',
media_id: this.iMediaId,
title: this.oInterface.oTitle.value,
description: this.oInterface.oDescription.value,
//is_public: this.oInterface.oPublic.checked ? '1' : '0',
//is_for_friends: this.oInterface.oForFriends.checked ? '1' : '0',
country: this.oInterface.oCountrySelector.options[this.oInterface.oCountrySelector.selectedIndex].value,
tags: this.oInterface.oTags.value,
'targets[]': aTargets
},
onSuccess: function(oRequest)
{
_this.oModal.ReloadOnExit();
_this.oModal.ShowSuccess('Änderungen gespeichert', 'Deine Änderungen wurden gespeichert', null, 2);
},
onError: function(oRequest)
{
}
});
}
}
var oMediaEditor = new MediaEditor('/__modules__/media');
/**
* WRAPPER: Profile image editor
* ----------------------------------------------------------------------------- */
function editProfileImage()
{
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); 
}
oImageEditor.AddPayload({ mediaType: 'Portrait', majorType: 'image' });
oImageEditor.Show(
'Profilbild editieren',
_('Hier hast Du die Möglichkeit, das Bild zu drehen. Außerdem kannst Du einen Ausschnitt für das Vorschaubild auswählen. Die Änderungen werden erst nach dem Speichern übernommen.')
);
}
/**
* WRAPPER: edit images
* ----------------------------------------------------------------------------- */
function editMedia(piMediaId)
{
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); 
}
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'.text.editMedia.klick'); 
wt_sendinfo(sWebtrekkCode+'.text.editMedia.klick','click');
}
oMediaEditor.Show(piMediaId);
}
function deleteMedia(piMediaId)
{
oMediaEditor._vDelete(piMediaId);
}
function deleteMediaLink(piMediaId)
{
var oModal = new Modal(1,500);
oModal.Show('Verlinkung entfernen', 'Möchtest du die Verlinkung auf Dich aus diesem Bild entfernen?');
oModal.AddButton('Verlinkung entfernen', function()
{
StdAjax('/__modules__/media',
{
parameters: { command: 'removeMediaLink', iMediaId: piMediaId },
onSuccess: function(oRequest)
{
oModal.ReloadOnExit();
oModal.ShowSuccess('Verlinkung entfernt', 'Die Verlinkung auf Dich wurde aus diesem Bild entfernt.', null, 2);
},
onError: function(oRequest, oErrors)
{
oModal.ShowSuccess('Verlinkung nicht entfernt', 'Die Verlinkung auf Dich konnte nicht entfernt werden.');
}
});
});
}
function editImage(piMediaId)
{
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); 
}
if(typeof sWebtrekkCode != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'.text.editImage.klick'); 
wt_sendinfo(sWebtrekkCode+'.text.editImage.klick','click');
}
oImageEditor.AddPayload({ iMediaId: piMediaId, mediaType: 'Foto', majorType: 'image' });
oImageEditor.Show(
'Bild editieren',
_('Hier hast Du die Möglichkeit, das Bild zu drehen. Außerdem kannst Du einen Ausschnitt für das Vorschaubild auswählen. Das eigentliche Bild bleibt davon unberührt. Alle Änderungen werden erst nach dem Speichern übernommen.')
);
}
/**
* WRAPPER: show images
* ----------------------------------------------------------------------------- */
function showMedia(piMediaId, psSort, piSearchId)
{
oMediaDisplay.AddPayload({ sSection: 'usermedia', iSearchId: piSearchId, sSortMethod: psSort });
oMediaDisplay.Show(piMediaId);
}
function showOverviewMedia(piMediaId, psSort, piSearchId)
{
oMediaDisplay.AddPayload({ sSection: 'overview', iSearchId: piSearchId, sSortMethod: psSort });
oMediaDisplay.Show(piMediaId);
}
function showAlbum(piAlbumId)
{
if(typeof sWebtrekkCodeCollection != 'undefined' && typeof wt_sendinfo != 'undefined') 
{ 
// alert(sWebtrekkCode+'.text.editMedia.klick'); 
wt_sendinfo(sWebtrekkCodeCollection+'.text.showMedia.klick','click');
}
oMediaDisplay.AddPayload({ sSection: 'collections' });
oMediaDisplay.ShowAlbum(piAlbumId);
}
function showEditorialAlbum(piAlbumId, psSponsorKey)
{
if (psSponsorKey)
{
vUpdateAd('MODAL_468X60', '+++'+psSponsorKey);
}
oMediaDisplay.AddPayload({ sSection: 'collections' });
oMediaDisplay.ShowAlbum(piAlbumId);
}
function showAssociationMedia(piMediaId, psMediaType, piAssociationId)
{
oMediaDisplay.AddPayload({ sSection: 'associations',iAssociationId:piAssociationId });
oMediaDisplay.Show(piMediaId);
}
function showReportsMedia(piMediaId, psMediaType, piReportId)
{
oMediaDisplay.AddPayload({ sSection: 'reports',iReportId:piReportId });
oMediaDisplay.Show(piMediaId);
}
function showTeamFoto(piMediaId)
{
MediaDisplay.Show(piMediaId, true);
}
function showLinkedMedia(piMediaId, bSimple)
{
oMediaDisplay.AddPayload({ sSection: 'linkedmedia', iOwnerId: __iOwnerId });
oMediaDisplay.Show(piMediaId, bSimple);
}
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;
//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";
if(typeof(arr) == 'object') { //Array/Hashes/Objects
for(var item in arr) {
var value = arr[item];
if(typeof(value) == 'object') { //If it is an array,
dumped_text += level_padding + "'" + item + "' ...\n";
dumped_text += dump(value,level+1);
} else {
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
}
}
} else { //Stings/Chars/Numbers etc.
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
}

