// JavaScript Document
function scrollEffect(targetID,elem){
	elem.removeAttribute('href');
		new Effect.ScrollTo(targetID, {
		from:0.0,
		to:1.0,
		// delay:0, // 開始までの秒数
		fps:60, // フレームレート
		duration: 0.8, // アニメーションする時間(秒)
		beforeStartInternal: function(effect) {
		},
		afterFinishInternal: function(effect) {
			clear();
		}
	});
	
	var clear = function (){
	elem.setAttribute('href', "#" + targetID);
	}

}

//===========================================================================
//Comments
//===========================================================================
function comments_url_check(elem){
	if(elem.value.match(/hola/)){
			alert('hola!!!!!!\nho←尻尾を立てた猫');
	}else{
		return false;
	}
}

//==================================================================================================
/*ナビの表示機能*/
function Door_Navigation(id,mode,swt){
var obj = $(id);
var boxH = obj.getStyle('height').toInt();
var height = boxH;
//var header = $('Head_discription');
var container = $('PageContentWrapper');


var Navi = $('NaviSwitch');
var duration = 0.2;
obj.style.display = "block";


//スイッチの切り替え　containerとスイッチ自身　表示バグ対策
if(mode == "close"){
	var from = 0;var to = height*-1;
	container.onmouseover = function(){};
	swt.onmouseover = function(){Door_Navigation(id,'open',swt);};
}
else if(mode == "open"){
		var from = height*-1;var to = 0;
		swt.onmouseover = function(){Door_Navigation(id,'close',swt);};
		container.onmouseover = function(){Door_Navigation(id,'close',swt);};
}

else if(mode == 'none'){return false;}
else if(mode == 'load'){
obj.style.top = boxH*-1 + "px";
}


var element  = new Tween(obj.style,'top',Tween.regularEaseInOut,from,to,duration,'px');
var naviga  = new Tween(Navi.style,'top',Tween.regularEaseInOut,(to*-1),(from*-1),duration,'px');
var container_s  = new Tween(container.style,'top',Tween.regularEaseInOut,(to*-1),(from*-1),duration,'px');
//var head  = new Tween(header.style,'top',Tween.regularEaseInOut,(to*-1),(from*-1),duration,'px');


element.start();
naviga.start();
//head.start();
container_s.start();

}
//==================================================================================================
/*ロールオーバー モノクロ切り替え仕様*/
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("/mono"))
			{
				images[i].onmouseout = function() {this.setAttribute("src", this.getAttribute("src").replace("images/", "images/mono/"));}
				images[i].onmouseover = function() {this.setAttribute("src", this.getAttribute("src").replace("/mono", ""));}
			}
			else if(images[i].getAttribute("src").match("/amazon_mono"))
			{
				images[i].onmouseout = function() {this.setAttribute("src", this.getAttribute("src").replace("images/amazon/", "images/amazon_mono/"));}
				images[i].onmouseover = function() {this.setAttribute("src", this.getAttribute("src").replace("images/amazon_mono/", "images/amazon/"));}
			}
		}
	}
}
if(window.addEventListener) {window.addEventListener("load", smartRollover, false);}
else if(window.attachEvent) {window.attachEvent("onload", smartRollover);}


