﻿/*
* SimpleModal Confirm Modal Dialog
* http://www.ericmmartin.com/projects/simplemodal/
* http://code.google.com/p/simplemodal/
*
* Copyright (c) 2008 Eric Martin - http://ericmmartin.com
*
* Licensed under the MIT license:
*   http://www.opensource.org/licenses/mit-license.php
*
* Revision: $Id: confirm.js 170 2008-12-04 19:03:12Z emartin24 $
*
*/
function nooption(){
    alert("No Option")
}


function confirm(message, callback) {
     $('#confirm').modal({
        close: false,
        position: ["20%", ],
        overlayId: 'confirmModalOverlay',
        containerId: 'confirmModalContainer',
        onShow: function(dialog) {
            dialog.data.find('.message').append(message);

            // if the user clicks "yes"
            dialog.data.find('.yes').click(function() {
                // call the callback
                if ($.isFunction(callback)) {
                    callback.apply();
                }
                // close the dialog
                $.modal.close();
            });
        }
    });
}

//Add parameters to make it more flexible
function show_modal(modal_id) {

    var panelContainer = document.getElementById(modal_id);

    //set display to block and opacity to 0 so we can use fadeTo
    $('#mask').css({ display: 'block', opacity: 0 });
    //hide dropdown boxes since mask will not cover in IE6
    $('.planOptions_Dropdown').css({ display: 'none' });
    $('.CustomControl_Text').css({ display: 'none' });
    $('.AuthorizedByDropdown').css({ display: 'none' });

    //fade in the mask to opacity 0.8
    $('#mask').fadeTo(600, 0.8);

    //show the modal window
    $('#' + modal_id).fadeIn(600);
    panelContainer.scrollIntoView();
    document.getElementById(modal_id).focus();
    document.body.onfocus = function() { document.getElementById(modal_id).focus(); };
    runLongProcess();
}
var ImageNum = 0;
var imagesTotal = 10;

function runLongProcess() {

    window.focus();
    var imgNum = 0;
    ImageArry = new Array(imagesTotal);
    for (var i = 0; i < imagesTotal; i++) {
        ImageArry[i] = new Image();
        imgNum = i + 1;
        ImageArry[i].src = "../../Images/Progress/stm_progress_" + imgNum + ".gif";
    }

    setTimeout('anim()', 100);
}

function anim() {
    ImageNum = (ImageNum + 1) % imagesTotal;
    document.getElementById("animgif").src = ImageArry[ImageNum].src;
    setTimeout('anim()', 100)
}
