$(document).ready(function() {


    $("#text_links a.intro").click(function() {
          $("#comic_pics").fadeTo(500, 0.0);
          $("#text_links span").fadeTo(500, 0.0);

       });

    $("#pic_holder a").click(function() {
       $("#pic_holder a").fadeTo(200, 0.0, function() {
                                               $("#pic_holder a").hide(1);
                                               $("#pic_holder").append("<span style='position:relative;top:100px;font-weight:bold;font-size:24px'>Loading, please wait<BR><img src='images/ajax-loader.gif'></span>");

                                           }); // fade link away
               // get rid of link
       $("#pic_holder img.main").fadeTo(500, 0.0,
                              function() {
                                   $("#pic_holder").animate({height:"233"}, 1000, "swing",
                                             function() {
                                                  $("#objholder").animate({left:"2"}, 1000, "swing", function() { $("#pic_holder span").hide(1); });

                                             });
                              });
    });

    $("#nav li a").click(focusfade);
    function focusfade() {
         //$(this).parent().attr("class", "current");
         $(this).attr("class", "current");
         $("#nav li a").not(this).attr("class", "");
         $("#container").append("<span class='loader' style='position:absolute;top:50px;left:50%;margin-left:-380px;font-weight:bold;color:white;font-size:18px'><img src='images/ajax-loader2.gif' align=bottom></span>");
         var toLoad = $(this).attr('href')+' #holder';
         $('#holder').fadeTo(500, 0.0).hide(1,loadContent);
         //showLoader();
         // ajax code to load content from other page


        //window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
        function loadContent() {
        //alert("here!");
            //alert("got here. toload = " + toLoad);
			$('#holder').load(toLoad,'',showNewContent);  // gets content ready to be shown



		}
		function showNewContent() {
             $('#holder').show(1).fadeTo(500, 1.0, function() {  $("#container span.loader").hide(1); });
		}
		return false;
		// end code to load content
    }







});
