var $$ = $.fn;

$$.extend({
  SplitID : function()
  {
    return this.attr('id').split('-').pop();
  },

  Slideshow : {
    Ready : function()
    {
      $('div.tmpSlideshowControl')
        .hover(
          function() {
            $(this).addClass('tmpSlideshowControlOn');
          },
          function() {
            $(this).removeClass('tmpSlideshowControlOn');
          }
        )
        .click(
          function() {
            $$.Slideshow.Interrupted = true;

            $('div.tmpSlide').hide();
            $('div.tmpSlideshowControl').removeClass('tmpSlideshowControlActive');

            $('div#tmpSlide-' + $(this).SplitID()).show()
            $(this).addClass('tmpSlideshowControlActive');
          }
        );

      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 = 3;
      }

      $('div#tmpSlide-' + this.Last).fadeOut(
        'slow',
        function() {
          $('div#tmpSlideshowControl-' + $$.Slideshow.Last).removeClass('tmpSlideshowControlActive');
          $('div#tmpSlideshowControl-' + $$.Slideshow.Counter).addClass('tmpSlideshowControlActive');
          $('div#tmpSlide-' + $$.Slideshow.Counter).fadeIn('slow');

          $$.Slideshow.Counter++;

          if ($$.Slideshow.Counter > 3) {
            $$.Slideshow.Counter = 1;
          }

          setTimeout('$$.Slideshow.Transition();', 5000);
        }
      );
    }
  }
});

$(document).ready(
  function() {
    $$.Slideshow.Ready();
  }
);


var tite = new Array();
var nid = '';
window.onload =   function () {
	  var tble = document.getElementById('showherelink');
	  if (tble!=null) {
			var ahref = tble.getElementsByTagName("a");
			for (i =0; i <  ahref.length; i++) {
				tite[i] = ahref[i].title;
				nid = 'id'+i;
				ahref[i].id = nid;

				document.getElementById(nid).href = 'javascript:void(0);';

				document.getElementById(nid).onmouseout = function () { showTit(this.id); };
				document.getElementById(nid).onmouseup = function () { showTit(this.id); };	 //this.title = tite[i];
				document.getElementById(nid).onmouseover = function () { this.title = ''; };
			}
	  }

};

	function showTit(myid) {
		var regex = new RegExp("[0-9]+");
		var match = regex.exec(document.getElementById(myid).id);
		if (match != null) {
			var s = "";
			for (i = 0; i < match.length; i++) {
				s = s + match[i];
			}
			document.getElementById(myid).title = tite[s];
		}
	}