// http(s)://ssl(2).xorox.net/static/js2/yliving.js
//
//  new yliving-specific javascript loadfile for all yliving pages (templates)
//
//  js is loaded from a directory particular to yliving editor vs live
//  also, title is modified for all but yliving 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 = "yv";            // yliving production live
var titleMsg = "";               // don't add msg to doc title
var initFname = "init-zw.js";    // init file for yliving
var jsProto = window.location.protocol;	// are we http or https?
var storeYahooName = 'yhst-37542584897213';	// yahoo internal name for store

// 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 (document.URL.indexOf('ylivingcs.com') >= 0) {
	isTest = false;
	isEditor = true;
}

if (document.URL.indexOf('ylivingtest.com') >= 0) {
	isTest = false;
	isEditor = true;
}

if (1 || !isTest) {
    if (isEditor) {
        // production editor
        titleMsg = "yv-editor";
        jsVersion = "yv-editor";
    }
} else {
	if (isEditor) {
		titleMsg = "yvtest-editor";
		jsVersion = "yvtest-editor";
	} else {
		titleMsg = "yvtest";
		jsVersion = "yvtest";
	}
}

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>');

