function redirect(sel)
{
	if (sel.options[sel.selectedIndex].value != "")
		location.href = sel.options[sel.selectedIndex].value;
////////////////////////////////////////////////////////////////////////////////////////////
// The following is to make dropdown links open in new window and replaces the above line //
////////////////////////////////////////////////////////////////////////////////////////////
//		var locationHref = sel.options[sel.selectedIndex].value;		  //
//		openBlankWindow(locationHref,'StandardLife')				  //
////////////////////////////////////////////////////////////////////////////////////////////







	return false;
}



// this redirects the user when the dropdown is changed


function redirectOption(url)
{
	if (url != ""){
		window.location.href = url
}

	return false;
}



// example .. <a href="url" onclick="return openPopup(this.href,'small','pdf')">show pdf</a>
//
// url - required :: this will normally be the href of the <a> tag, use 'this.href' in the html
// size - optional :: this can be one of 3 different set sizes. 'small', 'medium' and 'large' - all need to be passed as a string.
// 					If the string does not match any of constants, and no name is given, the string passed is used for the name.
// name - optional :: this is just a string, use it to allow a link to open in an already open popup (with the same name).
//

function openPopup(url,size,name,secure) {
	//alert(url)
	var a = arguments;
	// if no parameters are given
	if (!url) return false;
	// if no name parameter is given
	if (!name) name = "win"+Math.round(Math.random()*999);
	// check the size parameter
	if (!size) {var sizeStr = "width=310,height=455"; size="medium";}
		else switch(size) {
			case "small" : var sizeStr = "width=310,height=295"; break;
			case "medium" : var sizeStr = "width=310,height=455"; break;
			case "large" : var sizeStr = "width=630,height=455"; break;
			case "morningstar" : var sizeStr = "width=758,height=580"; break;
			case "finex" : var sizeStr = "width=530,height=560"; break;
			case "rates" : var sizeStr = "width=768,height=590"; break;
			case "savingsrates" : var sizeStr = "width=778,height=580"; break;
			case "slac_app" : var sizeStr = "width=750,height=600"; break;
			case "product_comparison" : var sizeStr = "width=800,height=600"; break;
			case "no_flash_scroll" : var sizeStr = "width=628,height=450,scrollbars=yes"; break;

// Added 22 01 2008 K SIMPSON for My Freestyle reesign
			case "costmoving" : var sizeStr = "width=725,height=600,scrollbars=yes"; break;
			case "demo" : var sizeStr = "width=628,height=450"; break;

// end of added popup sizes
			default : var sizeStr = "width=750,height=600";
		}


	// find anchor ref

	var anchor = "";
	if(url) {

		var pos = url.indexOf("#");
		if(pos != -1) {
			anchor = url.substring(pos);
			url = url.substring(0, pos);
		}

		if(url.indexOf("?") != -1){
			sepChar = "&"
		}
		else{
			sepChar = "?"
		}
	}


	if(!secure){
		secure = "no"
	}
	else{secure = "yes"}


	if (size == "morningstar" || size == "finex" || size == "savingsrates"){scrollbars = 'yes'}
	else {scrollbars = 'no'}



	// open the window

window.open(url+sepChar+'size='+size+anchor,name,"directories=no,location=no,menubar=no,resizable=no,scrollbars=" + scrollbars + ",status="+ secure +",toolbar=no,"+sizeStr);
	// this returns false so that the href is not processed in the original <a> tag.
	return false;
}

