// JavaScript Document
(function() {
    function async_load(){
        
        
        var b = '/assets/js/'
        
        // Load the utilities 
        SL.load(b + 'utils/utils.js', olg);
        // Load JSON 
        SL.load(b + 'utils/Json2.js', olg );
        
        // Load frameworks
        
        
        SL.load(b+'modal/modal.css', olg); 
        SL.load('/LPCremote/com/Connex/assets/usermenu-styles.css', olg,'','css');
        
        
        // Connect
        // SL.load('http://www.nightclubauthority.com/LPCremote/js/OAuthScripts/Conx.js', onConnect );
        // Locally managed...for now ( sight )
        
        
        
        
        //SL.load('http://www.nightclubauthority.com/LPCremote/js/OAuthScripts/Conx.js', onConnect );
         
        function olg()
        {}
        
        function onConnect ()
        {
            // instantiate and trigger the class. Only Once...
            if (ci == false)
            {
                //ci = new Connect('user-panel','', 'ci','/nca-proxy.php'); 
                ci = new Connect('user-panel','', 'ci');
                ci.init(); 
                
                //SL.load(b+ 'swf_object.js', onSWFObject);              
                
            }
        }
        function onSWFObject()
        {
            if ( window.rfc !== 'undefined')
            {
                window.rfc('fuck you!');
            }
        }
        
        // Google Analytics
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        SL.load(gaJsHost + 'google-analytics.com/ga.js', onLoadGoogleAnalytics );
        
        function onLoadGoogleAnalytics()
        {
           var pageTracker = _gat._getTracker("UA-5510736-7");
           pageTracker._trackPageview();
        }
        
        
        // JQUERY 
        
        SL.load('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', oljq);
        
        function oljq()
        {
            SL.load(b+'jquery/loopedslider.js', oljq_slide);
            SL.load(b+'jquery/modal/modal.js', oljq_sm);
            // Load as dependant since it used as such. 
            SL.load('/LPCremote/js/OAuthScripts/Conx.js', onConnect );
        }
        function oljq_slide()
        {
            // Start the show !!!
          	// Option set as a global variable
          	$.fn.loopedSlider.defaults.addPagination = false;
            $.fn.loopedSlider.defaults.containerClick = true;
          	$('#loopedSlider').loopedSlider();
   
        }
        function oljq_sm()
        {
            SL.load(b+'jquery/modal/dialogs/mod_pluggins.js', oljq_mods);
        }
        function oljq_mods()
        {
            var usr = new Object();
                usr.UserFirst = 'Guest'; 
                usr.UserLast =  '';
            // $('body').mp_phoneInput(usr);
        }
    }
    
    //var connectInstance = false;
    
    if (window.attachEvent) window.attachEvent('onload', async_load);
    else window.addEventListener('load', async_load, false);
})();
var ci = false;
