// 日本語 UTF-8N LF//-------------------------------------------------------------// JavaScript// サイト固有のイベント処理//-------------------------------------------------------------// Landwarf / Takayuki Onodera//-------------------------------------------------------------//var page = "";var newSession = 0;var screenW = 0;var screenH = 0;var cssPrint = "";var adID = "";var adTime = 0;var maskID = "";var timer = null;var effect = new Array();var maxTelopCount = 30; // 最大投稿文字数var searchChannelFormView = false;////-------------------------------------------------------------// ドキュメント読み込み完了//-------------------------------------------------------------$(document).ready(    function() {        // エラー処理        $.ajaxSetup({            timeout: 10000,     // 10秒でタイムアウト            error: errorProc    // 通信エラー時の処理        });        // 環境設定        screenW = window.screen.width;        screenH = window.screen.height;        // OKボタンにフォーカスする        $("input[name=ok]").focus();        // word-break を適用する        $('.wordBreak').breakWords();        // マウスオーバーボタン A        $('.btnMaskA').mouseover(            function() {                $(this).children("a").children("img").css("visibility", "visible");            }        );        $('.btnMaskA').mouseout(            function() {                $(this).children("a").children("img").css("visibility", "hidden");            }        );        // マウスオーバーボタン B        $('.btnMaskB').mouseover(            function() {                $(this).prevAll(".btnStr2").css("visibility", "hidden");            }        );        $('.btnMaskB').mouseout(            function() {                $(this).prevAll(".btnStr2").css("visibility", "visible");            }        );        // マウスオーバーボタン C        $('.btnC0').mouseover(            function() {                $(this).css("visibility", "hidden");            }        );        $('.btnC1').mouseout(            function() {                $(this).siblings(".btnC0").css("visibility", "visible");            }        );        // 広告エリアにマウスが重なったことを記録する A        $(".adArea").mouseover(            function() {                adID = $(this).closest(".ad").attr("id");            //  $("#adID").text("adID = " + adID);          //@TEST            }        );        $(".adArea").mouseout(            function() {                adID = "";            //  $("#adID").text("adID = " + adID);          //@TEST            }        );        $(".adPict").focus(     // フォーカスを得たとき            function() {                adID = $(this).closest(".ad").attr("id");            //  $("#adID").text("adID = " + adID);          //@TEST            }        );        $(".adPict").blur(      // フォーカスが外れたとき            function() {                adID = "";            //  maskID = "";                                //@TEST            //  $("#adID").text("adID = " + adID);          //@TEST            }        );        // 広告エリアにマウスが重なったことを記録する B（インラインフレーム用）        $(".sensor").mouseover(            function() {                $(".sensor").css("visibility", "visible");                $(this).css("visibility", "hidden");                adTime = (new Date).getTime();                maskID = $(this).attr("id");                //@TEST            //  $("#maskID").text("maskID = " + maskID);    //@TEST            //  $("#adTime").text("adTime = " + adTime);    //@TEST            //  $("#pgName").text("page   = " + page);      //@TEST            //  alert("sensor=" + maskID);                  //@DEBUG            }        );        $("body").mousemove(            function() {                if (adTime + 10 < (new Date).getTime()) {                    $(".sensor").css("visibility", "visible");                }            //  maskID = "";                                //@TEST            //  $("#maskID").text("B");                     //@TEST            //  $("#adTime").text("adTime = " + adTime);    //@TEST            //  $("#testA").text(page);                     //@TEST            }        );        // アンケート調査用        $(".selectBOX").mouseover(            function() {                $(this).css("cursor", "hand");            }        );        $(".ken").mousedown(            function() {                $(".ken").removeClass("selected");                $(".ken").addClass("selectable");                $(this).removeClass("selectable");                $(this).addClass("selected");                $("#ken").val($(this).text());            }        );        $(".nen").mousedown(            function() {                $(".nen").removeClass("selected");                $(".nen").addClass("selectable");                $(this).removeClass("selectable");                $(this).addClass("selected");                $("#nen").val($(this).text());            }        );        $(".sei").mousedown(            function() {                $(".sei").removeClass("selected");                $(".sei").addClass("selectable");                $(this).removeClass("selectable");                $(this).addClass("selected");                $("#sei").val($(this).text());            }        );        // 投稿フォーム用        $("#postTelop").keyup(            function() {                var count = $("#postTelopText").val().length;                $("#postTelopCount").text(maxTelopCount - count);            }        );        // GOOD ボタン用        $(".good").submit(            function() {                var dbID = $(this).children("input[name='dbID']").val();                $.post("/command/clickGood.php", { id:dbID }, postGood);                return false;   // ブラウザのsubmit処理をキャンセル            }        );        // GOOD 投票完了ダイアログ        $("#dialogGood").dialog(            {                width: 160,                height: 140,                draggable: false,                resizable: false,                autoOpen: false,  // hide dialog                modal: true,                buttons: {                    "OK": function() {                        $(this).dialog('close');                        urlBack();                    }                }            }        );        // メッセージ削除ボタン用        var telopID = 0;        $(".delete").submit(            function() {                telopID = $(this).children("input[name='dbID']").val();                $('#dialogDelete').dialog('open');                return false;   // ブラウザのsubmit処理をキャンセル            }        );        // メッセージ削除ダイアログ        $("#dialogDelete").dialog(            {                width: 260,                height: 140,                draggable: false,                resizable: false,                autoOpen: false,  // hide dialog                modal: true,                buttons: {                    "はい": function() {                        $.post("/command/deleteTelop.php", { id:telopID }, urlBack);                        $(this).dialog('close');                    },                    "いいえ": function() {                        $(this).dialog('close');                    }                }            }        );        // タブ選択パネル        $('#tabPanel').tabs();        $('#tabPanel').css("display", "block");        $(".chE").mouseover(            function() {                $(this).css("cursor", "hand");            }        );        $(".chE").mousedown(            function() {                $(".chE").removeClass("selected");                $(".chE").addClass("selectable");                $(this).removeClass("selectable");                $(this).addClass("selected");                var num = $(this).text();                $("#channel").val(num);                $(".numCH").text(num);            }        );        // チャンネル登録ボタン用        var confirmRegistCH = false;        $("#registCH").submit(            function() {                if (confirmRegistCH == true) {                    // 確認済み                } else {                    // 確認ダイアログ                    $('#dialogRegistCH').dialog('open');                    return false;   // ブラウザのsubmit処理をキャンセル                }            }        );        // チャンネル登録確認ダイアログ        $("#dialogRegistCH").dialog(            {                width: 260,                height: 140,                draggable: false,                resizable: false,                autoOpen: false,  // hide dialog                modal: true,                buttons: {                    "はい": function() {                        $(this).dialog('close');                        confirmRegistCH = true;                        $("#registCH").submit();                    },                    "いいえ": function() {                        $(this).dialog('close');                    }                }            }        );        // アイコトバ設定        $('.radioAK').click(            function() {                if ($(this).attr("value") == "YES") {                    $("#inputAK1").css("visibility","visible");                    $("#inputAK2").css("visibility","hidden");                } else {                    var str = $("#inputAK1").attr("value");                    $("#inputAK2").attr("value", str);                    $("#inputAK1").css("visibility","hidden");                    $("#inputAK2").css("visibility","visible");                }            }        );        // アニメーション処理//      effect.XV = $("#boxCV").height();               // 終了時：全体の本来の高さ//      effect.AS = $("#boxCA").height();               // 開始時：全体の高さ//      effect.MS = $("#boxCM").height();               // 開始時：表示部の高さ//      effect.BS = $("#boxCT").height() + effect.MS;   // 開始時：最下部のTOPオフセット//      effect.Size = effect.XV - effect.MS - 16;       // 拡大するドット数//      effect.AE = effect.XV;                          // 終了時：全体の高さ//      effect.ME = effect.MS + effect.Size;            // 終了時：表示部の高さ//      effect.BE = effect.BS + effect.Size;            // 終了時：最下部のTOPオフセット//      effect.Time = 1500;                             // アニメーション時間（速度）//  //  $("#boxCA").height(effect.AE);//      $("#boxCA").animate({ height: effect.AE + "px" }, effect.Time);//      $("#boxCM").animate({ height: effect.ME + "px" }, effect.Time);//      $("#boxCB").animate({ top:    effect.BE + "px" }, effect.Time);        // チャンネル検索フォーム        $("#searchChannelOpen").css("cursor","pointer");        $("#searchChannelOpen").mouseover(            function() {                $(this).css("background-color", "#EEBBFF");            }        );        $("#searchChannelOpen").mouseout(            function() {                $(this).css("background-color", "#CC99FF");            }        );        $("#searchChannelOpen").mousedown(            function() {                if (searchChannelFormView) {                    $("#searchChannelForm").animate({ height:"0px" }, 500, function(){$("#searchChannelForm").css("overflow","hidden")});                    searchChannelFormView = false;                } else {                    $("#searchChannelForm").animate({ height:"78px" }, 500);                    searchChannelFormView = true;                }            }        );        // ソータブルエリア        $(".myList").sortable(            {                connectWith:[".myList"],    // 移動できる領域            //  cursor:"move",              // カーソル                opacity: 0.6,               // 透明度                placeholder:"hover",        // 移動先エリアで表示するクラス名                scroll:"false",             // スクロールバー表示                update: function() { saveOrder(); }            }        );        //-----------------------------------------------------        // 左右中央ページDIVの高さを揃える        $('#pageLeft, #pageCenter, #pageRight').setHeight();    });function saveOrder() {    $.cookie("SA_" + page, $("#sortableArea").sortable("toArray"), { expires: 365, path: "/" });}//-------------------------------------------------------------// ウィンドウ ロード//-------------------------------------------------------------$(window).load(    function() {    });//-------------------------------------------------------------// ウィンドウ アンロード//-------------------------------------------------------------$(window).unload(    function() {        if (newSession == 1 && (0 < screenW + screenH)) {            $.post("/command/countScreenSize.php", { w:screenW, h:screenH });        }        if (adID != "") {            $.post("/command/countClickAds.php", { p:page, a:adID });        //  alert("JUMP:" + adID);        }    });//-------------------------------------------------------------// ウィンドウ リサイズ//-------------------------------------------------------------$(window).resize(    function() {    //  if ($.browser.msie) {    //  //  location.reload(true);    //      $('#pageLeft, #pageCenter, #pageRight').setHeight();    //  } else {    //      $('#pageLeft, #pageCenter, #pageRight').setHeight();    //  }    });//---------------------------------------------------------// GOOD投票完了//---------------------------------------------------------function postGood() {    $('#dialogGood').dialog('open');}//---------------------------------------------------------// URLバック処理//---------------------------------------------------------function urlBack() {    location.replace("/command/pageJump.php");}//---------------------------------------------------------// エラー処理//---------------------------------------------------------function errorProc() {    var dt = new Date();    var dt1 = dt.getTime();    while (true) {        dt = new Date();        dt2 = dt.getTime();        if (5000 < dt2 - dt1) break;    // 5秒ループ    }    location.reload(true);}//-------------------------------------------------------------// Copyright(C)Landwarf All right reserved.//-------------------------------------------------------------