$(document).ready(function() {
	$('#recommendArea .pickupImage').wink();
	$('#voteBanner').wink(600);
    
    // ロールオーバー
    $('.rollover').hover(function(){
    	$(this).attr('src', $(this).attr('src').replace('_1', '_2'));
    }, function(){
    	if (!$(this).hasClass('currentPage')) {
    		$(this).attr('src', $(this).attr('src').replace('_2', '_1'));
    	}
    });
    
    // メニュー位置を決定
    $('#ddLocMenu').click(function(){
    	var plusTop = 0;
    	if (jQuery.browser.msie && 6 <= jQuery.browser.version && jQuery.browser.version < 8) {
    		plusTop = $('#ddLocMenu').height();
    	}
    	
    	var position = $('#ddLocMenu').position();
        $('#ddLocation').css('top', position.top + plusTop).css('left', position.left - $('#ddLocation').width() + $('#ddLocMenu').width());
    	
    	var ddLocation = $('#ddLocation');
    	ddLocation.slideToggle(300).toggleClass('openPanel');
    	
    	if (ddLocation.hasClass('openPanel')) {
    		$('#ddLocMenu img').addClass('currentPage').attr('src').replace("_1","_2");
    	} else {
    		$('#ddLocMenu img').removeClass('currentPage').attr('src').replace("_2","_1");
    	}
    	return false;
    });
    
    // サイドバー検索
    $('#searchKeyword').focus(function(){
    	if ($(this).val() == '店舗検索') {
    		$(this).val('');
    	}
    }).blur(function(){
    	if ($(this).val() == '') {
    		$(this).val('店舗検索');
    	}
    });
    $('#searchBox').submit(function(){
    	if($('#searchKeyword').val() == '店舗検索') {
    		$('#searchKeyword').val('');
    	}
    });
    
    // datePicker
    //$('.datePicker').datepicker({minDate: 0});
    //$('.datePickerNoLimit').datepicker();
    
    // colorbox
    $('a.inlineView').colorbox();
    
    // smooth scroll
	$("a.smooth").click(function(){
	     $('html, body').animate({ scrollTop: $($(this).attr("href")).offset().top }, 'slow','swing');
	     return false;
	 });
	
	// focus
	$(".focusForm input[type='text']").focus(function(){
        $(this).addClass('focus');
    });
    $(".focusForm input[type='text']").blur(function(){
        $(this).removeClass('focus');
    });
    $(".focusForm textarea").focus(function(){
        $(this).addClass('focus');
    });
    $(".focusForm textarea").blur(function(){
        $(this).removeClass('focus');
    });
});
