/* =========================================================// jquery.innerfade.js// Datum: 2008-02-14// Firma: Medienfreunde Hofmann & Baldes GbR// Author: Torsten Baldes// ========================================================= */(function($) {    $.fn.innerfade = function(options) {        return this.each(function() {               $.innerfade(this, options);        });    };		    $.innerfade = function(container, options) {        var settings = {        		'animationtype':    'fade',            'speed':            'normal',            'type':             'sequence',            'timeout':          2000,            '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('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');	}}// news_main............****$(document).ready(function() {//Show Banner$(".main_image .desc").show(); //Show Banner$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity//Click and Hover events for thumbnail list$(".image_thumb ul li:first").addClass('active');// * Code added by Jeff Schram, SchramDesign, http://schramdesign.com, email@schramdesign.com// * Adds a class 'last' to the last li to let the rotator know when to return to the first$(".image_thumb ul li:last").addClass('last');$(".image_thumb ul li").click(function(){//Set Variablesvar imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Imagevar imgTitle = $(this).find(".inner_im").attr("href"); //Get Main Image URLvar imgDesc = $(this).find('.block').html(); //Get HTML of blockvar imgDescHeight = $(".main_image").find('.block').height(); //Calculate height of blockif ($(this).is(".active")) { //If it's already active, then…return false; // Don't click through} else {//Animate the Teaser$(".main_image img").animate({ opacity: 0}, 400 );$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 700 , function() {$(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 700 );$(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 400 );});}$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists$(this).addClass('active'); //add class of 'active' on this list onlyreturn false;}) .hover(function(){$(this).addClass('hover');}, function() {$(this).removeClass('hover');});//Toggle Teaser$("a.collapse").click(function(){$(".main_image .block").slideToggle();$("a.collapse").toggleClass("show");});// * Code added by Jeff Schram// * if we are hovering over the image area, pause the clickNext function// * by default, our new pauseClickNext variable is falsepauseClickNext = false;$(".main_image").hover(function () {pauseClickNext = true;},function () {pauseClickNext = false;});pauseClickNext = false;$(".image_thumb ul li").hover(function () {pauseClickNext = true;},function () {pauseClickNext = false;});// * Code added by Jeff Schram// * Define function to click the next li// * notice that it checks for a class of 'last', we added that abovevar clickNext = function(){if(!pauseClickNext) {/// find the next li after .activevar $next_li = $("li.active").next("li");if($("li.active").hasClass("last") ){$(".image_thumb ul li:first").trigger("click");} else {$next_li.trigger("click");}}};// * Code added by Jeff Schram// * setTimeInterval to run clickNextsetInterval(clickNext, 8000);});//Close Function