/* same function as above but to launch from a drop down menu */
function openPopupDDM(url,size,name,secure) {
	//alert(url)
	var a = arguments;
	// if no parameters are given
	if (!url) return false;
	// if no name parameter is given
	if (!name) name = "win"+Math.round(Math.random()*999);
	// check the size parameter
	if (!size) {var sizeStr = "width=310,height=455"; size="medium";}
		else switch(size) {
			case "small" : var sizeStr = "width=310,height=295"; break;
			case "medium" : var sizeStr = "width=310,height=455"; break;
			case "large" : var sizeStr = "width=630,height=455"; break;
			case "morningstar" : var sizeStr = "width=758,height=580"; break;
			case "finex" : var sizeStr = "width=530,height=560"; break;
			case "rates" : var sizeStr = "width=768,height=590"; break;
			case "savingsrates" : var sizeStr = "width=778,height=580"; break;
			case "slac_app" : var sizeStr = "width=750,height=600"; break;
			case "product_comparison" : var sizeStr = "width=800,height=600"; break;
			case "no_flash_scroll" : var sizeStr = "width=628,height=450,scrollbars=yes"; break;
			default : var sizeStr = "width=750,height=600";
		}


	// find anchor ref

	var anchor = "";
	if(url) {

		var pos = url.indexOf("#");
		if(pos != -1) {
			anchor = url.substring(pos);
			url = url.substring(0, pos);
		}

		if(url.indexOf("?") != -1){
			sepChar = "&"
		}
		else{
			sepChar = "?"
		}
	}


	if(!secure){
		secure = "no"
	}
	else{secure = "yes"}


	if (size == "morningstar" || size == "finex" || size == "savingsrates"){scrollbars = 'yes'}
	else {scrollbars = 'no'}



	// open the window

window.open(url+sepChar+'size='+size+anchor,name,"directories=no,location=no,menubar=no,resizable=no,scrollbars=" + scrollbars + ",status="+ secure +",toolbar=no,"+sizeStr);
	// this returns false so that the href is not processed in the original <a> tag.
//	return false;
}


function openNONBTPopup(url,size,name,secure) {
	//alert(url)
	var a = arguments;
	// if no parameters are given
	if (!url) return false;
	// if no name parameter is given
	if (!name) name = "win"+Math.round(Math.random()*999);
	// check the size parameter
	if (!size) {var sizeStr = "width=310,height=455"; size="medium";}
		else switch(size) {
			case "small" : var sizeStr = "width=310,height=295"; break;
			case "medium" : var sizeStr = "width=310,height=455"; break;
			case "large" : var sizeStr = "width=630,height=455"; break;
			case "morningstar" : var sizeStr = "width=758,height=580"; break;
			case "finex" : var sizeStr = "width=530,height=560"; break;
			case "rates" : var sizeStr = "width=768,height=590"; break;
			case "slac_app" : var sizeStr = "width=750,height=600"; break;
			case "product_comparison" : var sizeStr = "width=800,height=600"; break;
			case "no_flash_scroll" : var sizeStr = "width=628,height=450,scrollbars=yes"; break;
			default : var sizeStr = "width=310,height=455";
		}

	// find anchor ref

	var anchor = "";
	if(url) {

		var pos = url.indexOf("#");
		if(pos != -1) {
			anchor = url.substring(pos);
			url = url.substring(0, pos);
		}

		if(url.indexOf("?") != -1){
			sepChar = "&"
		}
		else{
			sepChar = "?"
		}
	}

	if(!secure){
		secure = "no"
	}
	else{secure = "yes"}

	// open the window
window.open(url+sepChar+'size='+size+anchor,name,"directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status="+ secure +",toolbar=no,"+sizeStr);
	// this returns false so that the href is not processed in the original <a> tag.
	return false;
}


// just for Morningstar popups, which need to be resizable
function openFinex(url,name) {
	window.open(url,name,"width=530,height=560,resizable=yes,scrollbars=yes");
	// this returns false so that the href is not processed in the original <a> tag.
	return false;
}


/*open pdfs*/
function openPdf(url,name) {

	window.open(url,name,"width=710,height=650,resizable=yes,scrollbars=no");
	// this returns false so that the href is not processed in the original <a> tag.
	return false;
}


/* this functions mimics the target="_blank" */

function openBlankWindow(url,name,width,height){
	// if no width is passed in
	if(!width){ width = "800";}
	// if no height is passed in
	if(!height){ height = "600";}

	// if no name parameter is given
	if (!name || name == "") {name = "win"+Math.round(Math.random()*999);}

	window.open(url,name,'width='+ width +',height='+ height +',directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes');

	return false;

}

