/* Omniture Optimization Suite
 * Copyright (c) Omniture 2001-2008. All rights reserved. Patent Pending.
 * Privacy Policy at http://www.omniture.com/privacy/
 */
/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here. */

// required configuration parameters
var tc = window.tc || {};
tc.site_id = tc.site_id || 235;
tc.log_path = tc.log_path || "/it/xslt/touchclarity";
tc.server_hostname = tc.server_hostname || "mi.lloydstsb.com";


// Value of tc_server_url now set in logging-config.js and is therefore no longer defined or has scope in this script. It is used in logging-code.js
document.write("<scr"+"ipt language='JavaScript' type='text/javascript' src='"+tc.log_path+"/logging-config.js'></scr"+"ipt>\n");

/************************** PLUGINS SECTION *************************/

// #638 Backward-compatability plugin
if (typeof tc.autoStart == 'undefined') { tc.autoStart = true; }

//#430 IB Login detect by URL
if (window.location.href.match('/internet_banking_log_off.asp') || window.location.href.match('/ibAccountOverview/AccountOverview')){
  if (!window.tc_extra_info){
    tc_extra_info = '';
  }
  tc_extra_info += 'tc_isCustomer=true';
}

/* #580 rendering issue IB logoff image wrapping issue */
//document.write('<style type="text/css">span#tc_content_LTSB_LatestOffers,span#tc_content_LTSB_LatestOffers_2,span#tc_content_LTSB_LatestOffers_3{float:left;}</style>');

