Event.observe(window, "load", function(){
    var b_path;
    var s_path;

    if(window.location.host == "localhost"){
        b_path = 'http://localhost/myTop/';
        s_path = 'https://localhost/myTop/';
    }
    else{
        b_path = 'http://cybercivil.net/';
        s_path = 'https://sv77.wadax.ne.jp/~cybercivil-net/';
    }
    var tmenus = [['index', b_path + 'index.html'],
                  ['reserve'  , 'http://cybercivil.net/reserve/index.html'],
                  ['kjmate'  , 'http://cybercivil.net/koujimate/index.html'],
                  ['privacy'  , b_path + 'privacy.html'],
                  ['company'  , b_path + 'company.html'],
                  ['contact'  , s_path + 'contact.html']
                 ];
    tMemuLinkSet(tmenus);

    var captions = ['トップページ',
                    '予約申込について',
                    '日次業務について',
                    'システム設定について',
                    'ＡＳＰレンタル導入',
                    'ＦＡＱ'
    ];
    var urls = ['http://cybercivil.net/reserve/index.html',
                'http://cybercivil.net/reserve/expEntry.php',
                'http://cybercivil.net/reserve/expDaily.php',
                'http://cybercivil.net/reserve/expConfig.html',
                'http://cybercivil.net/reserve/intro_asp.html',
                'https://sv77.wadax.ne.jp/~cybercivil-net/reserve/faq.html'
    ];

    new Control.CypopupMenu("reservedesk", captions, urls, 'sMenu');

    captions.clear();
    urls.clear();
    var captions = ['トップページ',
                    '製品情報',
                    'ダウンロード',
                    '説明ムービー',
                    '購入方法'
    ];
    var urls = ['http://cybercivil.net/koujimate/index.html',
                'http://cybercivil.net/koujimate/Products.htm',
                'http://cybercivil.net/koujimate/DownLoadpage.htm',
                'http://cybercivil.net/koujimate/Movie_DLpage.htm',
                'http://cybercivil.net/koujimate/Main_procedure.htm'
    ];
    new Control.CypopupMenu("koujimate", captions, urls, 'sMenu');
    if ($('ret')) {
        Event.observe($("ret"), 'click', function(){
            var err_msg = "";
            var ids = pattarnValidation();
            if (ids.include("setUrl")) {
                err_msg += '<li>生成ＵＲＬを入力してください。</li>' + "\n";
            }
            else {
                if (!lengthValidation("setUrl", 6, 128))
                    err_msg += '<li>ＵＲＬは６文字以上１２８文字以内で指定してください。</li>' + "\n";
            }
            if (!lengthValidation("setMsg", 0, 48))
                err_msg += '<li>付加メッセージは４８バイト以内で指定してください。</li>' + "\n";
            if (err_msg != "") {
                err_msg = '<ul class="list01">' + "\n" + err_msg + '</ul>';
                Modalbox.show(err_msg, {
                    title: "入力エラーがあります"
                });
            }
            else {
                var data = '&url=' + $("setUrl").value + '&msg=' + $("setMsg").value;
                var options = {
                    method: 'post',
                    onSuccess: ChartDisp,
                    parameters: data
                };
                if (window.location.host == "localhost") {
                    new Ajax.Request('../reservedesk/lib/ajax/playQr.php', options);
                }
                else {
                    new Ajax.Request('./reservedesk/lib/ajax/playQr.php', options);

                }
            }
        });
    }
},false);

function ChartDisp(httpObj){
    var Items;
    if(httpObj){
        Items = httpObj.responseJSON;

        $("qrImg").src = Items.uri;
    }
}

