// BROWSER DETECT (NS4.x & IE ONLY)

//var isNS4 = (document.layers != null);
//var isIE = (document.all != null);

var is_major = parseInt(navigator.appVersion); 
var is_minor = parseFloat(navigator.appVersion);
var agt=navigator.userAgent.toLowerCase();
var isNN = !(agt.indexOf("msie")>-1);
var isIE = agt.indexOf("msie")>-1;

isNS4 = is_major < 5 && isNN;
isNS5up = is_major > 4 && isNN;

// NETSCAPE 4.x RESIZE SCRIPT
function handleResize() {
	location.reload;
}

if (isNS4) {
	window.captureEvents(Event.RESIZE);
	window.onresize = handleResize();
}

//	GENERIC MACROMEDIA ROLLOVER SCRIPTS
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



// NAV ROLLOVERS
if (document.images) {
	imgDir = "/images/header/";
	var ourm_off = new Image;					ourm_off.src = imgDir + "nav_ourManagers_off.gif";
	var ourm_on = new Image;					ourm_on.src = imgDir + "nav_ourManagers_on.gif";
	var comm_off = new Image;					comm_off.src = imgDir + "nav_commentary_off.gif";
	var comm_on = new Image;					comm_on.src = imgDir + "nav_commentary_on.gif";
	var news_off = new Image;					news_off.src = imgDir + "nav_newsMedia_off.gif";
	var news_on = new Image;					news_on.src = imgDir + "nav_newsMedia_on.gif";
}

function showImg(imgName, imgState) {
	document.images[imgName].src = eval(imgName + imgState + ".src");
}

// FUND FINDER PULLDOWN WRITER

function writeFF(contentToWrite) {
	if(!isNS4) {
		FFopenMF = '<form name="FFFormMF" id="FFFormMF" class="fundFinder" method="" action="">';
		FFopenCEF= '<form name="FFFormCEF" id="FFFormCEF" class="fundFinder" method="" action="">';
		FFopenMA = '<form name="FFFormMA" id="FFFormMA" class="fundFinder" method="" action="">';
		FFclose = '</form>';
		document.write(eval(contentToWrite));
	}
}

// SHOW FUND FINDER IN NON-NETSCAPE 4.x BROWSERS
function showDiv(whichDiv) {
	if(!isNS4) {
	//theDiv = eval("document.all." + whichDiv);
	theDiv = document.getElementById(whichDiv);
	theDiv.style.display = "";
	}
}



// EXPAND FUND FINDER IN IE for PC

platform = (navigator.userAgent);
o = navigator.platform;
b = navigator.appName;
var win32;
if( o.indexOf("Win") !=-1 && b.indexOf("Microsoft") !=-1) { win32 = true }


function closeFFinder(currDiv) {
	if(win32) {
		if(document.FFFormMF) { document.all['FF_MF_B'].style.width=105 }
  		if(document.FFFormMF) {document.all['FF_MF_S'].style.width=105 }
		//if(document.FFFormMF) {document.all['FF_MF_IP'].style.width=105 }	 	   	
  		if(document.FFFormMA) {document.all['FF_MA'].style.width=105 }
  		if(document.FFFormCEF) { document.all['FF_CEF'].style.width=105 }  
  		if (currDiv) {
  			document.all[currDiv].style.width=300;
  		}
	}
}

function positionFF_MF_B() {
	
	if (document.all['finderTop_FF_MF_B']) {
		yPos_FF_MF_B = document.all['finderTop_FF_MF_B'].offsetTop;
		tempEl = document.all['finderTop_FF_MF_B'].offsetParent;
		while (tempEl != null) {
			yPos_FF_MF_B += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		document.all['FF_MF_B'].style.top = yPos_FF_MF_B + 12;
	}
}

function positionFF_MF_S() {
    		   	
	if (document.all['finderTop_FF_MF_S']) {
		yPos_FF_MF_S = document.all['finderTop_FF_MF_S'].offsetTop;
		tempEl = document.all['finderTop_FF_MF_S'].offsetParent;
		while (tempEl != null) {
			yPos_FF_MF_S += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		document.all['FF_MF_S'].style.top = yPos_FF_MF_S + 12;
	}
}

//	NEW SELECT MENU
function positionFF_MF_IP() {
	/*
    if (document.all['finderTop_FF_MF_IP']) {
		yPos_FF_MF_IP = document.all['finderTop_FF_MF_IP'].offsetTop;
		tempEl = document.all['finderTop_FF_MF_IP'].offsetParent;
		while (tempEl != null) {
			yPos_FF_MF_IP += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		document.all['FF_MF_IP'].style.top = yPos_FF_MF_IP + 12;
	}
	*/
}

function positionFF_CEF() {
    		   	
	if (document.all['finderTop_FF_CEF']) {
		yPos_FF_CEF = document.all['finderTop_FF_CEF'].offsetTop;
		tempEl = document.all['finderTop_FF_CEF'].offsetParent;
		while (tempEl != null) {
			yPos_FF_CEF += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		document.all['FF_CEF'].style.top = yPos_FF_CEF + 12;
	}
}

function positionFF_MA() {
    		   	
	if (document.all['finderTop_FF_MA']) {
		yPos_FF_MA = document.all['finderTop_FF_MA'].offsetTop;
		tempEl = document.all['finderTop_FF_MA'].offsetParent;
		while (tempEl != null) {
			yPos_FF_MA += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		document.all['FF_MA'].style.top = yPos_FF_MA + 12;
	}
}



// -------------------
// PRINTING

function openPrint(url) {
	var attr = 'width=670,height=460,menubar,toolbar,resizable,scrollbars=yes';
	var printing = window.open(url,'print',attr);
	printing.focus();

}

// PROMOTION POPUP URL IN NEW WINDOW
function promoPopup(urlValue, atribValues){

	windowName="Promotion_Popup";

	if (atribValues == null){
		atribValues="width=700,height=800";
	}
	//Always disable toolbars
	atribValues=atribValues+",toolbar=no";
	window.open(urlValue,windowName,atribValues);
}	
	
