function slide(dir){
	if(dir == 'next'){
		if(this.current < this.slides){
			//slides
			var moveBy = -Math.min(5, this.slides - this.current - 5);
			new Effect.Move(this, {
				x: moveBy * 110,
				y: 0,
				mode: 'relative',
				afterFinish: function(){
					this.current -= moveBy;
					enableLinks(this)
				}.bind(this)
			});
		}
	} else{
		if(this.current > 0){
			//slides
			var moveBy = Math.min(5, this.current);
			new Effect.Move(this, {
				x: moveBy * 110,
				y: 0,
				mode: 'relative',
				afterFinish: function(){
					this.current -= moveBy;
					enableLinks(this)
				}.bind(this)
			});
		}
	}
	return false;
}
function enableLinks(slideObj){
	if(slideObj.current == slideObj.slides - 5){
		slideObj.next.onclick = function(){return false;};
		slideObj.next.addClassName('disabled');
	} else{
		slideObj.next.onclick = slide.bind(slideObj, 'next');
		slideObj.next.removeClassName('disabled');
	}
	
	if(slideObj.current == 0){
		slideObj.prev.onclick = function(){return false;};
		slideObj.prev.addClassName('disabled');
	} else{
		slideObj.prev.onclick = slide.bind(slideObj);
		slideObj.prev.removeClassName('disabled');
	}
}

function rating(ratingBox, imgPath, videoUid){
	this.ratingBox		= ratingBox;
	this.rating			= ratingBox.down('img').src.split('rating_')[1].split('.png')[0];
	this.imgPath		= imgPath;
	this.videoUid		= ratingBox.down('img').id.split('-no')[1];
	this.ratingImages	= new Array();
	
	this.setOrigRating	= function(e){
		this.ratingImages.each(function(el, index){
			el.src	= (index <= this.rating) ? this.imgPath+"ro.png" : this.imgPath+"no.png";
		}, this);
	}

	this.setRating		= function(e,i){
		this.ratingImages.each(function(el, index){
			el.src	= (index <= i) ? this.imgPath+"ro.png" : this.imgPath+"no.png";
		}, this);
	}
	
	this.rateNow		= function(e,i){
		new Ajax.Request(
			'index.php?type=802&tx_twmeinlpercussion_videolist[videoUid]='+this.videoUid+'&tx_twmeinlpercussion_videolist[action]=rating&tx_twmeinlpercussion_videolist[controller]=Video&tx_twmeinlpercussion_videolist[rating]='+i+'&no_cache=1',
			{
				method: 'get',
				onSuccess: function(transport,json){
					var response = transport.responseText;
					var newRating = new Element('img', {src: videoRating.imgPath+response+".png"});
					videoRating.ratingBox.update('Thanks for rating!');
					videoRating.ratingBox.appendChild(newRating);
				},
				onFailure: function(){
					alert('Error while rating. Sorry! Your vote wasn\'t counted!');
				}
			}
		);
	}
	
	ratingBox.down('img').remove();
	for(var i = 1; i < 6; i++){
		var ratingImg	= new Element('img', {src: ((i <= this.rating) ? this.imgPath+"ro.png" : this.imgPath+"no.png")});
		ratingImg.addClassName('act');
		
		ratingBox.appendChild(ratingImg);
		
		ratingImg.onmouseover	= this.setRating.bindAsEventListener(this,i - 1);
		ratingImg.onmouseout	= this.setOrigRating.bindAsEventListener(this);
		ratingImg.onclick		= this.rateNow.bindAsEventListener(this, i);
		
		this.ratingImages.push(ratingImg);
	}
}

