var arena = {
activeAddonsRequestCount : 0,
// Global
TAAlert : function(txt,timeout) {
timeout = (typeof(timeout) != 'undefined')? timeout : 4000;
$('taalert').update(txt);
new Effect.SlideDown('taalert-box',{
duration: 0.3
});
setTimeout(function(){ new Effect.Fade('taalert-box',{duration:0.4}) }, timeout);
},
applyTooltips : function(id) {
// User and Autographs (styled boxes)
var tooltipElements = (typeof(id) != 'undefined')? '#'+id+' a.has-ttip' : 'a.has-ttip';
$$(tooltipElements).each( function(link) {
try{
var ttoffsetTop = (link.hasClassName('autograph-tip'))? 45 : 60;
var ttoffsetLeft = (link.hasClassName('autograph-tip'))? 35 : -180;
new Control.Modal(link, {
hover: true,
position: 'relative',
offsetTop: ttoffsetTop,
offsetLeft: ttoffsetLeft,
fade: true
});
} catch(e) {}
})
// Autologin-Checkbox
$$('#loginform input.checkbox').each( function(ele) {
try{
new Control.Modal(ele, {
hover: true,
offsetTop: 20,
offsetLeft: -50,
position: 'mouse',
containerClassName: 'ttip',
contents: function(){return 'Remember me please!';}
});
} catch(e) {}
})
// tooltips from title-Attributes
$$('.with-ttip').each( function(ele) {
try{
new Control.Modal(ele, {
hover: true,
offsetTop: 20,
offsetLeft: -50,
position: 'mouse',
containerClassName: 'ttip',
contents: ele.getAttribute('title')
});
ele.setAttribute('title', '');
} catch(e) {}
})
// preview-tooltips
$$('.with-preview-ttip').each( function(ele) {
if(ele.readAttribute('rel') != null) {
ele.writeAttribute('href',ele.readAttribute('rel'));
}
try{
new Control.Modal(ele, {
hover: true,
offsetTop: -310,
offsetLeft: -250,
position: 'mouse',
containerClassName: 'preview-ttip'
});
} catch(e) {}
})
// preview-tooltips
$$('.with-category-ttip').each( function(ele) {
if(ele.readAttribute('rel') != null) {
ele.writeAttribute('href',ele.readAttribute('rel'));
}
try{
new Control.Modal(ele, {
hover: true,
offsetTop: -305,
offsetLeft: -182,
position: 'relative',
containerClassName: 'preview-ttip'
});
} catch(e) {}
})
},
getParam : function() {
return window.location.search;
},
getHash : function() {
return window.location.hash;
},
setHash : function(str) {
window.location.hash = str;
},
// Navigation
toggleMediaSubmenu : function() {
// if available, hide subnavigation
$('media-bar').toggleClassName('open');
$$('#navi li.media a')[0].toggleClassName('open');
$$('#navi li.media a')[0].blur();
Effect.toggle('media-bar','blind', { duration: 0.3 });
return false;
},
// Community
toggleAddons : function(e) {
Effect.toggle( 'addons', 'blind', {duration: 0.4, scalemode: 'contents'});
if(arena.elementIsClosed('addons')) { arena.loadAddons() };
arena.toggleCloseState('addons'); // saves cookie
e.stop();
},
toggleNewShout : function(e) {
Effect.toggle( $('new-shout'), 'blind', {duration: 0.3});
e.stop();
},
toggleNewComment : function(e) {
Effect.toggle( $('new-comment'), 'blind', {
beforeStart: function() {if($('my-rating')){$('my-rating').hide()}},
afterFinish: function() {if($('my-rating')){$('my-rating').show()}},
duration: 0.4 });
e.stop();
},
toggleBlind : function(id) {
Effect.toggle( $(id), 'blind', {
beforeStart: function() {if($('my-rating')){$('my-rating').hide()}},
afterFinish: function() {if($('my-rating')){$('my-rating').show()}},
duration: 0.4 });
return false;
},
addUploadField : function(e) {
var uploadField = Builder.node('input', {
type : 'file',
className : 'file',
name : 'attachment[]'
})
Event.observe(uploadField, 'change', arena.addUploadField, false);
$('file-attachments').appendChild(uploadField);
},
toggleOpenState : function(title) {
try {
var newState = (arena.elementIsOpen(title))? 'closed' : 'open';
} catch(e) {}
Cookie.set('TA_OpenState_'+title, newState);
},
toggleCloseState : function(title) {
try {
var newState = (arena.elementIsClosed(title))? 'open' : 'closed';
} catch(e) {}
Cookie.set('TA_OpenState_'+title, newState);
},
elementIsOpen : function(title) {
return (Cookie.get('TA_OpenState_'+title) == 'open')? true : false;
},
elementIsClosed : function(title) {
return (Cookie.get('TA_OpenState_'+title) == 'closed')? true : false;
},
reloadUserOnline : function() {
new Ajax.Updater( 'user-online', '/lib/phpajax/useronline.php', {
method: 'get',
onCreate: function() { arena.activeAddonsRequestCount++; },
onComplete: function() {
arena.activeAddonsRequestCount--;
arena.hideAddonsSpinner();
Event.observe('refresh-user-online', 'click', arena.refreshUserOnline, false);
}
});
},
reloadUserActivities : function() {
new Ajax.Updater( 'user-activities', '/lib/phpajax/useractivities.php', {
method: 'get',
onCreate: function() { arena.activeAddonsRequestCount++; },
onComplete: function() {
arena.activeAddonsRequestCount--;
arena.hideAddonsSpinner();
Scroller.initiateActScroller();
}
});
},
reloadShoutbox : function() {
new Ajax.Updater( 'shoutbox', '/lib/phpajax/shoutbox.php', {
method: 'get',
onCreate: function() { arena.activeAddonsRequestCount++; },
onComplete: function(){
arena.activeAddonsRequestCount--;
arena.hideAddonsSpinner();
Scroller.initiateShoutScroller();
arena.countInputOf('shoutboxText',100);
$('new-shout').hide();
Event.observe('add-new-shout', 'click', arena.toggleNewShout, false);
Event.observe('new-shout-form','submit', arena.postNewShout, false);
$$('#new-shout button').invoke('observe','click', arena.postNewShout, false);
}
});
},
postNewShout : function(e) {
$('new-shout-form').request({
onCreate: function() {
$('addons-spinner').show();
arena.activeAddonsRequestCount++;
},
onSuccess: function(transport) { $('shoutbox').update(transport.responseText) },
onComplete: function() {
arena.activeAddonsRequestCount--;
arena.hideAddonsSpinner();
Scroller.initiateShoutScroller();
$('shoutboxText').value = '';
arena.countInputOf('shoutboxText',100);
Event.observe('add-new-shout', 'click', arena.toggleNewShout, false);
Event.observe('new-shout-form','submit', arena.postNewShout, false);
$$('#new-shout button').invoke('observe','click', arena.postNewShout, false);
}
});
e.stop();
},
loadAddons : function() {
$('addons-spinner').show();
arena.reloadUserOnline();
arena.reloadUserActivities();
arena.reloadShoutbox();
return true;
},
reloadAddons : function(e) {
arena.loadAddons();
e.stop();
},
refreshUserOnline : function(e) {
$('addons-spinner').show();
arena.reloadUserOnline(); // diese Zeile löschen
// Hier neuen Ajax-Request einfügen
// Folgende Funktion oncomplete ausführen, damit der Spinner wieder versteckt wird:
// arena.hideAddonsSpinner();
e.stop();
},
hideAddonsSpinner : function() {
if(arena.activeAddonsRequestCount == 0) {
$('addons-spinner').hide();
}
},
// List-Filters
toggleFilters : function(cookie) {
Effect.toggle( $('secondary-filters'), 'blind', {duration: 0.3});
arena.toggleOpenState(cookie); // saves cookie
return true;
},
// Directors
toggleDirectorFilters : function(e) {
arena.toggleFilters('directors_filter');
e.stop();
},
// Directors
toggleCollabFilters : function(e) {
arena.toggleFilters('collaborations_filter');
e.stop();
},
// Talents
toggleAddonFilters : function(e) {
arena.toggleFilters('talents_filter');
e.stop();
},
setRatingTo : function(val) {
$$('#my-rating select')[0].selectedIndex = val;
$('my-current-rating').setAttribute('style','width: '+val*20+'px;');
return false;
},
// Forms
setDefaultValue : function(id, str) {
var defValue = 'with-def-value';
if(field = $(id)) {
field.value = str;
field.addClassName( defValue );
Event.observe( field, 'focus', function(e) {
with(Event.element(e)) {
if(value == str) {
value = '';
removeClassName( defValue );
}
}
})
Event.observe( field, 'blur', function(e) {
with(Event.element(e)) {
if (value == '') {
value = str;
addClassName( defValue );
}
}
})
}
},
updateCharCounter : function(id,max) {
if($F(id).length >= max){
$(id).value = $F(id).substring(0, max);
}
$(id+'-counter').update( max - $F(id).length );
},
countInputOf : function(id, max){
if ($(id)){
Event.observe($(id), 'keyup', function(){ arena.updateCharCounter(id, max);}, false );
Event.observe($(id), 'keydown', function(){ arena.updateCharCounter(id, max);}, false );
arena.updateCharCounter(id,max);
}
},
unselectAccounts : function() {
$$('#choose-account-type label').each( function(e) { e.removeClassName('selected')} ); // remove highlighting
$$('.account-details div.container').each( function(e) { e.hide()}); // hide details
},
chooseAccount : function(type) {
arena.unselectAccounts();
$('user-type-'+type).click();
$$('#choose-account-type label.'+type)[0].addClassName('selected');
$$('div.account-information')[0].className = 'account-information for-'+type;
$(type+'-account-details').show();
new Effect.Highlight($(type+'-account-details'), {duration: 1.3, startcolor: '#ffffff', endcolor: '#ededed', restorecolor: true});
},
choosePayment : function(type) {
$$('#payment label').each( function(e) { e.removeClassName('selected') } ); // remove highlighting
$$('#payment label.'+type)[0].addClassName('selected');
},
subcategories : new Array(),
setSubcategory : function(maincat, initialValue, disabledValue, isPremium) {
if(maincat == '') {
// Deactivating subcategories when switching to default value
var optionstr = "\n";
$('subcategory').disable();
if(isPremium) $('subcategory2').disable();
} else {
// Aktivating subcategories
var optionstr = "\n";
for(attr in arena.subcategories[maincat]) {
optionstr += "\n";
}
$('subcategory').enable();
if(isPremium) $('subcategory2').enable();
}
$('subcategory').update(optionstr);
$('subcategory').options.selectedIndex=0;
if(isPremium) {
$('subcategory2').update(optionstr);
$('subcategory2').options.selectedIndex=0;
}
},
checkAGB : function(theForm) {
var checkBox = theForm.elements["register_recommended_agb"];
if(checkBox && checkBox.checked) {
$('checkAGBLabel').removeClassName('error');
$('checkAGBLabel2').removeClassName('error');
return true;
} else {
$('checkAGBLabel').addClassName('error');
$('checkAGBLabel2').addClassName('error');
return false;
}
},
updateDynamicPriceForConfig : function(configVal,configType,productId,productType) {
if(configVal == undefined || productId == undefined || configType == undefined) {
return false;
} else {
return new Ajax.Updater('price_tag','/lib/phpajax/updateDynamicPriceForConfig.php', {
parameters: {configVal:configVal,configType:configType,productId:productId,productType:productType}});
}
}
}
Scroller = {
shoutHeight : 42,
activityHeight : 17,
eventHeight : 72,
scrollPosShouts : 0,
scrollPosAct : 0,
scrollPosEvents : 0,
scrollShoutUp : function(e) {
if(Scroller.scrollPosShouts != 0){
Scroller.scrollPosShouts--;
Scroller.scrollItemTo('shouts',-(Scroller.scrollPosShouts * Scroller.shoutHeight));
}
e.stop();
},
scrollShoutDown : function(e) {
numberOfShouts = $('shouts').childElements().length;
if(Scroller.scrollPosShouts < (numberOfShouts - 6)) {
Scroller.scrollPosShouts++;
Scroller.scrollItemTo('shouts',-(Scroller.scrollPosShouts * Scroller.shoutHeight));
}
e.stop();
},
scrollActUp : function(e) {
if(Scroller.scrollPosAct != 0){
Scroller.scrollPosAct--;
ActItemOffset = Scroller.scrollPosAct * Scroller.activityHeight;
Scroller.scrollItemTo('activities',-(ActItemOffset));
}
e.stop();
},
scrollActDown : function(e) {
actListHeight = $('activities').getHeight();
ActItemOffset = (Scroller.scrollPosAct + 1) * Scroller.activityHeight;
if(ActItemOffset < (actListHeight - 85)) {
Scroller.scrollPosAct++;
Scroller.scrollItemTo('activities',-(ActItemOffset));
}
e.stop();
},
scrollEventUp : function(e) {
if(Scroller.scrollPosEvents != 0){
Scroller.scrollPosEvents--;
Scroller.scrollItemTo('upcoming-events',-(Scroller.scrollPosEvents * Scroller.eventHeight));
}
e.stop();
},
scrollEventDown : function(e) {
numberOfEvents = $('upcoming-events').childElements().length;
if(Scroller.scrollPosEvents < (numberOfEvents - 4)) {
Scroller.scrollPosEvents++;
Scroller.scrollItemTo('upcoming-events',-(Scroller.scrollPosEvents * Scroller.eventHeight));
}
e.stop();
},
scrollItemTo : function( id, xposition ) {
new Effect.Move($(id), { x: 0, y: xposition, mode: 'absolute', duration: 0.3 });
},
resetPositons : function() {
$('shouts').style.top = '0';
$('activities').style.top = '0';
Scroller.scrollPosShouts = 0;
Scroller.scrollPosAct = 0;
},
initiateShoutScroller : function() {
Event.observe($$('#shoutscroller a.up')[0], 'click', function(e){ Scroller.scrollShoutUp(e)}, false);
Event.observe($$('#shoutscroller a.down')[0], 'click', function(e){ Scroller.scrollShoutDown(e)}, false);
},
initiateActScroller : function() {
Event.observe($$('#activityscroller a.up')[0], 'click', function(e){ Scroller.scrollActUp(e)}, false);
Event.observe($$('#activityscroller a.down')[0], 'click', function(e){ Scroller.scrollActDown(e)}, false);
},
initiateEventScroller : function() {
Event.observe($$('#eventscroller a.up')[0], 'click', function(e){ Scroller.scrollEventUp(e)}, false);
Event.observe($$('#eventscroller a.down')[0], 'click', function(e){ Scroller.scrollEventDown(e)}, false);
}
}
var ItemSlider = {
init : function(containerId,itemsPerPage,itemWidth) {
defaultOffset = $$('#'+containerId+' ul')[0].offsetLeft;
pageWidth = itemWidth * itemsPerPage;
Event.observe($$('#'+containerId+' .prev')[0], 'click', function(e){
if(((ItemSlider.currentPos(containerId,defaultOffset)) + pageWidth) <= 0) {
newPos = (ItemSlider.currentPos(containerId,defaultOffset)) + pageWidth;
ItemSlider.slideTo(containerId,newPos,itemWidth,itemsPerPage);
}
e.stop();
}, false)
Event.observe($$('#'+containerId+' .next')[0], 'click', function(e){
if(((ItemSlider.currentPos(containerId,defaultOffset) - pageWidth) + ($$('#'+containerId+' ul li').length * itemWidth)) > 0) {
newPos = (ItemSlider.currentPos(containerId,defaultOffset)) - pageWidth;
ItemSlider.slideTo(containerId,newPos,itemWidth,itemsPerPage);
}
e.stop();
}, false)
},
currentPos : function(containerId,defaultOffset) {
return ($$('#'+containerId+' ul')[0].offsetLeft) - defaultOffset;
},
slideTo : function(containerId,pos,itemWidth,itemsPerPage) {
//
// alert(pos);
// alert($$('#'+containerId+' ul li').length * itemWidth);
// if(pos - ($$('#'+containerId+' ul li').length * itemWidth) < 0) {
// $$('#'+containerId+' .prev')[0].addClassName('prev-inactive');
// } else {
// $$('#'+containerId+' .prev')[0].removeClassName('prev-inactive');
// }
if(pos == 0) {
$$('#'+containerId+' .prev')[0].addClassName('prev-inactive');
} else {
$$('#'+containerId+' .prev')[0].removeClassName('prev-inactive');
}
if((($$('#'+containerId+' ul li').length - itemsPerPage) * itemWidth) + pos == 0) {
$$('#'+containerId+' .next')[0].addClassName('next-inactive');
} else {
$$('#'+containerId+' .next')[0].removeClassName('next-inactive');
}
new Effect.Move($$('#'+containerId+' ul')[0], {
x: pos,
y: 0,
mode: 'absolute',
duration: 0.4,
afterFinish: function() {
// leer
}
});
// check active status for prev
// check active status for next
}
}
/*
popups.js
Author: Maurice Kühlborn
$LastChangedDate: 2007-02-28 18:59:15 +0100 (Wed, 28 Feb 2007) $
$Rev: 272 $
Use like this:
Popup with default size
Popup with special size
*/
Popup = {
openup:function(obj, w, h, res) {
if(typeof obj == "string") {
var url = obj; // for flash-links
} else {
var url = (obj.getAttribute)? obj.getAttribute('href') : obj.href; // for HTML-links
}
if(!url) return true; // if href is not given, no popup will be opened
var w = (w === undefined)? 640 : w;
var h = (h === undefined)? 570 : h;
var res = (res === undefined || res == true)? "yes" : "no";
var pop = window.open(url, 'mypopup', 'width='+w+', height='+h+', resizable='+res+', scrollbars=yes');
if (pop) {
if (pop.focus) pop.focus();
return false; // prevents link to open in parent window
} else {
return true; // if popup could not be opened link opens in original window
}
}
}
/*
links.js
Author: Maurice Kühlborn
$LastChangedDate: 2006-12-11 13:42:27 +0100 (Mon, 11 Dec 2006) $
$Rev: 222 $
Excerpts inspired by
http://www.456bereastreet.com/archive/200605/opening_new_windows_with_javascript_version_11/
Thanks to Roger Johansson from 456 Berea Street
*/
Links = {
touch_external_links:function(classname) {
links = document.getElementsByTagName("a");
for(i=0; i < links.length; i++) {
link = links[i];
if(link.className.indexOf(classname) != -1) {
Links.attach_onclick_event(link);
Links.set_title(link);
}
}
},
touch_external_links_within:function(id) {
if(document.getElementById(id)) {
links = document.getElementById(id).getElementsByTagName("a");
for(i=0; i < links.length; i++) {
link = links[i];
Links.attach_onclick_event(link);
Links.set_title(link);
}
}
},
attach_onclick_event:function(tag) {
tag.onclick = function(e) {
if (!e) var e = window.event;
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
return true;
}
var new_window = window.open(this.href, "_blank");
if (new_window) {
if (new_window.focus) {
new_window.focus();
return false;
}
}
return true;
}
},
set_title:function(tag) {
tag.setAttribute("title", "Open in a new window!");
}
}
// Initializing
document.observe("dom:loaded", function() {
// Open external links in new window
Links.touch_external_links('external');
Links.touch_external_links_within('urbmag');
// Hide Ajax spinner by default
$$('img.spinner').each(function(e){e.hide()});
// Media-Submenu
if(($('media-bar')) && !($$('body')[0].hasClassName('media'))) {
$('media-bar').hide();
}
// Addons-Area
if($('addons') && $('toggle-addons')) {
if(!arena.elementIsClosed('addons')) {
arena.loadAddons();
} else {
$('addons').hide();
}
$$('#toggle-addons a').invoke('observe','click', arena.toggleAddons, false);
}
if($('reload-addons')) {
Event.observe('reload-addons', 'click', arena.reloadAddons, false);
}
// Commentform
if($('new-comment') && $('new-comment-toggle')) {
$('new-comment').hide();
Event.observe('new-comment-toggle', 'click', arena.toggleNewComment, false);
}
if($('file-attachments')) {
Event.observe($$('#file-attachments input')[0], 'change', arena.addUploadField, false);
}
if($('my-rating')) {
$$('#my-rating select')[0].hide();
$('my-star-rating').show();
}
// Set default values for input fields
arena.setDefaultValue( 'search_term', 'Artists, media and products...');
arena.setDefaultValue( 'login_username', 'E-Mail');
arena.setDefaultValue( 'login_pw', 'Password');
// Apply Tooltips
arena.applyTooltips();
// Init Lightboxes
$$('[rel=lightbox]').each(
function(link) {
var TAlightbox = new Control.Modal(link,{
fade: true,
fadeDuration: 0.3,
overlayDisplay: true,
containerClassName: 'lightbox',
beforeOpen: function() {
if($('flash-rating-container')) {
$('flash-rating-container').style.visibility = 'hidden';
}
},
afterClose: function() {
setTimeout(function(){if($('flash-rating-container')){$('flash-rating-container').style.visibility = 'visible'}}, 700);
}
});
}
)
// Language-Dropdown
var langdropdown = $$('#lang-switch ul')[0];
langdropdown.hide();
Event.observe($$('#lang-switch .current')[0], 'click', function(e){
langdropdown.show();
e.stop();
}, false);
Event.observe($$('body')[0], 'click', function(e){
langdropdown.hide();
}, false);
// Registration
if($('choose-account-type')){
$$('.account-details h5').each(function(e){e.hide()});
Event.observe($$('#choose-account-type label.jury')[0], 'click', function(e){arena.chooseAccount('jury')}, false);
Event.observe($$('#choose-account-type label.basic')[0], 'click', function(e){arena.chooseAccount('basic')}, false);
Event.observe($$('#choose-account-type label.premium')[0], 'click', function(e){arena.chooseAccount('premium')}, false);
Event.observe($$('#choose-account-type label.director')[0], 'click', function(e){arena.chooseAccount('director')}, false);
arena.chooseAccount('jury')
};
});