function closePopup()
{
	self.close();
}

function Print(Frame){
parent[Frame].focus();
parent[Frame].print();
}

/***************************************************/

function accounttypeOption(prod){
 var loc="https://www.britannia.co.uk/savingapps/savings/disclaimer.do?affinity=default&execute=start&selectorname="
 var url = loc + prod
  if(document.forms["accounttype"].type[0].checked)
  {
  url = url + document.forms['accounttype'].type[0].value;
  window.location=url;
  }
  else if(document.forms["accounttype"].type[1].checked)
  {
  url = url + document.forms['accounttype'].type[1].value;
  window.location=url;
  }
  else if(document.forms["accounttype"].type[2].checked)
  {
  url = url + document.forms['accounttype'].type[2].value;
  window.location=url;
  }
  else if(document.forms["accounttype"].type[3].checked)
  {
  url = url + document.forms['accounttype'].type[3].value;
  window.location=url;
  }
  else
  {
  alert("Please make a selection")
  }

}

/***************************************************/

function affaccounttypeOption(prod){
 var loc="https://www.britannia.co.uk/savingapps/savings/disclaimer.do?affinity=default&execute=start&selectorname="
 var url = loc + affinityName + prod
  if(document.forms["accounttype"].type[0].checked)
  {
  url = url + document.forms['accounttype'].type[0].value;
	//alert(url);
  window.location=url;
  }
  else if(document.forms["accounttype"].type[1].checked)
  {
  url = url + document.forms['accounttype'].type[1].value;
	//alert(url);
  window.location=url;
  }
  else if(document.forms["accounttype"].type[2].checked)
  {
  url = url + document.forms['accounttype'].type[2].value;
  window.location=url;
  }
  else if(document.forms["accounttype"].type[3].checked)
  {
  url = url + document.forms['accounttype'].type[3].value;
  window.location=url;
  }
  else
  {
  alert("Please make a selection")
  }

}

/***************************************************/

function accounttypeISA(prod){
 
 //refernce back to setting in popups.js
 if (sav == "on")
 {
 var url = "sav-apply-online-"
 }
 else
 {
 var url = "sav-apply-tandc-"
 }
 
 var urlEnd = ".html";
  if(document.forms["accounttype"].type[0].checked)
  {
  url = url + document.forms['accounttype'].type[0].value + urlEnd;
  window.location=url;
  }
  else if(document.forms["accounttype"].type[1].checked)
  {
  url = url + document.forms['accounttype'].type[1].value + urlEnd;
  window.location=url;
  }
  else
  {
  alert("Please make a selection")
  }

}

/***************************************************/


function accounttypeISAoffline(prod){
 
 //refernce back to setting in popups.js
 if (sav == "on")
 {
 var url = "sav-apply-tandc-"
 }
 else
 {
 var url = "sav-apply-tandc-"
 }
 
 var urlEnd = ".html";
  if(document.forms["accounttype"].type[0].checked)
  {
  url = url + document.forms['accounttype'].type[0].value + urlEnd;
  window.location=url;
  }
  else if(document.forms["accounttype"].type[1].checked)
  {
  url = url + document.forms['accounttype'].type[1].value + urlEnd;
  window.location=url;
  }
  else
  {
  alert("Please make a selection")
  }

}


/***************************************************/

function accounttype(prod){
 var loc="https://www.britannia.co.uk/savingapps/savings/disclaimer.do?affinity=default&execute=start&selectorname="
 var url = loc + prod
 window.location=url;
}

/***************************************************/

function affaccounttype(prod){
	
 var loc="https://www.britannia.co.uk/savingapps/savings/disclaimer.do?affinity=default&execute=start&selectorname="
 var url = loc + affinityName + prod
	//alert(url);
 window.location=url;
}

/***************************************************/




function printContent(id){
str=document.getElementById(id).innerHTML
newwin=window.open('','printwin','left=100,top=100,width=400,height=400')
newwin.document.write('<HTML>\n<HEAD>\n')
newwin.document.write('<TITLE>Print Page</TITLE>\n')
newwin.document.write('<script>\n')
newwin.document.write('function chkstate(){\n')
newwin.document.write('if(document.readyState=="complete"){\n')
newwin.document.write('window.close()\n')
newwin.document.write('}\n')
newwin.document.write('else{\n')
newwin.document.write('setTimeout("chkstate()",2000)\n')
newwin.document.write('}\n')
newwin.document.write('}\n')
newwin.document.write('function print_win(){\n')
newwin.document.write('window.print();\n')
newwin.document.write('chkstate();\n')
newwin.document.write('}\n')
newwin.document.write('<\/script>\n')
newwin.document.write('</HEAD>\n')
newwin.document.write('<BODY onload="print_win()">\n')
newwin.document.write(str)
newwin.document.write('</BODY>\n')
newwin.document.write('</HTML>\n')
newwin.document.close()
}

/***************************************************/

function sav_app_relocator(url){
  if(document.forms.read.CHECKBOX_1.checked == true) location.href=url;
  else alert("You must read the Terms and Condtions and Data Protection Notice before continuing. Please check the box once you have read the document.");
}




/***************************************************/
/* Important Legal Information Point 8
/***************************************************/

function phonecodes( phoneincode, phoneoutcode ) {

    this.phoneincode = phoneincode;
    this.phoneoutcode = phoneoutcode;
}