function bigSlide(){
	this.slides			= new Array();
	this.container		= new Element('div', {'class': 'slideshow-big'});
	this.slideContainer	= new Element('div', {'class': 'slider-big'});
	this.slider			= new Element('div', {'class': 'inner-big'});
	this.index			= 0;
	this.next			= new Element('a', {'href': '#'}).update('next');
	this.prev			= new Element('a', {'href': '#'}).update('prev');
	this.next.addClassName('next-big');
	this.prev.addClassName('prev-big');
	this.prev.addClassName('disabled-big');
	this.maxHeight		= 0;
	
	this.checkLinks		= function(){
		this.next.removeClassName('disabled-big');
		this.prev.removeClassName('disabled-big');
		
		this.next.onclick = this.slide.bindAsEventListener(this,-1);
		this.prev.onclick = this.slide.bindAsEventListener(this,1);
		
		if(this.index == this.slides.length - 1){
			this.next.addClassName('disabled-big');
			this.next.onclick = function(){return false;};
		} else if(this.index == 0){
			this.prev.addClassName('disabled-big');
			this.prev.onclick = function(){return false;};
		}
	}
	
	this.slide			= function(e, dir){
		var moveBy = 960 * dir;
		if(dir == 1){
			--this.index;
		} else{
			++this.index;
		}
		this.slider.setStyle({zIndex: 8001});
		new Effect.Move(this.slider, {
			x: moveBy,
			y: 0,
			mode: 'relative',
			afterFinish: function(){
				this.checkLinks();
				this.slider.setStyle({zIndex: 7999});
			}.bind(this)
		});
		return false;
	}
	
	if($$('.mp-stage').length > 1){
		$$('.mp-stage').each(function(single, index){
			this.maxHeight = Math.max(this.maxHeight, single.getHeight());
			if(index == 0){
				single.insert({before: this.container});
				this.container.appendChild(this.slideContainer);
				this.slideContainer.appendChild(this.slider);
			}
			single.addClassName('sliding');
			this.slider.appendChild(single);
			this.slides.push(single);
		}, this);
		
		if(this.slides.length > 1){
			this.slider.setStyle({width: (this.slides.length * 960)+'px', height: this.maxHeight+'px'});
			this.container.setStyle({height: this.maxHeight+'px'});
			this.slideContainer.setStyle({height: this.maxHeight+'px'});
			this.slides.each(function(el){
				var margin = parseInt(this.maxHeight) - parseInt(el.getHeight());
				el.setStyle({marginTop: margin+'px'});
			}, this);
			this.container.insert({before: this.prev});
			this.container.insert({before: this.next});
			this.next.onclick = this.slide.bindAsEventListener(this,-1);
			this.prev.onclick = this.slide.bindAsEventListener(this,1);
			
			this.next.setStyle({marginTop: (this.maxHeight - 350 + 120)+'px'});
			this.prev.setStyle({marginTop: (this.maxHeight - 350 + 120)+'px'});
			
			this.checkLinks();
		}
	}
}

function initFavs(){
	$$('a.func-fav').each(function(link){
		link.onclick = function(){
			ajaxFavs(this.href);
			this.removeClassName('func-fav');
			this.addClassName('func-fav-added');
			this.onclick = function(){return false;};
			return false;
		}
	});
	ajaxFavs('index.php');
}

function ajaxFavs(url){
	$('favourites-container').hide();
	new Ajax.Request(url, {
		method: 'get',
		parameters: {type: 458, no_cache: 1},
		onSuccess: function(transport){
			var f			= $('favourites');
			f.replace(transport.responseText);
			$('favourites-container').hide();
			initFavsSlide();
		}
	});
}
function initFavsSlide(){
	$$('.func-remove').each(function(link){
		link.onclick		= function(){
			new Ajax.Request(this.href, {
				method: 'get',
				parameters: {type: 458, no_cache: 1},
				onSuccess: function(transport){
					var f			= $('favourites');
					f.replace(transport.responseText);
					initFavsSlide();
				}
			});
			return false;
		}
	});
	var favContainer = $('favourites-container');
	if(favContainer.hasClassName('keepopen')){
		favContainer.removeClassName('keepopen');
		new Effect.Highlight('favourites-count', {
			startcolor: '#1b8be2',
			endcolor: '#E2001A',
			afterFinish: function(){
				new Effect.Highlight('favourites-count', {
					startcolor: '#E2001A',
					endcolor: '#1b8be2',
					afterFinish: function(){
						new Effect.Highlight('favourites-count', {
							startcolor: '#1b8be2',
							endcolor: '#E2001A'
						});
					}
				});
			}
		});
	}
	
	
	$('favourites').down('h3').onclick = function(){
		if($('browse-index') && $('browse-index').getStyle('display') != 'none'){
			new Effect.toggle('browse-index', 'blind', {
				duration: 0.5,
				afterFinish: function(){
					new Effect.toggle('favourites-container', 'blind', {duration: 0.5});
				}
			});
		} else{
			new Effect.toggle('favourites-container', 'blind', {duration: 0.5});
		}
	}
}

