/*
 *	Copyright (c) 1996-2003, Fidelity Investments
 * 	Fidelity Investments Confidential Information 
 *	
 *	popW: Generic function to open a pop-up window.
 *		<a href="JavaScript:popW(4)">Pop Window</a>
 */

urls = new Array();

// Start of URLS array

urls[0] = new popUp();
urls[1] = new popUp("Help","/public/help/index.html","PublicMainHelp",645,500,1,115);
urls[2] = new popUp();
urls[3] = new popUp();
urls[4] = new popUp();
urls[5] = new popUp("Legal","/public/legal.html","Legal",530,530,1,115);

// End of URLS array


function popUp (WinRef,WinURL,WinName,width,height,left,down , style_of_window ) {

	if (!WinName) this.WinName = WinRef + "";
	else this.WinName = WinName;
	if (!width) this.width = 810;
	else this.width = width;
	if (!height) this.height = 580;
	else this.height = height;
	if (!left) this.left = 1;
	else this.left = left;
	if (!down) this.down = 115;
	else this.down = down;
	
	this.WinRef = WinRef;
	this.WinURL = WinURL;
	if ( !style_of_window  ) 
	{
		this.features = "resizable=yes,scrollbars=yes,menubar=no,location=no,toolbar=no,status=yes,width=";
	} else
	{
		this.features = style_of_window;
	}
}

var openWindows = new Object();

function popW (index) {
	if (index>urls.length) {
		alert("index number is out of range");
		return;
	}
	tmp = urls[index];
	winReference = tmp.WinRef;
	winUrl = tmp.WinURL;
	winName = tmp.WinName;
	width = tmp.width;
	height = tmp.height;
	left = tmp.left;
	down = tmp.down;
	style_of_window = tmp.features;
	
	var bV = ( navigator.appName == "Netscape" ) ? "nn" : "ie";
	
	if (!openWindows[winReference] || (openWindows[winReference] && openWindows[winReference].closed))
		if (bV == "ie") {
			openWindows[winReference] = window.open(winUrl, winName,  style_of_window + width+',height='+height+',left='+left+',top='+down);
		}
		else 
			openWindows[winReference] = window.open(winUrl, winName,  style_of_window + width+',height='+height+',screenX='+left+',screenY='+down);
	else
		openWindows[winReference].focus();
}


function fidOpenNewWindow(winReference, winUrl, winName, width, height)
{
	var bV = ( navigator.appName == "Netscape" ) ? "nn" : "ie";
	if (!winName)
		winName = winReference + "";
	if (!width)
		width = 810;
	if (!height)
		height = 580;
	
	if (!openWindows[winReference] || (openWindows[winReference] && openWindows[winReference].closed))
		if (bV == "nn")
			openWindows[winReference] = window.open(winUrl, winName,  'resizable=yes,scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,width='+width+',height='+height+',left=30,top=30');
		else 
			openWindows[winReference] = window.open(winUrl, winName,  'resizable=yes,scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,width='+width+',height='+height+',screenX=30,screenY=30');
	else
		openWindows[winReference].focus();
}


function SPW(lnk)
{
	if (!openWindows.SP || (openWindows.SP && openWindows.SP.closed)){
		openWindows.SP = window.open('http://www.funds-sp.com/servlets/com.sandp.urls.PDFFetcher?key='+lnk+'.pdf&type=0&lang=en','SP','toolbar=yes,location=no,directories=no,menubar=yes,resizable=yes,scrollbars=yes,status=yes,width=540,height=540');
	}
	else{
		openWindows.SP.focus();
	}
	return;
}


function kFProvider (providerNumber, customerType)
{

var bV = ( navigator.appName == "Netscape" ) ? "nn" : "ie";

winReference='key features';
width=730;
height=400;
winName="keyfeatures";
keyFeaturesDevURL="https://www.keyfeatures.fidelity.co.uk:8686/html_kfd/";
keyFeaturesUATURL="http://uat.keyfeatures.fidelity.co.uk/html_kfd/";
keyFeaturesLiveURL="http://www.keyfeatures.fidelity.co.uk/html_kfd/";

keyFeaturesURL=keyFeaturesLiveURL;

adviserURL=keyFeaturesURL+"adviser/provider_"+ providerNumber + ".html";
directURL=keyFeaturesURL+"new/provider_"+ providerNumber + ".html";

if  (customerType == "direct")
{
winURL=directURL;
}
else
{
winURL=adviserURL;
}

fidOpenNewWindow(winReference, winURL, winName, width, height);

}

function kFFund (fundCode, customerType)
{
var bV = ( navigator.appName == "Netscape" ) ? "nn" : "ie";

winReference='key features';
width=730;
height=400;
winName="keyfeatures";
keyFeaturesDevURL="https://www.keyfeatures.fidelity.co.uk:8686/html_kfd/";
keyFeaturesUATURL="http://uat.keyfeatures.fidelity.co.uk/html_kfd/";
keyFeaturesLiveURL="http://www.keyfeatures.fidelity.co.uk/html_kfd/";

keyFeaturesURL=keyFeaturesLiveURL;

adviserURL=keyFeaturesURL+"adviser/"+ fundCode + "_single1000.html";
directURL=keyFeaturesURL+"new/"+ fundCode + "_single1000.html";

if  (customerType == "direct")
{
winURL=directURL;
}
else
{
winURL=adviserURL;
}

fidOpenNewWindow(winReference, winURL, winName, width, height);


}

function openFundFactsheet(SEDOL)
{
      OpenFactsheetWindow('/cgi-bin/fundchart.cgi?id='+SEDOL, 'dsp_Factsheet','toolbar=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=yes,status=yes,width=630,height=540,left=1,top=115');
 return;
}
function openPricingPageInfo(href_obj)
{
	window.open(href_obj,'MYPOPUP','resizable=yes,scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,width=560,height=500,left=1,top=115');
	return false;
}

function openHowFundScopeWork(href_obj)
{
		window.open(href_obj,'FundScopePopup','resizable=yes,scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,width=560,height=500,left=1,top=115');
}



