// Legacy wrapped ads support

var wrap = null;



// Browser sniffer constructor

function Is () {

	// convert all characters to lowercase to simplify testing

	var agt=navigator.userAgent.toLowerCase();



	// *** BROWSER VERSION ***

	// Note: On IE5, these return 4, so use is.ie5up to detect IE5.



	this.major = parseInt(navigator.appVersion);

	this.minor = parseFloat(navigator.appVersion);



	// Note: Opera and WebTV spoof Navigator.  We do strict client detection.

	// If you want to allow spoofing, take out the tests for opera and webtv.

	this.nav     = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)

			 	   && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)

				   && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

	this.nav4    = (this.nav && (this.major == 4));

	this.nav4up  = (this.nav && (this.major >= 4));

	this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) 

				   || (agt.indexOf("; nav") != -1)) );

	this.nav6    = (this.nav && (this.major == 5));

	this.nav6up  = (this.nav && (this.major >= 5));

	this.gecko   = (agt.indexOf('gecko') != -1);

	this.ie      = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

	this.ie3     = (this.ie && (this.major < 4));

	this.ie4     = (this.ie && (this.major == 4) && (agt.indexOf("msie 5")==-1)

				   && (agt.indexOf("msie 6")==-1));

	this.ie4up   = (this.ie  && (this.major >= 4));

	this.ie5     = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );

	this.ie5_5   = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));

	this.ie6     = (this.ie && (this.major == 6) && (agt.indexOf("msie 6.0") != -1));

	this.ie5up   = (this.ie  && !this.ie3 && !this.ie4 && !this.ie6);

	this.ie5_5up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5);

	this.ie6up   = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);

	this.opera   = (agt.indexOf('opera') != -1);



	// *** PLATFORM ***

	this.win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );

	// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all

	//        Win32, so you can't distinguish between Win95 and WinNT.

	this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

	// is this a 16 bit compiled version?

	this.win16 = ((agt.indexOf("win16")!=-1) 

				 || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) 

				 || (agt.indexOf("windows 16-bit")!=-1) );

	this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) 

				 || (agt.indexOf("windows 16-bit")!=-1));

	// NOTE: Reliable detection of Win98 may not be possible. It appears that:

	//       - On Nav 4.x and before you'll get plain "Windows" in userAgent.

	//       - On Mercury client, the 32-bit version will return "Win98", but

	//         the 16-bit version running on Win98 will still return "Win95".

	this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));

	this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));

	this.win32 = (this.win95 || this.winnt || this.win98 

				 || ((this.major >= 4) && (navigator.platform == "Win32")) 

				 || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

	this.winme = ((agt.indexOf("win 9x 4.90")!=-1));

	this.win2k = ((agt.indexOf("windows nt 5.0")!=-1));

	this.mac    = (agt.indexOf("mac")!=-1);

	this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) 

				  || (agt.indexOf("68000")!=-1)));

	this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) 

				  || (agt.indexOf("powerpc")!=-1)));

}



var is;

is = new Is();



// Opera check

var opAgt=navigator.userAgent.toLowerCase();

var is_opera = (opAgt.indexOf("opera") != -1);



// Advert constructor

