$(function () {

    // run the code in the markup!

    $('#s4').before('<div id="nav-s4">').cycle({
        fx: 'fade',
        speed: 'slow',
        timeout: 5000,
        random: 0,
        pager: '#nav-s4'
    });

});

$(function () {

    // run the code in the markup!

    $('table pre code').not('#skip,#skip2').each(function () {

        eval($(this).text());

    });

    $('#s2').cycle({
        fx: 'fade',
        speed: 'slow',
        timeout: 0,
        next: '#next2',
        prev: '#prev2'
    });

});



function onBefore() {

    $('#output').html("Scrolling image:<br>" + this.src);

    //window.console.log(  $(this).parent().children().index(this) );

}

function onAfter() {

    $('#output').html("Scroll complete for:<br>" + this.src)

        .append('<h3>' + this.alt + '</h3>');

}

$.fn.cycle.defaults.speed = 5000;

$.fn.cycle.defaults.timeout = 1000;

$.fn.cycle.defaults.random = true;



$(function () {


    $('#fade').cycle();

});
$(document).ready(function () {

    $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav

    $("ul.navigation li span").click(function () { //When trigger is clicked...

        //Following events are applied to the subnav itself (moving subnav up and down)
        $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

        $(this).parent().hover(function () {
        }, function () {
            $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
        });

        //Following events are applied to the trigger (Hover events for the trigger)
    }).hover(function () {
        $(this).addClass("subhover"); //On hover over, add class "subhover"
    }, function () {  //On Hover Out
        $(this).removeClass("subhover"); //On hover out, remove class "subhover"
    });

    $(document).ready(function () {
        prepareFormFieldsLabelInside();
    });
    function prepareFormFieldsLabelInside() {
        $('textarea[title]').focus(function () { showHideInputValue($(this), 'focus') }).blur(function () { showHideInputValue($(this), 'blur') }).each(function () { showHideInputValue($(this), 'blur') });
        $('input[type=text][title]').focus(function () { showHideInputValue($(this), 'focus') }).blur(function () { showHideInputValue($(this), 'blur') }).each(function () { showHideInputValue($(this), 'blur') });
    }

    function showHideInputValue(argObj, argStrType) {
        if (argStrType == 'focus' && $(argObj).val() == $(argObj).attr('title'))
            $(argObj).val('')
        else if ($(argObj).val() == "")
            $(argObj).val($(argObj).attr('title'))
    }

    $(window).bind("load", function () {

        $("div#basic").slideViewerPro({
            NovicellthumbsHeight: 95,
            NovicellthumbsWidth: 100,
            thumbs: 6
        });
    });
});


