/* 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. */

tc = window.tc || {};
tc.site_id = tc.site_id || 484;
tc.log_path = tc.log_path || "/touchclarity";
//tc.server_hostname = tc.server_hostname || "test2.tc-prelive.com";
tc.server_hostname = tc.server_hostname || "tc.barclays.co.uk";

/************************** PLUGINS SECTION *************************/

// #692 alias www pages
(function (config) {
	var find = function	(str) {
		return window.location.pathname.indexOf(str) > -1;
	}
	var get_param =	function (param) {
		var query =	window.location.search.substring(1);
		var startPos = query.toLowerCase().indexOf(param.toLowerCase()+"=");
		if (startPos> -1) {
			startPos = startPos + param.length + 1;
			var	endPos = query.indexOf("&",startPos);
			if (endPos == -1) endPos = query.length;
			return unescape(query.substring(startPos,endPos)).toLowerCase();
		}
		return "";
	}
	if (config.page_alias || window.tc_page_alias) {
		return;
	}
	if (find('/brccontrol') || find('/brcscontrol') || find('/brcucontrol')) {
		var id = get_param("value"), loc = window.location;
		if (isNaN(id))
			config.page_alias = id + loc.search;
		else
		{
			config.page_alias = loc.href.substring(0,loc.href.indexOf("?"));
			config.page_alias += "/page-" + id + loc.search;
		}
	}
})(tc);

// #692 autostart
if (typeof tc.autoStart == 'undefined') { tc.autoStart = true; }

