﻿// common.js

// jQuery
if(typeof jQuery != 'undefined') {
	
	// load soundmanager
	if(typeof soundManager != 'undefined') {
		soundManager.url = '/fileadmin/web/scripts/libraries/soundmanager/swf/';
		soundManager.debugMode = false;
		soundManager.flashVersion = 9;
		
		soundManager.defaultOptions = {
			'autoLoad': true,		// enable automatic loading (otherwise .load() will call with .play())
			'stream': true,			// allows playing before entire file has loaded (recommended)
			'multiShot': false		// let sounds "restart" or "chorus" when played multiple times..
		}
	}
	
	// default window opener (external)
	$(document).ready(function() {
		$('a[rel~=external]').click(function() {
			relation = $(this).attr('rel');
			
			if($(this).attr('href')) {
				options = '';
				
				address = $(this).attr('href');
				
				if(relation.match(/\[([0-9]{2,4})\,([0-9]{2,4})\]/)) {
					options += '';
					
					size = relation.split('[');
					size = size[1].replace(/\]/, '');
					size = size.split(',');
					
					options += 'width=' + size[0] + ', height=' + size[1] + ',left=200,top=200';
				}
				
				window.open($(this).attr('href'), '', options);
				
				return false;
			}
		});
	});
	
	// typo3 shortcut
	$(document).ready(function() {
		$(document).keyup(function(e) {
			if(e.which == 113)
				window.open('http://' + document.URL.split('/')[2] + '/typo3/');
		});
	});
}

// Prototype
if(typeof Prototype != 'undefined') {
	
}

