var _ua = (function(){
return {
ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
ie:document.uniqueID,
firefox:window.globalStorage,
opera:window.opera,
webkit:!document.uniqueID && !window.opera && !window.globalStorage && window.localStorage,
mobile:/android|iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase())
}
})();

jQuery(function($) {

	var time = 0, timer = $('#timer');
	setInterval(function() {
		timer.html(++time +' sec');
		
	}, 1000);

	$.bgSwitcher.defaultOptions.interval = 5000;
	$.bgSwitcher.defaultOptions.images = ['./images/slide/bg_body.jpg', 1, 8];

	var methods = ['start', 'stop', 'toggle', 'reset'];
	$('.bg, #bgSwitch-inline').each(function() {
		var self = $(this),
		    nav  = $('<ul>').addClass('nav');
		$(methods).each(function(i, method) {
			var ctrl = $('<a>', {
				href: 'javascript:void(0)',
	
				click: function() {
					
					var bs = self.data('bgSwitcher');
					bs[method]();
				}
			});
			nav.append($('<li>').append(ctrl));
		});
		if (this.tagName === 'SPAN') {
			return self.parents('p').before(nav);
		}
		
		self.before(nav);
	});

	$('#bgSwitch-normal').bgSwitcher({
		fadeSpeed: 0
	});

	$('#bgSwitch-fadeOut').bgSwitcher({
		loop: true,
			
		switchHandler: function() {
			this.node.slideUp(this.options.duration, this.options.easing);
		}
	});
	//デフォルト
	
	$('#bgSwitch-random').bgSwitcher({
		random: true,
		switchHandler: function() {
			this.node.slideUp(this.options.duration, this.options.easing);
		}
	});

	$('#bgSwitch-inline').bgSwitcher();//フェード
	$('#maxWidth .bg').bgSwitcher();
	$('#marginAuto .bg').bgSwitcher();
})
