// http(s)://ssl(2).xorox.net/static/js2/ylighting.js
//
//  new ylighting-specific javascript loadfile for all ylighting pages (templates)
//
//  js is loaded from a directory particular to ylighting vs ylightingtest, and editor vs live
//  also, title is modified for all but ylighting live to indicate version loaded

// defaults: production live from hydra
var isTest = false;              // production (not test) store
var isEditor = false;            // live (not editor)
var jsHost = "ssl.xorox.net";    // fetch js, css from hydra (not hydro)
var traxHost = "ssl.xorox.net";  // where to find trax
var yappHost = "yapp.xorox.net"; // where to find yapp
var jsVersion = "yl";            // yl production live
var titleMsg = "";               // don't add msg to doc title
var initFname = "init.js";       // init file for ylighting
var jsProto = window.location.protocol;	// are we http or https?

// http vs. https
if (!/^http/.test(jsProto))
	jsProto = 'https:';

// detect ylightingtest
if (document.URL.indexOf('ylightingtest') >= 0 || document.URL.indexOf('yhst-63435808889512') >= 0)
    isTest = true;

// detect editor vs. live
if (document.URL.indexOf('edit.store.yahoo') >= 0)
    isEditor = true;

if (!isTest) {
    if (isEditor) {
        // production editor
        titleMsg = "yl-editor";
        jsVersion = "yl-editor";
    }
} else {
    //jsHost = "ssl2.xorox.net";
    // ylightingtest.com test store
    if (isEditor) {
	// test editor
	titleMsg = "yltest-editor";
        jsVersion = "yltest-editor";
    } else {
	// test live
	titleMsg = "yltest";
        jsVersion = "yltest";
    }
}

if (titleMsg) document.title = "** " + titleMsg + ": js2/" + jsVersion + " ** " + document.title;

var jsUrl = jsProto + '//' + jsHost + "/static/js2/" + jsVersion + "/js/";
document.writeln('<script type="text/javascript" src="' + jsUrl + 'kava.js"></script>');
document.writeln('<script type="text/javascript" src="' + jsUrl + initFname + '"></script>');
