// *** Espana site include
// *** Last Updated 06-01-06
if (typeof(wsstag_enabled) == 'undefined' || wsstag_enabled != "false") { //enabtest
// setup paths to js files
// - use relative path starting from domain name to keep the protocol intact

var wsstag_jsConfigURL = "/es/js/wss_cms2_config.js";
var wsstag_jsDirURL = "/es/js/wss_dir2_config.js";
var wsstag_jsImplURL = "/es/js/hbx.js";

var index = document.body.innerHTML.toLowerCase().indexOf("/iframe");
if (index == -1)
	wsstag_enabled = "true";
else 
	wsstag_enabled = "false";

// set ON/OFF flag
if (typeof(wsstag_enabled) == 'undefined')
  var wsstag_enabled = "true";
var wsstag_batch = "false";
var wsstag_location = document.location;
var wsstag_doctitle = document.title;
var _wss_temp_url = null;
var wsstag_querystring = document.location.search;

if (typeof(wss_testonly) != "undefined") {
  if (wss_testonly == "true") {
    wsstag_batch = "true";
    wsstag_location = new Object();
    wsstag_location.protocol = wss_testprotocol;
    wsstag_location.hostname = wss_testhostname;
    wsstag_location.href = wss_testhref;
    wsstag_location.pathname = wss_testpathname;
    wsstag_location.search = wss_testsearch;
    wsstag_doctitle = wss_testtitle;	
  }
}

// Disable tag if page protocol starts with "file"
if (wsstag_location.protocol.indexOf("file") == 0)
{
  wsstag_enabled = "false";
}

// set prod env value
var wsstag_prodEnv = "prod";  // used to compare against environment result
var wsstag_testEnv = "test";

// determine current environment
var wsstag_hostname = location.hostname;
// check for typical non-prod domains as well as IP addresses
var wsstag_regex = new RegExp("\\b(dev|stage|test|localhost|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\b", "i");
var wsstag_matches = wsstag_hostname.match(wsstag_regex);

var wsstag_envResult = "";
if(wsstag_matches == null) {
   wsstag_envResult = "prod";
} else {
   wsstag_envResult = wsstag_matches[1].toLowerCase();
}
if (wsstag_location.href.indexOf('www.mastercard.com') != -1) {
	wsstag_envResult = "prod";
}
if (wsstag_location.href.indexOf('http://mastercard.com') != -1) {
	wsstag_envResult = "prod";
}

// include js files
if (wsstag_enabled == "true") {   
   document.write("<scr"+"ipt src=\""+wsstag_jsDirURL+"\"></scr"+"ipt>");
	document.write("<scr"+"ipt src=\""+wsstag_jsConfigURL+"\"></scr"+"ipt>");
   if (wsstag_batch != "true") {
		if(typeof(wsstag_videoType)!="undefined"){ 
			document.write("<scr"+"ipt src=\""+wsstag_jsImplURL+"\"></scr"+"ipt>");
		}
		else {
			document.write("<scr"+"ipt defer src=\""+wsstag_jsImplURL+"\"></scr"+"ipt>");
		}
   }   
}

}//end enabtest
