  var _num = 1;
   $(document).ready(function() {


         //setInterval("change_info();", 4000);

           setInterval("change_info();", 10000);

       //$("#nav li a").click(focusfadenav);

      // $("#left a.site").click(focusfadenav);
       



       //for(i = 1; i <= 2; i++)
       //{
           $("a.vid1").click(function() {
              $("#tv_box1").animate({top:"0"}, 1500, "swing", function() {
                $("a.vid1").removeClass("vid1").addClass("vid1" + "down");
              });
              
              return false;
           });
           $("#tv_box1" + " span a").click(function() {
              $("#tv_box1").animate({top:"-1000"}, 1500, "swing");
              
              return false;
           });

        //}


           $("a.vid2").click(function() {
              $("#tv_box2").animate({top:"0"}, 1500, "swing", function() {
                $("a.vid2").removeClass("vid2").addClass("vid2" + "down");
              });
              
              return false;
           });
           $("#tv_box2" + " span a").click(function() {
              $("#tv_box2").animate({top:"-1000"}, 1500, "swing");
              
              return false;
           });
           
           
           
  // GET AND SET BODY HEIGHT FOR OVERLAY DIV
  var bod_h = $("body").height();
  $("#box").height(bod_h);
  ///////////////////////////////
           
        // SET OPACITY FOR OVERLAY DIV
  $("#box").fadeTo(1, 0.7);
  ///////////////////////////////
  
   $("a").hover(function() {
      $(this).css("cursor","pointer");

   });

   // FUNCTION FOR CLICKING ANNOUNCEMENT LINK
  $("#left_content span a").click(function() {
      $("#box").show(1, function() {
         $("#info").slideDown(1000);
      });

  });

  $("#info a").click(function() {

     $("#box").fadeTo(1000, 0.0).hide(1).fadeTo(1, 0.7);
     $("#info").fadeTo(1000, 0.0).hide(1).fadeTo(1, 1.0);
  });



   });
   

   
   
   function focusfadenav() {
      // "this" is the link that was clicked
         $(this).attr("id", "current");               // highlight the link
         $("#nav li a").not(this).attr("id", "");

         $('#left').fadeTo(500, 0.0).hide('normal',loadContent);

         showLoader();
         // ajax code to load content from other page
        var toLoad = $(this).attr('href') + ' #holder';
        //alert("this is " + toLoad);
        //window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
        function loadContent() {
        //alert(toLoad);
			$('#left').load(toLoad,'',showNewContent());
		}
		function showNewContent() {
			$('#left').show('normal').fadeTo(500, 1.0, hideLoader);
		}
		return false;
		// end code to load content

      }

     ///////////////////////////////////////////////////////////////////
    // PERFORM ACTION WHEN CLICKING A LINK
    function change_info() {
         _num = _num + 1;
         if(_num > 3) _num = 1;
         //alert("number is " + _num);
         $("img.head").attr("src", "images/johnnybhead2closed.png");
         //showLoader();
         // ajax code to load content from other page
        //var toLoad = $(this).attr('href')+' #bubble_' + _num;

        $('#talk_bubble').hide("slide", {direction:"right" }, 500, loadContent);



        //window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
        function loadContent() {
            var val1 = $("#bub" + _num).html();
            //alert("val is " + val1);
			$('#bubble_cont').html(val1);  // grab bubble_2 from bubble.htm and put it in #talk_bubble
            showNewContent();
    	}
		function showNewContent() {

			$('#talk_bubble').show("slide", {direction:"right"}, 500, function() {
               $("img.head").attr("src", "images/johnnybhead2.png");

            });    // show #talk_bubble

		}
		// end code to load content

      }

      ///////////////////////////////////////////////////////
      // SHOW ANIMATION WHEN LOADING
      function hideLoader() {
      //alert('poop');
			$('#load').fadeOut('normal');
		}
		function showLoader() {
	//	alert('poop');
	    	$('#load').remove();
            $('#container').prepend('<span id="load">LOADING...</span>');
            $('#load').fadeIn('normal');
       }