function Advert(pos,ftsite,params,issec,wrap,asset){

	// Properties

	this.posID = pos;

	this.pos = "&pos="+pos;

	this.ftsite = ftsite;

	this.params = params;

	this.issec = issec;

	this.asset = asset;

	this.adHTML = '';

	this.adDims = [

		["ban",468,60],

		["sb1",120,60],

		["sb2",120,60],

		["tf1",88,31],

		["tf2",88,31],

		["tf3",88,31],

		["tf4",88,31],

		["fmbut2",88,31],

		["tick",120,20],

		["box",240,400],

		["hp120x20",120,20],

		["sky",120,600],

		["sbn1",120,40],

		["pop",0,0],

	];

	

	// Methods

	this.getAdHTML = function(){

		var add = '';

		if (this.posID == 'box'){ add = "&params.styles=artimg,arthtml"; }

		if (this.posID == 'ban' && this.asset != ''){ add = "&asset="+this.asset; }

		this.wrap = wrap != ''?'&wrap='+wrap:'';

		var allParams = this.pos+this.params+this.wrap+add;

		var adHTML = '';

		

		var siteName='ftcom';

		if (this.ftsite == 'yahoo1'){

			if (this.posID == 'ban' || this.posID =='box'){ siteName=this.ftsite; }

		}

		

		if (!this.issec){

			if (!is.nav4){

				adHTML += '<scr'+'ipt src="http://ads.ft.com/js.ng/site='+siteName+allParams+'">';

				adHTML += '</scr'+'ipt>\n';

				adHTML += '<noscr'+'ipt>\n';

			}

			adHTML += '<a href="http://ads.ft.com/click.ng/site='+siteName+allParams+'" target="_blank">';

			adHTML += '<img src="http://ads.ft.com/image.ng/site='+siteName+allParams+'" border="0" alt="Advertisement" />';

			adHTML += '</a>';

			if (!is.nav4){

				adHTML += '</noscr'+'ipt>';

			}

		} else {

			// No ad for secure documents

			adHTML += '<img src="https://globalelements.ft.com/c.gif" alt="" />';

		}

		if (is.nav4){ adPos[adPos.length] = this.posID; }

		return adHTML;	  	

	}



	this.getAdDim = function(xy,pos){

		var adDim = 0;

		var idx = 0;

		if (xy == 'w') { idx = 1; }

		else if (xy == 'h') { idx= 2; }

		for (var i = 0; i < this.adDims.length; i++){

			if (pos == this.adDims[i][0]) { adDim = this.adDims[i][idx]; }

		}

		return adDim;

	}

	

	// Init

	this.adHTML = this.getAdHTML();

	if (is.nav4){

		this.adWidth = this.getAdDim('w',this.posID);

		this.adHeight = this.getAdDim('h',this.posID);

	}

}



// Page attributes constructor

function PageAttributes(FTSite,FTSection,FTPage,FTIndustry){

	// Properties

	this.defsite = 'ftcom';

	this.wrap = '';

	

	// Methods

	// Used to avoid ad call caching

	this.getTransId = function(){

		var cDate = new Date();

		var uSec = cDate.getTime();

		return(uSec);

	}



	// Determine if the page is being served via SSL

	this.isSecure = function(){

		var secure = 0;

		if (this.thisLoc.indexOf('https') > -1){ secure = 1; }

		return secure;

	}



	// Gets the ad site code

	this.getFTSite = function(){

		var code = this.defsite;

		var ck = getCookieValue('FTAdSiteCode','');

		var client = getValueFromStr('ft_ref','',this.thisLoc,'&');

		var page = typeof FTSite != 'undefined'?FTSite.toLowerCase():'';

		if (client){ code = client; }

		else if (ck){ code = ck; }

		else if (page){ code = page; }

		return code; 

	}



	// Get extra params for ad from AYSC user cookie

	this.getAdParams = function(){

		var sAYSC = getCookieValue('AYSC', '');

		var params = '';

		params += "&13=" + getValueFromStr('_13', '', sAYSC, '_', '');

		params += "&14=" + getValueFromStr('_14', '', sAYSC, '_', '');

		params += "&17=" + getValueFromStr('_17', '', sAYSC, '_', '');

		params += "&18=" + getValueFromStr('_18', '', sAYSC, '_', '');

		params += "&transId=" + this.getTransId();

		return params;

	}



	// Get search or quote terms for ads

	this.getKeyword = function(loc){

		var keyword = '';

		// Retrieve the value of "vsc_query" or "symb" from the URL or from a cookie

		if ((loc.indexOf("search.ft.com") != -1) && (loc.indexOf("&vsc_query=") != -1)){

			// The URL contains search.ft.com and there is a vsc_query parameter in the URL

			keyword = getValueFromStr('vsc_query','',loc,'&');

		} else if ((loc.indexOf("mwprices.ft.com") != -1) && (loc.indexOf("&symb=") != -1)){

			// The URL contains mwprices.ft.com and there is a symb parameter in the URL

			keyword = getValueFromStr('symb','',loc,'&');

		} else if (getCookieValue('keywordValue','').length > 0){

			// A cookie called keywordValue has previously been set for this domain 

			keyword = getCookieValue('keywordValue','');

		}

		// The following requires JavaScript 1.2

		var whtSpc = new RegExp("\\+","g");

		var ampSym = new RegExp("%26","g");

		var apoSym = new RegExp("%27","g");

		var perSym = new RegExp("\\.","g");

		keyword = keyword.replace(whtSpc,"_");   //replace plus sign with underscore '_'

		keyword = keyword.replace(ampSym,"and"); //replace ampersands with 'and'

		keyword = keyword.replace(apoSym,"");    //replace apostrophe with nothing

		keyword = keyword.replace(perSym,"");    //replace periods with nothing

		var keyStr = (keyword.length > 0)?"&keyword="+keyword.toLowerCase():'';

		return keyStr;

	}



	this.doAdPlacement = function(theArray){

		// Should only ever be called by NS4!

		if (!is.nav4) { return false; }

		else {

			for(i = 0; i < theArray.length; i++){

				if ((eval("typeof "+theArray[i]) != 'undefined') && (theArray[i] != 'box')){

					var lyrContent = eval(theArray[i]+'.adHTML');

					var theWidth = eval(theArray[i]+'.adWidth');

					var theHeight = eval(theArray[i]+'.adHeight');

					var theX = eval('document.layers["'+theArray[i]+'"].pageX');

					var theY = eval('document.layers["'+theArray[i]+'"].pageY');

					var theLayer = '<layer id="'+theArray[i]+'AD" name="'+theArray[i]+'AD" clip="'+theWidth+','+theHeight+'" visibility="hide" onLoad="moveToAbsolute('+theX+','+theY+');visibility=\'show\';">'+lyrContent+'</layer>';

					document.write(theLayer);

				}

			}

		}

		return true;

	}

	

	// Init

	this.thisLoc = getRealLoc();

	this.ftsite = this.getFTSite();

	this.ftsec = "&sec="+FTSection;

	this.ftpage = "&artid="+FTPage;

	this.ftind = "&ind="+FTIndustry;

	this.adparams = this.getAdParams();

	this.keyword = this.getKeyword(this.thisLoc);

	this.asset = typeof AssetType != 'undefined'?AssetType.toLowerCase():'';

	this.alladparams = this.ftsec+this.ftpage+this.ftind+this.adparams+this.keyword;

	this.timerrunning = false;

	this.issec = this.isSecure();

}



