$(function() {
    $("#tabuArea > ul").tabs({ fx: { opacity: 'toggle' } });
    $("#tabuArea > ul").tabs("select", '#tab1Body');
    $("#tabuArea2 > ul").tabs({ fx: { opacity: 'toggle' } });
    $("#tabuArea2 > ul").tabs("select", '#tab1Body2');

    var aryList = $(".jCarouselLite li").clone(true);
    var aryListIndexNum = shuffle_number(aryList.length);
    $(".jCarouselLite ul").empty();
    for(var i=0;i<aryList.length;i++){
	$(".jCarouselLite ul").append(aryList[aryListIndexNum[i]]);
    }
    $("#bannerArea .jCarouselLite").jCarouselLite({
        auto: 800,
        speed: 1000,
        visible: 5
    });

    var aryList = $("#fellow01 li").clone(true);
    var aryList2 = $("#fellow02 li").clone(true);
    var _listLength = aryList.length;
    aryListIndexNum = shuffle_number(_listLength);

    $("#fellow01 ul").empty();
    $("#fellow02 ul").empty();
    for(var i=0;i<_listLength;i++){
	$("#fellow01 ul").append(aryList[aryListIndexNum[i]]);
    }
    for(i=1;i<_listLength;i++){
      $("#fellow02 ul").append(aryList2[aryListIndexNum[i]]);
    }
    $("#fellow02 ul").append(aryList2[aryListIndexNum[0]]);

    $("#topCon_223fellowArea #fellow01").jCarouselLite({
        auto: 2000,
        speed: 400,
        visible: 1
    });
    $("#topCon_223fellowArea #fellow02").jCarouselLite({
        auto: 2000,
        speed: 400,
        visible: 3
    });
    var options = {
      newsList: "#newsticker",
      tickerRate: 40,
      startDelay: 10,
      placeHolder1: "_"
    }
    $().newsTicker(options);
});

function changeMapImage(imgPath) {
  document.getElementById('project_japan').src = imgPath;
}


function shuffle_number(argListLength) {
  var aryListIndexN = new Array(argListLength);
  for(i=0;i<argListLength;i++){
    aryListIndexN[i]=i;
  }
  return shuffle(aryListIndexN);
}

/*
 * shuffle
 *
 * Copyright 2006, Kyo Nagashima
 * licensed under the creativecommons.(CC BY-NC 2.1)
 * http://hail2u.net/
 *
 */
function shuffle(list) {
  var i = list.length;

  while (--i) {
    var j = Math.floor(Math.random() * (i + 1));
    if (i == j) continue;
    var k = list[i];
    list[i] = list[j];
    list[j] = k;
  }

  return list;
}

