﻿/* ************************************
Climbing Turn JavaScript Library
5th December 2010
************************************ */

// ensures all links with attribute rel="external" open in a new browser window
// thanks to Gez Lemon :: http://juicystudio.com/
function externalLinks() {
    var objCurrent, objReplacement;
    if (document.getElementsByTagName) {
        var objAnchors = document.getElementsByTagName('a');

        for (var iCounter = 0; iCounter < objAnchors.length; iCounter++) {
            if (objAnchors[iCounter].getAttribute('href') && objAnchors[iCounter].getAttribute('rel') == 'external') {
                objAnchors[iCounter].onclick = function (event) { return launchWindow(this, event); }
                objAnchors[iCounter].onkeypress = function (event) { return launchWindow(this, event); }
            }
        }
    }
}

function launchWindow(objAnchor, objEvent) {
    var iKeyCode;
    if (objEvent && objEvent.type == 'keypress') {
        if (objEvent.keyCode)
            iKeyCode = objEvent.keyCode;
        else if (objEvent.which)
            iKeyCode = objEvent.which;
        if (iKeyCode != 13 && iKeyCode != 32)
            return true;
    }
    return !window.open(objAnchor);
}

$(document).ready(function () {
    $('#ctHurricane').toggle();
    $('#ContentLinks').toggle();
    $('#Address').toggle();
    $('#ctHurricane').fadeIn(1000);
    $('#ContentLinks').fadeIn(2000);
    $('#Address').fadeIn(4000);
    externalLinks();
});