/* #638 include swfobject.js */
/**
 * SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = {};
if(typeof deconcept.util == "undefined") deconcept.util = {};
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = {};
	this.variables = {};
	this.attributes = [];
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
		if (!deconcept.unloadSet) {
			deconcept.SWFObjectUtil.prepUnload = function() {
				__flash_unloadHandler = function(){};
				__flash_savedUnloadHandler = function(){};
				window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
			}
			window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
			deconcept.unloadSet = true;
		}
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name] || "";
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name] || "";
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = [];
		var key;
		var variables = this.getVariables();
		for(key in variables){
			if (typeof variables[key] == "string" || typeof variables[key] == "number") {
				variablePairs[variablePairs.length] = key +"="+ variables[key];
			}
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			for(var key in params){ 
				if (typeof params[key] == "string" || typeof params[key] == "number") {
					swfNode += [key] +'="'+ params[key] +'" '; 
				}
			}
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
				if (typeof params[key] == "string" || typeof params[key] == "number") {
					swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
				}
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
//				document.write("player v: "+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;


/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
window.undefined=window.undefined;var omtr=window.omtr||{};omtr.extend=function(_1,_2,_3){var _4=_1.split("."),_5=window;if(typeof _3!="boolean"){_3=false;}for(var i=0;i<_4.length;i++){_5[_4[i]]=_5[_4[i]]||{};_5=_5[_4[i]];}for(var _7 in _2){if(_3||typeof _5[_7]=="undefined"){_5[_7]=_2[_7];}}return _5;};omtr.extend("omtr.tc.plugin.backwards_compatibility",{init:function(_8){var _9=window;_9.tc_log=omtr.tc.log;_9.tc_redirect=omtr.tc.redirect;_9.tc_open_window=omtr.tc.open_window;_9.tc_optimise=omtr.tc.optimize;var i,_b,_c="undefined",_d=["active","site_id","timeout","page_alias","extra_info","referrer","products","containers","log_path"];for(i=0;i<_d.length;i++){_b=_d[i];if(typeof _9["tc_"+_b]!==_c){_8[_b]=_9["tc_"+_b];}}if(typeof _9.tc_server_url!==_c){_8.server_hostname=_9.tc_server_url;}}});omtr.extend("omtr.tc.plugin",{tc_swf_content:function(_e,_f){if(!_e||!(typeof _e=="object")){return _f;}if(typeof deconcept!="object"||typeof deconcept.SWFObject!="function"){return _f;}_e.id=_e.id||"tc-flash-content";_e.version=_e.version||"6.0.65";_e.backgroundColor=_e.backgroundColor||"#FFFFFF";if(!_e.swf||!_e.width||!_e.height){return _f;}var _10=new deconcept.SWFObject(_e.swf,_e["id"],_e.width,_e.height,_e.version,_e.backgroundColor,false,_e["quality"],false,_e["detectKey"],_e["detection"]);if(_e.vars&&typeof _e.vars=="object"){var a=[];for(var i=0;i<_e.vars.length;i++){if(typeof _e.vars[i]=="string"){a[i]=_e.vars[i].split("=");_10.addVariable(a[i][0],a[i][1]);}}}if(_10.installedVer.versionIsValid(_10.getAttribute("version"))){return _10.getSWFHTML();}else{return _f;}}});window.tc_swf_content=omtr.tc.plugin.tc_swf_content;omtr.extend("omtr.tc",{Version:"5.1",Vendor:"Omniture",Product:"TouchClarity"});(function(){var _13=function(){var _14="undefined";var api=this;var _16=window.location;var _17={timeout:5,site_id:425,server_hostname:"tagging-qa.touchclarity.com",active:true,base_url:_16.href,products:"",referrer:(function(){if(typeof document.referrer==_14){return _14;}if(document.referrer===null){return "null";}if(document.referrer===""){return "empty";}return document.referrer;})(),log_path:"/touchclarity",containers:new function(){var _18=function(id,_1a){this.id=id;this.rendered=false;this.displayed=false;this.defaulted=false;this.error=false;this.content="";this.default_content=_1a;this.timeout_id=null;this.coids=[];};var ccs={};this.add=function(_1c){var cc=new _18(_1c,"");ccs[_1c]=cc;return cc;};this.get=function(_1e){var cc=ccs[_1e];if(!cc){cc=this.add(_1e);cc.error=true;}return cc;};this.getAll=function(){var _20=[];for(var id in ccs){if(ccs[id].constructor==_18){_20.push(ccs[id]);}}return _20;};this.getIDs=function(){var ids=[];for(var id in ccs){if(ccs[id].constructor==_18){ids.push(id);}}return ids;};}()};var _24=new function(){var _25=encodeURIComponent||escape;this.getLogURL=function(_26,_27,_28,_29,_2a){var _2b=function(url){if(typeof url==_14||url===""||url===null){return _16.href;}url=""+url;if(url.substring(0,4)!="http"&&url.substring(0,1)!="/"){url=_16.pathname.substring(0,_16.pathname.lastIndexOf("/")+1)+url;}if(url.substring(0,1)=="/"){url=api.logger.http+_16.host+url;}return url;};var _2d=function(_2e){_2e=(typeof _2e!=_14?_2e:_17.base_url);if(_2e.indexOf("?")>0){_2e=_2e.substring(0,_2e.indexOf("?"));}var al=(_2e!=api.logger.http+_16.host+_16.pathname);return al;};if(typeof _26==_14){_26="i";}if(typeof _27==_14){_27=_17.base_url;}_27=_2b(_27);var url=api.logger.http+_17.server_hostname+"/"+_26+"?siteID="+_17.site_id;var _31=new Date().getTime();url+="&ts="+(typeof _29!=_14?_29:_31);var _32=_17.containers.getIDs();if(_32.length>0){for(var cc=0;cc<_32.length;cc++){url+="&ccID="+_25(_32[cc]);}}if(_26=="c"){url+="&log=no";}var al=_2d(_27);if(al){url+="&alias=true";}if(_28&&_28.length){url+="&prod="+_25(_28);}if(typeof _2a!=_14){url+=_2a;}_27=_25(_27);while(_27.length>1999-url.length){_27=_27.substring(0,_27.lastIndexOf(_25("&")));}url+="&location="+_27;var dg={};dg.tagv=_25(omtr.tc.Version);dg.tz=0-(new Date().getTimezoneOffset());dg.r=_25(_17.referrer);dg.title=""+_25(document.title);if(al){dg.aliased=_25(_16.href);}if(screen){dg.cd=screen.colorDepth;dg.ah=screen.availHeight;dg.aw=screen.availWidth;dg.sh=screen.height;dg.sw=screen.width;dg.pd=screen.pixelDepth;}for(var key in dg){if((typeof (dg[key])!=("function"))&&(typeof (dg[key])!=("array"))&&(typeof (dg[key])!=("object"))){var _37="&"+key+"="+dg[key];if(url.length+_37.length<2000){url+=_37;}else{break;}}}return url;};}();this.logger=new function(){var _38=this;this.loaded=true;this.http="http"+(_16.href.substring(0,6)=="https:"?"s":"")+"://";var _39=false;var _3a=false;var _3b=[];var _3c=function(_3d,url,_3f,_40,_41){if(typeof url==_14||url===""){return false;}if(_17.active){var _42=new Image();_42.src=_24.getLogURL("i",_3f,_41,new Date().getTime());_3b.push(_42);}if(typeof _40==_14){return window.open(url,_3d);}else{return window.open(url,_3d,_40);}};var _43=function(_44,_45,_46){if(!_17.active){return null;}var _47=new Image();_47.src=_24.getLogURL("i",_44,_45,new Date().getTime(),_46);_3b.push(_47);return _47;};var _48=function(_49,url,_4b,_4c,_4d,_4e){var _4f=null;if(typeof url==_14||url===""){return;}if(typeof _4e==_14||_4e===""){_4e="window.location.href='"+url+"'";}if(typeof _4b==_14){_4b=url;}if(typeof _49==_14||_49===""||_49=="_self"){if(_17.active){_4f=new Image();_4f.timeout_id=setTimeout(_4e,(_17.timeout*1000));_4f.onload=function(){eval(_4e);clearTimeout(_38.image.timeout_id);};_4f.onerror=function(){eval(_4e);clearTimeout(_38.image.timeout_id);};_4f.src=_24.getLogURL("i",_4b,_4d,new Date().getTime());_3b.push(_4f);}else{eval(_4e);}}else{if(typeof _49=="object"&&_49.document){if(_17.active){_4f=new Image();_4f.src=_24.getLogURL("i",_4b,_4d);_3b.push(_4f);}_49.location.href=url;}else{_3c(_49,url,_4b,_4c,_4d);}}};var _50=function(_51){if(_51.containers){return null;}else{var _52=null;if(_17.active&&!_3a){_52=_43();_52.onload=function(){_39=true;};}_3a=true;return _52;}};this.init=function(_53){if(_3a){return;}if(typeof _53!="object"){if(typeof window.tc=="object"){_53=window.tc;}else{_53={};}}if(_53.active===false||_53.active==="false"||_53.active===0){_17.active=false;}if(_53.site_id){_17.site_id=_53.site_id;}if(_53.server_hostname){_17.server_hostname=_53.server_hostname;}if(_53.page_alias){_17.base_url=_53.page_alias;}if(_53.extra_info){_17.base_url+=(_17.base_url.indexOf("?")>0?"&":"?")+_53.extra_info;}if(_53.products){_17.products=_53.products;}if(_53.referrer){_17.referrer=_53.referrer;}_50(_53);};api.log=_43;api.redirect=_48;}();this.targeter=new function(){this.loaded=true;this.content_url="";var _54=false;var _55=false;var _56=function(){return (!document.getElementById&&!document.all);};var _57=function(){if(_55===true){return 0;}var cc,_59=_17.containers.getAll(),_5a="",_5b=0,_5c=0,_5d=0;for(var i=0;i<_59.length;i++){cc=_59[i];if(cc.error){_5a+="&error="+cc.id;_5b++;}}if(_5b>0){api.log(null,null,_5a);_55=true;return 3;}for(var i=0;i<_59.length;i++){cc=_59[i];if(!cc.displayed&&!cc.defaulted){return 0;}if(cc.defaulted){_5a+="&default="+cc.id;_5c++;}else{for(var co=0;co<cc.coids.length;co++){_5a+="&displayed="+cc.coids[co];_5d++;}}}api.log(null,null,_5a);_55=true;var _60=1;if(_5c>0&&_5d==0){_60=2;}if(_5c>0&&_5d>0){_60=3;}return _60;};api.report=_57;var _61=function(cc){return (function(){if(!cc.displayed){cc.defaulted=true;document.getElementById("tc_content_"+cc.id).innerHTML=cc.default_content;}omtr.tc.report();});};var _63=function(id,_65){var _66=function(_67){document.write("<div id='tc_content_"+id+"'>"+_67+"</div>");};if(_56()){_66(_65);return;}var cc=_17.containers.get(id);cc.default_content=_65;if(cc.error===true){_66(_65);}else{if(cc.content!==""){if(cc.content=="__default__"){_66(cc.default_content);}else{_66(cc.content);}cc.displayed=true;}else{_66("");cc.rendered=true;if(cc.default_content){var _69=_61(cc);cc.timeout_id=setTimeout(_69,_17.timeout*1000);}}}omtr.tc.report();};var _6a=function(_6b,_6c,_6d){var cc=_17.containers.get(_6b);if(cc.defaulted){return;}cc.coids.push(_6c);if(cc.rendered){if(_6d=="__default__"){_6d=cc.default_content;}document.getElementById("tc_content_"+_6b).innerHTML+=_6d;cc.displayed=true;}else{cc.content+=_6d;}};this.init=function(_6f){if(_54){return;}if(typeof _6f.containers=="string"){_17.containers.add(_6f.containers);}else{if(_6f.containers&&_6f.containers.length){for(var i=0;i<_6f.containers.length;i++){_17.containers.add(_6f.containers[i]);}}else{return;}}if(_6f.log_path){_17.log_path=_6f.log_path;}if(_17.active&&!_56()){var _71=_6f.test?_24.fixURL(_6f.test):_24.getLogURL("c");this.content_url="<scr"+"ipt src='"+_71+"'></scr"+"ipt>";if(_6f.test){document.writeln(this.content_url);}else{document.writeln("<iframe id='tc_iframe' src='"+_17.log_path+"/tc_targeting.html' width=0 height=0 style='display:none'></iframe>");}}_54=true;};api.optimize=_63;api.set_content=_6a;}();var _72=function(_73){if(omtr.tc.plugin){for(var _74 in omtr.tc.plugin){if(omtr.tc.plugin[_74].init){omtr.tc.plugin[_74].init(_73);}}}};var _75=false;this.init=function(_76){if(_75){return;}if(typeof _76!="object"){if(typeof window.tc=="object"){_76=window.tc;}else{_76={};}}_72(_76);this.logger.init(_76);this.targeter.init(_76);_75=true;};};omtr.extend("omtr.tc",new _13());if(window.tc&&window.tc.autoStart){omtr.tc.init(tc);}})();