// Legacy function call support

function getAdHTML(pos,width,height,ftsite,ftsection,ftpage,ftindustry){

	eval("var "+pos+" = new Advert(\""+pos+"\",thisPage.ftsite,thisPage.alladparams,thisPage.issec,thisPage.wrap);");

	return eval(pos+".adHTML");

}



function getWrapHTML(pos,wrap,ftsite,ftsection,ftpage,ftindustry,assettype){

	eval("var "+pos+" = new Advert(\""+pos+"\",thisPage.ftsite,thisPage.alladparams,thisPage.issec,thisPage.wrap,thisPage.asset);");

	return eval(pos+".adHTML");

}



function getInAdHTML(pos,ftsite,ftsection,ftpage,ftindustry){

	eval("var "+pos+" = new Advert(\""+pos+"\",thisPage.ftsite,thisPage.alladparams,thisPage.issec,thisPage.wrap);");

	return eval(pos+".adHTML");

}



function getRealLoc(){

	return thisPage.thisLoc;

}



// Support variables

var adPos = new Array();



// Support functions

// Gets a value from a string or returns default

function getValueFromStr(key,defaultVal,inStr,sep,keySep){

	var value = defaultVal;

	var begin;

	var str;

	if (key && key.length > 0){

		key += arguments.length >= 5 ? keySep : '=';

		begin =  inStr.indexOf(key) > -1 ? inStr.indexOf(key) + key.length : -1;

		if( begin > -1){

			str =  inStr.substr(begin, inStr.length);

			value = str.substr(0, str.indexOf(sep) >= 0 ? str.indexOf(sep) : str.length);

		}

	}

	return value;

}



// Gets a cookie value or returns default

function getCookieValue(key,defaultVal){

	return(getValueFromStr(key,defaultVal,document.cookie,';'));

}



// Sets a cookie value

function setCookieValue(key,value,domain,expireInMinutes){

	var expDate = new Date();

	expDate.setTime(expDate.getTime() + (expireInMinutes * 60000) );

	document.cookie

	var cookie = key + '=' + value + ';domain=' + domain + ';path=/;';

	if( expireInMinutes > -1 ){ cookie +=  'expires=' + expDate.toGMTString(); }

	document.cookie = cookie;

	return true;

}



