function ads_gettag() {}
function adsc_cadwidth() {}
function adsc_skywidth() {}
function adsc_cadheight() {}
function adsc_skyheight() {}
function adsc_cadpercent() {}
function adsc_skypercent() {}

document.blankoweb_client = 'NORA';
document.blankoweb_client_settings = {
	'RegioMask': {
		styles: {
			'background': '#002d65'
		}
	},
	'RegioLike': {
		fade: {
			enabled: false
		},
		//lifetime: [daily, weekly, monthly, yearly, infinite]
		lifetime: 'infinite'
	},
	'RegioDialog_Flipbook' : {
		counter : {
			separator : ' von '
		}
	}
};


window.addEvent('domready', function () {

	/**
	 * Init Navigation
	 */
	var NavigationClass = new RegioNavigation({
		selectors: {
			container: '#navigation'
		}
	});

	/**
	 * Init on-focus clearing for inputs
	 */
	$$('#search_word, #artist-stories-query').each(function(el) {
		var val = el.value;

		el.addEvents({
			focus: function () {
				if( this.value == val ) this.value = '';
			},
			blur: function () {
				if( this.value == '' ) this.value = val;
			}
		});
	});

	/**
	 * Init AjaxFlipbooks
	 */
	/*
	$$('.ajax-flipbook .flipbook-preview .image img').addEvents({
		mouseover : function() {
			this.fade(1);
		},
		mouseout : function() {
			this.fade(0.5);
		},
		click : function() {
			var flipbook_key = this.id.replace(/flipbook_/, '');
			new RegioDialog_Flipbook({json: this.getProperty('json_key'), flipbook_key: flipbook_key, key:0});
		}
	});

	$$('.more-flipbooks a').addEvents({
		click : function() {
			var flipbook_key = this.rel.replace(/flipbook_/, '');
			new RegioDialog_Flipbook({json: JsonString, flipbook_key: flipbook_key, key:0});
		}
	});

	+/

	/**
	 * Init RegioLike
	 */
	if( $chk($$('.regio_like')) ) {
		
		$$('.regio_like').each( function (RegioLikeElement) {
			if( $chk(RegioLikeElement) ) {
				if( RegioLikeElement.getProperty('class') ) {
					var RegioFilePrefix = RegioLikeElement.getProperty('class').split(' ').pop();

					new RegioLike( $$('.regio_like.'+RegioFilePrefix) ,{
						file_prefix: RegioFilePrefix.capitalize(),
						save_url: 'php/RegioLike_Save.php',
						state_url: 'php/RegioLike_State.php',
						text: {
							hasVoted: 'Sie haben schon geklickt'
						}
					});
				}
			}
		});

	}
	if( $chk($$('.regio_like_artist_song')) ) {
		$$('.regio_like_artist_song').each( function (RegioLikeElement) {
			if( $chk(RegioLikeElement) ) {
				if( RegioLikeElement.getProperty('class') !== null ) {
					var RegioFilePrefix = RegioLikeElement.getProperty('class').split(' ').pop();

					new RegioLike( $$('.regio_like_artist_song.'+RegioFilePrefix) ,{
						file_prefix: 'ArtistSong',
						save_url: 'php/RegioLike_Save.php',
						state_url: 'php/RegioLike_State.php',
						text: {
							hasVoted: 'Sie haben schon geklickt'
						}
					});
				}
			}
		});

	}

	var BookmarksButtons = $$('.bookmark-button');
	var BookmarksTargets = $$('.bookmark-target');

	BookmarksButtons.each( function(elButton,intIdx) {
		elButton.addEvents({
			'mouseenter': function (e) {
				e.stop();
				BookmarksTargets[intIdx].setStyles({
					'display':'block'
				});

			},
			'mouseleave': function () {
				BookmarksTargets[intIdx].setStyle('display','none');
			}
		});
	});


	/**
	 * Update Webcam Image
	 */
	if( $chk($('webcam_image')) ) {
		reloadWebcamImage.periodical(30000);
	}

	/**
	 * Toogle ArtistStories
	 */

	if( $chk($$('.artist-stories.default-detail .teaser-text')) && $chk($$('.artist-stories.default-detail .full-text')) ) {

		var ArtistStoriesButtons = $$('.artist-stories.default-detail .teaser-text');
		var ArtistStoriesTargets = $$('.artist-stories.default-detail .full-text');

		ArtistStoriesButtons.each( function (elTeaserText,key) {
			elTeaserText.addEvents({
				'click': function (event) {
					event.stop();

					var Content = ArtistStoriesTargets[key];
					var RegioDialogElement = new RegioDialog_Element(Content,{});

				}
			});

		});

	}



	/**
	 * Open Links
	 */
	$$('a.open-webcam,a.open-livestream').each( function(elLink,Index) {
		elLink.addClass('RegioObserver_popup');
	});

	$$('a.write-story-link, a.open-dialog, a.moderator-autograph, a.moderator-email, a.icon.track-request, a.icon.greeting-to').each( function(elLink, Index) {
		elLink.addClass('RegioObserver_ajax_layer');
	});

	$$('a.RegioObserver_popup').each(function(elLink) {
		var link = new RegioLinkObserver(elLink,{
			url : elLink.href,
			type : 'popup',
			title: document.blankoweb_client + ' - Popup',
			popup: {
				width: 982,
				height: 600,
				scrollbars: 'no'
			}
		});
	});

	$$('a.RegioObserver_ajax_layer').each(function(elLink) {

		var link = new RegioLinkObserver(elLink,{
			url : elLink.href,
			type : 'ajax'
		});
	});

	if( $chk($$('.toggle_button')) == true ) {
		var arrButtons = $$('.toggle_button');
		var arrTargets = $$('.toggle_target');
		
		arrButtons.each( function(elButton,intIdx) {
		
			arrTargets[intIdx].slide('hide');
		
			elButton.addEvents({
				'click': function (e) {
					e.stop();
					arrTargets[intIdx].slide('toggle');
				}
			});
		});
		
	}

	if( $chk( $('TabPanel')) ) {
		var PanelContainer = $('TabPanel');
		var Navigation = PanelContainer.getElement('ul.tabSet');
		var Panels = PanelContainer.getElement('div.panelSet').getElements('.panel');

		Navigation.getElements('a').each( function(elNavi,elKey) {

			elNavi.addEvents({
				'click': function () {

					var Parent = elNavi.getParent('li');

					Panels.each( function(elTPanel,panelKey) {
						elTPanel.removeClass('on').addClass('off');
					});

					Navigation.getElements('a').each( function(elTNavi,elKey) {
						var TParent = elTNavi.getParent('li');
						TParent.removeClass('on').addClass('off');
					});

					if( Parent.hasClass('off') ) {
						Parent.removeClass('off').addClass('on');
						Panels[elKey].removeClass('off').addClass('on');
					}

				}
			});

		});
	}

});

/*
 * reloads the Webcamimage periodicle
 */
var reloadWebcamImage = function () {
	var Image = $('webcam_image');

	var strSource = Image.getAttribute('src');

	var myUri = new URI(strSource);
	strSource = myUri.get('directory') + myUri.get('file');

	strSource = strSource + '?' + ((new Date()).getTime());

	$('webcam_image').setAttribute('src',strSource);
};

/**
 * Bookmark this page
 */
var wt_socialbookmarks_add2favourite = function (url,title) {

	if( Browser.Engine.trident ) {
		window.external.AddFavorite(url,title);
	} else {
		window.external.addPanel(title,url, '')
	}

};
