// JavaScript Document

$(document).ready(function ()

{ 

$.fn.ChangeSlide = function(slideID) {var slide = slideID;

var play;
var play_Partner;

  var active_slide = 1;

  var num_slides = $("."+slide).size();

  $("#"+slide + active_slide).fadeIn(300);

  rotateSwitch = function (){

    play = setInterval(function ()

    { next_slide(); //Set timer - this will repeat itself every 7 seconds//Trigger the paging and slider function

    }, 5000); //Timer speed in milliseconds (7 seconds)

  }; rotateSwitch();

  function next_slide(){ 

    $("#"+slide + active_slide).fadeOut(200, function ()

    {

      if (active_slide < num_slides){

        active_slide++;

        $("#"+slide + active_slide).fadeIn(200);

      } else {

        active_slide = 1;

        $("#"+slide + active_slide).fadeIn(200);

      }

    });

  }

  function prev_slide() {

    $("#"+slide + active_slide).fadeOut(200, function (){

      if (active_slide > 1){

        active_slide--;

        $("#"+slide + active_slide).fadeIn(200);

      }else{

        active_slide = num_slides;

        $("#"+slide + active_slide).fadeIn(200);

      }

    });

  }

  /*

  $("#"+slide+"Up, #"+slide+"Down").mouseover(function () {$(this).css('cursor', 'pointer'); });

  $("#"+slide+"Up").click(function (){ next_slide();});

  $("#"+slide+"Down").click(function (){prev_slide(); });

  */

  $("#sliderUp, #sliderDown").mouseover(function (){$(this).css('cursor', 'pointer');});

  $("#sliderUp").click(function (){next_slide(); });

  $("#sliderDown").click(function (){prev_slide();});

};

$().ChangeSlide("slide");

$().ChangeSlide("slide_mtg");

$().ChangeSlide("slide_ins");

$().ChangeSlide("slide_mny");

  //--------------------------------------



  /* Rotating partner links at bottom */



   var active_partner_slide = 1;

   var num_partner_slides = $(".partnerLinks").size();

   
  $("#partnerLinks" + active_partner_slide).fadeIn(300);
  
	rotatePartnerSwitch = function ()

  {

    play_Partner = setInterval(function ()

    { //Set timer - this will repeat itself every 7 seconds

      next_PartnerSlide(); //Trigger the paging and slider function

    }, 3000); //Timer speed in milliseconds (7 seconds)

  };

  //rotatePartnerSwitch();

  

  

   function next_PartnerSlide()

  {
  
    $("#partnerLinks" + active_partner_slide).fadeOut(700, function ()

    {

      if (active_partner_slide < num_partner_slides)

      {

        active_partner_slide++;

        $("#partnerLinks" + active_partner_slide).fadeIn(700);

      }

      else

      {

        active_partner_slide = 1;

         $("#partnerLinks" + active_partner_slide).fadeIn(700);

      }

    });

  }

  

  

  

   /* Rotating press links at bottom */

   

   var active_press_slide = 1;
   var num_press_slides = $(".pressLinks").size();
   
   $("#pressLinks" + active_press_slide).fadeIn(700);
    
	rotatePressSwitch = function ()
  {
    play = setInterval(function ()
    { //Set timer - this will repeat itself every 7 seconds
      next_PressSlide(); //Trigger the paging and slider function
    }, 3000); //Timer speed in milliseconds (7 seconds)
  };
  //rotatePressSwitch();

   function next_PressSlide(){
    $("#pressLinks" + active_press_slide).fadeOut(700, function ()
    {
      if (active_press_slide < num_press_slides)
      {
        active_press_slide++;
        $("#pressLinks" + active_press_slide).fadeIn(700);
      }
      else
      {
        active_press_slide = 1;
         $("#pressLinks" + active_press_slide).fadeIn(700);
      }
    });
  }

});



/*

var active_slide = 1;

var num_slides = $(".slide").size();

$("#slide" + active_slide).fadeIn(300);





rotateSwitch = function ()

{

  play = setInterval(function ()

  { //Set timer - this will repeat itself every 7 seconds

    next_slide(); //Trigger the paging and slider function

  }, 5000); //Timer speed in milliseconds (7 seconds)

};

rotateSwitch();

function next_slide()

{

  $("#slide" + active_slide).fadeOut(300, function ()

  {

    if (active_slide < num_slides)

    {

      active_slide++;

      $("#slide" + active_slide).fadeIn(300);

    }

    else

    {

      active_slide = 1;

      $("#slide" + active_slide).fadeIn(300);

    }

  });

}

function prev_slide()

{

  $("#slide" + active_slide).fadeOut(300, function ()

  {

    if (active_slide > 1)

    {

      active_slide--;

      $("#slide" + active_slide).fadeIn(300);

    }

    else

    {

      active_slide = num_slides;

      $("#slide" + active_slide).fadeIn(300);

    }

  });

}

$("#sliderUp, #sliderDown").mouseover(function ()

{

  $(this).css('cursor', 'pointer');

});

$("#sliderUp").click(function ()

{

  next_slide();

});

$("#sliderDown").click(function ()

{

  prev_slide();

});

*/
