//////////////////////////////////////////////////////////////////////////////
// loader.js
// This is single include file for 'Co-browsing Client' for Customer.

// Avaya Inc. – Proprietary (Restricted)
// Solely for authorized persons having a need to know
// pursuant to Company instructions.
//
// Copyright © 2013 Avaya Inc. All rights reserved.
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Avaya Inc.
// The copyright notice above does not evidence any actual
// or intended publication of such source code.
//////////////////////////////////////////////////////////////////////////////
(function(g,b,d){
    //flag
    var useMinified = false;
    //Change the path here to suit your deployment
    var path = 	window.location.protocol + "//" + window.location.hostname + ":"+ window.location.port + "/cobrowse_test_app/cobrowse/customer/";
    //labjs code
	var jsSDKPath = window.location.protocol + "//" + window.location.hostname + ":"+ window.location.port + "/cobrowse_test_app/cobrowse/customer/libs/sdk/";
    var c=b.head||b.getElementsByTagName("head"),D="readyState",E="onreadystatechange",F="DOMContentLoaded",G="addEventListener",H=setTimeout;
    function f(){
        var s = document.createElement('link');
        var t = document.createElement('link');
        s.id = 'cbeCSS';s.type = 'text/css';s.rel = 'stylesheet';s.href = path + 'css/cbe.css';document.getElementsByTagName("head")[0].appendChild(s);
        t.id = 'select2';t.type = 'text/css';t.rel = 'stylesheet';t.href = path + 'css/select2.min.css';document.getElementsByTagName("head")[0].appendChild(t);
		
		    //CSS for WEB ANNOTATION
    var r1 = document.createElement('link');
    r1.id = 'annotateCSS';r1.type = 'text/css';r1.rel = 'stylesheet';r1.href = path + 'css/annotate.css';document.getElementsByTagName("head")[0].appendChild(r1);

    

        if(useMinified){
                 $LAB.script(jsSDKPath + "sock.min.js")
                .script(jsSDKPath + "Base64.min.js")
				.script(jsSDKPath + "md5.min.js")				
				.script(jsSDKPath + "select2.js")
				.script(jsSDKPath + "AvayaCoBrowseClientServices.min.js")
				.script(path + "js/cobrowse-sample-gui.min.js").wait()
                .script(path + "js/app.min.js")                
                .wait(function(){cobrowseInit()});
				
				
        }else{
            $LAB.script(jsSDKPath + "sock.js")
                .script(jsSDKPath + "Base64.js")
		.script(jsSDKPath + "md5.js")		
		.script(jsSDKPath + "select2.js")
		.script(jsSDKPath + "AvayaCoBrowseClientServices.min.js")
		.script(path + "js/cobrowse-sample-gui.js").wait()
                .script(path + "js/app.js")                
                .wait(function(){cobrowseInit()});
        }
    };
    H(function(){if("item"in c){if(!c[0]){H(arguments.callee,25);return}c=c[0]}var a=b.createElement("script"),e=false;a.onload=a[E]=function(){if((a[D]&&a[D]!=="complete"&&a[D]!=="loaded")||e){return false}a.onload=a[E]=null;e=true;f()};
        a.src=path+"js/LAB.min.js";
        c.insertBefore(a,c.firstChild)},0);if(b[D]==null&&b[G]){b[D]="loading";b[G](F,d=function(){b.removeEventListener(F,d,false);b[D]="complete"},false)}
})(this,document);
