window.log = function(){
  log.history = log.history || [];  
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});


/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
  def: 'easeOutQuad',
  swing: function (x, t, b, c, d) {
    //alert(jQuery.easing.default);
    return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
  },
  easeInQuad: function (x, t, b, c, d) {
    return c*(t/=d)*t + b;
  },
  easeOutQuad: function (x, t, b, c, d) {
    return -c *(t/=d)*(t-2) + b;
  },
  easeInOutQuad: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t + b;
    return -c/2 * ((--t)*(t-2) - 1) + b;
  },
  easeInCubic: function (x, t, b, c, d) {
    return c*(t/=d)*t*t + b;
  },
  easeOutCubic: function (x, t, b, c, d) {
    return c*((t=t/d-1)*t*t + 1) + b;
  },
  easeInOutCubic: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t + b;
    return c/2*((t-=2)*t*t + 2) + b;
  },
  easeInQuart: function (x, t, b, c, d) {
    return c*(t/=d)*t*t*t + b;
  },
  easeOutQuart: function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
  },
  easeInOutQuart: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
    return -c/2 * ((t-=2)*t*t*t - 2) + b;
  },
  easeInQuint: function (x, t, b, c, d) {
    return c*(t/=d)*t*t*t*t + b;
  },
  easeOutQuint: function (x, t, b, c, d) {
    return c*((t=t/d-1)*t*t*t*t + 1) + b;
  },
  easeInOutQuint: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
    return c/2*((t-=2)*t*t*t*t + 2) + b;
  },
  easeInSine: function (x, t, b, c, d) {
    return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  },
  easeOutSine: function (x, t, b, c, d) {
    return c * Math.sin(t/d * (Math.PI/2)) + b;
  },
  easeInOutSine: function (x, t, b, c, d) {
    return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  },
  easeInExpo: function (x, t, b, c, d) {
    return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  },
  easeOutExpo: function (x, t, b, c, d) {
    return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  },
  easeInOutExpo: function (x, t, b, c, d) {
    if (t==0) return b;
    if (t==d) return b+c;
    if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
    return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  },
  easeInCirc: function (x, t, b, c, d) {
    return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  },
  easeOutCirc: function (x, t, b, c, d) {
    return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  },
  easeInOutCirc: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
    return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  },
  easeInElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  },
  easeOutElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  },
  easeInOutElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  },
  easeInBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158;
    return c*(t/=d)*t*((s+1)*t - s) + b;
  },
  easeOutBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158;
    return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  },
  easeInOutBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158; 
    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  },
  easeInBounce: function (x, t, b, c, d) {
    return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  },
  easeOutBounce: function (x, t, b, c, d) {
    if ((t/=d) < (1/2.75)) {
      return c*(7.5625*t*t) + b;
    } else if (t < (2/2.75)) {
      return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
    } else if (t < (2.5/2.75)) {
      return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
    } else {
      return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
    }
  },
  easeInOutBounce: function (x, t, b, c, d) {
    if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
    return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  }
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */

/*
jQuery Coda-Slider v2.0 - http://www.ndoherty.biz/coda-slider
Copyright (c) 2009 Niall Doherty
This plugin available for use in all personal or commercial projects under both MIT and GPL licenses.
*/

$(function(){
// Remove the coda-slider-no-js class from the body
$("body").removeClass("coda-slider-no-js");
// Preloader
$(".coda-slider").children('.panel').hide().end().prepend('<p class="loading">Loading...</p>');
});

var sliderCount = 1;

