/*-----------------
   common.js
------------------*/

wold=window.onload;

j$(function(){
    if (document.getElementById && !window.opera) {
        eles=document.getElementsByTagName('body');
        if (!document.all) {
            eles[0].setAttribute('oncontextmenu','return(brc2()); ');
            }
        else eles[0].oncontextmenu=brc2;
        }
    if (wold) wold();
});

function brc2() {
        return(false);
}

// {{{ 

/**
 * オンマウスフェード
 *
 * @param url ロケーション先URL
 * @return void
 */
j$(function(){
    j$("a.fade img,input.fade").fadeTo(0,1.0);
    j$("a.fade img,input.fade").hover(function(){
         j$(this).fadeTo(200,0.8);
     },
     function(){
         j$(this).fadeTo(200,1.0);
     });
});

// }}}
// {{{ chenColor

/**
 * オンマウスチェンジカラー
 *
 * @param id 指定id
 * @return void
 */
function chenColor(id, color) {

    var tag = id;
    var color = '#' + color;
    var target = document.getElementById( tag );
    target.style.background=color;

}

// }}}
// {{{ chenHideSeek

/**
 * Hide & Seek
 *
 * @param id 指定id
 * @return void
 */
function chenHideSeek(id) {

    var tag = id;
    var target = document.getElementById( tag );
    if(target.style.display == 'none'){
        clearTimeout(this.timeout);
        this.timeout = setTimeout(function(){new Effect.BlindDown(tag, {duration:.3, fps:40})},400);
    }else{
        this.timeout = setTimeout(function(){new Effect.BlindUp(tag, {duration:.3, fps:40})},300);
    }
//     var target = document.getElementById( tag );
//     if (target.style.display == 'block') {
//         target.style.display="none";
//     } else {
//         target.style.display="block";
//     }
    return false;

}
// }}}
// {{{ outlink

/**
 * 別タブリンクメソッド
 *
 */

j$(function(){
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "out")
     anchor.target = "_blank";
 }
});
// }}}
// {{{ ch_submit

/**
 * サブミット先変更メソッド
 *
 */
function ch_submit(f_name, location) {
    var location = location;
    var f_name = f_name;
    var target = document.getElementById(f_name);

    target.action = location;
//    target.submit();
    return true;
}

// }}}
// {{{ setupDes/offDes/onDes

/**
 * テキストエリア初期化メソッド
 *
 */
function setupDes() {

    var textarea = document.getElementsByTagName("textarea");
    for (i = 0; i < textarea.length; i++) {
        if (textarea[i].className.search("nodes") < 0) {
            if (textarea[i].value == textarea[i].defaultValue) {textarea[i].className += " ondes"; }
            textarea[i].onfocus = function() {offDes(this); }
            textarea[i].onblur = function() {onDes(this); }
        }
    }
    var input = document.getElementsByTagName("input");
    for (i = 0; i < input.length; i++) {
        if ((input[i].className.search("nodes") < 0) && ((input[i].getAttribute("type") == "text")||(input[i].getAttribute("type") == null))) {
            if (input[i].value == input[i].defaultValue) {input[i].className += " ondes"; }
            input[i].onfocus = function() {offDes(this); }
            input[i].onblur = function() {onDes(this); }
        }
    }
    return;
}
function offDes(from) {
    if (from.className.search("ondes") < 0) {return 0;}
    from.className = from.className.replace(/ondes/, "");
    from.value = "";
    return 1;
}
function onDes(from) {
    if (from.value != "") {return 0;}
    from.className += " ondes";
    from.value = from.defaultValue;
    return 1;
}
// }}}



/*---------------------------------------------------------------------------*/
/* インスタンス化                                                            */
/*---------------------------------------------------------------------------*/
//Ins = new Instance();
/*---------------------------------------------------------------------------*/

