
if (!SUSTO) var SUSTO={};

	//alert(jQuery.support.opacity); では足りない
	// rgba の対応ブラウザは
	// Firefox 3以上，Safari 3以上，Opera 10以上，IE8以上，Chrome
	var agent = navigator.userAgent;
	var apname = navigator.appName;
	var appversion = navigator.appVersion;

	var Mac = agent.indexOf('Mac',0) != -1;
	var Win = agent.indexOf('Win',0) != -1;
	//var IE = agent.indexOf("MSIE",0) != -1;
	var IE = apname.indexOf("Microsoft",0) != -1;
	var Firefox = agent.indexOf('Firefox',0) != -1;
	var Gecko = agent.indexOf('Gecko',0) != -1;
	var Safari = agent.indexOf('AppleWebKit',0) != -1;
	//var Opera = agent.indexOf('Opera',0) != -1;
	var Opera = window.opera;
	var iCab = agent.indexOf('iCab',0) != -1;
	var Chrome = agent.indexOf('Chrome',0) != -1;
	var MacIE = (Mac && IE);

	function reg_match(pattern,text) {
		return pattern.test(text);
	}

	var version = parseFloat(navigator.appVersion.charAt(0));

	if (IE) {
		version = parseFloat(agent.match(/MSIE\s(\d+\.\d+)/)[1]);
	}
	if (Gecko && !Safari) {
		version = parseFloat(agent.match(/rv:(\d+\.\d+)/)[1]);
	}
	if (Firefox) {
		version = parseFloat(agent.match(/Firefox\/(\d+\.\d+\.\d+)/)[1]);
	}
	if (Safari) {
		version = parseFloat(agent.match(/Version\/(\d+\.\d+)/)[1]);
	}
	if (Opera) {
		version = parseFloat(navigator.appVersion.match(/^(\d+\.\d+)\s\(/)[0]);
	}

	var winie = false;
	var old = true;
	var standard = false;
	var usergba = false;

	if (Win && IE) {
		winie = true;
		old = (document.compatMode == "BackCompat")?true:false;
		standard = ((version > 7) && (document.compatMode == "CSS1Compat"))?true:false;
		if (version >= 8) {
			//usergba = true;
			//alert('8!');
		}
	}
	//alert(old);
	// 標準準拠（モード）
	if (Safari || Firefox || (Opera && version >= 7) || Chrome) {
		old = false;
		standard = true;
	}
	// rgba 対応（CSS3 対応とはたぶん違う）
	if ((Safari && version >= 3) || (Firefox && version >= 3) || (Opera && version >= 10) || Chrome) {
		usergba = true;
	}

(function($) {
	$.fn.customFadeTo = function(speed, to, callback) {
		$(this).fadeTo(speed, to, function() {
			if ($.browser.msie) {
				$(this).get(0).style.removeAttribute('filter');
			}
			if (callback != undefined) callback();
		});
	};

	$.fn.ScrollTo = function(speed, callback) {
		var top = jQuery(this).offset().top;
		if ('BODY' == jQuery(this).attr('tagName')) {// for IE6
			top = 0;
		}
		//$('html, body').animate({scrollTop: top}, speed, "easeOutExpo", callback);
		$('html, body').animate({scrollTop: top}, speed, "swing", callback);
	};
/*
Copyright (c) 2007, KITAMURA Akatsuki

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

	$.fn.flatHeights = function() {
		/* 対象となる要素群の集合 */
		var sets = [];

		/* 高さ揃えの処理本体 */
		var flatHeights = function(set) {
			var maxHeight = 0;
			set.each(function(){
				var height = this.offsetHeight;
				if (height > maxHeight) maxHeight = height;
				//alert($(this).css('paddingBottom'));
				if (parseInt($(this).css('paddingBottom'))) {
					height += parseInt($(this).css('paddingBottom'));
				}
			});
			set.css('height', (maxHeight+0) + 'px');
		};

		/* 要素群の高さを揃え、setsに追加 */
		//jQuery.fn.flatHeights = function() {
		if (this.length > 1) {
			flatHeights(this);
			sets.push(this);
		}
		return this;
		//};
	}

	$.fn.sustoslideshow = function(covers) {
		var pbox = $(this);
		var imgpos = new Array();
		imgpos[0] = '0';
		imgpos[1] = '-130px';
		imgpos[2] = '-260px';
		//imgpos[3] = '-390px';
		var imgposcount = 0;
		var setimg = null;
		$('<div class="container"></div>').appendTo(pbox).css({
			'margin': '0',
			'padding': '0',
			'background': 'transparent'
		});
		var efxbox = pbox.children('.container');

		function scr() {
			pbox.css({
				'width': '100%',
				'height': '130px',
				'padding': '0'
			});
			efxbox.css({
				'position': 'relative',
				'left': '0',
				'opacity': '0',
				'width': '660px',
				'height': '130px',
				'padding': '0',
				'zIndex':'1',
				'backgroundImage':'url('+covers+')',
				'backgroundPosition': '0 0'
			}).animate({
				'opacity': '1.0'
			},3000,'easeInQuart',function(){
				imgposcount++;
				bgposchange(pbox,imgposcount);
			});
		}
		function bgposchange(obj,pos) {
			clearTimeout(setimg);
			var mpos = imgpos[pos];
			obj.css({
				'backgroundImage':'url('+covers+')',
				'backgroundPosition': '0 '+mpos
			});
			var crosstime = 1000*6;
			setimg = setTimeout(function() { islide('fade'); },crosstime);
		}
		// efx = 'fade', 'slide', 'slidedown'
		function islide(efx) {
			switch (efx) {
				case 'slide':
					efxbox.animate({
						'opacity': '0.5',
						//'width': '1%',
						'left': '100%'
					},800,'easeInQuart',function(){
						bgposchange(efxbox,imgposcount);
						efxbox.css({
							'opacity': '1.0',
							'width': '100%',
							'left': '0'
						});
						if (imgposcount < imgpos.length-1) {
							imgposcount++;
						} else {
							imgposcount = 0;
						}
						bgposchange(pbox,imgposcount);
					});
					break;
				case 'fade':
					efxbox.animate({
						'opacity': '0'
					},800,'easeInQuart',function(){
						bgposchange(efxbox,imgposcount);
						efxbox.css({
							'opacity': '1.0'
						});
						if (imgposcount < imgpos.length-1) {
							imgposcount++;
						} else {
							imgposcount = 0;
						}
						bgposchange(pbox,imgposcount);
					});
					break;
				case 'slidedown':
					efxbox.animate({
						'opacity': '0',
						//'height': '0',
						//'width': '1%',
						//'left': '100%',
						'top': '100%'
					},800,'easeInQuart',function(){
						bgposchange(efxbox,imgposcount);
						efxbox.css({
						'opacity': '1.0',
						'height': '100%',
						'width': '100%',
						'left': '0',
						'top': '0'
						});
						if (imgposcount < imgpos.length-1) {
							imgposcount++;
						} else {
							imgposcount = 0;
						}
						bgposchange(pbox,imgposcount);
					});
					break;
			}
			var crosstime = 1000*5;
			setimg = setTimeout(function() { islide(); },crosstime);
		}

		
		return scr();

	};

})(jQuery);

