// JavaScript Document

//Call this to load flash movies
function outputFlash( flashUrl, width, height ) {
		document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"')
		document.write( 'width="' + width + '" height="' + height + '">' );
		document.write( '<param name="movie" value="' + flashUrl + '">' );
		document.write( '<param name="quality" value="high">' );
		document.write( '<param name="wmode" value="transparent">' );
		document.write( '<embed src="' + flashUrl + '" width="' + width + '" height="' + height + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed></object>');
		
	}

//URL Functions

function goToURLbtp() { window.top.location="http://www.ifa.com/btp/"; }
function btp() { window.top.location="http://www.ifa.com/btp/"; }
function portfolios() { window.top.location="http://www.ifa.com/portfolios/"; }
function returnsandstandarddeviation() { window.top.location="http://www.ifa.com/Library/Support/Data/returnsandstandarddeviationsformodelportfolios.asp"; }
function efficientportfolios() { window.top.location="http://www.ifa.com/Admin/efficientports.htm"; }
function portfoliosimulator() { window.top.location="http://www.ifa.com/Admin/portfoliosimulator.asp"; }
function riskreturn() { window.top.location="http://www.ifa.com/portfolios/index.asp#RiskReturnTable"; }
function goToUrlRiskTable() { window.top.location="http://www.ifa.com/portfolios/index.asp#RiskReturnTable"; }
         
function goToUrlCharts() { window.top.location="http://www.ifa.com/library/support/data/returnsandstandarddeviationsformodelportfolios.asp"; }
function goToUrlMatrix005() { window.top.location="http://www.ifa.com/portfolios/p005/matrix.asp"; }
function goToUrlMatrix010() { window.top.location="http://www.ifa.com/portfolios/p010/matrix.asp"; }
function goToUrlMatrix015() { window.top.location="http://www.ifa.com/portfolios/p015/matrix.asp"; }
function goToUrlMatrix020() { window.top.location="http://www.ifa.com/portfolios/p020/matrix.asp"; }
function goToUrlMatrix025() { window.top.location="http://www.ifa.com/portfolios/p025/matrix.asp"; }
function goToUrlMatrix030() { window.top.location="http://www.ifa.com/portfolios/p030/matrix.asp"; }
function goToUrlMatrix035() { window.top.location="http://www.ifa.com/portfolios/p035/matrix.asp"; }
function goToUrlMatrix040() { window.top.location="http://www.ifa.com/portfolios/p040/matrix.asp"; }
function goToUrlMatrix045() { window.top.location="http://www.ifa.com/portfolios/p045/matrix.asp"; }
function goToUrlMatrix050() { window.top.location="http://www.ifa.com/portfolios/p050/matrix.asp"; }
function goToUrlMatrix055() { window.top.location="http://www.ifa.com/portfolios/p055/matrix.asp"; }
function goToUrlMatrix060() { window.top.location="http://www.ifa.com/portfolios/p060/matrix.asp"; }
function goToUrlMatrix065() { window.top.location="http://www.ifa.com/portfolios/p065/matrix.asp"; }
function goToUrlMatrix070() { window.top.location="http://www.ifa.com/portfolios/p070/matrix.asp"; }
function goToUrlMatrix075() { window.top.location="http://www.ifa.com/portfolios/p075/matrix.asp"; }
function goToUrlMatrix080() { window.top.location="http://www.ifa.com/portfolios/p080/matrix.asp"; }
function goToUrlMatrix085() { window.top.location="http://www.ifa.com/portfolios/p085/matrix.asp"; }
function goToUrlMatrix090() { window.top.location="http://www.ifa.com/portfolios/p090/matrix.asp"; }
function goToUrlMatrix095() { window.top.location="http://www.ifa.com/portfolios/p095/matrix.asp"; }
function goToUrlMatrix100() { window.top.location="http://www.ifa.com/portfolios/p100/matrix.asp"; }
//Close

//Rollover Images Functions
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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}
//Close

//Redirect 
var url1="http://www.ifa.com/library/support/data/IFAindexdata.asp";
function go_IFAindexdata() {
location.href=url1;
}
//Close

//Redirect
function MM_popupMsg(msg) {
  alert(msg);
}
//Close

//Open New Browser
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//Close

