var amonths = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function formatDate(vdate){
	var viewdd = vdate.getDay();
	var viewhh = vdate.getHours();
	var viewtt = (viewhh<12)?'AM':'PM';
	var viewmm = vdate.getMinutes()+"";
	var viewss = vdate.getSeconds()+"";
	if(viewmm.length==1){viewmm="0"+viewmm;}
	if(viewss.length==1){viewss="0"+viewss;}
	if(viewhh==0){viewhh=12;}
	if(viewhh>12){viewhh=viewhh-12;}
	return(amonths[viewdd]+" "+viewhh+":"+viewmm+":"+viewss+" "+viewtt);	
}
//JAA 9/18/2010 commented out for new layout functionality
//function initwindow(){wTime();navinit();extL();}
function initwindow(){navinit();extL();}
function navinit(){
{if(document.all&&document.getElementById){ele=document.getElementsByTagName("UL");for(j=0;j<ele.length;j++){for(i=0;i<ele[j].childNodes.length;i++){node=ele[j].childNodes[i];if(node.nodeName=="LI"){node.onmouseover=function(){this.className+=" over";};node.onmouseout=function(){this.className=this.className.replace(" over","");}}}}}}}
if (!Array.prototype.push){Array.prototype.push = function(elem){this[this.length] = elem;}}var EventManager={_registry:null,Initialise:function(){if(this._registry==null){this._registry=[];EventManager.Add(window, "unload", this.CleanUp);}},Add:function(obj,type,fn,useCapture){this.Initialise();if(typeof obj=="string"){obj = document.getElementById(obj);}if(obj==null || fn==null){return false;}if(obj.addEventListener){obj.addEventListener(type,fn,useCapture);this._registry.push({obj:obj,type:type,fn:fn,useCapture:useCapture});return true;}if(obj.attachEvent && obj.attachEvent("on" + type, fn)){this._registry.push({obj:obj,type:type,fn:fn,useCapture:false});return true;}return false;},CleanUp:function(){for(var i=0;i<EventManager._registry.length;i++){with(EventManager._registry[i]){if(obj.removeEventListener){obj.removeEventListener(type,fn,useCapture);}else if (obj.detachEvent){obj.detachEvent("on" + type, fn);}}}EventManager._registry = null;}};
function extL(){if(!document.getElementsByTagName)return;var ax=document.getElementsByTagName('a');for(var i=0;i<ax.length;i++){if(ax[i].getAttribute('href') && ax[i].getAttribute('rel')=='external'){ax[i].target='_blank';}}}
function $(id){return document.getElementById(id);}

//JAA 9/18/2010 commented out for new layout functionality
window.onload=initwindow;

function openTPlusWindow() {
	openTPWin = window.open('http://transparencyplus.icdfunds.com/');
}

// SSO Window allows only 1 window open at a time
var gmyWinCTKSSO = null;

var gmyWinTPSSO = null;

function myOpenWindow(winURL, winName, winFeatures, winObj)
{
  var theWin; // this will hold our opened window 

  // first check to see if the window already exists
  if (winObj != null)
  {
    // the window has already been created, but did the user close it?
    // if so, then reopen it. Otherwise make it the active window.
    if (!winObj.closed) {
      winObj.focus();
      return winObj;
    } 
    // otherwise fall through to the code below to re-open the window
  }

  // if we get here, then the window hasn't been created yet, or it
  // was closed by the user.
  theWin = window.open(winURL, winName, winFeatures); 
  return theWin;
} 


function CloseWindow(){
	window.open('','_self','');
	window.close();
}

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];}
}