jQuery(function($){

	/* ***************************
	
	
	restore layout styles hacks
	
	
	 *************************** */

	var rpass = 'http://www.sjw.k-ai.jp/';
	var pass = 'http://www.sjw.k-ai.jp/common/sjw2/';

	$('h1 a').text('');
	$('#contents').css({
		overflow: 'hidden'
	});
	if (old) {
		$('body').css({
			fontFamily: 'Meiryo, "Trebuchet MS", "MS PGothic", Sans-Serif',
			fontSize: '100.01%'
		});
		$('h1').css({
			width: '240px',
			height: '140px'
			//'filter':'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=1, sizingMethod=image, src='+pass+'images/h1.png)'
		});
		$('h3').css({
			height: '1%'
		});
		$('#sidebar').css({
			position: 'relative',
			display: 'inline'
		});
		$('.mimg').css({
			position: 'relative',
			display: 'inline'
		});
	} else {
		if (IE && version == 7) {
			$('h3').css({
				zoom: '1'
			});
			$('.mimg').css({
				position: 'relative',
				display: 'inline'
			});
		}
			// haslayout to true
		if (IE && version < 7) {
			$('ul.bullets li').css({
				//height: '1%'
				zoom: '1'
			});
		}
		$('h1').css({
			margin: '0 auto',
			width: '240px',
			height: '140px',
			background: 'url('+pass+'images/h1.png) no-repeat 50% 0',
			opacity: '0'
		}).customFadeTo(1000,'1.0');
		//.animate({
		//	opacity: '1.0'
		//},1000);
		$('.ctop').css({
			backgroundColor: 'transparent',
			backgroundImage: 'url('+pass+'images/bg_ctop.png)',
			backgroundPosition: '50% 0',
			backgroundRepeat: 'no-repeat'
		});
		$('#contents').css({
			background: 'transparent url('+pass+'images/bg_contents.png) repeat-y 50% 0'
		});
		$('.cbottom').css({
			backgroundColor: 'transparent',
			backgroundImage: 'url('+pass+'images/bg_cbottom.png)',
			backgroundPosition: '50% 0',
			backgroundRepeat: 'no-repeat'
		});
		$('dl.menu1 dd').css({
			background: 'transparent url('+pass+'images/bg_dlmenudot.png) no-repeat 0 50%'
		});
		$('dl.menu1 dd.desc').css({
			background: 'transparent none'
		});
	}
	$('h1 a').css({
		display: 'block',
		position: 'relative',
		top: '0',
		width: '240px',
		height: '140px'
	});
	$('ul.m').css({
		margin: '0',
		padding: '0',
		listStyle: 'none'
		//opacity: '0'
	});
	$('ul.m li').css({
		height: '60px',
		background: 'transparent none'
	});
	$('ul.m li a').text('').css({
		display: 'block',
		height: '60px',
		background: 'transparent none'
	});
	$('ul.m li.mspecial').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 0'
	});
	$('ul.m li.mscotch').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -60px'
	});
	$('ul.m li.mwhisky').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -120px'
	});
	$('ul.m li.mwine').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -180px'
	});
	$('ul.m li.mcoctail').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -240px'
	});
	$('ul.m li.mnonalc').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -300px'
	});
	$('ul.m li.mfoodsp').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -360px'
	});
	$('ul.m li.mfoods').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -420px'
	});
	$('ul.m li.msalad').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -480px'
	});
	$('ul.m li.mside').css({
		background: 'transparent url('+pass+'images/h3_menus.gif) no-repeat 0 -540px'
	});
	$("ul.m>li").hover(
		function () { $(this).css({opacity: '0.6'}); },
		function () { $(this).css({opacity: '1.0'}); });
	if(document.URL == 'http://www.sjw.k-ai.jp/') {
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/IMG_0061.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/IMG_0656.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/interior01.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/IMG_0434.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/IMG_0499.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/IMG_0653.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/interior02.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/IMG_0637.jpg" width="400" height="300" alt="" />');
	$('#slides').prepend('<img src="'+rpass+'common/media/cover/exterior01.jpg" width="400" height="300" alt="" />');
	$('#slides').cycle({
		//fx:     'turnDown',
		fx:     'fade',
		//easing: 'easeOutBounce',
		delay:  -1000,
		pause:  1,
		timeout: 5000
	});
	}
	if (old) {
		$('#slides').css({
		width: '468px',
		height: '320px',
		margin: '0 0 10px',
		padding: '10px 32px',
		textAlign: 'center'
		});
		$('#slides img').css({
		width: '400px',
		height: '300px',
		margin: '10px 32px',
		padding: '0'
		});
	} else {
		$('#slides').css({
		height: '300px',
		margin: '0 0 10px',
		padding: '10px 32px',
		textAlign: 'center'
		});
		$('#slides img').css({
		width: '400px',
		height: '300px',
		margin: '10px 32px',
		padding: '0'
		});
	}
	//}

});