/*
//Popups for book. Can be deleted.
var popoverTimer = null;

function sitb_showLayer(obj) {
  if(document.layer) {
	return; // netscape 4
  }

  if(popoverTimer) {
    clearTimeout(popoverTimer);
    popoverTimer = null;
  }

  var sitb_lyr = sitb_getLayer(obj);
  if(!sitb_lyr) {
    return;
  }
  
  var sitb_img = sitb_getLayer('popoverImage');
  if(!sitb_img) {
    return;
  }

  var sitb_x, sitb_y, sitb_temp;
  if(sitb_img.x) {
    sitb_x = sitb_img.x;
  } else {
    sitb_temp = sitb_img;
    sitb_x = sitb_img.offsetLeft;
    while(sitb_temp.offsetParent) {
      sitb_temp = sitb_temp.offsetParent;
      sitb_x += sitb_temp.offsetLeft;
    }
  }
  if(sitb_img.y) {
    sitb_y = sitb_img.y;
  } else {
    sitb_temp = sitb_img;
    sitb_y = sitb_img.offsetTop;
    while(sitb_temp.offsetParent) {
      sitb_temp = sitb_temp.offsetParent;
      sitb_y += sitb_temp.offsetTop;
    }
  }

    sitb_lyr.style.visibility="visible";
    sitb_lyr.style.display="block";

    sitb_lyr.style.left = sitb_x + (sitb_img.width / 2);

    sitb_lyr.style.top = sitb_y + (sitb_img.height / 2);
} 

function sitb_getLayer(obj) {
  if(document.layers) {
    return document.layers[obj];
  } else if(document.all && !document.getElementById) {
   return document.all[obj];
  } else if(document.getElementById) {
   return document.getElementById(obj);
  } else {
   return null;
  }
}

function sitb_hideLayer(obj) {

  var sitb_lyr = sitb_getLayer(obj);
 
  if(!sitb_lyr) {
    return;
  }

  if(document.layers) {
    sitb_lyr.visibility="hidden";
  } else {
    sitb_lyr.style.display="none";
    sitb_lyr.style.visibility="hidden";
  }

}

function sitb_doHide (obj) {
  if(document.layer) {
    return;
  }
  popoverTimer = setTimeout('sitb_hideLayer("' + obj +'")', 50);  
}

if(document.layers) {
 sitb_hideLayer('popover');
 
} else {

}*/
//Close

//Humanclick Popup
function popUp() {
	/* begin configuration */
	var url = "http://hc2.humanclick.com/hc/42353038/?cmd=file&file=visitorWantsToChat&site=42353038&byhref=1"; 
	var w = "475"; 
	var h = "325"; 
	var menu = "no"; 
	var scroll = "no"; 
	var tool = "no"; 
	var location = "no"; 
	var resize = "no";
	/* end configuration */

	var winl = "475";
	var wint = "325";
	winprops = 'width='+w+', height='+h+', top='+wint+', left='+winl+', menubar='+menu+', scrollbars='+scroll+', toolbar='+tool+', location='+location+', resizable='+resize+''
	window.open(url, 'popup', winprops);
}

//from netlobo.com, modified by IFA
function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		
		if( style2.display == "none" ) {
			style2.display = "block";
		}
		else {
			style2.display = "";	
		}
		//style2.display = style2.display ? "none" : "block";
		
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display ? "none" : "block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display ? "none" : "block";
	}
}

/*****Start IE Update Code
 * Following is taken from http://activecontent.blogspot.com/
 * Microsoft's IE update in April forces users to click an ActiveX control before using it. 
 * This code will fix the problem. Function will be called in the footer body.
 */
 
function isIE6() {
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if (strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0) {
    if (parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6) {
      return false;
    }
    if (strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  } else {
    return false;
  }
}
 
function ieupdate(){
 var strBrowser = navigator.userAgent.toLowerCase();
 if( isIE6() ){
  var theObjects = document.getElementsByTagName('object');
  var theObjectsLen = theObjects.length;
  for (var i = 0; i < theObjectsLen; i++) {
   if(theObjects[i].outerHTML){
    if(theObjects[i].data){
     theObjects[i].removeAttribute('data');
    }
    var theParams = theObjects[i].getElementsByTagName("param");
    var theParamsLength = theParams.length;
    for (var j = 0; j < theParamsLength; j++) {
      if(theParams[j].name.toLowerCase() == 'flashvars'){
        var theFlashVars = theParams[j].value;
      }
    }
    var theOuterHTML = theObjects[i].outerHTML;
    var re = /<param name="FlashVars" value="">/ig;
    theOuterHTML = theOuterHTML.replace(re, "<param name='FlashVars' value='" + theFlashVars + "'>");
    theObjects[i].outerHTML = theOuterHTML;
   }
  }
 }
}

window.onunload = function() {
 if( isIE6() ) {
 	if (document.getElementsByTagName) {
  		var objs = document.getElementsByTagName("object");
  		for (i=0; i<objs.length; i++) {
 	  		objs[i].outerHTML = "";
  		}
	}
 }
}

/****End IE Update Code*******/

