﻿// JScript File

var ContentContainer = [];
var popUpLoad = [];
var popUpTargets = [];
var popUpNoClientContent = [];

function PopUpAggregatorNoClientContent(popUpElement,targetId)
{
    var n = new Object();
    n.targetID = targetId;
    n.popUpElement = popUpElement;
    popUpNoClientContent.push(n);
}
//Grabs all the PopUp script calls where a contentGuid and targetid are passed
function PopUpAggregator(contentGuid,targetId)
{
    var n = new Object();
    n.targetID = targetId;
    n.contentGuid = contentGuid;
    popUpTargets.push(n);
}
//Aggregates the pop up information to be hooked up on the PageLoad call to initPopUps
function PopUpAggregatorJSON(json)
{
    if ( json != null  && json != ""){popUpLoad.push(json);}
}

//Aggregates the Content information to be hooked up on the PageLoad call to LoadContent
function ContentAggregator(json)
{
    if ( json != null && json != "" ){ContentContainer.push(json);}
}
//Iterates through the pop ups and gets hooks up the extender to the created pop up
function initPopUps()
{
    for(var i=0;i<= popUpTargets.length -1;i++)
    {
        setPopup(popUpTargets[i].contentGuid,popUpTargets[i].targetID);
    }
}
function initNonClientContentPopUps()
{
    for(var i=0;i<= popUpNoClientContent.length -1;i++)
    {
        createPopUp(popUpNoClientContent[i].popUpElement,popUpNoClientContent[i].targetID);
    }
}
//Add the content items to the ClientContent object
function LoadContent()
{
    if ( ClientContent == null ){return;}
    //alert("Load Content Called and ClientContent object is null!");
    for(var i=0;i<=ContentContainer.length -1 ;i++)
    {
       ClientContent.AddContentItem(ContentContainer[i]);
    }
}