$.fn.codaSlider = function(settings) {

settings = $.extend({
  autoHeight: true,
  autoHeightEaseDuration: 1000,
  autoHeightEaseFunction: "easeInOutExpo",
  autoSlide: false,
  autoSlideInterval: 7000,
  autoSlideStopWhenClicked: true,
  crossLinking: true,
  dynamicArrows: true,
  dynamicArrowLeftText: "&#171; left",
  dynamicArrowRightText: "right &#187;",
  dynamicTabs: true,
  dynamicTabsAlign: "center",
  dynamicTabsPosition: "top",
  externalTriggerSelector: "a.xtrig",
  firstPanelToLoad: 1,
  panelTitleSelector: "h2.title",
  slideEaseDuration: 1000,
  slideEaseFunction: "easeInOutExpo"
}, settings);

return this.each(function(){
  
  // Uncomment the line below to test your preloader
  // alert("Testing preloader");
  
  var slider = $(this);
  
  // If we need arrows
  if (settings.dynamicArrows) {
    slider.parent().addClass("arrows");
    slider.before('<div class="coda-nav-left" id="coda-nav-left-' + sliderCount + '"><a href="#">' + settings.dynamicArrowLeftText + '</a></div>');
    slider.after('<div class="coda-nav-right" id="coda-nav-right-' + sliderCount + '"><a href="#">' + settings.dynamicArrowRightText + '</a></div>');
  };
  
  var panelWidth = slider.find(".panel").width();
  var panelCount = slider.find(".panel").size();
  var panelContainerWidth = panelWidth*panelCount;
  var navClicks = 0; // Used if autoSlideStopWhenClicked = true
  var mousein = 0; // Used if autoSlideStopWhenClicked = true added by continent7
  var timer; //added by continent7
  
  // Surround the collection of panel divs with a container div (wide enough for all panels to be lined up end-to-end)
  $('.panel', slider).wrapAll('<div class="panel-container"></div>');
  // Specify the width of the container div (wide enough for all panels to be lined up end-to-end)
  $(".panel-container", slider).css({ width: panelContainerWidth });
  
  // Specify the current panel.
  // If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position...
  if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
    var currentPanel = parseInt(location.hash.slice(1));
    var offset = - (panelWidth*(currentPanel - 1));
    $('.panel-container', slider).css({ marginLeft: offset });
  // If that's not the case, check to see if we're supposed to load a panel other than Panel 1 initially...
  } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { 
    var currentPanel = settings.firstPanelToLoad;
    var offset = - (panelWidth*(currentPanel - 1));
    $('.panel-container', slider).css({ marginLeft: offset });
  // Otherwise, we'll just set the current panel to 1...
  } else { 
    var currentPanel = 1;
  };
  
  //added by continent7
  $(".coda-slider").mouseenter(function(){
    mousein = 1;
    if(timer) clearTimeout(timer);
  });
  $(".coda-slider").mouseleave(function(){
    if(timer) clearTimeout(timer);
    mousein = 0;
    if (settings.autoSlide) {
      slider.ready(function() {
        timer = setTimeout(autoSlide,settings.autoSlideInterval);
      });
    };
  });
    
  // Left arrow click
  $("#coda-nav-left-" + sliderCount + " a").click(function(){
    navClicks++;
    if (currentPanel == 1) {
      offset = - (panelWidth*(panelCount - 1));
      alterPanelHeight(panelCount - 1);
      currentPanel = panelCount;
      slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('li:last a').addClass('current');
    } else {
      currentPanel -= 1;
      alterPanelHeight(currentPanel - 1);
      offset = - (panelWidth*(currentPanel - 1));
      slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().prev().find('a').addClass('current');
    };
    $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
    if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking)
    return false;
  });
    
  // Right arrow click
  $('#coda-nav-right-' + sliderCount + ' a').click(function(){
    navClicks++;
    if (currentPanel == panelCount) {
      offset = 0;
      currentPanel = 1;
      alterPanelHeight(0);
      slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('a:eq(0)').addClass('current');
    } else {
      offset = - (panelWidth*currentPanel);
      alterPanelHeight(currentPanel);
      currentPanel += 1;
      slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().next().find('a').addClass('current');
    };
    $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
    if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking)
    return false;
  });
  
  // If we need a dynamic menu
  if (settings.dynamicTabs) {
    var dynamicTabs = '<div class="coda-nav" id="coda-nav-' + sliderCount + '"><ul></ul></div>';
    switch (settings.dynamicTabsPosition) {
      case "bottom":
        slider.parent().append(dynamicTabs);
        break;
      default:
        slider.parent().prepend(dynamicTabs);
        break;
    };
    ul = $('#coda-nav-' + sliderCount + ' ul');
    // Create the nav items
    $('.panel', slider).each(function(n) {
      var icons = $(this).find('.slide-icons').html();
      if(icons == null) icons = '';
      ul.append('<li class="tab' + (n+1) + '"><a href="#' + (n+1) + '">' + icons + $(this).find(settings.panelTitleSelector).html() + '</a></li>'); /*changed by continent7 */                       
    });
    navContainerWidth = slider.width() + slider.siblings('.coda-nav-left').width() + slider.siblings('.coda-nav-right').width();
    ul.parent().css({ width: navContainerWidth });
    switch (settings.dynamicTabsAlign) {
      case "nothing": /*added by continent7 */
        $('li', ul).css({ width: 'auto' });
        break;
      case "maximize": /*added by continent7 */
        var tabwidth = Math.floor(slider.width() / panelCount);
        $('li', ul).css({ width: tabwidth });
        break;
      case "center":
        ul.css({ width: ($("li", ul).width() + 2) * panelCount });
        break;
      case "right":
        ul.css({ float: 'right' });
        break;
    };
    
    /*added by continent7 */
    var totalwidth = 0
    $('li', ul).each(function(){
      totalwidth += $(this).width();
    });
    totalwidth +=2;
    ul.parent().css({ width: totalwidth });
    
  };
    
  // If we need a tabbed nav
  $('#coda-nav-' + sliderCount + ' a').each(function(z) {
    // What happens when a nav link is clicked
    $(this).bind("click", function() {
      navClicks++;
      $(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current');
      offset = - (panelWidth*z);
      alterPanelHeight(z);
      currentPanel = z + 1;
      $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
      if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified
    });
  });
  
  // External triggers (anywhere on the page)
  $(settings.externalTriggerSelector).each(function() {
    // Make sure this only affects the targeted slider
    if (sliderCount == parseInt($(this).attr("rel").slice(12))) {
      $(this).bind("click", function() {
        navClicks++;
        targetPanel = parseInt($(this).attr("href").slice(1));
        offset = - (panelWidth*(targetPanel - 1));
        alterPanelHeight(targetPanel - 1);
        currentPanel = targetPanel;
        // Switch the current tab:
        slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (targetPanel - 1) + ') a').addClass('current');
        // Slide
        $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
        if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified
      });
    };
  });
    
  // Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking).
  if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
    $("#coda-nav-" + sliderCount + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current");
  // If there's no cross-linking, check to see if we're supposed to load a panel other than Panel 1 initially...
  } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) {
    $("#coda-nav-" + sliderCount + " a:eq(" + (settings.firstPanelToLoad - 1) + ")").addClass("current");
  // Otherwise we must be loading Panel 1, so make the first tab the current one.
  } else {
    $("#coda-nav-" + sliderCount + " a:eq(0)").addClass("current");
  };
  
  // Set the height of the first panel
  if (settings.autoHeight) {
    panelHeight = $('.panel:eq(' + (currentPanel - 1) + ')', slider).height();
    slider.css({ height: panelHeight });
  };
  
  // Trigger autoSlide
  if (settings.autoSlide) {
    slider.ready(function() {
      timer = setTimeout(autoSlide,settings.autoSlideInterval); //changed by continent7
    });
  };
  
  function alterPanelHeight(x) {
    if (settings.autoHeight) {
      panelHeight = $('.panel:eq(' + x + ')', slider).height()
      slider.animate({ height: panelHeight }, settings.autoHeightEaseDuration, settings.autoHeightEaseFunction);
    };
  };
  
  function autoSlide() {
    if ((navClicks == 0 && mousein == 0)  || !settings.autoSlideStopWhenClicked) {
      if (currentPanel == panelCount) {
        var offset = 0;
        currentPanel = 1;
      } else {
        var offset = - (panelWidth*currentPanel);
        currentPanel += 1;
      };
      alterPanelHeight(currentPanel - 1);
      // Switch the current tab:
      slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (currentPanel - 1) + ') a').addClass('current');
      // Slide:
      $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
      timer = setTimeout(autoSlide,settings.autoSlideInterval); //changed by continent7
    };
  };
  
  // Kill the preloader
  $('.panel', slider).show().end().find("p.loading").remove();
  slider.removeClass("preload");
  
  sliderCount++;
  
});
};


