
$(document).ready(function () {

    //Initiate Fisheye jQuery Plugin
    $('#fisheye').Fisheye({
        maxWidth: 50,
        items: 'a',
        itemsText: 'span',
        container: '.fisheyeContainter',
        itemWidth: 125,
        proximity: 75,
        halign: 'center'
    }); //End Fisheye Plugin

    //Detect IE6 and adjusts site accordingly
    if ($.browser.msie && $.browser.version <= "6.0") {
        //if (true) {
        $('img').each(function () {
            var source = $(this).attr("src");
            $(this).attr("src", source.replace(".png", ".gif"));
        });
    }

    //Hide span aspect of Fisheye
    $('a.fisheyeItem span').css('visibility', 'hidden');

    //Handle sphere clicks
    $('.fisheyeItem img').click(function () {

        //Determine which section this pertains to
        var iID = $(this).parent().attr('href');

        //Reload Video Players
        //$('#LTAC div.innerImage').html('<iframe src="http://storage.ndandp.com/files/kindred/ferris.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>');
        //$('#SkilledNursing div.innerImage').html('<iframe src="http://storage.ndandp.com/files/kindred/dad.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>');

        //Set all circles to white and clicked to orange
        $('.fisheyeItem img').each(function (intIndex) {
            var cSrc = $(this).attr("src");
            cSrc = cSrc.replace("_or", "_w");
            $(this).attr("src", cSrc);
        });
        var nSrc = $(this).attr("src");
        nSrc = nSrc.replace("_w", "_or");
        $(this).attr("src", nSrc);

        $('div.bg').css('display', 'none');
        $(iID).fadeIn('slow');

    }); //End Fisheye Click

    //Load Video Players
    //$('#LTAC div.innerImage').html('<iframe src="http://storage.ndandp.com/files/kindred/ferris.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>');
    //$('#SkilledNursing div.innerImage').html('<iframe src="http://storage.ndandp.com/files/kindred/dad.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>');

    //Google Analytics
    $('div.fisheyeContainter a').click(function () {
        switch ($(this).attr("href")) {
            case '#LTAC':
                path = 'iframes/ltac.html';
                break;
            case '#InpatientRehab':
                path = 'iframes/InpatientRehab.html';
                break;
            case '#SkilledNursing':
                path = 'iframes/SkilledNursing.html';
                break;
            case '#AssistedLiving':
                path = 'iframes/AssistedLiving.html';
                break;
            case '#OutpatientRehab':
                path = 'iframes/OutpatientRehab.html';
                break;
            case '#HomeHealthCare':
                path = 'iframes/HomeHealthCare.html';
                break;
            case '#Hospice':
                path = 'iframes/Hospice.html';
                break;
        }
        $('#iAnalytics').attr("src", path);
    });

});              //End document.ready

function ShowIFrame() {
    $("#CTC_Form_iFrame").attr("src","https://www.continuethecare.com/Referral.aspx");
    $("#CTC_Cover").show();
    //$("#LTAC div.innerImage,#SkilledNursing div.innerImage").hide();
}

function ShowLTAC() {
    $("#CTC_Form_iFrame").attr("src","http://storage.ndandp.com/files/kindred/LTAC.html");
    $("#CTC_Cover").show();
    //$("#LTAC div.innerImage,#SkilledNursing div.innerImage").hide();
}

function ShowSN() {
    $("#CTC_Form_iFrame").attr("src","http://storage.ndandp.com/files/kindred/skillednursing.html");
    $("#CTC_Cover").show();
    //$("#LTAC div.innerImage,#SkilledNursing div.innerImage").hide();
}

function ShowIFrameNewsletter() {
        $("#CTC_Form_iFrame").attr("src","Newsletter.htm");
	$("#CTC_Cover").show();
	//$("#LTAC div.innerImage,#SkilledNursing div.innerImage").hide();
}

function HideIFrame() {
    $("#CTC_Cover").hide();
    //$("#LTAC div.innerImage,#SkilledNursing div.innerImage").show();
}