$(document).ready( function(){
// doccument ready ////////////////////////////////////////
PEPS.rollover.init();

// tdの中身が無いときにtrを削除 ////////////////////////////////////////
$('#galleryInfo td').each(function(){
$contentText = $(this).text();
if ($contentText == ''){$(this).parent().remove();}
});

// subphotoの中身が無いときにdivを削除 ////////////////////////////////////////
$(".subPhoto img[src$='/']").each(function(){
$(this).parent().parent().remove();
});



$('#navigation li:eq(6) a,#navigation li:eq(7) a, #navigation li:eq(8) a, a.full, #footerNav a:eq(6), #footerNav a:eq(7), #footerNav a:eq(8),.spcl a').click(function(){
window.open(this.href, 'special','fullscreen = yes');
return false;
});




// GuideMap //
$("#guideNav li").mouseover(function(){
	$("#floorMap .guide00").hide();
});
$("#guideNav li").mouseout(function(){
	$("#floorMap .guide00").show();
});
$("#guideNav a").mouseover(function(){
	thisClass = $(this).attr('class');
	$("#floorMap ."+thisClass).fadeIn('fast');
});
$("#guideNav a").mouseout(function(){
	thisClass = $(this).attr('class');
	$("#floorMap ."+thisClass).fadeOut('fast');
});

// GuideMap //
$("#galleryNav").bind('mouseleave',function(){
	$("#galleryMap .guide00").show();
});
$("#galleryNav li").bind('mouseenter',function(){
	thisClass = $(this).attr('class');
	$("#galleryMap ."+thisClass).fadeIn('fast');
});
$("#galleryNav li").bind('mouseleave',function(){
	thisClass = $(this).attr('class');
	$("#galleryMap ."+thisClass).fadeOut('fast');
});


$(".subPhoto .left:even").css('clear','both');

$(".profile .now li:last").css('border','none');
$(".profile .next li:last").css('border','none');
$(".profile .past li:last").css('border','none');

// subphotoの中身が無いときにdivを削除 ////////////////////////////////////////
$(".profile li a[href='']").each(function(){
$(this).parent().remove();
});


// とまとの花 dtをddのセンターに ////////////////////////////////////////
$('#hnMainContents dd').each(function(){
$ddHeight = $(this).height();

$(this).prev('dt').css('padding-top',(($ddHeight-18)/2)+'px');
$(this).after('<div></div>');
});




//End of doccument ready ////////////////////////////////////////
});


// Roll over ////////////////////////////////////////
PEPS = {};

PEPS.rollover =
{
   init: function()
   {
      this.preload();
     
      $(".over").hover(
         function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
         function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
      );
   },

   preload: function()
   {
      $(window).bind('load', function() {
         $('.over').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
      });
   },
   
   newimage: function( src )
   {
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_over' + src.match(/(\.[a-z]+)$/)[0];
   },

   oldimage: function( src )
   {
      return src.replace(/_over\./, '.');
   }
};
// Roll over end ////////////////////////////////////////