// JavaScript Document

/* onload 競合阻止
------------------------------------------------------------ */
function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}


/* 背景色変更等
------------------------------------------------------------ */

function changeColor(c,t,d,f){
    $(t).style.background = c;
    $(d).style.display = f;
}

function colorChanges(){
        $('color-block').style.background = $('select-color').options[$('select-color').selectedIndex].value;
    }


/* ページスクロール用
------------------------------------------------------------ */

Event.observe(window, 'load', function() {
  $$('a[href^=#]:not([href=#])').each(function(element) {
    element.observe('click', function(event) {
      new Effect.ScrollTo(this.hash.substr(1));
      Event.stop(event);
    }.bindAsEventListener(element))
  })
})




/* 別ウィンドゥでブラウザを開く
------------------------------------------------------------ */

function set_newwin() {
var node_a = document.getElementsByTagName('a');
for (var i in node_a) {
if (node_a[i].className == 'newwin') {
node_a[i].onclick = function() {
window.open(this.href, '', '');
return false;
};
}
}
};
addEvent(window,"load",set_newwin);


/* 別ウィンドゥでブラウザを開く
------------------------------------------------------------ */

function set_newwin_cyber() {
var node_a = document.getElementsByTagName('a');
for (var i in node_a) {
if (node_a[i].className == 'newwin_cyber') {
node_a[i].onclick = function() {
window.open(this.href, '_blank', 'width=460, height=620, menubar=no, toolbar=no, scrollbars=yes');
return false;
};
}
}
};
addEvent(window,"load",set_newwin_cyber);


/* お問い合わせフォームの送信 
------------------------------------------------------------ */

function sendform(md){
    if(document.getElementById){
        fm = document.getElementById('docform');
    }else{
        fm = document.all('docform');
    }
	mo = document.createElement("input");
	mo.type = "hidden";
	mo.name="mode";
	mo.value=md;
	fm.appendChild(mo);
	fm.submit();
}
