/* menuYloc */
var scTop = null;

/* SWFobject */
var flashvars = null;
var params = {
  menu: "false",
  flashvars: "userID=65280861&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml"
};
var attributes = {
  id: "areaTwitterFlash",
  name: "areaTwitterFlash"
};
function stayMenu(top) {
	// menu
	offset = Math.max(0, top - 170);
	offset = Math.min($('#areaMain').height() - 400, offset);
	offset += 'px';
	$('#areaSub').animate({top:offset},{duration:300,queue:false});
}
function stayNavi(top) {
	// navi
	offset = (top + $(window).height() - 100);
	offset = Math.min($('#wrap').height() - 150, offset);
	offset += 'px';
	$('#pagetop').animate({top:offset},{duration:300,queue:false});
}
$(document).ready(function(){
	scTop = $(document).scrollTop();
	stayMenu(scTop);
	stayNavi(scTop);
	$(window).scroll(function() {
		scTop = $(document).scrollTop();
		stayMenu(scTop);
		stayNavi(scTop);
	});
	$(window).resize(function() {
		stayNavi(scTop);
	});

	/* Twitter */
	swfobject.embedSWF("http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf", "areaTwitterFlash", "230", "350", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
	
	/* modal */
	var ua = navigator.userAgent;
	if (ua.indexOf('iPhone') == -1 && ua.indexOf('iPod') == -1 && ua.indexOf('Android') == -1) {
		$('.popup').nyroModal();
	}
});

