﻿window.onload = function () {

    // fix the background image
    var number_of_images = 4;
    var pick_random_image = (Math.floor(Math.random(0) * number_of_images));
    $('div#background_image').css('background-image', 'url(App_Themes/Woberator/bg_woberator_' + pick_random_image + '.jpg)');

    // scroll to the correct step
    var step = $.query.get('step');

    if (step == '' || step == true || isNaN(step) || step < 1 || step > 10) {
        // querstring 'step' is not defined, too big, too small, or not a number: jump to step 1
        $('div#keyhole').scrollTo($("#step01"), 0);
        $('#stepbar a.stepbar01').addClass('selected');
    }
    else {
        // jump to correct step
        var stepstring = String(step);
        if (stepstring.length < 2) stepstring = '0' + stepstring;
        $('div#keyhole').scrollTo($("#step" + stepstring), 0);
        $('#stepbar a.stepbar' + stepstring).addClass('selected');
    }

};