var videoShortList	= new Array();
var videoRating		= null;


function contestItem(contestItem, imgPath){
	this.contestItem	= contestItem;
	this.bigImage		= this.contestItem.down('p.front'); 
	this.contestItem.select('a.contest-image').each(function(el){
		el.bigImage				= this.bigImage;
		el.onclick = function(){
			this.bigImage.update(new Element('img', {'src': this.href}));
			return false;
		}
	}, this);
	
	this.contestBox		= contestItem.down('h4.contest-rate');
	if(!this.contestBox){
		return false;
	}
	this.rating			= this.contestBox.down('img').src.split('rating_')[1].split('.png')[0];
	this.imgPath		= imgPath;
	this.itemUid		= this.contestBox.down('img').id.split('-no')[1];
	this.ratingImages	= new Array();
	
	this.setOrigRating	= function(e){
		this.ratingImages.each(function(el, index){
			el.src	= (index < this.rating) ? this.imgPath+"ro.png" : this.imgPath+"no.png";
		}, this);
	}

	this.setRating		= function(e,i){
		this.ratingImages.each(function(el, index){
			el.src	= (index <= i) ? this.imgPath+"ro.png" : this.imgPath+"no.png";
		}, this);
	}
	
	this.rateNow		= function(e,i){
		var cItem		= this.contestItem;
		var cBox		= this.contestBox;
		new Ajax.Request(
			'index.php?type=803&tx_twmeinlpercussion_contest[itemUid]='+this.itemUid+'&tx_twmeinlpercussion_contest[action]=rating&tx_twmeinlpercussion_contest[controller]=Contest&tx_twmeinlpercussion_contest[rating]='+i+'&no_cache=1',
			{
				method: 'get',
				onSuccess: function(transport,json){
					var response = transport.responseText.evalJSON(true);
					var newRating = new Element('img', {src: this.imgPath+response.rating.ratingsum+".png", id: "video-rating-no"+response.rating.uid});
					this.contestBox.update('Thanks for rating!<br/>');
					this.contestBox.appendChild(newRating);
					
					window.setTimeout(function(){
						cBox.update('Rate this design: ('+response.rating.ratingcount+')<br/>');
						cBox.appendChild(newRating);
						new window.contestItem(cItem,'fileadmin/templates/css/img/contest/rating_');
					}, 20000);
				}.bind(this),
				onFailure: function(){
					alert('Error while rating. Sorry! Your vote wasn\'t counted!');
				}
			}
		);
	}
	
	this.contestBox.down('img').remove();
	for(var j = 1; j < 6; j++){
		var ratingImg	= new Element('img', {src: ((j <= this.rating) ? this.imgPath+"ro.png" : this.imgPath+"no.png")});
		ratingImg.addClassName('act');
		
		this.contestBox.appendChild(ratingImg);
		
		ratingImg.onmouseover	= this.setRating.bindAsEventListener(this,j - 1);
		ratingImg.onmouseout	= this.setOrigRating.bindAsEventListener(this);
		ratingImg.onclick		= this.rateNow.bindAsEventListener(this, j);
		
		this.ratingImages.push(ratingImg);
	}
	this.setOrigRating();
}

