﻿function showPopup(parentID, ev)
{
    /*  The parentID is what element on the page my popup
        is going to be postioned on...and the position is
        determined from positioningMode the in variable passed in.
        
        Positioning Ints
            Center: 1
            BottomLeft: 2
            BottomRight: 3
            TopLeft: 4
            TopRight: 5 
    */
    
    CallParametersPageMethod(parentID);
    
    // set the parentElementID to the parentID...the popup is positioned on this
    $find('popupBhvrPopupBehavior').set_parentElement($get(parentID)); 
    
    // set the positioningMode of where to position upon on the parentID
    $find('popupBhvrPopupBehavior').set_positioningMode(4); 
            
    // this is a work around to cancel the bubbling up done in the body that hides the popup
    //ev.cancelBubble = true;

    // show the popup...
    $find('popupBhvr').showPopup();
}

function hidePopup()
{
    $find('popupBhvrPopupBehavior').hide();
}    

function CallParametersPageMethod(dateId)
{
    PageMethods.GetDateInfo(dateId,onSucceeded,onFailed);
}

function onSucceeded(result,userContext,methodName)
{
    //alert(result);
    $get('WebinarSpeechBubbleEvent').innerHTML=result;
}

function onFailed(error,userContext,methodName)
{
    alert("An error occurred")
}        

var currentRequestFormId;
function requestFormShowPrivacy(requestFormId)
{
    document.getElementById("RequestFormPrivacyPolicy").style.display="block";
    document.getElementById(requestFormId).style.display="none";
    currentRequestFormId = requestFormId;
}
function requestFormHidePrivacy()
{
    document.getElementById("RequestFormPrivacyPolicy").style.display="none";
    document.getElementById(currentRequestFormId).style.display="block";
}