/* same function as above but to launch from a drop down menu */
function openBlankWindowDDM(url,name,width,height){
	// if no width is passed in
	if(!width){ width = "800";}
	// if no height is passed in
	if(!height){ height = "600";}

	// if no name parameter is given
	if (!name || name == "") {name = "win"+Math.round(Math.random()*999);}

	window.open(url,name,'width='+ width +',height='+ height +',directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes');

//	return false;

}





/*used to open sli email alerts only*/

function openPopupSli(url,size,name,secure) {
	//alert(url)
	var a = arguments;
	// if no parameters are given
	if (!url) return false;
	// if no name parameter is given
	if (!name) name = "win"+Math.round(Math.random()*999);
	// check the size parameter
	if (!size) {var sizeStr = "width=310,height=455"; size="medium";}
		else switch(size) {
			case "small" : var sizeStr = "width=310,height=295"; break;
			case "large" : var sizeStr = "width=630,height=455"; break;
			default : var sizeStr = "width=310,height=455";
		}

	// find anchor ref

	var anchor = "";
	if(url) {
		var pos = url.indexOf("#");
		if(pos != -1) {
			anchor = url.substring(pos);
			url = url.substring(0, pos);
		}
	}

	if(!secure){
		secure = "no"
	}
	else{secure = "yes"}


	// open the window

	window.open(url+anchor,name,"directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status="+ secure +",toolbar=no,"+sizeStr);
	// this returns false so that the href is not processed in the original <a> tag.
	return false;
}


// scripts for CIA2 login -  johnm - 16/03
	var submitFlag = 1;
	function fnCiaLogin()
	{
		if(submitFlag == "1")
		{
			windowOpenCia('popup', 915, 570);
			setTimeout('document.ciaLogin.submit();',1000)
			submitFlag=0;
		}
		setTimeout("document.ciaLogin.userId.value='';submitFlag=1;",1500);

	}

	function windowOpenCia(windowname, width, height)
	{
		var thiswin = open('',windowname,'width=' + width + ',height=' + height + ',status=yes,resizable=yes,scrollbars=yes,left=10,top=10');
		if (thiswin.focus) thiswin.focus();
	}

// opens a popup that provides the status bar to show if the user is in a secure environment.
	function openShowStatus(url,name,w,h)
	{
		window.open(url,name,"width="+w+",height="+h+",status=yes,toolbar=no,directories=no,resizable=yes,location=no,menubar=no,scrollbars=yes");
	}

// scripts for CIA2 login -  end


//***************************************************************
//** Scripts for the DHTML FAQs in the RNIB Section of UKGroup **
//***************************************************************

// for IE
var d = document.all;

// for NN6
var g = document.getElementById;

// for the first two functions below
var lastText = "default";

// generic hiding of lumps of text function
// noPara is the number of paragraphs of text there are
function hideText(noPara)
{
	if(d)
	{
		for (i=1; i<=noPara; i++)
		{
			document.all['t'+i].style.display="none";
		}
		document.all['default'].style.display="block";
	}

	else if(g)
	{
		for (i=1; i<=noPara; i++)
		{
			document.getElementById('t'+i).style.display="none";
		}
		document.getElementById('default').style.display="block";
	}
}

// generic showing of the same lumps of text function
function showText(textNo)
{
	if(d)
	{
		document.all[lastText].style.display="none";
		document.all['t'+textNo].style.display = 'block';
		lastText = 't'+textNo;
	}

	else if(g)
	{
		document.getElementById(lastText).style.display="none";
		document.getElementById('t'+textNo).style.display = 'block';
		lastText = 't'+textNo;
	}
}


//*************************************************
//** Script for opening the fund selection tool  **
//*************************************************

