/****************************************************************
	HTML5 タグ対策
****************************************************************/
document.createElement("header");
document.createElement("footer");
document.createElement("section");
document.createElement("nav");
document.createElement("hgroup");
document.createElement("article");
document.createElement("aside");
document.createElement("dialog");
document.createElement("figure");
document.createElement("figcaption");
document.createElement("time");
document.createElement("mark");
document.createElement("details");
document.createElement("summary");


/****************************************************************
	自動スクロールメニュー
****************************************************************/
$(function() {
	var offset = $("#auto_menu").offset();
	var topPadding = 0;

	$(window).scroll(function() {
		if( $(window).scrollTop() > offset.top ) {
			$("#auto_menu").stop().animate({ marginTop: $(window).scrollTop() - offset.top + topPadding });
		} else {
			$("#auto_menu").stop().animate({ marginTop: 0 });
		};
	});
});


/****************************************************************
	エリアボタンのアクション
****************************************************************/
$(function() {
	$('#area_navi li img')
	.hover(
		function(){
			$(this).stop().animate({'marginTop':'-29px'},'fast');
		},
		function () {
			$(this).stop().animate({'marginTop':'0px'},'fast');
		}
	);
});


/****************************************************************
	オブジェクトの表示/非表示
****************************************************************/
function checkExpand(ch) {
	var obj=document.all && document.all(ch) || document.getElementById && document.getElementById(ch);
	if(obj && obj.style) obj.style.display = "none" == obj.style.display ?"" : "none"
}


/****************************************************************
	画像の自動横スライド
****************************************************************/
window.onload = function(){
	var interval = 50;
	var step     = 1;
	var e, w, c, i, t = document.getElementById('screen');
	e = t.getElementsByTagName('IMG');
	if (!e.length) return;
	w = t.currentStyle?t.currentStyle['width']:document.defaultView.getComputedStyle(t, null).getPropertyValue('width');
	t = e[0].parentNode;
	c = t.childNodes;
	for (i=c.length-1; i>-1; i--) if (c[i].nodeName != 'IMG') t.removeChild(c[i]);
	t.appendChild(e[0].cloneNode(true));
	w = parseInt(w);
	t.style.width = ( w * e.length ) + 'px';
	c = ( w * ( e.length - 1 ) ), w = 0, e = null;
	setInterval(function(){
		w = ( w - step ) % c;
		t.style.left = w + 'px';
	}, interval);
}


