j$(function(){

	//初期表示時処理
	initDisp();

    j$("a.newsTabList").click(function(){
      //タブの移動
      var selId;
      if(j$(this).attr("id") == "a1" || j$(this).attr("id") == "a3"){
        selId = "a1";
      	changeNewsTab1();
        j$("#recom_" + selId).load("/sp_1.htm");
        j$("#recom_" + selId).fadeIn("slow");


      // お勧め
      } else if(j$(this).attr("id") == "a2"){
        //selId = "a2";
        //changeNewsTab2();
        document.getElementById('pf1').style.backgroundImage='url(./images2/title_off.gif)';
        document.getElementById('pf2').style.backgroundImage='url(./images2/title_on.gif)';
        recomDisp(1);
      }

    });

    j$("a.closeTabList").click(function(){

        // 特集
        if(j$(this).attr("id") == "cl1"){
          // 全部消去
          initDisp();

        // おすすめ
        } else {
          recomDisp(0);
        }
    });

    j$("a.pagerSp").click(function(){
        // 特集ページ
        j$("#recom_a1").load("/" + j$(this).attr("id") + ".htm");
        j$("#recom_" + selId).fadeIn("slow");
    });

    j$("a.pagerRe").click(function(){

        // お勧めページ
        j$("div.Recommendation").fadeOut("fast");
    });

});

//リストのクローズ
function closeList(){
    initDisp();
}

//リストのクローズ(お勧め)
function closeList2() {
    recomDisp(0);
}


//リストのページング（特集ページ用）
function pageList(pageNum){
    j$("div.Recommendation").fadeOut("fast");
    j$("#recom_a1").load("/sp_" + pageNum + ".htm");
    j$("#recom_a1").fadeIn("slow");
}

function initDisp(){
    j$("div.Recommendation").fadeOut("fast");
    j$("#recom_a1").load("/sp_default.htm");
    j$("#recom_a1").fadeIn("slow");
}


// お勧め表示
function recomDisp(page)
{
    j$("div.Recommendation").fadeOut("fast");

    // お勧めデータ表示PHP
    var url = '/i/iscRecommendDisp.php';

    // パラメータ
    var param = 'recomPage=' + page;

    // 出力DIV ID
    var innerDiv = 'recom_a2';


    // 出力処理
    var a = new Ajax.Request(
        url,
        {
            'method': 'get',
            'parameters': param,
            onSuccess: function(request) {
            },
            onComplete: function(request) {
                j$("#recom_a2").html(request.responseText);
            },
            onFailure: function(request) {
            },
            onException: function (request) {
            }
        }
    );

    j$("#recom_a2").fadeIn("slow");
}