function openFundSelectionTool(url){


	switch(screen.width){

	case 800 :
		w = 760
		h = 500

	break;

	case 1024 :
		w = 890
		h = 630

	break;

	case 1152 :
		w = 950
		h = 700

	case 1280 :
		w = 1000
		h = 700

	break;

	default :
		w = 760
		h = 500

	break;

	}



	window.open(url,'fundselectiontool','width='+w+',height='+h+',directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no')

	return false

}








/*custom sized popup*/

function openCustomPopup(url,width,height,name,secure) {
	
	var a = arguments;
	// if no parameters are given

	if (!url) return false;

	// if no name parameter is given
	if (!name) name = "win"+Math.round(Math.random()*999);

	// check the size parameter
	if (!width) {var sizeStr = "width=800,height=600";}
	
	else {
		var sizeStr = "width="+width+",height="+height+"";
	}

	// find anchor ref

	var anchor = "";
	if(url) {

		var pos = url.indexOf("#");
		if(pos != -1) {
			anchor = url.substring(pos);
			url = url.substring(0, pos);
		}

		if(url.indexOf("?") != -1){
			sepChar = "&"
		}
		else{
			sepChar = "?"
		}
	}

	if(!secure){
		secure = "no"
	}
	else{secure = "yes"}

	// open the window
	window.open(url+sepChar+anchor,name,"directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status="+ secure +",toolbar=no,"+sizeStr);
	// this returns false so that the href is not processed in the original <a> tag.
	return false;
}

var orgTip = null;
function getOriginalTip()
{
	if (orgTip == null) orgTip = getFooterText().innerHTML;
	return orgTip;
}

function getFooterText()
{
	return document.getElementById("footerText");
}

function onTip(id)
{
	getOriginalTip();
	getFooterText().innerHTML = document.getElementById(id).innerHTML;
}

function offTip()
{
    getFooterText().innerHTML = getOriginalTip();
}

var conditionsWin = null;
function openConditions(strUrl)
{
	if (!conditionsWin || conditionsWin.closed)
		conditionsWin = window.open(strUrl, "", "width=330,height=300,scrollbars=1");
	conditionsWin.focus();
	return false;
}

var legalInfoWin = null;
function openLegalInfo(strUrl)
{
	if (!legalInfoWin || legalInfoWin.closed)
		legalInfoWin = window.open(strUrl, "", "width=630,height=445");
	legalInfoWin.focus();
	return false;
}

//Added 14/01/2005 for Telephone numbers

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
   var pair = vars[i].split("=");
   if (pair[0] == variable) {
     return pair[1];
   }
}
}

function setCookie(name, value) {
  var curCookie = name + "=" + escape(value);
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

var telString = "0845 845 8450";

if (!getCookie("cookString")) {

	if (getQueryVariable("source")=="ppc") {
		var telString = "0845 609 6388";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="dir") {
		var telString = "0845 609 6277";
		setCookie("cookString", telString);

	}
	if (getQueryVariable("source")=="mor") {
		var telString = "0845 601 2358";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="prop") {
		var telString = "0845 272 6634";
		setCookie("cookString", telString);
	}

	if (getQueryVariable("source")=="nets") {
		var telString = "0845 272 6635";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="spring") {
		var telString = "0845 272 6636";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="test") {
		var telString = "0845 272 6637";
		setCookie("cookString", telString);
	}

}

else{
		var telString = getCookie("cookString");
	}


// allows links within the pop-up to open in it's parent window
function loadinparent(url, closeSelf){
self.opener.location = url;
if(closeSelf) self.close();
}

//Added 29/02/2008 for movie popups in My Freestyle
var newwindow = '';
function videopop(url)
{
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = url;
	}
	else
	{
		newwindow=window.open(url,'name','status,height=460,width=610');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}



//Added 02/03/2008 to remove image flicker in IE6
function fixIE6flicker(fix) {
                       try {
                               document.execCommand("BackgroundImageCache", false, fix);
                       }   catch(err) { }
           }
  window.onload = function() { fixIE6flicker(true); }