// Deletes a cookie

function deleteCookie(key,domain){

	document.cookie = key + '=' + ( (domain) ? ';domain=' + domain : '') + ';path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT';

	return true;

}



// Open a popup window with no location buttons etc

function openPopUp(location,name,width,height,relativeTo,top,left){

	var tly;

	var tlx;

	var winProps;

	switch( relativeTo ){

		case 'screenTR':

			tlx = screen.width - width - left;

			tly = top;

			break;

		case 'windowTL':

			tlx = window.dialogLeft ? window.dialogLeft + left : 0;

			tly = window.dialogTop ? window.dialogTop + top : 0;

			break;

		case 'screenTL':

			default:

			tlx = left;

			tly = top;

			break;

	}

	winProps = 'scrollbars=no,toolbar=no,location=no,nonresizable,width=' + width + ',height=' + height + ',left=' + tlx + ',top=' + tly;

	var objWin = window.open(location, name, winProps);

	objWin.focus();

	return objWin;

}



// Navigates to user selection from drop down list without need for a Go button

function FTCheckGo(obj){

	// Prepare for cross-browser support

	var winRef = 'top.';

	if (is.nav4){ winRef = ''; }

	var sValue = obj.options[obj.options.selectedIndex].value;

	if (sValue != ''){ eval(winRef + 'location.href="' + sValue + '"'); }

	obj.selectedIndex = 0; // Reset dropdown box

	return true;

}



// Get the date

function getDate(){

	var today = new Date();

	var day = today.getDay();

	var dday = today.getDate();

	var mon = today.getMonth();

	var year = today.getFullYear();

	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

	var mons = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

	var outStr = days[day] + ' ' + mons[mon] + ' ' + dday + ' ' + year;

	return outStr;

}



// html for region determination

// getReg uses doc location and returns one of:

var EDNO = 0;

var EDUK = 1;

var EDUS = 2;

var EDWW = 3;

var EDRW = 4;



var regVals = [[EDUK,'ukreghp','ukregrt','/uk'],[EDUS,'usreghp','usregrt','/us'],[EDRW,'rowreghp','rowregrt','/rw'],[EDRW,'cid=1012571727092'],[EDUK,'cid=1012571727085'],[EDUS,'cid=1012571727088']];



function getReg(){

	var loc = getRealLoc();

	var reg = EDNO;

	if (loc.length > 0){

		for (var i = 0; i < regVals.length ; i++){

			for (var j = 1; j < regVals[i].length ; j++){

				if (loc.indexOf(regVals[i][j]) != -1){

					reg = regVals[i][0];

					break;

				}

			}

			if (reg > EDNO){ break; }

		}

	}

	return reg;

}



// World Indices function

function writeIndex(url,name,val,chge){

	var doLink = url.length > 0?true:false;

	var output = '<tr>\n<td bgcolor="#FFFFFF" class="footer">&nbsp;';

	var name = name == 'HANG SENG'?'H. SENG':name;

	if (doLink){ output += '<a href="'+url+'" class="footer" target="_top">'+name+'</a>'; }

	else { output += name; }

	output += '</td><td><img src="http://globalelements.ft.com/c.gif" width="1" height="1" /></td>';

	output += '<td align="right" bgcolor="#FFFFFF" class="footer">'+val+'</td><td><img src="http://globalelements.ft.com/c.gif" width="1" height="1" /></td><td align="right" bgcolor="#FFFFFF" class="footer"><font color="';

	if (chge.toString().indexOf("-") != -1){ output += 'red'; }

	else { output += 'green'; }

	output += '">'+chge+'%</font></td>\n</tr>';

	document.write(output);

}



// World Currencies function

function writeCurrency(url,curr,val){

	var output = '<tr>\n<td bgcolor="#FFFFFF" class="footer">&nbsp;';

	output += '<a href="'+url+'" class="footer" target="_top">'+curr+'</a></td>';

	output += '<td><img src="http://globalelements.ft.com/c.gif" width="1" height="1" /></td>';

	output += '<td align="right" class="footer" bgcolor="#FFFFFF">'+val+'</td>\n</tr>';

	document.write(output);

}



