

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 "slac_app" : var sizeStr = "width=750,height=600"; break;
			case "product_comparison" : var sizeStr = "width=800,height=600"; break;
			case "lps" : var sizeStr = "width=800,height=600"; break;
			case "pta" : var sizeStr = "width=800,height=600"; break;
			case "slh_raf" : var sizeStr = "width=500,height=600"; 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 == "pta" || size == "finex" || size == "slh_raf"){scrollbars = 'yes'}
	else {scrollbars = 'no'}

	if (size == "pta") {resizable='yes'}
	else {resizable='no'}


	// open the window

if(size == "pta"){
window.open(url,name,"directories=no,location=no,menubar=no,resizable=" + resizable + ",scrollbars=" + scrollbars + ",status="+ secure +",toolbar=no,"+sizeStr);

}
else{
window.open(url+sepChar+'size='+size+anchor,name,"directories=no,location=no,menubar=no,resizable=" + resizable + ",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,scrollbars) {
	//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;
			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"}



	if(!scrollbars){
		scrollbars = "no"
	}
	else{scrollbars = "yes"}



	// 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;
}


// 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;

}







/*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', 760, 475);
			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;
}

function openQAPopup(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=yes,scrollbars=yes,status="+ secure +",toolbar=no,"+sizeStr);
	// this returns false so that the href is not processed in the original <a> tag.
	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 = "0800 33 33 50";

if (!getCookie("cookString")) {

	if (getQueryVariable("source")=="ppc") {
		var telString = "0800 33 33 71";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="directories") {
		var telString = "0800 33 33 43";
		setCookie("cookString", telString);

	}
	if (getQueryVariable("source")=="networks") {
		var telString = "0800 33 33 13";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="content") {
		var telString = "0800 33 33 17";
		setCookie("cookString", telString);
	}

	if (getQueryVariable("source")=="test") {
		var telString = "0800 33 33 31";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="uka") {
		var telString = "0800 33 33 82";
		setCookie("cookString", telString);
	}
	if (getQueryVariable("source")=="OMG") {
		var telString = "0800 33 33 83";
		setCookie("cookString", telString);
	}

}

else{
		var telString = getCookie("cookString");
	}






