
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

function OpenWindow(link)
{
    window.open(link);
}

function SetPageIndex(pageNo)
{
    $('PageIndex').value = pageNo;
    document.forms[0].submit();
}

function $(elementID)
{
    return document.getElementById(elementID);
}

function RespPageState(n, ctrl)
{
	var pageState = n;
	var control = document.getElementById(ctrl);

	if (pageState!=1)
	{
		document.body.style.cursor='wait';
		control.options.length = 0;
		control.options.add(new Option("Loading...", ""));				
	}
	if (pageState!=0)
	{
		document.body.style.cursor='default';	
	}
}

function RedirectTo(page)
{
  document.forms[0].action=page;
  document.forms[0].method='Post';
  document.forms[0].target='_self';
  document.forms[0].submit();
}


function ToolTip(id,isAnimated,aniSpeed)
{ var isInit = -1;
  var div,divWidth,divHeight,iframe;
  var xincr=10,yincr=10;
  var animateToolTip =false;
  var html;
  
  function Init(id)
  {
   div = document.getElementById(id);
   iframe = document.getElementById(id+'IFrame');
   if(div==null) return;
   
   if((div.style.width=="" || div.style.height==""))
   {
   alert("Both width and height must be set");
   return;
   }
   
   divWidth = parseInt(div.style.width);
   divHeight= parseInt(div.style.height);
   if(div.style.overflow!="hidden")
   {
   div.style.overflow="hidden";
   iframe.style.overflow="hidden";
   }
   if(div.style.display!="none")
   {
     div.style.display="none";
     iframe.style.display="none";
   }
   if(div.style.position!="absolute")
   {
    
   div.style.position="absolute";
   iframe.style.position="absolute";
   }
   if(isAnimated && aniSpeed>0)
   {
   xincr = parseInt(divWidth/aniSpeed);
   yincr = parseInt(divHeight/aniSpeed);
   animateToolTip = true;
   }
   isInit++; 
  }
  
    
  this.Show =  function(e,strHTML)
  {
    if(isInit<0) return;
    
    var newPosx,newPosy,height,width;
    if(typeof( document.documentElement.clientWidth ) == 'number' ){
    width = document.body.clientWidth;
    height = document.body.clientHeight;}
    else
    {
    width = parseInt(window.innerWidth);
    height = parseInt(window.innerHeight);
    
    }
    var curPosx = (e.x)?parseInt(e.x):parseInt(e.clientX);
    var curPosy = (e.y)?parseInt(e.y):parseInt(e.clientY);
    
    if(strHTML!=null)
    {html = strHTML;
     div.innerHTML=html;}
    
    var minusWidth=parseInt(divWidth/2);
    if((curPosx+divWidth+10)< width)
    newPosx= curPosx+10;
    else
    newPosx = curPosx-divWidth;
    newPosx=newPosx-minusWidth;
    //if((curPosy+divHeight)< height)
    newPosy= curPosy;
    newPosx -= 4;
   // else
   // newPosy = curPosy-divHeight-10;

   if(window.pageYOffset)
   { newPosy= newPosy+ window.pageYOffset;
     newPosx = newPosx + window.pageXOffset;}
   else
   { newPosy= newPosy+ document.body.scrollTop;
     newPosx = newPosx + document.body.scrollLeft;}

   
   
    div.style.display='block';
    
    iframe.style.display='block';    
    iframe.style.top= parseFloat(parseFloat(newPosy) + 25) + "px";
    iframe.style.left= newPosx+ "px";
    
    //debugger;
    //alert(document.body.scrollTop);
    
    div.style.top= newPosy + "px";
    div.style.left= newPosx+ "px";
    div.focus();
    }

   
   this.Hide= function(e)
    {
    div.style.display='none';
    iframe.style.display='none';
    if(!animateToolTip)return;
    
    iframe.style.height= "0px";
    iframe.style.width= "0px";
    div.style.height= "0px";
    div.style.width= "0px";
    
    }
    
   this.SetHTML = function(strHTML)
   {html = strHTML;
    div.innerHTML=html;} 
       
   Init(id);
}

var t1=null;
var l1="This helps you identify funds with similar characteristics, as each sector is made up of funds investing in similar assets, or the same stockmarket sectors, or in the same geographical region.";
var l2="<br />Show funds available by specific risk category";
var l3="Income (Inc) funds provide a choice between having fund growth paid to you on a monthly basis, or re-invested in to the fund. Accumulation (Acc) funds reinvest the growth";
var l4 = "Compare your portfolio against a sector made up of funds investing in similar assets, or the same stockmarket sectors, or in the same geographical region."
var l5 = "Show funds available from a specified fund manager"

function init()
{
 t1 = new ToolTip("ToolTip",false);
}

function HideOrShowToolTip()
{
  return document.getElementById('ToolTip').style.display=="none";
}
