/**
* Fullscreenr - lightweight full screen background jquery plugin
* By Jan Schneiders
* Version 1.0
* www.nanotux.com
**/

(function($){	
	$.fn.fullscreenr = function(options) {
		if(options.height === undefined) alert('Please supply the background image height, default values will now be used. These may be very inaccurate.');
		if(options.width === undefined) alert('Please supply the background image width, default values will now be used. These may be very inaccurate.');
		if(options.bgID === undefined) alert('Please supply the background image ID, default #bgimg will now be used.');
		var defaults = { width: 1200,  height: 880, bgID: 'bgimg' };
		var options = $.extend({}, defaults, options); 
		$(document).ready(function() { $(options.bgID).fullscreenrResizer(options);	});
		$(window).bind("resize", function() { $(options.bgID).fullscreenrResizer(options); });		
		return this; 		
	};	
	$.fn.fullscreenrResizer = function(options) {
		// Set bg size
		var ratio = options.height / options.width;	
		// Get browser window size
		var browserwidth = $(window).width();
		var browserheight = $(window).height();
		// Scale the image
		if ((browserheight/browserwidth) > ratio){
		    $(this).height(browserheight);
		    $(this).width(browserheight / ratio);
		} else {
		    $(this).width(browserwidth);
		    $(this).height(browserwidth * ratio);
		}
		// Center the image
		$(this).css('left', (browserwidth - $(this).width())/2);
		$(this).css('top', 0);
		return this; 		
	};
})(jQuery);
var FullscreenrOptions = {  
		width: 1200, 
		height: 880,
		bgID: '#bgimg'
	};
jQuery.fn.fullscreenr(FullscreenrOptions);

(function($){	
	$.fn.paddingResizer = function() {
		$(document).ready(function() {$.fn.paddingResize();});
		$(window).bind("resize", function() {$.fn.paddingResize(); });		
		return this; 		
	};	
	$.fn.paddingResize = function() {
		var browserH = $(window).height();
		var blockBox = $(".main").height();
		$("div.mainLarge").css({'height':browserH});
		if (browserH < 600){
			$("#lineUp").css({'height':"500" });
		} else {
			$("#lineUp").css({'height':browserH - "220"});
		};
	};
})(jQuery);
jQuery.fn.paddingResizer();

jQuery(function($){	
		$("#showBtn").find("hgroup").mouseover(function(e){$(this).addClass("txtGold"); return this; });
		$("#showBtn").find("hgroup").mouseout(function(){$(this).removeClass("txtGold"); return this; });
			var browserH = $(window).height();
			var blockBox = $(".main").height();
		$("#showBtn").find("hgroup").click(function(e){
			$("article").toggle("slow",function(){
				$(this).css({padding:"10px 0"})
				});	
		$("div.mainLarge").css({'height':browserH});
		return false;
			return this;
			});	
		$("div.btnClose").click(function(e){
			$("div.topLink").toggle("slow");	
			return false;
			return this;
			});	
			var newmarkCount = 2000;
			setTimeout(function(){$(".topLink").fadeIn(500);}, newmarkCount);

			var taggleCount = 1500;
			setTimeout(function(){
								$("article").toggle("slow",function(){
																	$(this).css({padding:"10px 0"})
																	});
								}, taggleCount);

	jQuery.fn.extend({
	  scrollTo : function(speed, easing) {
		<!-- hashの取得が出来なければ、処理を中断 -->
		if(!$(this)[0].hash || $(this)[0].hash == "#") {
		  return false;
		}
		return this.each(function() {
		  var targetOffset = $($(this)[0].hash).offset().top;
		  $('html,body').animate({scrollTop: targetOffset}, speed, easing);
		});
	  }
	});
	$(document).ready(function(){
	  $('a[href*=#]').click(function() {
		$(this).scrollTo(1000);
		return false;
	  });
	});
});


