Event.observe(window, 'load', function(){
	
/*	ADJUST HEIGHT OF SUB MENU / NEWS LIST
*/
	var height = $$('ul.sub_menu')[0].getHeight();
	if($('content').getHeight() < height) { $('content').setStyle({'height':height+'px'}); }
	if($$('div.newsArchive').length > 0) {
	  var height = $$('div.newsArchive')[0].getHeight() + 100;
	  if($('content').getHeight() < height) { $('content_inner').setStyle({'height':height+'px'}); }}
	
/*	FACEBOOK XFBML

	$('content').insert('<div id="fb-root"></div>');
	 window.fbAsyncInit = function() {
		FB.init({appId: '195887193770278', status: true, cookie: true, xfbml: true}); };
		(function() {
		    var e = document.createElement('script'); e.async = true;
		    e.src = document.location.protocol + '//connect.facebook.net/de_DE/all.js';
		    document.getElementById('fb-root').appendChild(e);
		  }());
*/

/*	FACEBOOK ACTIVITY BOX - HOME PAGE

	if($$('div.page_11670').length > 0) { $('content_inner').insert('<div class="fb_activity"><fb:like-box href="http://www.facebook.com/fdpfraktionnds" width="215" show_faces="false" stream="true" header="false"></fb:like-box><br /><fb:facepile href="http://www.facebook.com/fdpfraktionnds" width="215" max_rows="1"></fb:facepile></div>'); }
*/
/*	FACEBOOK COMMENTS / NEWS PAGES
	
	if($$('div.page_news')[0] && !$$('ul.newsList')[0]) { $('content_inner').insert('<fb:comments></fb:comments>'); }
*/	
/*	FACEBOOK LIKE BUTTON
	
	$('content_inner').insert('<div class="like_button"><fb:like layout="button_count" show_faces="false"></fb:like></div>');  
*/
/*	FACEBOOK STATIC BUTTON - STATUS UPDATE
*/
	$('content_inner').insert('<a onclick="window.open($(this).readAttribute(\'href\'),\'sharer\',\'toolbar=0,status=0,width=626,height=436\');return false;" class="facebook_status" href="http://www.facebook.com/sharer.php?u='+encodeURIComponent(document.location.href)+'"><img src="/files/768/style/img/facebook_button_24.png" alt="Auf Facebook posten" /></a>');

/*	VOTING / JULES BUTTON
*/
	//$$('div.site')[0].insert('<a class="poll" href="/de/44871-Umfrage"><img src="/files/768/style/img/umfrage_btn.jpg" alt="Umfrage" /></a>');
	$$('div.site')[0].insert('<a class="poll" href="/de/96440-Jules-Audio-Blog"><img src="/files/768/style/img/jab_btn.jpg" alt="Jules Audio Blog" /></a>');

/*	HOME PAGE - NEWS BOX HEADLINE
*/
	if($$('div.news_inner').length>0){$$('div.news_inner')[0].insert({'before':'<p><b>Aktuelle Pressemitteilungen</b></p>'});} 
	
/*	MP3 PLAYER
*/
	if($$('body.frontend').length>0){
		$$('a[href$=.mp3]').each(function(mp3LinkElement){
			var mp3File		=	mp3LinkElement.readAttribute('href');
			var mp3Title	=	mp3LinkElement.innerHTML;
			var mp3Player	=	'<div class="mp3player">'
				+mp3Title
				+'<br /><a href="'+mp3File+'" class="mp3_load" target="_blank">(Datei herunterladen)</a><br />'
				+'<embed src="/files/768/upload/_mp3player/mp3.swf?'
				+'mp3url='+mp3File
				+'&bgcolor=#FFFFFF'
				+'&txtcolor=#000000'
				+'&barbgcolor=#999999'
				+'&loadbar=#003ac0'
				+'&posbar=#fbe92f'
				+'&loop=false" quality="high" width="275" height="20" name="mp3" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
				+'</div>';
			$(mp3LinkElement).insert({'before':mp3Player}).remove();
		});
	}
	

/*	SIMPLE FORM VALIDATION
*/	
	// js foreach
	Array.prototype.foreach=function(callback){for(var k=0;k<this.length;k++){callback(k,this[k]);}}
	// required fields IDs
	required_fields = new Array('ModuleContactName','ModuleContactAdresse','ModuleContactPLZ&Ort','BlockDataModuleContactEmail');
	var error_alert = 'Bitte füllen Sie die markierten Felder aus';
	var form_selector = 'div.module_contact form';
	var required_class = 'required';
	var validation_fail_class = 'validation-fail';
	required_fields.foreach(function(k,v){if($(v)){$(v).addClassName(required_class);}});	
	if($$(form_selector).length>0){$$(form_selector)[0].observe('submit',function(submission){required_fields.foreach(function(k,v){if($(v)){$(v).removeClassName(validation_fail_class);if($(v).value==''){$(v).addClassName(validation_fail_class);}}});if($$('.'+validation_fail_class).length>0) { alert(error_alert);submission.stop()}})}
});