// Top Gainers/Losers function

function writeMover(mkt,comp,compUrl){

	var output = '<tr>\n<td colspan="3"><img src="http://globalelements.ft.com/c.gif" width="130" height="1" /></td>\n</tr>';

	output += '<tr>\n<td class="footer" bgcolor="#FFFFFF">&nbsp;</td><td colspan="2" height="30" bgcolor="#FFFFFF">';

	output += '<span class="promoBold">'+mkt+'</span><br />';

	output += '<a href="'+compUrl+'" class="footer" target="_top">'+comp+'</a></td>\n</tr>';

	document.write(output);

}



function inputText(name){

	var size = 10;

	var type = "text";

	if (is.nav4){ size = 8; }

	if ((name == "vsc_query" || name == "quote") && is.ie){ size = 13; }

	if (name == "password"){ type = "password"; size = 9; }

	if ((name == "password") && is.nav4){ type = "password"; size = 7; }

	if (name == "name"){ size = 9; }

	if ((name == "name") && is.nav4){ size = 7; }

	document.write('<input type="'+type+'" name="'+name+'" size="'+size+'" class="all">');

}



// CB:START

// Change window status msg

// pName : escaped Page name

// numP  : td ID

// numC  : td number

function wS(pName,numP,numC){

	if ((pName != "null") && (pName != "home")){

		pName = pName.replace(/\+/,"\'");

		window.status = pName;

		//get number of args parsed into function

		var args = wS.arguments;

		//if no numC parsed set default

		if (args.length < 3){ if (is.ie4up){ for (c = 1;c <= 2;c++){ eval("document.all.td"+numP+c).style.cursor = "hand"; } } }

		else { if (is.ie4up){ for (c = 1;c <= numC; c++){ eval("document.all.td"+numP+c).style.cursor = "hand"; } } }

	} else if(pName != "home"){ window.status = ""; }

}



// Rollover of cell and text

// numP  : Unique Page numebr

// numC  : # of cells

// numT  : # of text

// rDesc : cell/text colour id

// pName : escaped Page name

function x(numP,numC,numT,rDesc,pName){

	if (!is.nav4){

		if (is.ie4up){			

			var op = "all.";

			var cl = "";

		} else {

			var op = "getElementById('";

			var cl = "')";

		}

		switch (rDesc){

			case 1:	// home/top level roll on

			cColour = "#990000";

			tColour = "#FFFFFF";

			break;

			case 2:	// home/top level roll off

			cColour = "#FFE9D1";

			tColour = "#990000";

			break;

			case 3:	// sub nav roll on

			cColour = "#CC6666";

			tColour = "#FFFFFF";

			break;

			case 4:	// sub nav roll off

			cColour = "#FFCC99";

			tColour = "#990000";

			break;

			case 5:	// grey nav sub nav roll off

			cColour = "#EEEEEE";

			tColour = "#333333";

			break;

			case 6:	// grey nav sub nav roll on			

			cColour = "#666666";

			tColour = "#FFFFFF";

			break;

			default :

			break;

		}

		for (a = 1;a <= numC;a++){ eval("document."+op+"td"+numP+a+cl+".style.backgroundColor = cColour;"); }

		for (b = 1;b <= numT;b++){ eval("document."+op+"txt"+numP+b+cl+".style.color = tColour;"); }

		wS(pName,numP,numC);

	}

}



// Cell link

// tName : CS Page template

// cID   : CS Page id

function cC(tName,cID){

	var linkURL = '';

	if(cID == 'null'){ linkURL = tName; }

	else { linkURL = '/servlet/ContentServer?pagename=FT.com/Page/'+tName+'&cid='+cID; }

	top.location.href = linkURL;

}

// CB:END



// Ad prototypes

function pageOffset() { }

function checkVisible() { }



// Sites running non ft.com domains

