DD_roundies.addRule('.ddCorner', '3px');
DD_roundies.addRule('.pageNaviBox span.current_page', '2px');


jQuery(function($){

    $('.pageTop a').click(function(){
        $.scrollTo('#container', {
            duration: 500
        });
    });

    $('a.pageLink').click(function(){
        var href = $(this).attr('href');
        if (href != '') {
            $.scrollTo(href, {
                duration: 500
            });
        }
    });

    $('a.linkOpenWin').click(function(){
        var href = $(this).attr('href');
        if (href != '') {
            var w = window.open(href, "freakswin", "width=1000,height=800,resizable=yes,scrollbars=yes");
        }
    });

    if ($('.scrollpane').length > 0) {
        $('.scrollpane').jScrollPane({showArrows: false});
    }


    if ($('#twitter').length > 0) {
        $("#twitter").getTwitter({
            numTweets: 3,
            userName: "FREAKS_STORE"
        });
    }


//    if ($.browser.msie) {//for ie
//        $('ul.sitemapUL a, ul.homeUL a').each(function(){
//            $(this).corner("round 3px");
//        });
//    }




    if ($('.news_shibuya #newsBoxInner').length > 0) {
        $('.news_shibuya #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/shibuya.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_shibuya').length > 0) {
        $('#staffBoxInner_shibuya').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/shibuya/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_shibuyaCS #newsBoxInner').length > 0) {
        $('.news_shibuyaCS #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/shibuyaCS.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_shibuyaCS').length > 0) {
        $('#staffBoxInner_shibuyaCS').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/shibuyacs/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_harajuku #newsBoxInner').length > 0) {
        $('.news_harajuku #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/harajuku.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_harajuku').length > 0) {
        $('#staffBoxInner_harajuku').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/harajuku/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_shinjuku #newsBoxInner').length > 0) {
        $('.news_shinjuku #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/shinjuku.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_shinjuku').length > 0) {
        $('#staffBoxInner_shinjuku').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/shinjuku/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_shinjuku2 #newsBoxInner').length > 0) {
        $('.news_shinjuku2 #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/shinjuku2.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_shinjuku2').length > 0) {
        $('#staffBoxInner_shinjuku2').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/shinjuku2/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_yurakucho #newsBoxInner').length > 0) {
        $('.news_yurakucho #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/yurakucho.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_yurakucho').length > 0) {
        $('#staffBoxInner_yurakucho').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/yurakucho/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_ikebukuro #newsBoxInner').length > 0) {
        $('.news_ikebukuro #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/ikebukuro.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_ikebukuro').length > 0) {
        $('#staffBoxInner_ikebukuro').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/ikebukuro/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_tachikawa #newsBoxInner').length > 0) {
        $('.news_tachikawa #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/tachikawa.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_tachikawa').length > 0) {
        $('#staffBoxInner_tachikawa').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/tachikawa/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_machida #newsBoxInner').length > 0) {
        $('.news_machida #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/machida.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_machida').length > 0) {
        $('#staffBoxInner_machida').showfeed({ q:'http://www.freaksstore.com/area/staff/tokyo/machida/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_yokohama #newsBoxInner').length > 0) {
        $('.news_yokohama #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/yokohama.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_yokohama').length > 0) {
        $('#staffBoxInner_yokohama').showfeed({ q:'http://www.freaksstore.com/area/staff/kanagawa/yokohama/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_kashiwa #newsBoxInner').length > 0) {
        $('.news_kashiwa #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/kashiwa.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_kashiwa').length > 0) {
        $('#staffBoxInner_kashiwa').showfeed({ q:'http://www.freaksstore.com/area/staff/chiba/kashiwa/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

//    if ($('.news_DPkashiwa #newsBoxInner').length > 0) {
//        $('.news_DPkashiwa #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/DPkashiwa.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
//    }
//    if ($('#staffBoxInner_DPkashiwa').length > 0) {
//        $('#staffBoxInner_DPkashiwa').showfeed({ q:'http://www.freaksstore.com/area/staff/chiba/dpkashiwa/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
//    }

    if ($('.news_kashiwaSM #newsBoxInner').length > 0) {
        $('.news_kashiwaSM #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/kashiwaSM.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_kashiwaSM').length > 0) {
        $('#staffBoxInner_kashiwaSM').showfeed({ q:'http://www.freaksstore.com/area/staff/chiba/kashiwasm/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_koga #newsBoxInner').length > 0) {
        $('.news_koga #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/koga.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_koga').length > 0) {
        $('#staffBoxInner_koga').showfeed({ q:'http://www.freaksstore.com/area/staff/ibaraki/koga/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_takasaki #newsBoxInner').length > 0) {
        $('.news_takasaki #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/takasaki.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_takasaki').length > 0) {
        $('#staffBoxInner_takasaki').showfeed({ q:'http://www.freaksstore.com/area/staff/gunma/takasaki/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }

    if ($('.news_nagano #newsBoxInner').length > 0) {
        $('.news_nagano #newsBoxInner').showfeed({ q:'http://www.freaksstore.com/news/nagano.xml' + '?' + ((new Date()).getTime() - 300), num:'5' }, 'showStoreNews');
    }
    if ($('#staffBoxInner_nagano').length > 0) {
        $('#staffBoxInner_nagano').showfeed({ q:'http://www.freaksstore.com/area/staff/nagano/nagano/atom.xml' + '?' + ((new Date()).getTime() - 300), num:'3' }, 'showStoreStaff');
    }



});



  var diffDate = 7;
  var now = new Date();
  $('span.iconNew').each(function () {
    $target = $(this).attr('title');
    var diff = Math.floor((now.getTime() - $target.getTime()) / 1000);
    if (diff < diffDate * 24 * 60 * 60) {
      $(this).show();
    }
  });


function addEvent(obj, evType, fn){
    if (obj.addEventListener){ //IE以外
        obj.addEventListener(evType, fn, false);
        return true;
    } else if (obj.attachEvent){ //IE
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    } else {
        return false;
    }
}


(function($) {
    $.fn.checkDiffDate = function(options) {
        return this.each(function(options) {
            $.checkDiffDate(this, options);
        });
    };

    $.checkDiffDate = function(target, options) {
        var settings = {
            'checkAttr': 'title',
            'diffDate': 7
        };
        if (options) {
            $.extend(settings, options);
        }
        var now = new Date();
        $(target).each(function () {
            var target = $(this).attr(settings.checkAttr);
            target = new Date(target);
            var diff = Math.floor((now.getTime() - target.getTime()) / 1000);
            if (diff < diffDate * 24 * 60 * 60) {
                $(this).show();
            }
        });
    };
    
})(jQuery);

function openWindow(theURL,winName,features)
{
  window.open(theURL,winName,features);
}

/*
(function($) {
    $.fn.formatDate = function(options) {
        return this.each(function() {   
            $.formatDate(options);
        });
    };

    $.formatDate = function(options) {
        var settings = {
//            'zBase':            10
        };
//        if (options && options.photoElmID && options.hoverElmID) {
//            $.extend(settings, options);
//        }
        var months = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
//        var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
        
        var str = $(this).text();
        alert(str);
        if (str != '') {
            var dates = $(str).split('/');
            var showStr = '';
            
            showStr = month[parseInt(dates[1], 10) - 1] + ".'" + dates[2];
            $(this).text(showStr);
        }
        
        
    };
    
    
})(jQuery);
*/






