$(function() {
	
	//UACLASS
	var agent = navigator.userAgent;
	if(agent.search(/iPhone/) != -1){
		$("body").addClass("iphone");
	}
	//alert(agent);

	//PS
	pageScroll();
	
	//INDEX
	$("#slider dd").hide();
	$("#slider dt").click(function(){
		var index = $("#slider dt").index(this);
		$("#sslider dd").eq(index).slideToggle("slow");
		var img = $($("#slider dt img").eq(index));
		var src = img.attr('src');
		var src_df;
		var src_on = src.substr(0, src.lastIndexOf('.')) + "_on" + src.substring(src.lastIndexOf('.'));
		if(!src.match(/_on/)){
			img.attr('src', src_on);
		}else{
			src_df = src.replace("_on", "");
			img.attr('src', src_df);
		}
	});

});

function pageScroll(){
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
   			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
   			if ($target.length) {
  				var targetOffset = $target.offset().top;
  				$('html,body')
  				.animate({scrollTop: targetOffset}, 1000);
    			return false;
			}
		}
 	});
}


/*popup*/
function noguchiNotHara(url,wx,wy){
	var st = "";
	
	st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	if(wy == ''){
		wy = screen.height - (screen.height*0.15);
	}
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 30;
	newwin = window.open(url,"newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}



