window.onload = function(){
	if(checkUserAgent() == true) {
		setInterval( "slideSwitch()", 1500 );
	}
}

function checkUserAgent(){
	// iPhone、iPodまたは、Androidの場合は振り分けを判断（iPadは除く）
	if ((navigator.userAgent.indexOf('iPhone') > 0 
		&& navigator.userAgent.indexOf('iPad') == -1) 
		|| navigator.userAgent.indexOf('iPod') > 0 
		|| navigator.userAgent.indexOf('Android') > 0) {

		// ポップアップ表示
		jConfirm('&nbsp;&nbsp;スマートフォン向けサイトをご利用になりますか？\r\n<p id="warning">※&nbsp;html5に対応しているため、一部端末ではレイアウトが崩れる場合があります。\r\n&nbsp;&nbsp;AndroidのVer2.1未満の端末をご利用の方は、Webブラウザー「Firefox」のご利用をお勧め致します。</p>',"ご利用案内",
		function(r){
			if(r == true){
				location.href = 'http://www.produce.co.jp/for.smartphone/index.shtml';
				document.cookie = "smfFlg=1";
			}
		});
	}
	return true;
}

/*
* トップ画像再生
*/
function slideSwitch() {
	var $active = $('#slideshow IMG.active');
	var $next = $active.next();
	$active.addClass('last-active');
	$next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 800, function() {
		$active.removeClass('active last-active');
	});
}

