

jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
};
 
// Usage
$.preloadImages(

);



		

  $(function() { 
        $.fn.extend({
            chBGcolor: function(colorOn,colorOff) { 
           this.each(function() {
									
     		$(this).hover(function(){

         $(this).stop().animate({ backgroundColor: colorOn }, 600 );
          },
          function(){
	
            $(this).stop().animate({ backgroundColor: colorOff }, 600 );	
          }
        )
                });

                return this;
            }
        });
        
	$("#nav li a span").chBGcolor("#053962",'#053962');
	$(".formTrigger a").chBGcolor("#f7f7f7",'#053962');
	$(".formOpen").chBGcolor("#f5f5f5","#ffffff");
    });
		
		
		  $(function() { 
        $.fn.extend({
            chcolor: function(colorOn,colorOff) { 
           this.each(function() {
									
     		$(this).hover(function(){

         $(this).stop().animate({ color: colorOn }, 600 );
          },
          function(){
	
            $(this).stop().animate({ color: colorOff }, 600 );	
          }
        )
                });

                return this;
            }
        });
        
	
	
    });



		  $(function() { 
        $.fn.extend({
         chAlpha : function(dtime,alphaOn) { 
                this.each(function() {
									
						$(this).css('opacity',1)
     		.hover(function(){
	   $(this).stop().fadeTo(dtime,alphaOn);	
          },
          function(){
          $(this).stop().fadeTo(dtime,1);
	 			  }
        )
                });

             return this;
            }
        });
       
				$(".mainTitle a.logo span").css('opacity',0);
				//$("h3 a span").css('opacity',0);
	//			$('h3.top1 a , h3.top2 a , h3.top3 a , h3.top4 a , h3.top5 a , h3.top6 a , h3.top7 a , h3.top8 a').chAlpha(500,0);	
	/*			$('#nav li a').chAlpha(500,0);	*/
				$(".single img, .mainTitle a.logo, .feed").chAlpha(600,0.6);
	//			$(".work").chAlpha(600,0.6);
				/*


        
	*/
	
    });
		
	
var hoverColour = "#002850";

$(function(){
	$("a.hoverBtn").show("fast", function() {
		$(this).wrap("<div class=\"hoverBtn\">");
		$(this).attr("class", "");
	});
	
	//display the hover div
	$("div.hoverBtn").show("fast", function() {
		//append the background div
		$(this).append("<div></div>");
		
		//get link's size
		var wid = $(this).children("a").width();
		var hei = $(this).children("a").height();
		
		//set div's size
		$(this).width(wid);
		$(this).height(hei);
		$(this).children("div").width(wid);
		$(this).children("div").height(hei);
		
		//on link hover
		$(this).children("a").hover(function(){
			//store initial link colour
			if ($(this).attr("rel") == "") {
				$(this).attr("rel", $(this).css("color"));
			}
			//fade in the background
			$(this).parent().children("div")
				.stop()
				.css({"display": "none", "opacity": "1"})
				.fadeIn("fast");
			//fade the colour
			$(this)	.stop()
				.css({"color": $(this).attr("rel")})
				.animate({"color": hoverColour}, 600);
		},function(){
			//fade out the background
			$(this).parent().children("div")
				.stop()
				.fadeOut("slow");
			//fade the colour
			$(this)	.stop()
				.animate({"color": $(this).attr("rel")}, 600);
		});
	});
});


/* $(function(){
	$('#wrapper').css('opacity' ,0).fadeTo(1000,1);
});*/

//インラインCSSで#wrapper{display;block;}を追加
$('head').append('<style type="text/css">#wrapper{display;none;}</style>');
$(function(){
	if(!$('body').hasClass('top')){		  
    $('#content').css('opacity' ,0).fadeTo(600,1);
    $('#nav a, #sidebar a , .formBtn a').click(function(){
        var url = $(this).attr("href");
        $('#content').animate({"opacity":0},700,function(){
            location.href = url;
        });
        return false;
    });
		$('#content').css('opacity' ,0).fadeTo(600,1);
    $('.mainTitle a, #nav .navHome a').click(function(){
        var url = $(this).attr("href");
        $('#mainContent').animate({"opacity":0},700,function(){
            location.href = url;
        });
        return false;
    });
	
		}  else {
	
    $('#mainContent').css('opacity' ,0).fadeTo(600,1);
    //aタグクリック時にフェードアウト実行
    $('a').click(function(){
	
				 var url = $(this).attr("href");
        $('#mainContent').animate({"opacity":0},700,function(){
            location.href = url;
        });
	return false;
    });
		}
	
});
