// JavaScript Document
hideLastSeparator();

function hideLastSeparator() {
   var elements = getElementsByClass("article_separator", null, "span");
   if(elements.length > 0) {
      elements[elements.length-1].style.display="none";
   }
}

function getElementsByClass(searchClass,node,tag) {
   var classElements = new Array();
   if (node == null) node = document;
   if (tag == null) tag = '*';
   var els = node.getElementsByTagName(tag);
   var elsLen = els.length;
   var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|jQuery)");
   for (i = 0, j = 0; i < elsLen; i++) {
      if (pattern.test(els[i].className)) {
         classElements[j] = els[i];
         j++;
      }
   }
   
   return classElements;
}

var jQueryjQuery = jQuery.fn;

jQueryjQuery.extend({
  SplitID : function()
  {
    return this.attr('id').split('-').pop();
  },

  Slideshow : {
    Ready : function()
    {
      jQuery('div.sayToSlideshowControl')
        .hover(
          function() {
            jQuery(this).addClass('sayToSlideshowControlOn');
          },
          function() {
            jQuery(this).removeClass('sayToSlideshowControlOn');
          }
        )
        .click(
          function() {
            jQueryjQuery.Slideshow.Interrupted = true;

            jQuery('div.sayToSlide').hide();
            jQuery('div.sayToSlideshowControl').removeClass('sayToSlideshowControlActive');

            jQuery('div#sayToSlide-' + jQuery(this).SplitID()).show()
            jQuery(this).addClass('sayToSlideshowControlActive');
          }
        );

      this.Counter = 1;
      this.Interrupted = false;

      this.Transition();
    },

    Transition : function()
    {
      if (this.Interrupted) {
        return;
      }

      this.Last = this.Counter - 1;

      if (this.Last < 1) {
        this.Last = 5;
      }

      jQuery('div#sayToSlide-' + this.Last).fadeOut(
        'slow',
        function() {
          jQuery('div#sayToSlideshowControl-' + jQueryjQuery.Slideshow.Last).removeClass('sayToSlideshowControlActive');
          jQuery('div#sayToSlideshowControl-' + jQueryjQuery.Slideshow.Counter).addClass('sayToSlideshowControlActive');
          jQuery('div#sayToSlide-' + jQueryjQuery.Slideshow.Counter).fadeIn('slow');

          jQueryjQuery.Slideshow.Counter++;

          if (jQueryjQuery.Slideshow.Counter > 5) {
            jQueryjQuery.Slideshow.Counter = 1;
          }

          setTimeout('jQueryjQuery.Slideshow.Transition();', 5000);
        }
      );
    }
  }
});

jQuery(document).ready(
  function() {
    jQueryjQuery.Slideshow.Ready();
  }
);

jQuery(document).ready(function(){
					jQuery("#show-panel").click(function(){
					jQuery("#popup_view").fadeIn(300);
				})
					jQuery("#close-panel").click(function(){
					jQuery("#popup_view").fadeOut(300);
				})
					jQuery("#show-panel01").click(function(){
					jQuery("#popup_view01").fadeIn(300);
				})
					jQuery("#close-panel01").click(function(){
					jQuery("#popup_view01").fadeOut(300);
				})
					jQuery("#show-panel02").click(function(){
					jQuery("#popup_view02").fadeIn(300);
				})
					jQuery("#close-panel02").click(function(){
					jQuery("#popup_view02").fadeOut(300);
				})
					
					jQuery("#show-panel03").click(function(){
					jQuery("#popup_view03").fadeIn(300);
				})
					jQuery("#close-panel03").click(function(){
					jQuery("#popup_view03").fadeOut(300);
				})
					
					jQuery("#show-panel04").click(function(){
					jQuery("#popup_view04").fadeIn(300);
				})
					jQuery("#close-panel04").click(function(){
					jQuery("#popup_view04").fadeOut(300);
				})
					
					jQuery("#show-panel05").click(function(){
					jQuery("#popup_view05").fadeIn(300);
				})
					jQuery("#close-panel05").click(function(){
					jQuery("#popup_view05").fadeOut(300);
				})
					jQuery("#close-panel-top1").click(function(){
					jQuery("#popup_view").fadeOut(300);
					
				})
					jQuery("#close-panel-top2").click(function(){
					jQuery("#popup_view01").fadeOut(300);
					
				})
					jQuery("#close-panel-top3").click(function(){
					jQuery("#popup_view02").fadeOut(300);
					
				})
					jQuery("#close-panel-top4").click(function(){
					jQuery("#popup_view04").fadeOut(300);
					
				})
					
					jQuery("#close-panel-top5").click(function(){
					jQuery("#popup_view05").fadeOut(300);
					
				})
					jQuery("#close-panel-top6").click(function(){
					jQuery("#popup_view03").fadeOut(300);
					
				})


})