/*-----------------------------------------------------------------------*/
/* Search Box */
/*-----------------------------------------------------------------------*/
var searchBox = {
	input:		null,
	box:		null,
	resultBox:	null,
	locale:		'de',
	links:		[],
	current:	-1,
	count:		0,
	title:		'',
	labels: {
		de:		{
			viewAll:	'Alle Suchergebnisse »'
		},
		en:		{
			viewAll:	'view all results »'
		}
	},
	init: function(){
		this.form				= $('productsearch');
		this.input				= $('quicksearchfield');
		this.title				= this.input.value;
		this.locale				= 'en';
		this.resultBox			= new Element('div', {'id': 'productsearch-results'}).update('searching...');
		this.form.appendChild(this.resultBox);
		this.resultBox.hide();
		this.input.setAttribute("autocomplete", "off");
		this.input.onkeyup		= this.keyUp.bindAsEventListener(this);
		this.input.onkeydown	= this.keyDown.bindAsEventListener(this);
		this.input.onfocus		= this.focus.bindAsEventListener(this);
		this.input.onblur		= this.blur.bindAsEventListener(this);
	},
	keyUp: function(e){
		Event.extend(e);
		if (![Event.KEY_RETURN, Event.KEY_DOWN, Event.KEY_UP, Event.KEY_ESC].include(e.keyCode)) {
			this.search();
		}
	},
	keyDown: function(e){
		Event.extend(e);
		switch (e.keyCode) {
			// Enter-Taste wurde gedrückt: Start der Suche
			case Event.KEY_RETURN:
				if (this.resultBox.visible() && (this.current >= 0)) {
					this.selectLink(false, this.current);
				} else {
					this.collapse();
					this.form.submit();
				}
				Event.stop(e);
				return false;
				break;
			
			// Pfeiltaste nach unten wurde gedrückt
			case Event.KEY_DOWN:
				if (!this.resultBox.visible()) {
					this.search();
				} else if (this.count && (this.current < this.count - 1)) {
					this.activateLink(this.current + 1);
				}
				return false;
				break;
			
			// Pfeiltaste nach oben wurde gedrückt
			case Event.KEY_UP:
				if (this.resultBox.visible() && this.count && (this.current > 0)) {
					this.activateLink(this.current - 1);
				}
				return false;
				break;
				
			// Escape-Taste wurde gedrückt
			case Event.KEY_ESC:
				this.collapse();
				break;
			default:

				break;
		}
	},
	focus: function(e) {
		if (this.title && this.title.length && (this.title == this.input.value)) {
			this.input.value = '';
		}
	},
	blur: function(e) {
		if (this._keepFocus) {
			this._keepFocus	= false;
			delete this._keepFocus;
		} else {
			this.collapse();
		}
	},
	search: function(){
		new Ajax.Request('/s/'+this.normalize(this.input.value), {
			method: 'get',
			onComplete: this.receive.bind(this)
		});
	},
	receive: function(response){
		this.links			= [];
		this.resultBox.update();
		this.current		= -1;
		if(response){
			var result		= response.responseJSON;
			this.count		= result.response.docs.length;
			var searchLink	= new Element('a', {'href': ''}).update(this.labels[this.locale].viewAll);
			searchLink.onclick = function(){
				this.form.submit();
				return false;
			}.bindAsEventListener(this);
			searchLink.addClassName('search-more');
			result.response.docs.each(function(el, index){
				var a		= new Element('a', {'href': 'goto/'+encodeURIComponent(el.sku)});
				//var img		= new Element('span').update(new Element('img', {'src': 'typo3temp/fl_eshop/@'+el.image+'_'+el.image_md5+'-20m-20m.png'}));
				//var mfc		= (result.highlighting[el.uid].mfcshort)? result.highlighting[el.uid].mfcshort[0] : el.mfcshort;
				var title	= (result.highlighting[el.uid]['title'+this.locale]) ? result.highlighting[el.uid]['title'+this.locale][0] : ((el['title'+this.locale]) ? el['title'+this.locale] : ((result.highlighting[el.uid].title)? result.highlighting[el.uid].title[0] : ((el.title.length) ? el.title[0] : '')));
				//var span	= new Element('span').update(mfc+' '+title);
				var span	= new Element('span').update(title);
				span.addClassName('text');
				//img.addClassName('img');
				//a.appendChild(img);
				a.appendChild(span);
				this.resultBox.appendChild(a);
				this.links.push(a);
			}, this);
			this.links.push(searchLink);
			this.resultBox.appendChild(searchLink);
			this.appearResults();
		}
	},
	activateLink: function(link){
		if (this.current >= 0) {
			this.links[this.current].removeClassName('hl');
		}
		this.current = link;
		this.links[this.current].addClassName('hl');
	},
	selectLink: function(e, link){
		document.location.href = this.links[link].href;
		if (e) {
			Event.stop(e);
		}
		return false;
	},
	appearResults: function() {
		document.onmousedown	= this.fadeResults.bindAsEventListener(this);
		this.resultBox.fading	= true;
		Effect.Appear(this.resultBox, {'duration': 0.2, 'afterFinish': function() { this.fading = false; }.bind(this.resultBox) });
	},
	fadeResults: function(e) {
		if (!Event.element(e).descendantOf(this.form)) {
			document.onmousedown = null;
			this.collapse();
		} else {
			this._keepFocus = true;
		}
	},
	collapse: function() {
		this.resultBox.fading = true;
		Effect.Fade(this.resultBox, {'duration': 0.2, 'afterFinish': function() { this.fading = false; }.bind(this.resultBox) });
		if (this.current >= 0) {
			this.links[this.current].removeClassName('hl');
		}
		this.current	= -1;
	},
	normalize: function(value) {
		value					= value.toLowerCase().split(' ');
		var terms				= [];
		for (var v = 0; v < value.length; ++v) {
			var term			= value[v].strip();
			if (term.length) {
				terms.push(term);
			}
		}
		return terms.join(' ');
	},
	encode: function(value){
		return encodeURI(value);
	}
}

