﻿// JScript File

//production will be replaced by the environment (production, staging, dev) on the server before
// tremorapp.js is returned.  It stays "production" when running from file system
var env = "production";
var tremor_host;
var commonUrl;
var debug = false;
var tremor_js_url;
var ajaxUrlPath = 'service.ashx';

if (env == 'production' || env == 'staging')
{
    tremor_host = document.location.host;
    commonUrl = '/common/v2';
    tremor_js_url = "/common/v2/js/tremor.js";
    ajaxUrlPath = 'service.ashx';
}
else if (env == "qa")
{
    tremor_host = "cvgintqa01";
    commonUrl = 'http://cvgintqa01/common/v2';
    tremor_js_url = "http://cvgintqa01/common/v2/js/tremor.js";
    ajaxUrlPath = 'service.ashx';
}
else if (env == "dev") // production wasn't replaced so it came from a file instead of the server
{
    // put the values for the server you are testing against here
    tremor_host = location.host;
    commonUrl = 'http://'+location.host+'/common/v2';
    tremor_js_url = 'http://'+location.host+'/common/v2/js/tremor.js';
    ajaxUrlPath = 'service.ashx';
    debug = true;
    if (location.search.indexOf("debug=false")>0)
    {
        debug = false;
    }
}
else if (env == "production") // production wasn't replaced so it came from a file instead of the server
{
    // put the values for the server you are testing against here
    tremor_host = "cvgintqa01";
    commonUrl = 'http://cvgintqa01/common/v2';
    tremor_js_url = "http://cvgintqa01/common/v2/js/tremor.js";
    ajaxUrlPath = 'http://cvgintqa01/vp/service.ashx';
    debug = false;
}

 
 

var TremorApp = {
    debug : debug,
    debug_level : "long",
    log_level : {ajax:2,content:2, DEFAULT:4,popup:1,calendar:1,validation:1,tree:4},
    log_style : {"exception":"color:red;text-decoration:underline","ajax":"color:#77f"},

    require_auth : "none",
    require_auth_role : ["member"],
    realm : 'vocalpoint',
    login_page:'login.html',

    program_name:'Vocalpoint Microsite',
     
    ajax_url: ajaxUrlPath,
    ajax_url_secure: ajaxUrlPath,

    common_url: commonUrl,
     
    cookie_expiration_days: 30,

    modules: ["default","form","security","calendar","tree","controls"]
}


function includeJS(jsPath){
var js = document.createElement("script");
js.setAttribute("type", "text/javascript");
js.setAttribute("src", jsPath);
document.getElementsByTagName("head")[0].appendChild(js);
}

//includeJS(tremor_js_url);
document.write('<scr'+'ipt type="text/javascript" language="javascript" src="'+tremor_js_url+'">\<\/scr'+'ipt>');