﻿// Javascript for LoadSession user control.

// Defining constant strings control IDs
var SAVESESSION2_MODAL_POPUP_ID = "TitleBanner1_SaveSession2_ModalPopupExtender";
var SAVESESSION2_HYPER_LINK_ID = "TitleBanner1_SaveSession2_buClose";

var SAVESESSION2_DELAY = 500;


function SAVESESSION2_Close()
{      
    // CLOSE MODAL POPUP WINDOW
    var modalPopupBehavior = $find(SAVESESSION2_MODAL_POPUP_ID);
    if(modalPopupBehavior != null)
    {
        modalPopupBehavior.hide();
    }  
}

function SAVESESSION2_Show()
{      
    // OPEN MODAL POPUP WINDOW
    var modalPopupBehavior = $find(SAVESESSION2_MODAL_POPUP_ID);
    if(modalPopupBehavior != null)
    {
        modalPopupBehavior.show();
        
        // Set focus on main panel. 
        var hyperLink = document.getElementById(SAVESESSION2_HYPER_LINK_ID);
        hyperLink.focus();
        
    }     
}

function SAVESESSION2_Save()
{      
    SAVESESSION2_Close();
    SAVESESSION_Show();
}

// ****** KEY EVENTS *******************************
// **
// **
function SAVESESSION2_stopEvent(e) {
	if(!e) var e = window.event;
	
	//e.cancelBubble is supported by IE - this will kill the bubbling process.
	e.cancelBubble = true;
	e.returnValue = false;

	//e.stopPropagation works only in Firefox.
	if (e.stopPropagation) {
		e.stopPropagation();
		e.preventDefault();
	}
	return false;
}

function SAVESESSION2_OnKeyDown(e)
{
  if (e.keyCode == 27) 
  {
    SAVESESSION2_Close();
    SAVESESSION2_stopEvent(e);
  } 
}


// ************************************************
