﻿

$(document).ready(function() {
    // Slider Menu 
    $('.kwicks').kwicks({
        max: 220, //245
        spacing: -3, // This is negative to remove spaces on lower menu items (bug in control)
        isVertical: true,
        sticky: true
    });

    // Show the back to menu item when Navagation class is available
    if ($('#slideshowHolder').hasClass('hasNavagation')) {
        $('#btnBack').show();
    } else {
        $('#btnBack').hide();
    }
    
    // Don't show the employment button when noEmpOpp class is available
    if ($('#slideshowHolder').hasClass('noEmpOpp')) {
        $('#btnEmpOpp').hide();
    } else {
        $('#btnEmpOpp').show();
    }

    // Background image swaper
    $('#slideshowHolder').jqFancyTransitions({
        effect: 'wave', // wave, zipper, curtain
        width: 920, // width of panel
        height: 386, // height of panel
        strips: 0, // number of strips
        delay: 4000, // delay between images in ms
        stripDelay: 0, // delay between strips in ms
        titleOpacity: 0.7, // opacity of title
        titleSpeed: 1000, // speed of title appereance in ms
        position: 'alternate', // top, bottom, alternate, curtain
        direction: 'left', // left, right, alternate, random, fountain, fountainAlternate
        navigation: $('#slideshowHolder').hasClass('hasNavagation'), // prev and next navigation buttons  
        links: false // show images as links
    });

    // Change the verbiage on the image rotator
    $('#ft-prev-slideshowHolder').text(" <-- Previous ");
    $('#ft-next-slideshowHolder').text(" Next -->");

    // set download links href to the value of the hidden fields 'hdnURL' value which was loaded with a web.config value
    $('#aDownload').attr('href', $('[id$="hdnURL"]').val());
});

// Remove the moto image
$(document).click(function() {
  $("#moto").fadeOut('slow', function() {
    // Animation complete.
  });
  
});

function ShowMessage(path, top, left, width, height, returnpath)
{
       
    // Setup path to slider content
    path = "./slide_menu_content/" + path 
    
    // fade out the image    
    $("#box").fadeOut(200, function() {
    });

    // Load the content into the div    
    $("#box").hide().load(path + " #guts", function() {

        // Add the close button and return link (if applicable)
        // Unfortunately, had to put the CSS information in this section
        // I'm guessing its because the object anchor is not available when rendering???
        if (returnpath.length > 0)
            $("#box").prepend('<a href="#" style="margin-left: 400px; padding-top: 5px; color: #027A4A; text-decoration: none; margin-right: 20px" id="btnReturn" onmouseover="UnderlineIt(this)" onmouseout="NoTextDecoration(this)" onclick="ShowMessage(\'' + returnpath + '\', 40, 300, 600, 100,\'\')">Return to Previous Page</a><img style="padding-top: 5px;" onclick="CloseMessage();" id="btnClose" src="./image/common/close.png" />');
        else
            $("#box").prepend('<img style="margin-left: 580px; padding-top: 5px" onclick="CloseMessage();" id="btnClose" src="./image/common/close.png" />');
     });
  
    // Animate the div to display the content
    $("#box").animate({
        opacity: 0.85,
        top: top + ' px',
        left: left + ' px',
        height: 'toggle',
        width: width + ' px'
    }, 1000, function() {
        // Animation complete.
    });   
}

// Close button fire this function which hide the window
function CloseMessage()
{
    $('#box').fadeOut('fast');
}

// Puts an underline on the hyperlink (doesn't do it in IE6 if no href is given)
function UnderlineIt(control)
{
    $(control).css('text-decoration', 'underline');
}

// Clears text decoration on the hyperlink 
function NoTextDecoration(control)
{
    $(control).css('text-decoration', 'none');
}



