/* config */
$(function() {

    //page scroll
    $('a[href^=#]').click(function() {
        var href= $(this).attr("href");
        var target = $(href == "#" || href == "" ? 'html' : href);
        var position = target.offset().top;
        $($.browser.safari ? 'body' : 'html').animate({
            scrollTop:position
        }, 'fast');
        return false;
    });


    //Roll Over
    var preLoad = new Object();
    $('img.over').each(function(){
        var imgSrc = this.src;
        var fType = imgSrc.substring(imgSrc.lastIndexOf('.'));
        var imgName = imgSrc.substr(0, imgSrc.lastIndexOf('.'));
        var imgOver = imgName + '_o' + fType;
        preLoad[this.src] = new Image();
        preLoad[this.src].src = imgOver;
        $(this).hover(
            function (){
                this.src = imgOver;
            },
            function (){
                this.src = imgSrc;
            }
        );
    });
    

    // external link
    $('a[href^="http"]').not('a[href^="http://www.nulab.co.jp/"],a[href^="https://www.nulab.co.jp/"],a[href^="http://player.vimeo.com/"]').click(function(){
        window.open(this.href, '');
        return false;
    });

    $("#videoHolder").colorbox({iframe:true, innerWidth:800, innerHeight:500});
    $("#contactBtn").colorbox({
        width:"857",
        height:"407",
        transition:"none",
        iframe:true,
        onLoad:function(){ $("#colorbox").addClass("popupForm"); },
        onClosed:function(){ $("#colorbox").removeClass("popupForm"); }
    });
   
    
});