document.observe('dom:loaded', function(){
	Cufon.replace(
		$('head').down('ul').select('a'),
			{
				fontFamily:	'Caecilia LT Bold',
				hover:		true
			}
		)(
			'h1',
			{
				fontFamily:	'Caecilia LT Bold',
				hover:		true
			}
		)(
			'h2',
			{
				fontFamily: 'j.d.'
			}
		)(
			$$('.day'),
			{
				fontFamily: 'Caecilia LT Bold'
			}
		)(
			$$('.caeciliastd'),
			{
				fontFamily: 'Caecilia LT Std'
			}
		)(
				$$('.cbold'),
				{
					fontFamily: 'Caecilia LT Bold'
				}
			);
	if(Prototype.Browser.IE){
		Cufon.now();
	}
	
	
	/*shop specific*/
	var shopNav			= $('main-shop-nav');
	if(shopNav){
		Cufon.replace(
			shopNav.select('a'),
			{
				fontFamily:	'Caecilia LT Bold',
				hover:		true
			}
		)
	}
	
	var productIndex	= $('product-index');
	if(productIndex){
		if($('browse-index')){
			$('browse-index').setStyle({display: 'none'});
			productIndex.onclick = function(){
				if($('favourites-container').getStyle('display') != 'none'){
					new Effect.toggle('favourites-container', 'blind', {
						duration: 0.5,
						afterFinish: function(){
							new Effect.toggle('browse-index', 'blind', {duration: 0.5});
						}
					});
				} else{
					new Effect.toggle('browse-index', 'blind', {duration: 0.5});
				}
			}
		}
	}
	if($('favourites')){
		initFavs();
	}
	
	/*var productBrowser		= $$('.product-browser');
	if(productBrowser.length){
		var browser			= new Element('div', {'class': 'grid-3 omega', 'id': 'product-browser-container'});
		$('content').appendChild(browser);
		productBrowser.each(function(el){
			browser.appendChild(el);
		});
		
		browser.select('a.anchor').each(function(a){
			a.onclick = function(){
				$('product-browser-container').select('a.anchor').each(function(aTemp){aTemp.removeClassName('act')});
				var element = this.href.split('#').pop();
				Effect.ScrollTo(element, {duration: 0.8});
				this.addClassName('act');
				return false;
			}
		});
	
		var maxHeight		= $('content').getHeight();
		var browserHeight	= browser.getHeight();
		var leftOffset		= browser.cumulativeOffset()[0] - 10;
		window.onscroll		= function(){
			var offset		= browser.cumulativeScrollOffset();
			if(offset[1] > 170){
				// FIX
				if((offset[1] + 100 + browserHeight) < maxHeight){
					if(Prototype.Browser.IE){
						browser.setStyle({position: 'fixed', top: (10)+'px', marginLeft: '765px', width: '200px'});
					} else{
						browser.setStyle({position: 'fixed', top: (10)+'px', left: leftOffset+'px'});
					}
				} else{
					browser.setStyle({position: 'absolute', top: (maxHeight - browserHeight - 100)+'px'});
				}
			} else{
				browser.setStyle({position: 'static'});
			}
		}
	}*/
	
	/*init slider*/
	$$('div.csc-textpic-imagewrap').each(function(el){
		
		if(el.select('img').length > 1){
			var imageCount 		= el.select('img').length;
			
			var container		= new Element('div');
			var slideContainer	= new Element('div');
			var slider			= new Element('div');
			
			slideContainer.appendChild(slider);
			container.appendChild(slideContainer);
			
			el.insert({before: container});
			
			el.select('img').each(function(img){
				var fullImg 	= (img.ancestors()[0].href) ? img.ancestors()[0] : img;
				var li			= document.createElement('li');
				li.appendChild(fullImg);
				slider.appendChild(li);
			});
			slider.imageCount	= imageCount; 
			var sliderWidth		= imageCount * 110;
			
			slider.setStyle({width: sliderWidth+'px'});
			
			if(imageCount < 6){
				//kein scrollen - deswegen zentrieren
				slider.setStyle({marginLeft: ((550 - sliderWidth) / 2)+'px'});
			} else{
				// scrollen
				slider.current	= 0;
				slider.slides	= imageCount;
				slider.next		= new Element('a');
				slider.prev		= new Element('a');
				
				slideContainer.insert({before: slider.prev});
				slideContainer.insert({after: slider.next});
				
				slider.setStyle({width: (sliderWidth + 50)+'px'});
				
				slider.next.update('next');
				slider.prev.update('prev');
				
				slider.next.onclick	= slide.bind(slider, 'next');
				
				slider.next.addClassName('next');
				slider.prev.addClassName('prev');
				slider.prev.addClassName('disabled');
			}
			el.remove();
			container.addClassName('slideshow');
			slideContainer.addClassName('slider');
			slider.addClassName('inner');
		}
	});
	
	// blog comment
	var formField = $('blog-form-data');
	if(formField){
		formField.value = 'Cajon';
		formField.up('div').setStyle({display: 'none'});
		$('blog-new-comment').onsubmit = function(){
			var error = false;
			if(!$('blog-form-comment').value.length || !$('blog-form-name').value.length){
				error = true;
			}
			if(error === true){
				if(!$('blog-comment-error')){
					$('blog-new-comment-section').insert({after:'<p class="error" id="blog-comment-error">Please fill out all required fields!</p>'});
				}
				return false;
			} else{
				return true;
			}
		};
	}
	
	// video comment
	var formField = $('video-form-data');
	if(formField){
		formField.value = 'Bongo';
		formField.up('div').setStyle({display: 'none'});
		$('video-new-comment').onsubmit = function(){
			var error = false;
			if(!$('video-form-comment').value.length || !$('video-form-name').value.length){
				error = true;
			}
			if(error === true){
				if(!$('video-comment-error')){
					$('video-new-comment-section').insert({after:'<p class="error" id="video-comment-error">Please fill out all required fields!</p>'});
				}
				return false;
			} else{
				return true;
			}
		};
	}
	
	// video shortlist
	$$('ul.video-shortlist').each(function(el, index){
		el.uid			= el.id.split('-no')[1];
		el.parent		= $('video-nav-no'+el.uid); 
		videoShortList.push(el);
		
		$('video-nav-no'+el.uid).onclick = function(){
			var newSec = this;
			videoShortList.each(function(section){
				if(section.parent.hasClassName('act')){
					section.parent.removeClassName('act');
					newSec.parent.addClassName('act');
					new Effect.Opacity(section, { from: 1.0, to: 0, duration: 0.3, afterFinish:function(){
						section.setStyle({display: 'none'});
						
						newSec.setOpacity(0);
						newSec.setStyle({display: 'block'});
						new Effect.Opacity(newSec, { from: 0, to: 1.0, duration: 0.3 });
					} });
				}
			});

		}.bind(el);
		
		if(!el.parent.hasClassName('act')){
			el.setStyle({display: 'none'});
		}
	});
	
	var ratingBox = $('rating');
	if(ratingBox){
		videoRating = new rating(ratingBox, "fileadmin/templates/css/img/video/rating_");
	}
	
	// video embed
	if($('embed-video')){
		$('embed-video').onclick = function(){
			this.focus();
			this.select();
		}
	}
	
	var slideshow = new bigSlide();
	
	if($('productsearch')){
		searchBox.init();
	}
	
	//twitter
	if($('twitter_div')){
		$$('head')[0].appendChild(new Element('script', {src: "http://twitter.com/javascripts/blogger.js", type: "text/javascript"}));
		$$('head')[0].appendChild(new Element('script', {src: "http://twitter.com/statuses/user_timeline/Meinlpercussion.json?callback=twitterCallback2&count=3", type: "text/javascript"}));
	}
	
	$$('div.contest-item').each(function(el, index){
		new contestItem(el, "fileadmin/templates/css/img/contest/rating_");
	});
	
	
});
