﻿$(document).ready(function () {
    $("a[href^='http']").bind('click keypress', function (event) {

        var code = event.charCode || event.keyCode;

        if (!code || (code && code == 13)) {
            var fixedLink = this.href;
            fixedLink = fixedLink.replace(/https?:\/\/(.*)/, "$1");
            fixedLink = '/outgoing/' + fixedLink;
            $.trackPageview(fixedLink);
        };
    });

    $(".placedropdown").change(function () {
        if ($(this).val() == "") {
            $(".placetext").focus();
        }
    });

    $(".placetext").change(function () {
        var dropdown = $(".placedropdown").get(0);
        if (dropdown != undefined) {
            dropdown.selectedIndex = 1;
        }
    });
});

function initImageRotator(listId, containerHeight, intervall) {
    $('#' + listId).innerfade({ speed: 'slow', timeout: intervall, type: 'sequence', containerheight: containerHeight + 'px' });
}