var extLoc = [['21cacrcl','credit.ftyourmoney.com'],['21perloa','loans.ftyourmoney.com'],['21motori','www.aaaffinities.co.uk/Insurance/FT/Carquote'],['21travel','products.xelector.com'],['21mortga','mortgages.charcolonline.co.uk'],['21gaselec','www.uswitch.com/energy'],['21lifein','193.130.154.202'],['21homins','www.aaaffinities.co.uk/Insurance/FT/Homequote'],['21medins','212.212.140.140'],['21telsup','www.uswitch.com/ht'],['21annfin','www.hargreaveslansdown.co.uk'],['21uncass','www.uar.co.uk'],['12trasea','www.ft.otc-uk.com'],['12spgolf','www.sportinglife.com/clients/ft/golf'],['12spform','www.sportinglife.com/clients/ft/formula1'],['12sprugu','www.sportinglife.com/clients/ft/rugbyunion'],['12spfoot','www.sportinglife.com/clients/ft/football'],['12spboxi','www.sportinglife.com/clients/ft/boxing'],['12spracg','www.sportinglife.com/clients/ft/racing'],['12spsnok','www.sportinglife.com/clients/ft/snooker'],['12spcric','www.sportinglife.com/clients/ft/cricket'],['12spgrey','www.sportinglife.com/clients/ft/greyhounds'],['12sprugb','www.sportinglife.com/clients/ft/rugbyleague'],['12sporar','www.sportinglife.com/clients/ft/story_get'],['12sptenn','www.sportinglife.com/clients/ft/tennis'],['12spothr','www.sportinglife.com/clients/ft/others'],['12spnfls','www.sportinglife.com/clients/ft/nfl'],['12sports','www.sportinglife.com/clients/ft/home'],['12spbett','www.sportinglife.com/clients/ft/betting']];



// Determine the location of the parent page

function getRealLoc(){

	var realLoc = '';

	if (self == top){ realLoc = window.location.toString(); }

	else if (window.ourLoc){ realLoc = window.ourLoc; }

	else if (document.referrer){ realLoc = document.referrer; }

	else { realLoc = window.location.toString(); }

	return realLoc;

}



// Get a non ft.com domain code

function getSiteNav(){

	var realDomain;

	var realLoc = getRealLoc(); 

	var navStr = '';

	for (var i = 0; i < extLoc.length ; i++){

		if (realLoc.indexOf(extLoc[i][1]) != -1){ return(navStr + extLoc[i][0]); }

	}

	return(navStr);

}

// Attempt to get FTSite, FTSection and FTPage from cookie if not yet set

// Set cookie values to default values

if (!FTSite && !FTSection && !FTPage && !FTIndustry){

	var FTSection = 'undef';

	var FTPage = 'undef';

	var FTIndustry = 'XXXX';

	var FTAdValues = getSiteNav();

	if (FTAdValues != '') {

		// We matched an external, non-ft.com domained 3rd party - woah! This only covers Your Money at the moment

		// hence the hard-coded FTSection tag. If this needs extending, amend the getSiteNav function to 

		// return both values

		FTSite = 'FTYM';

		FTSection = '21ymy';

		FTPage = FTAdValues;

	} else {

		// We didn't get a match, so grab the ad values from the cookie

		// FTSection and FTPage - use the values in FTAdValues or FTSection / Page if available, or set to undef if neither available

		var FTSite = getCookieValue('FTSite','');

		var FTAdValues = getCookieValue('FTAdValues','');

		var adLIndex = FTAdValues.indexOf(':');

		var adRIndex = FTAdValues.lastIndexOf(':');

		var FTSection = FTAdValues.substring(0, adLIndex)?FTAdValues.substring(0, adLIndex):getCookieValue('FTSection','undef');

		var FTPage = FTAdValues.substring(adLIndex + 1, adRIndex)?FTAdValues.substring(adLIndex + 1, adRIndex):getCookieValue('FTPage','undef');

		var FTIndustry = FTAdValues.substring(adRIndex + 1);

	}

}



// Create JavaScript page object

var thisPage = new PageAttributes(FTSite,FTSection,FTPage,FTIndustry);



// Common Template functions

function initPage(Site,Section,Page){

	return true;

}



function finishPage(){

	if (typeof pop == 'undefined') {

		var pop = new Advert("pop",thisPage.ftsite,thisPage.alladparams,thisPage.issec,thisPage.wrap);

	}

	if (is.nav4){ 

		document.write('<ilayer id="pop" name="pop" visibility="hide" width="'+pop.adWidth+'" height="'+pop.adHeight+'"></ilayer>');

		thisPage.doAdPlacement(adPos);

	} else {

		document.write(pop.adHTML);

	}

	return true;

}