function getAffPoint8ImpInfo() {

var codes= new Array()
codes[0] = new phonecodes("mcfc","you may introduce me to, or pass my information (including details of my purchasing preferences) to other Group companies and Manchester City FC. The Group and/or Manchester City FC may wish to contact me by mail, telephone, in person, or otherwise about products, services (including financial services) and events which are considered to be relevant to my personal needs. Manchester City FC may advise the Group whether I have expressed an interest in their products, services and events. <strong>I can tick the box(es) in the declaration section if I do not want to receive these offers;</strong>");

codes[1] = new phonecodes("evertonfc","You may introduce me to, or pass my information (including details of my purchasing preferences) to other Group companies and Everton FC. The Group and Everton FC may wish to contact me by mail, telephone, in person or otherwise about products, services (including financial services) and events which are considered relevant to my personal needs. Everton FC may advise the Group whether I have expressed an interest in their products, services and events. <strong>I can tick the box(es) in the declaration section if I do not want to receive these offers;</strong>");

codes[2] = new phonecodes("spurs","you may introduce me to, or pass my information (including details of my purchasing preferences) to other Group companies, Tottenham Hotspur or other Tottenham Hotspur partners. The Group, Tottenham Hotspur and/or other Tottenham Hotspur partners may wish to contact me by mail, telephone, in person, or otherwise about products, services (including financial services) and events which are considered to be relevant to my personal needs. Tottenham Hotspur and/or other Tottenham Hotspur partners may advise the Group whether I have expressed an interest in their products, services and events. Where you agree to information being shared with Tottenham Hotspur it will not be passed to other financial suppliers of Tottenham Hotspur Money.<strong>I can tick the box(es) in the declaration section if I do not want to receive these offers;</strong>");

codes[3] = new phonecodes("cfc","You may introduce me to, or pass my information (including details of my purchasing preferences) to other Group companies, Chelsea FC or other Chelsea FC partners. The Group, Chelsea FC and/or other Chelsea FC partners may wish to contact me by mail, telephone, in person or otherwise about products, services (including financial services) and events which are considered relevant to my personal needs. Chelsea FC and/or other Chelsea FC partners may advise the Group whether I have expressed an interest in their products, services and events. Where you agree to information being shared with Chelsea FC it will not be passed to other financial suppliers of Chelsea FC Money. <strong>I can tick the box(es) in the declaration section if I do not want to receive these offers;</strong>");


			var query = location.search.substring(1);
			var begin = query.indexOf('=');
			var value = query.substring(begin+1); 		// Extract the text after the "=".
			var aff = unescape(value);


var sendImpInfo = "you may introduce me to, or pass my information (including details of my purchasing preferences) to other Group companies. The Group may wish to contact me by mail, telephone, in person, or otherwise about products, services (including financial services) and events which are considered to be relevant to my personal needs. <strong>I can tick the box(es) in the declaration section if I do not want to receive these offers;</strong>";

for (var i = 0; i < codes.length; ++i) {

	if ( codes[i].phoneincode == aff ) {
    sendImpInfo=codes[i].phoneoutcode;
  }
}


return (sendImpInfo);
}


/***************************************************/
/* End - Important Legal Information Point 8
/***************************************************/

         

function affinitySavAppTandC()
{
//alert(affinityName);

var tandc = affinityName + "tandc";
var dpn = affinityName + "DPN";

//alert(Head);



for ( i=0; i < affinityList.length; i++ )
{
var afftandc = affinityList[i] + "tandc";
var affDPN = affinityList[i] + "DPN";



//alert(affFooter);

  document.getElementById(afftandc).style.display="none";
  document.getElementById(affDPN).style.display="none";

  
}
document.getElementById(tandc).style.display="block";
document.getElementById(dpn).style.display="block";


//alert(supNav);

}

/***************************************************/

function affinitySavAppPDF()
{

//alert(affinityName);

var Pdf = affinityName + "Pdf";

//alert(Pdf);

for ( i=0; i < affinityList.length; i++ )
{
var affpdf = affinityList[i] + "Pdf";

//alert(affpdf);

  document.getElementById(affpdf).style.display="none";

  
}
document.getElementById(Pdf).style.display="block";

//alert(Pdf);

}


/**********************************************************/
/* start - Generic PDF code to generate PDF name from address bar
/**********************************************************/
/* Tony Nall : 231008
/*
/*
/**********************************************************/

		loc = document.location.href;

		//var re = /www.britannia.co.uk\//g;
		//loc = loc.replace(re,'');
		// removed as now removing domain from address below TN

		var re = /home\//g;
		loc = loc.replace(re,'');

		trimPosition=loc.indexOf("://") + 3; //count characters required for server address - everything after ://
		pdfAddress=loc.substring(trimPosition); // get server address inc sub folders

		trimPosition=pdfAddress.indexOf("/") + 1; //count characters required for address minus the domain - everything after first /
		pdfAddress=pdfAddress.substring(trimPosition); // get address minus server inc sub folders

		var re = /\.html/g;
		pdfAddress = pdfAddress.replace(re,'');

		var re = /\//g;
		pdfAddress = pdfAddress.replace(re,'.');


/**********************************************************/
/* end - Generic code to get affinity name from address bar
/**********************************************************/

/**********************************************************/
/* start - Affinity PDF tracking Code - CC 010709
/**********************************************************/

function affPdfLink(obj, aff) {

trackpdfAddress = pdfAddress + "." + aff;

//alert(trackpdfAddress);

var s=s_gi('britbscoukprod');
s.linkTrackVars='None';
s.linkTrackEvents='None';
s.tl(obj,'d',trackpdfAddress);


}

/**********************************************************/
/* end - Generic PDF tracking Code
/**********************************************************/

