$(function () {
    $('.topWrap .col1 dl').click(function () {
        var boxLink = $(this).find('a');
        if (boxLink.attr('target') == '_blank') {
            window.open(boxLink.attr('href'));
        }
        else window.location = boxLink.attr('href');
        return false;
    });
});

$(function () {
    $('.newItem .wrap4 .col1').click(function () {
        var boxLink = $(this).find('a');
        if (boxLink.attr('target') == '_blank') {
            window.open(boxLink.attr('href'));
        }
        else window.location = boxLink.attr('href');
        return false;
    });
});

$(function () {
    $('.topWrap .col1 dl').mouseover(function () {
        $(this).css('background-color' , '#eeeeee');
        $(this).css('cursor' , 'pointer');
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
	});
    $('.topWrap .col1 dl.tink').mouseover(function () {
        $(this).css('background-color' , '#F9EAEA');
        $(this).css('cursor' , 'pointer');
/*		$(this).addClass("tinkon");*/
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
/*		$(this).removeClass("tinkon");*/
	});

	$('.topWrap .col1 dl.tomica').mouseover(function () {
        $(this).css('background-color' , '#E5EAF2');
        $(this).css('cursor' , 'pointer');
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
	});
	$('.topWrap .col1 dl.licca').mouseover(function () {
        $(this).css('background-color' , '#FDF0F2');
        $(this).css('cursor' , 'pointer');
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
	});
    $('.newItem .wrap4 .col1').mouseover(function () {
        $(this).css('background-color' , '#F9EAEA');
        $(this).css('cursor' , 'pointer');
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
	});
	$('.newItem .wrap4 .col1.tomica').mouseover(function () {
        $(this).css('background-color' , '#E5EAF2');
        $(this).css('cursor' , 'pointer');
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
	});
	$('.newItem .wrap4 .col1.lica').mouseover(function () {
        $(this).css('background-color' , '#FDF0F2');
        $(this).css('cursor' , 'pointer');
    }).mouseout(function () {
        $(this).css('background-color' , '#ffffff');
        $(this).css('cursor' , 'default');
	});
});


$.fn.autoChange = function(config) {
   var options = $.extend({
      effect  : 'fade',
      type    : 'repaet',
      timeout : 3000,
      speed   : 1000
   }, config);

   return this.each(function() {
      var current = 0;
      var next = 1;

      var element = $(this).children();

      $(element).hide();

      $(element[0]).show();

      var change = function(){
         if (options.effect == 'fade') {
            $(element[current]).fadeOut(options.speed);
            $(element[next]).fadeIn(options.speed);

         } else if  (options.effect == 'slide') {
            $(element[current]).slideUp(options.speed);
            $(element[next]).slideDown(options.speed);
         }

         if (options.type == 'repeat') {
            if ((next + 1) < element.length) {
                current = next;
                next++;
            } else {
                current = element.length - 1;
                next = 0;
            }
         }

         if (options.type == 'stop') {
            if ((next + 1) < element.length) {
                current = next;
                next++;
            } else {
                return;
            }
         }
      };

      var timer = setInterval(function(){change();}, options.timeout);
   });
};

$(function() {
   $('#mainImage').autoChange({effect : 'fade', type : 'repeat', timeout: 6000, speed : 2500});
});


/*$(document).ready(function(){
$(".topWrap").fadeTo(0,0.7);//ページ読み込み時
});
$(function(){
$(".topWrap .col1").fadeTo(0,2.0);
});*/
