//NEWS TICKER
(function($){
	$.fn.innerfade = function(options){
		return this.each(function(){
			$.innerfade(this, options);
		});
	};
	$.innerfade = function(container, options){
		var settings ={
			'animationtype':'fade',
			'speed':'slow',
			'type':'sequence',
			'timeout':10000,
			'containerheight':'auto',
			'runningclass':'innerfade',
			'children':null
		};
		if (options)
			$.extend(settings,options);
		if (settings.children === null)
			var elements = $(container).children();
		else
			var elements = $(container).children(settings.children);
		if (elements.length > 1){
			$(container).css('display', 'block').css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
			for (var i = 0; i < elements.length; i++){
				$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
			};
			if (settings.type == "sequence"){
				setTimeout(function(){
					$.innerfade.next(elements, settings, 1, 0);
				}, settings.timeout);
				$(elements[0]).show();
			} else if (settings.type == "random"){
					var last = Math.floor ( Math.random () * ( elements.length ) );
				setTimeout(function(){
					do{
						current = Math.floor ( Math.random ( ) * ( elements.length ) );
						} while (last == current );
						$.innerfade.next(elements, settings, current, last);
				}, settings.timeout);
				$(elements[last]).show();
					} else if ( settings.type == 'random_start' ){
						settings.type = 'sequence';
						var current = Math.floor ( Math.random () * ( elements.length ) );
						setTimeout(function(){
							$.innerfade.next(elements, settings, (current + 1) %  elements.length, current);
						}, settings.timeout);
						$(elements[current]).show();
					}	else{
						alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
					}
				}
	};
	$.innerfade.next = function(elements, settings, current, last){
		if (settings.animationtype == 'slide'){
			$(elements[last]).slideUp(settings.speed);
			$(elements[current]).slideDown(settings.speed);
		} else if (settings.animationtype == 'fade'){
			$(elements[last]).fadeOut(settings.speed);
			$(elements[current]).fadeIn(settings.speed, function(){
				removeFilter($(this)[0]);
			});
		} else
			alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
		if (settings.type == "sequence"){
			if ((current + 1) < elements.length){
				current = current + 1;
				last = current - 1;
			} else{
				current = 0;
				last = elements.length - 1;
			}
		} else if (settings.type == "random"){
			last = current;
			while (current == last)
				current = Math.floor(Math.random() * elements.length);
		} else
			alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
		setTimeout((function(){
			$.innerfade.next(elements, settings, current, last);
		}), settings.timeout);
	};
})(jQuery);
//remove Opacity-Filter in ie
function removeFilter(element){
	if(element.style.removeAttribute){
		element.style.removeAttribute('filter');
	}
}
$(document).ready(
 function(){
	$('#news').innerfade({
	});
});



//WORLD TIMES
/*
jQuery jclock - Clock plugin - v 1.2.0
http://plugins.jquery.com/project/jclock
Copyright (c) 2007-2008 Doug Sparling <http://www.dougsparling.com>
Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
$.fn.jclock = function(options) {
	var version = '1.2.0';
	// options
	var opts = $.extend({}, $.fn.jclock.defaults, options);
	return this.each(function() {
		$this = $(this);
		$this.timerID = null;
		$this.running = false;
		var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
		$this.timeNotation = o.timeNotation;
		$this.am_pm = o.am_pm;
		$this.utc = o.utc;
		$this.utc_offset = o.utc_offset;
		$this.css({
		fontFamily: o.fontFamily,
		fontSize: o.fontSize,
		backgroundColor: o.background,
		color: o.foreground
		});
		$.fn.jclock.startClock($this);
	});
};
$.fn.jclock.startClock = function(el) {
	$.fn.jclock.stopClock(el);
	$.fn.jclock.displayTime(el);
}
$.fn.jclock.stopClock = function(el) {
	if(el.running) {
		clearTimeout(el.timerID);
	}
	el.running = false;
}
$.fn.jclock.displayTime = function(el) {
	var time = $.fn.jclock.getTime(el);
	el.html(time);
	el.timerID = setTimeout(function(){$.fn.jclock.displayTime(el)},1000);
}
$.fn.jclock.getTime = function(el) {
	var now = new Date();
	var hours, minutes, seconds;
	if(el.utc == true) {
		var localTime = now.getTime();
		var localOffset = now.getTimezoneOffset() * 60000;
		var utc = localTime + localOffset;
		var utcTime = utc + (3600000 * el.utc_offset);
		now = new Date(utcTime);
	}
	hours = now.getHours();
	minutes = now.getMinutes();
	seconds = now.getSeconds();
	var am_pm_text = '';
	(hours >= 12) ? am_pm_text = " P.M." : am_pm_text = " A.M.";
	if (el.timeNotation == '12h') {
		hours = ((hours > 12) ? hours - 12 : hours);
	} else if (el.timeNotation == '12hh') {
		hours = ((hours > 12) ? hours - 12 : hours);
		hours   = ((hours <  10) ? "0" : "") + hours;
	} else {
		hours   = ((hours <  10) ? "0" : "") + hours;
	}
	minutes = ((minutes <  10) ? "0" : "") + minutes;
	seconds = ((seconds <  10) ? "0" : "") + seconds;
	var timeNow = hours + ":" + minutes + ":" + seconds;
	if ( (el.timeNotation == '12h' || el.timeNotation == '12hh') && (el.am_pm == true) ) {
	 timeNow += am_pm_text;
	}
	return timeNow;
};
// plugin defaults
$.fn.jclock.defaults = {
	timeNotation: '24h',
	am_pm: false,
	utc: false,
	fontFamily: '',
	fontSize: '',
	foreground: '',
	background: '',
	utc_offset: 0
};
})(jQuery);
$(function($){
	var options={
		utc: true,
		utc_offset:-4
	};
	$('.jclockNY').jclock(options);//from second sunday in march -4, from first sunday in november -5

	var options={
		utc: true,
		utc_offset:+8
	};
	$('.jclockSG').jclock(options);//homo sapiens, stabile +8

	var options={
		utc: true,
		utc_offset:+9
	};
	$('.jclockTYO').jclock(options);//homo sapiens, stabile +9

	var options={
		utc: true,
		utc_offset:+1
	};
	$('.jclockLDN').jclock(options);//from last sunday in march +1, from last sunday in october 0

	var options={
		utc: true,
		utc_offset:0
	};
	$('.jclockGMT').jclock(options);//UTC, stabile 0
});