(function($) {$(document).ready(function(loaded){

	window.HPDemoTutorialManager = new fnz.portal.videoManager();
	//var video = new fnz.portal.video();
    
    window.launchLightboxVideoClick = function(object) {        
        object.find('.video-link').click(function(a){
          window.playVideo(a, object.find('.video-link').attr('video-id'));
        });
    }
    
    window.playVideo = function(event, videoId) {
		video = window.HPDemoTutorialManager.videoList[videoId];      
  
        FNZ.Popup.Lightbox.show({
            event: event,
            target: "p_l_id=172979&p_p_id=cmscontent_WAR_cmisportlet_INSTANCE_JM9k",
            width: 638,
            modal: true,
            title: video.title,
            tearOff : false,
            resizable: false
        });      
    }
    
    // get URL parameter values
    function getUrlVars()
    {
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for(var i = 0; i < hashes.length; i++)
        {
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    }

    window.launchLightboxVideoClick($('.campaign-footer'));
            
    window.HPDemoTutorialManager.addVideo(0,
                                "How to use SmartText",
                                "<p>Learn how to quickly interpret complex data with SmartText.</p>",
                                '<!-- Start of Brightcove Player --><div style="display: none">&nbsp;</div><!-- By use of this code snippet, I agree to the Brightcove Publisher T and C  found at https://accounts.brightcove.com/en/terms-and-conditions/.  --><script language="JavaScript" type="text/javascript" src="https://sadmin.brightcove.com/js/BrightcoveExperiences.js"><\/script><object id="myExperience1481731060001" class="BrightcoveExperience"><param value="#FFFFFF" name="bgcolor" /><param value="618" name="width" /><param value="412" name="height" /><param value="617256261001" name="playerID" /><param value="AQ~~,AAAAGcmra4k~,UwPgqTD291HJkOO_B6kgZlRUp0JMG02s" name="playerKey" /><param value="true" name="isVid" /><param value="true" name="isUI" /><param value="true" name="dynamicStreaming" /><param value="true" name="secureConnections" /><param value="https://share.brightcove.com/services/messagebroker/amf" name="cacheAMFURL" /><param value="1481731060001" name="@videoPlayer" /><param name="linkBaseURL" value="https://www.nabtrade.com.au/home?video=0"/></object><!--  This script tag will cause the Brightcove Players defined above it to be created as soon as the line is read by the browser. If you wish to have the player instantiated only after the rest of the HTML is processed and the page load is complete, remove the line. --><script type="text/javascript">brightcove.createExperiences();<\/script><!-- End of Brightcove Player -->',
                                "0:45 mins");

    window.HPDemoTutorialManager.addVideo(1,
                                "",
                                "<p>nabtrade Demo.</p>",
                                '<!-- Start of Brightcove Player --><div style="display: none">&nbsp;</div><!-- By use of this code snippet, I agree to the Brightcove Publisher T and C  found at https://accounts.brightcove.com/en/terms-and-conditions/.  --><script language="JavaScript" type="text/javascript" src="https://sadmin.brightcove.com/js/BrightcoveExperiences.js"><\/script><object id="myExperience1481719371001" class="BrightcoveExperience"><param value="#FFFFFF" name="bgcolor" /><param value="618" name="width" /><param value="412" name="height" /><param value="617256261001" name="playerID" /><param value="AQ~~,AAAAGcmra4k~,UwPgqTD291HJkOO_B6kgZlRUp0JMG02s" name="playerKey" /><param value="true" name="isVid" /><param value="true" name="isUI" /><param value="true" name="dynamicStreaming" /><param value="true" name="secureConnections" /><param value="https://share.brightcove.com/services/messagebroker/amf" name="cacheAMFURL" /><param value="1481719371001" name="@videoPlayer" /><param name="linkBaseURL" value="https://www.nabtrade.com.au/home?video=1"/></object><!--  This script tag will cause the Brightcove Players defined above it to be created as soon as the line is read by the browser. If you wish to have the player instantiated only after the rest of the HTML is processed and the page load is complete, remove the line. --><script type="text/javascript">brightcove.createExperiences();<\/script><!-- End of Brightcove Player -->',
                                "0:45 mins");                                
                                
    var playVideo = getUrlVars()["video"]; 
    if (playVideo=="0" || playVideo=="1") {
      window.playVideo(loaded, playVideo);
    } 
                                
});})(jQuery)
