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.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];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function printPage() {
	if (navigator.appVersion.indexOf("Macintosh") != -1) {
		alert("Mac users: To print this screen, please click on this page, then choose File -->  Print from the main menu.");
 	} else if (window.print) {
		self.focus();
  		self.print();
   	}
 	else {
		alert("To print this page, click OK, then press Control-P.");
	}
 }
function openWindow(url) {
	var winl = (screen.width - 800) / 2;
	var wint = (screen.height - 600) / 2;
	var newwin = window.open(url, 'newwin', 'width=800, height=600, scrollbars=yes, toolbar=no, left='+winl+', top='+wint+', screenX='+winl+', screenY='+wint+', resizable=yes, alwaysRaised=yes');
	newwin.focus();
	
}

/*function openWindow(url) { 
 	var winl = (screen.width - 800) / 2;
	var wint = (screen.height - 600) / 2;
    var features; 
    features = 'width=800, height=600, scrollbars=yes, toolbar=no, left='+winl+', top='+wint+', screenX='+winl+', screenY='+wint+', resizable=yes, alwaysRaised=yes'; 
	///////////////////////////////////////////////////////////////////////////­/////////////////////// 
	// Grab it with blank url (""), close it.... 
	var popupwin = window.open("", "popupWindow",features); 
	popupwin.close(); 
	// Re-open it with url and set focus to it... 
	///////////////////////////////////////////////////////////////////////////­/////////////////////// 
	if (!popupwin || popupwin.closed) {
    	popupwin = window.open(url, "popupWindow", features); 
	} else { 
    	popupwin.location.href = url; 
		popupwin.focus(); 
 	}
 } */







/*560 x 470 comparison-calc.html
340 x 460 deferment-calc.html
340 x 705 extended-repayment-calc.html
340 x 590 forbearance-calc.html
340 x 700 graduated-repayment-calc.html
340 x 770 income-sensitive-calc.html
340 x 565 standard-calc.html */

function openCalculator(calc) {
	var width = '';
	var height = '';
	var url = '';
switch (calc)
{
case 'comparison':
  width = '560';
  height = '470';
  url = '/bor/managing_education_debt/calculators/comparison-calc.html';
  break
case 'deferment':
  width = '340';
  height = '460';
  url = '/bor/managing_education_debt/calculators/deferment-calc.html';
  break
 case 'extended':
  width = '340';
  height = '705';
  url = '/bor/managing_education_debt/calculators/extended-repayment-calc.html';
  break
 case 'forbearance':
  width = '340';
  height = '590';
  url = '/bor/managing_education_debt/calculators/forbearance-calc.html';
  break
  case 'graduated':
  width = '340';
  height = '700';
  url = '/bor/managing_education_debt/calculators/graduated-repayment-calc.html';
  break
  case 'income':
  width = '340';
  height = '770';
  url = '/bor/managing_education_debt/calculators/income-sensitive-calc.html';
  break
  case 'standard':
  width = '340';
  height = '565';
  url = '/bor/managing_education_debt/calculators/standard-calc.html';
  break
}
var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	var calcwin = window.open(url, 'calcwin', 'width='+width+', height='+height+', scrollbars=yes, toolbar=no, left='+winl+', top='+wint+', screenX='+winl+', screenY='+wint+', resizable=yes, alwaysRaised=yes');
	calcwin.focus();
}

// Feed Module Mouse Over Popup Functions - Starts
function createPop()
{
    var popRef = document.createElement("p");
    popRef.className = 'feedPop';
    popRef.setAttribute('id','feedPop');
    document.body.appendChild(popRef);
    popRef.style.display = 'none';
   
}

function showPop(e,trgElement,textPopup)
{
    var elHt = trgElement.offsetHeight;//this is the element height
    var elWt = trgElement.offsetWidth;//this is the element height
    createPop();
	posY = findMousePos(e)
    if(document.getElementById('feedPop').style.display.indexOf('none')==0)
    {
        popRef = document.getElementById('feedPop');
        var txtNode = document.createTextNode(textPopup);
	var arrPos = findPos(trgElement);
	popRef.style.display = "block";
	popRef.style.left = arrPos[0] + "px";
    popRef.style.top = parseInt(posY+elHt/2)+ "px";
       
        try
        {
            popRef.removeChild(popRef.firstChild);
        }
        catch(e){}
        popRef.appendChild(txtNode);
    }
}

function hidePop()
{
    var popRef = document.getElementById('feedPop');
    popRef.style.display = "none";
}

function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent)
    {
        curleft = obj.offsetLeft;
        curtop = obj.offsetTop;
        while (obj = obj.offsetParent)
        {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        }
    }
    else if(obj.x)curleft+=obj.x;

    if(document.all)
     	curleft-=document.getElementsByTagName("body")[0].offsetLeft;
    
    if(navigator.userAgent.indexOf('Safari')!=-1)
	curleft-=document.getElementsByTagName("body")[0].offsetLeft;

    return [curleft,curtop];
}

function findMousePos(e) {
	var posY = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posY = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posY = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	return posY;
}