/*
News ticker plugin (BBC news style)
Bryan Gullan,2007-2011
version 2.3.6
updated 2011-03-16
Documentation at http://www.makemineatriple.com/news-ticker-documentation/
Demo at http://www.makemineatriple.com/jquery/?newsTicker
Use and distrubute freely with this header intact.
*/

(function($) {
  
  var name='newsTicker';
  var debugMode = false; // enabling this turns on console logging for interactions
  
  function runTicker(settings) {
    
    tickerData = $(settings.newsList).data('newsTicker');
    
    if(tickerData.currentItem > tickerData.newsItemCounter){
      // if we've looped to beyond the last item in the list, start over
      tickerData.currentItem = 0;
    }
    else if (tickerData.currentItem < 0) {
      // if we've looped back before the first item, move to the last one
      tickerData.currentItem = tickerData.newsItemCounter;
    }
    
    if(tickerData.currentPosition == 0) {
      if(tickerData.newsLinks[tickerData.currentItem].length > 0) {
        $(tickerData.newsList).empty().append('<li><a '+ tickerData.newsAttributes[tickerData.currentItem] +'></a></li>');
      }
      else {
        $(tickerData.newsList).empty().append('<li></li>');
      }
    }
    
    //only start the ticker itself if it's defined as animating: otherwise it's paused or under manual advance
    if (tickerData.animating) {
      
      if( tickerData.currentPosition % 2 == 0) {
          var placeHolder = tickerData.placeHolder1;
      }
      else {
        var placeHolder = tickerData.placeHolder2;
      }
      
      if( tickerData.currentPosition < tickerData.newsItems[tickerData.currentItem].length) {
        // we haven't completed ticking out the current item
        
        var tickerText = tickerData.newsItems[tickerData.currentItem].substring(0,tickerData.currentPosition);
        if(tickerData.newsLinks[tickerData.currentItem].length > 0) {
          $(tickerData.newsList + ' li a').text(tickerText + placeHolder);
        }
        else {
          $(tickerData.newsList + ' li').text(tickerText + placeHolder);
        }
        tickerData.currentPosition ++;
        setTimeout(function(){runTicker(settings); settings = null;},tickerData.tickerRate);
      }
      
      else {
        // we're on the last letter of the current item
        
        if(tickerData.newsLinks[tickerData.currentItem].length > 0) {
          $(tickerData.newsList + ' li a').text(tickerData.newsItems[tickerData.currentItem]);
        }
        else {
          $(tickerData.newsList + ' li').text(tickerData.newsItems[tickerData.currentItem]);
        }
        
        setTimeout(function(){
          if (tickerData.animating) {
            tickerData.currentPosition = 0;
            tickerData.currentItem ++;
            runTicker(settings); settings = null;
          }
        },tickerData.loopDelay);
        
      }
    }
    
    else {// settings.animating == false 
      
      // display the full text of the current item
      var tickerText = tickerData.newsItems[tickerData.currentItem];
      
      if(tickerData.newsLinks[tickerData.currentItem].length > 0) {
        $(tickerData.newsList + ' li a').text(tickerText);
      }
      else {
        $(tickerData.newsList + ' li').text(tickerText);
      }
          
    }
    
  }

  
  // Core plugin setup and config
  jQuery.fn[name] = function(options) {
 
    // Add or overwrite options onto defaults
    var settings = jQuery.extend({}, jQuery.fn.newsTicker.defaults, options);
   
    var newsItems = new Array();
    var newsLinks = new Array();
    var newsAttributes = new Array();
    var newsItemCounter = 0;
    
    // Hide the static list items
    $(settings.newsList + ' li').hide();
    
    // Store the items and links in arrays for output
    $(settings.newsList + ' li').each(function(){
      if($(this).children('a').length) {
        newsItems[newsItemCounter] = $(this).children('a').text();
        newsLinks[newsItemCounter] = $(this).children('a').attr('href');
        
        var linkAttributes = new Object();
          var attrs = $(this).children('a')[0].attributes;
          for (var i=0;i<attrs.length;i++) {
          linkAttributes[attrs[i].nodeName] = attrs[i].nodeValue;
        }
        if (debugMode){ 
          console.log(linkAttributes);
        }
        
        var linkAttributesProcessed = '';
        for (var prop in linkAttributes) {
          // print out the attributes as a string ready for output within the anchor tag
          linkAttributesProcessed = linkAttributesProcessed + prop + '="' + linkAttributes[prop] + '" ';
        }
        if (debugMode){ 
          console.log(linkAttributesProcessed);
        }
        
        newsAttributes[newsItemCounter] = linkAttributesProcessed;
        
      }
      else {
        newsItems[newsItemCounter] = $(this).text();
        newsLinks[newsItemCounter] = '';
        newsAttributes[newsItemCounter] = '';
      }
      newsItemCounter ++;
    });
        
        var tickerElement = $(settings.newsList); // for quick reference below
        
        tickerElement.data(name, {
          newsList: settings.newsList,
          tickerRate: settings.tickerRate,
          startDelay: settings.startDelay,
          loopDelay: settings.loopDelay,
          placeHolder1: settings.placeHolder1,
          placeHolder2: settings.placeHolder2,
          controls: settings.controls,
          ownControls: settings.ownControls,
          stopOnHover: settings.stopOnHover,
          resumeOffHover: settings.resumeOffHover,
          newsItems: newsItems,
          newsLinks: newsLinks,
          newsAttributes: newsAttributes,
          newsItemCounter: newsItemCounter - 1, // -1 because we've incremented even after the last item (above)
          currentItem: 0,
          currentPosition: 0,
          firstRun:1
        })
        .bind({
      stop: function(event) {
        // show remainder of the current item immediately
          tickerData = tickerElement.data(name);
          if (tickerData.animating) { // only stop if not already stopped
                tickerData.animating = false;
                if (debugMode){ 
                  console.log('stop'+tickerData.currentItem + ' ' + tickerData.animating);
                }
                }
        },
        play: function(event) {
          // show 1st item with startdelay
          tickerData = tickerElement.data(name);
          if (!tickerData.animating) { // if already animating, don't start animating again
                tickerData.animating = true;
                if (debugMode){ 
                  console.log('play'+tickerData.currentItem + ' ' + tickerData.animating);
                }
                setTimeout(function(){runTicker(tickerData); tickerData = null;},tickerData.startDelay);
              }
        },
        resume: function(event) {
          // start from next item, with no delay
          tickerData = tickerElement.data(name);
          if (!tickerData.animating) { // if already animating, don't start animating again
                tickerData.animating = true;
                // set the character position as 0 to ensure on resume we start at the right point
          tickerData.currentPosition = 0;
                tickerData.currentItem ++;
                if (debugMode){ 
                  console.log('resume'+tickerData.currentItem + ' ' + tickerData.animating);
                }
                runTicker(tickerData); // no delay when resuming.
            }
        },
        next: function(event) {
          // show whole of next item
          tickerData = tickerElement.data(name);
          // stop (which sets as non-animating), and call runticker
          $(tickerData.newsList).trigger("stop");
          // set the character position as 0 to ensure on resume we start at the right point
        tickerData.currentPosition = 0;
              tickerData.currentItem ++;
              if (debugMode){ 
                  console.log('next'+tickerData.currentItem + ' ' + tickerData.animating);
                }
          runTicker(tickerData);
        },
        previous: function(event) {
        // show whole of previous item
        tickerData = tickerElement.data(name);
          // stop (which sets as non-animating), and call runticker
          $(tickerData.newsList).trigger("stop");
          // set the character position as 0 to ensure on resume we start at the right point
        tickerData.currentPosition = 0;
              tickerData.currentItem --;
              if (debugMode){ 
                  console.log('previous'+tickerData.currentItem + ' ' + tickerData.animating);
                }
          runTicker(tickerData);
      }
    });   
    if (settings.stopOnHover) {
        tickerElement.bind({            
          mouseover: function(event) {
            tickerData = tickerElement.data(name);
            if (tickerData.animating) { // stop if not already stopped
              $(tickerData.newsList).trigger("stop");
              if (tickerData.controls) { // ensure that the ticker can be resumed if controls are enabled
                $('.stop').hide();
                  $('.resume').show();
              }
            }
          }
      });
      if (settings.resumeOffHover) { // only allowed if stopOnHover enabled
          tickerElement.bind({            
            mouseout: function(event) {
              tickerData = tickerElement.data(name);
              if (!tickerData.animating) { // if already animating, don't start animating again
                    $(tickerData.newsList).trigger("resume");
                    if (debugMode){ 
                      console.log('resumeoffhover'+tickerData.currentItem + ' ' + tickerData.animating);
                    }
                }
            }
        });
        }
      }
      
      tickerData = tickerElement.data(name);
      
      // set up control buttons if the option is on
    if (tickerData.controls || tickerData.ownControls) {
      if (!tickerData.ownControls) {
        $('<ul class="ticker-controls"><li class="previous"><a href="#previous">Previous</a></li><li class="play"><a href="#play">Play</a></li><li class="resume"><a href="#resume">Resume</a></li><li class="stop"><a href="#stop">Stop</a></li><li class="next"><a href="#next">Next</a></li></ul>').insertAfter($(tickerData.newsList));
      }
      $('.play').hide();
        $('.resume').hide();
      
        $('.play').click(function(event){
            $(tickerData.newsList).trigger("play");
            $('.play').hide();
            $('.resume').hide();
            $('.stop').show();
            event.preventDefault();
        });
        $('.resume').click(function(event){
            $(tickerData.newsList).trigger("resume");
            $('.play').hide();
            $('.resume').hide();
            $('.stop').show();
            event.preventDefault();
        });
      $('.stop').click(function(event){
            $(tickerData.newsList).trigger("stop");
            $('.stop').hide();
            $('.resume').show();
            event.preventDefault();
        });
        $('.previous').click(function(event){
            $(tickerData.newsList).trigger("previous");
            $('.stop').hide();
          $('.resume').show();
            event.preventDefault();
        });
        $('.next').click(function(event){
            $(tickerData.newsList).trigger("next");
            $('.stop').hide();
          $('.resume').show();
            event.preventDefault();
        });

      };
      
      // tell it to play
      $(tickerData.newsList).trigger("play");
  };

  // News ticker defaults 
  jQuery.fn[name].defaults = {
    newsList: "#news",
    tickerRate: 80,
    startDelay: 100,
    loopDelay: 3000,
    placeHolder1: " |",
    placeHolder2: "_",
    controls: true,
    ownControls: false,
    stopOnHover: true,
    resumeOffHover: false
  }

})(jQuery);

/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'/fileadmin/templates/acctis/img/lightbox-ico-loading.gif',imageBtnPrev:'/fileadmin/templates/acctis/img/lightbox-btn-prev.gif',imageBtnNext:'/fileadmin/templates/acctis/img/lightbox-btn-next.gif',imageBtnClose:'/fileadmin/templates/acctis/img/lightbox-btn-close.gif',imageBlank:'/fileadmin/templates/acctis/img/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);
