var earthInfo = {
selectAreaOptions : {
defaultArea: 'syutoken',
changeAreaName: ['rectour'],
areaInfo: {
syutoken: {
area_name: '首都圏',
fright_start_name: 'NRT,HND,TYO'
},
tyubu: {
area_name: '中部',
fright_start_name: 'NGO'
},
kansai: {
area_name: '関西',
fright_start_name: 'KIX,ITM,OSA'
},
kyusyu: {
area_name: '九州',
fright_start_name: 'FUK'
},
hokkaido: {
area_name: '北海道',
fright_start_name: 'SPK,CTS'
},
tyugoku: {
area_name: '中国',
fright_start_name: 'HIJ'
}
},
initFunction: function(activeArea) {
$("#con01").tabboxManager({
slideShow: false,
activeTabName: activeArea
}).trigger('createChildren');
},
afterFunction: function (activeArea) {
var idList = ['#con05'];
for (var key in idList) {
var url = $(idList[key]).attr("data-base-url");
if(url !== undefined) {
url = url + '&dep=' + earthInfo.selectAreaOptions.areaInfo[activeArea].fright_start_name;
$(idList[key] + " .btnTitle a").attr("href", url);
}
}
var tabButtonLI = $(".tab_btn li");
tabButtonLI.each(function () {
if ($(this).attr('data-tab-name') == activeArea) {
$(this).trigger('click');
}
});
$("#topTour .topTourItems .topTourItem").each(function () {
if ($(this).attr('data-area-name') == activeArea) {
$("#topTour .topTourArea").html($(this).html());
}
});
if ( $('.hoverBox .hoverThumbList').attr(activeArea) ){
var hovers = $('.hoverThumbList').attr(activeArea).split(",");
var hoverhtmls = new Array();
$(".hoverBox .hoverThumbList li").each(function () {
if ( $.inArray($(this).attr("data-hover-name").replace(/hover/,''),hovers) == -1 ){
$(this).hide();
}else{
$(this).show();
hoverhtmls[$.inArray($(this).attr("data-hover-name").replace(/hover/,''),hovers)] = $(this).prop("outerHTML");
$(this).remove();
}
});
$('.hoverThumbList').append(hoverhtmls.join(''));
$('.hoverBox').show();
}else{
$("#BanBox").html(
$('#BanBox > li').sort(function(a, b) {
return parseInt($(a).attr(activeArea), 10) - parseInt($(b).attr(activeArea), 10);
})
);
var hovercnt = 0;
$(".hoverBox .hoverThumbList li").each(function () {
if ($(this).attr(activeArea) > 0 ) {
if ( hovercnt < 6 ){
$(this).show();
hovercnt++;
}
}else{
$(this).hide();
}
});
if ( hovercnt < 6 ){
$(".hoverBox .hoverThumbList li").each(function () {
if ( !$(this).attr('syutoken') && !$(this).attr('hokkaido') && !$(this).attr('tyubu') && !$(this).attr('kansai') && !$(this).attr('tyugoku') && !$(this).attr('kyusyu') && $(this).css('display') == "none" ) {
if ( hovercnt < 6 ){
$(this).show();
hovercnt++;
}
}
});
}
$('.hoverBox').show();
}
if ( $('#con00 #con00BoxInner').attr(activeArea) ){
var bans = $('#con00 #con00BoxInner').attr(activeArea).split(",");
var banhtmls = new Array();
$("#con00 #con00BoxInner li").each(function () {
if ( $.inArray($(this).attr("ban-id"),bans) == -1 ){
$(this).hide();
}else{
$(this).show();
banhtmls[$.inArray($(this).attr("ban-id"),bans)] = $(this).prop("outerHTML");
$(this).remove();
}
});
$('#con00 #con00BoxInner').append(banhtmls.join(''));
$('#con00 #con00BoxInner').show();
}else{
var depflg = false;
$("#con00 #con00BoxInner li").each(function () {
if ($(this).attr(activeArea) > 0 ) {
depflg = true;
}
});
if ( depflg === true ){
$("#con00 #con00BoxInner").html(
$('#con00 #con00BoxInner > li ').sort(function(a, b) {
return parseInt($(a).attr(activeArea), 10) - parseInt($(b).attr(activeArea), 10);
})
);
}
$("#con00 #con00BoxInner li").each(function () {
if ($(this).attr(activeArea) > 0 ) {
debflg = true;
$(this).show();
}else{
$(this).hide();
}
if ( !$(this).attr('syutoken') && !$(this).attr('hokkaido') && !$(this).attr('tyubu') && !$(this).attr('kansai') && !$(this).attr('tyugoku') && !$(this).attr('kyusyu') && $(this).css('display') == "none" ) {
$(this).show();
}
});
$('#con00 #con00BoxInner').show();
}
if ( $('#areaTour').length ){
$.post("/area_guide/?calltour=1&cu="+$('#areaTour').attr("homen")+"&ct="+$('#areaTour').attr("city")+"&dep="+activeArea,
function(data){
$('.areaContInner').html(data);
}
);
}
$(".hoverBox").hoverManager({clearTarget:"#wrapper_Des", mainArea: "#mainBnr"});
}
}
};
$(document).ready(function(){
var navModule = function() {
var touch = window.ontouchstart===null ? true : false,
nav_side = $("#nav_side"),
nav_side_a = $('#nav_side li a'),
hideNavi = function() {
var maxWith = 50;
nav_side_a.each(function() {
if (maxWith <= $(this).width()) {
maxWith = $(this).width();
}
});
if(maxWith>50) maxWith = 196;
nav_side.css('width',maxWith+'px');
},
clearNavi = function() {
nav_side_a.each(function(){
if($(this).width() > 50) {
$(this).stop().animate({'width':'50px'},'slow', null, hideNavi);
}
});
},
hoverOff = function() {
$(this).stop().animate({'width':'50px'},'slow', null, hideNavi);
},
hoverOn = function() {
var hoverFlg = $(this).width() > 50;
if(touch) {
clearNavi();
}
if(!touch || !hoverFlg) {
nav_side.css('width','196px');
$(this).stop().animate({
'width':'196px'
},'fast');
}
};
nav_side_a.each(function(){
$(this).css('width', '50px');
if(touch) {
$(this).bind('touchstart', hoverOn);
} else {
$(this).hover(hoverOn , hoverOff);
}
});
if(touch) {
$("#wrapper_Des").bind('touchstart', clearNavi);
}
};
navModule();
$('#container').masonry({
columnWidth: 366,
itemSelector: '.item',
isFitWidth: true
});
$("#navi").navigationMenuManager({
nav_side: $("#nav_side"),clearTarget:"#wrapper_Des", mainArea: ".naviContents",
hoverOnAction: function(touch, currentMenuID) {
if (touch) {
switch (currentMenuID) {
case 'pullDownMenu001':
this.nav_side.animate({'top': '470px'});
break;
case 'pullDownMenu002':
this.nav_side.animate({'top': '340px'});
break;
case 'pullDownMenu003':
this.nav_side.animate({'top': '280px'});
break;
default:
this.nav_side.animate({'top': '180px'});
break;
}
}
},
hoverOffAction: function(touch, currentMenuID) {
if(touch) $("#nav_side").animate({'top': '180px'});
}
});
$("#contry_navi").navigationMenuManager({
nav_side: $("#nav_side"),clearTarget:"#wrapper_Des", mainArea: "#contryNavi",
hoverOnAction: function(touch, currentMenuID) {
if(touch) {
if(currentMenuID=='pullDownMenu005') {
this.nav_side.animate({'top': '400px'});
} else {
this.nav_side.animate({'top': '180px'});
}
}
},
hoverOffAction: function(touch, currentMenuID) {
if(touch && currentMenuID=='pullDownMenu005') $("#nav_side").animate({'top': '180px'});
}
});
$("#con00,#con00_b").sliderManager({
speed : 1200
, pause : 4000
, minSlides : 5
, maxSlides : 5
, slideWidth : 197
, areaMargin : 55
}).trigger('createChildren');
//エリア詳細ページ用
$("#areaPoint,#areaGourmet,#areaShopping").sliderManager({
speed : 2000
, pause : 9000
, minSlides : 3
, maxSlides : 3
, slideWidth : 292
, areaMargin : 150
}).trigger('createChildren');
$(".sidebox01Des .btn_area").click(function(){
if($("#worldMap").css('display')=='none') {
$("#worldMap").css('display', 'block');
$("#countryMap").css('display', 'none');
$(".sidebox01Des .btn_area").html('国マップへ戻る');
} else {
$("#worldMap").css('display', 'none');
$("#countryMap").css('display', 'block');
$(".sidebox01Des .btn_area").html('他のエリアをみる');
}
event.preventDefault();
});
$(".selectarea").selectdefault(earthInfo.selectAreaOptions);
// pageTracker._trackEvent('area', 'view', $(".area_name").html(), 0, true);
$(".hoverBox").hoverManager({clearTarget:"#wrapper_Des", mainArea: "#mainBnr"});
// 出発日
var i, today = new Date();
var $deptY = $('#sidebox02departureYear');
for(i = 0; i < 2; i++) { $deptY.append($('').html((today.getFullYear() + i) + "年").val(today.getFullYear() + i)); }
var $deptM = $('#sidebox02departureMonth');
for(i = 1; i <= 12; i++) { $deptM.append($('').html(i + "月").val(i)); }
var $deptD = $('#sidebox02departureDate');
for(i = 1; i <= 31; i++) { $deptD.append($('').html(i + "日").val(i)); }
$.datepicker.setDefaults( $.datepicker.regional[ "ja" ] );
$( "#departureDatePicker" ).datepicker({
buttonImageOnly : true
, showOn: "button"
, buttonImage : "//stworld.jp/images/common/icon_calendar.png"
, changeMonth: true
, changeYear: true
, onSelect: function(dateText, inst) {
var dates = dateText.split('/');
$deptY.val(dates[0]);
$deptM.val(parseInt(dates[1]));
$deptD.val(parseInt(dates[2]));
}
, beforeShow: function(input, inst) {
var calendar = inst.dpDiv;
setTimeout(function() {
calendar.position({
my: 'left top'
, at: 'left top'
, of: '#keysearch'
});
}, 1);
}
});
$("#calendar").on('click', function(event){ $( "#departureDatePicker" ).datepicker("show"); });
});