/************* 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",{Version:"5.1",Vendor:"Omniture",Product:"TouchClarity"});(function(){var _e=function(){var _f="undefined";var api=this;var _11=window.location;var _12={timeout:5,site_id:425,server_hostname:"tagging-qa.touchclarity.com",active:true,base_url:_11.href,products:"",referrer:(function(){if(typeof document.referrer==_f){return _f;}if(document.referrer===null){return "null";}if(document.referrer===""){return "empty";}return document.referrer;})(),log_path:"/touchclarity",containers:new function(){var _13=function(id,_15){this.id=id;this.rendered=false;this.displayed=false;this.defaulted=false;this.error=false;this.content="";this.default_content=_15;this.timeout_id=null;this.coids=[];};var ccs={};this.add=function(_17){var cc=new _13(_17,"");ccs[_17]=cc;return cc;};this.get=function(_19){var cc=ccs[_19];if(!cc){cc=this.add(_19);cc.error=true;}return cc;};this.getAll=function(){var _1b=[];for(var id in ccs){if(ccs[id].constructor==_13){_1b.push(ccs[id]);}}return _1b;};this.getIDs=function(){var ids=[];for(var id in ccs){if(ccs[id].constructor==_13){ids.push(id);}}return ids;};}()};var _1f=new function(){var _20=encodeURIComponent||escape;this.getLogURL=function(_21,_22,_23,_24,_25){var _26=function(url){if(typeof url==_f||url===""||url===null){return _11.href;}url=""+url;if(url.substring(0,4)!="http"&&url.substring(0,1)!="/"){url=_11.pathname.substring(0,_11.pathname.lastIndexOf("/")+1)+url;}if(url.substring(0,1)=="/"){url=api.logger.http+_11.host+url;}return url;};var _28=function(_29){_29=(typeof _29!=_f?_29:_12.base_url);if(_29.indexOf("?")>0){_29=_29.substring(0,_29.indexOf("?"));}var al=(_29!=api.logger.http+_11.host+_11.pathname);return al;};if(typeof _21==_f){_21="i";}if(typeof _22==_f){_22=_12.base_url;}_22=_26(_22);var url=api.logger.http+_12.server_hostname+"/"+_21+"?siteID="+_12.site_id;var _2c=new Date().getTime();url+="&ts="+(typeof _24!=_f?_24:_2c);var _2d=_12.containers.getIDs();if(_2d.length>0){for(var cc=0;cc<_2d.length;cc++){url+="&ccID="+_20(_2d[cc]);}}if(_21=="c"){url+="&log=no";}var al=_28(_22);if(al){url+="&alias=true";}if(_23&&_23.length){url+="&prod="+_20(_23);}if(typeof _25!=_f){url+=_25;}_22=_20(_22);while(_22.length>1999-url.length){_22=_22.substring(0,_22.lastIndexOf(_20("&")));}url+="&location="+_22;var dg={};dg.tagv=_20(omtr.tc.Version);dg.tz=0-(new Date().getTimezoneOffset());dg.r=_20(_12.referrer);dg.title=""+_20(document.title);if(al){dg.aliased=_20(_11.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 _32="&"+key+"="+dg[key];if(url.length+_32.length<2000){url+=_32;}else{break;}}}return url;};}();this.logger=new function(){var _33=this;this.loaded=true;this.http="http"+(_11.href.substring(0,6)=="https:"?"s":"")+"://";var _34=false;var _35=false;var _36=[];var _37=function(_38,url,_3a,_3b,_3c){if(typeof url==_f||url===""){return false;}if(_12.active){var _3d=new Image();_3d.src=_1f.getLogURL("i",_3a,_3c,new Date().getTime());_36.push(_3d);}if(typeof _3b==_f){return window.open(url,_38);}else{return window.open(url,_38,_3b);}};var _3e=function(_3f,_40,_41){if(!_12.active){return null;}var _42=new Image();_42.src=_1f.getLogURL("i",_3f,_40,new Date().getTime(),_41);_36.push(_42);return _42;};var _43=function(_44,url,_46,_47,_48,_49){var _4a=null;if(typeof url==_f||url===""){return;}if(typeof _49==_f||_49===""){_49="window.location.href='"+url+"'";}if(typeof _46==_f){_46=url;}if(typeof _44==_f||_44===""||_44=="_self"){if(_12.active){_4a=new Image();_4a.timeout_id=setTimeout(_49,(_12.timeout*1000));_4a.onload=function(){eval(_49);clearTimeout(_33.image.timeout_id);};_4a.onerror=function(){eval(_49);clearTimeout(_33.image.timeout_id);};_4a.src=_1f.getLogURL("i",_46,_48,new Date().getTime());_36.push(_4a);}else{eval(_49);}}else{if(typeof _44=="object"&&_44.document){if(_12.active){_4a=new Image();_4a.src=_1f.getLogURL("i",_46,_48);_36.push(_4a);}_44.location.href=url;}else{_37(_44,url,_46,_47,_48);}}};var _4b=function(_4c){if(_4c.containers){return null;}else{var _4d=null;if(_12.active&&!_35){_4d=_3e();_4d.onload=function(){_34=true;};}_35=true;return _4d;}};this.init=function(_4e){if(_35){return;}if(typeof _4e!="object"){if(typeof window.tc=="object"){_4e=window.tc;}else{_4e={};}}if(_4e.active===false||_4e.active==="false"||_4e.active===0){_12.active=false;}if(_4e.site_id){_12.site_id=_4e.site_id;}if(_4e.server_hostname){_12.server_hostname=_4e.server_hostname;}if(_4e.page_alias){_12.base_url=_4e.page_alias;}if(_4e.extra_info){_12.base_url+=(_12.base_url.indexOf("?")>0?"&":"?")+_4e.extra_info;}if(_4e.products){_12.products=_4e.products;}if(_4e.referrer){_12.referrer=_4e.referrer;}_4b(_4e);};api.log=_3e;api.redirect=_43;}();this.targeter=new function(){this.loaded=true;this.content_url="";var _4f=false;var _50=false;var _51=function(){return (!document.getElementById&&!document.all);};var _52=function(){if(_50===true){return 0;}var cc,_54=_12.containers.getAll(),_55="",_56=0,_57=0,_58=0;for(var i=0;i<_54.length;i++){cc=_54[i];if(cc.error){_55+="&error="+cc.id;_56++;}}if(_56>0){api.log(null,null,_55);_50=true;return 3;}for(var i=0;i<_54.length;i++){cc=_54[i];if(!cc.displayed&&!cc.defaulted){return 0;}if(cc.defaulted){_55+="&default="+cc.id;_57++;}else{for(var co=0;co<cc.coids.length;co++){_55+="&displayed="+cc.coids[co];_58++;}}}api.log(null,null,_55);_50=true;var _5b=1;if(_57>0&&_58==0){_5b=2;}if(_57>0&&_58>0){_5b=3;}return _5b;};api.report=_52;var _5c=function(cc){return (function(){if(!cc.displayed){cc.defaulted=true;document.getElementById("tc_content_"+cc.id).innerHTML=cc.default_content;}omtr.tc.report();});};var _5e=function(id,_60){var _61=function(_62){document.write("<span id='tc_content_"+id+"'>"+_62+"</span>");};if(_51()){_61(_60);return;}var cc=_12.containers.get(id);cc.default_content=_60;if(cc.error===true){_61(_60);}else{if(cc.content!==""){if(cc.content=="__default__"){_61(cc.default_content);}else{_61(cc.content);}cc.displayed=true;}else{_61("");cc.rendered=true;if(cc.default_content){var _64=_5c(cc);cc.timeout_id=setTimeout(_64,_12.timeout*1000);}}}omtr.tc.report();};var _65=function(_66,_67,_68){var cc=_12.containers.get(_66);if(cc.defaulted){return;}cc.coids.push(_67);if(cc.rendered){if(_68=="__default__"){_68=cc.default_content;}document.getElementById("tc_content_"+_66).innerHTML+=_68;cc.displayed=true;}else{cc.content+=_68;}};this.init=function(_6a){if(_4f){return;}if(typeof _6a.containers=="string"){_12.containers.add(_6a.containers);}else{if(_6a.containers&&_6a.containers.length){for(var i=0;i<_6a.containers.length;i++){_12.containers.add(_6a.containers[i]);}}else{return;}}if(_6a.log_path){_12.log_path=_6a.log_path;}if(_12.active&&!_51()){var _6c=_6a.test?_1f.fixURL(_6a.test):_1f.getLogURL("c");this.content_url="<scr"+"ipt src='"+_6c+"'></scr"+"ipt>";if(_6a.test){document.writeln(this.content_url);}else{document.writeln("<iframe id='tc_iframe' src='"+_12.log_path+"/tc_targeting.html' width=0 height=0 style='display:none'></iframe>");}}_4f=true;};api.optimize=_5e;api.set_content=_65;}();var _6d=function(_6e){if(omtr.tc.plugin){for(var _6f in omtr.tc.plugin){if(omtr.tc.plugin[_6f].init){omtr.tc.plugin[_6f].init(_6e);}}}};var _70=false;this.init=function(_71){if(_70){return;}if(typeof _71!="object"){if(typeof window.tc=="object"){_71=window.tc;}else{_71={};}}_6d(_71);this.logger.init(_71);this.targeter.init(_71);_70=true;};};omtr.extend("omtr.tc",new _e());if(window.tc&&window.tc.autoStart){omtr.tc.init(tc);}})();

