// Avoid conflict
jQuery.noConflict();

var HOVER_DURATION = 100;
var FADE_DURATION = 150;
var SCROLL_VELOCITY = 500;
var SCROLL_EFFECT = 'easeInOutCubic';

jQuery(document).ready(function(){
    // If IE, turn off animations.
    if (jQuery.browser.msie) {
        FADE_DURATION = 0;
    }

    // Rollover(Swap)
    jQuery('img.hover').hover(function(){
        // jQuery(this).fadeTo(HOVER_DURATION, 0.8);
        jQuery(this).attr('src', this.src.replace('_off', '_on'));
    }, function(){
        // jQuery(this).fadeTo(HOVER_DURATION, 1.0);
        jQuery(this).attr('src', this.src.replace('_on', '_off'));
    });

    // Fade
    jQuery('img.fade').hover(function(){
        jQuery(this).fadeTo(HOVER_DURATION, 0.8);
    }, function(){
        jQuery(this).fadeTo(HOVER_DURATION, 1.0);
    });

    // World Travel Series
    jQuery('div.wtsPin').hover(function(){
        var country = jQuery(this).attr('id').replace('wtsPin', '');
        jQuery('div#wtsDetail' + country).fadeIn(FADE_DURATION);
    }, function(){
        var country = jQuery(this).attr('id').replace('wtsPin', '');
        jQuery('div#wtsDetail' + country).fadeOut(FADE_DURATION);
    });

    // Smooth scrolling
    jQuery('a[href*=#]').click(function(){
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var $target = jQuery(this.hash);
            $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                jQuery('html,body').animate({ scrollTop: targetOffset }, SCROLL_VELOCITY, SCROLL_EFFECT);
                return false;
            }
        }
    });
});


