/* tnc.js	06/01/2006	Jeff Myers - js functions for TNC web site */

/* Initialize */
//function goLoad() { 
	//getQ();
	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];}
	}

	sfHover = function() {
		var sfEls = document.getElementById("headerRightNav").getElementsByTagName("li");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
//}

/* Questions */
quotes = new Array;
quotes[1] = '<p>&quot;The greatest benefit of working with Nottingham is being able to pick up the phone, call and get a person on the other end. The personal service is everything to us.&quot;</p> <p><b>Head of Administration<br>Mutual Fund</b></p>';
quotes[2] = '<p>&quot;Each person that I work with or have worked with over the years is very genuine. They are all well-intended, hard working people and I&#39;ve always liked that about Nottingham.&quot;</p> <p><b>Chief Investment Officer<br>Mutual Fund</b></p>';
quotes[3] = '<p>&quot;Our relationship with Nottingham has improved the effectiveness and efficiency of what I&#39;ve been able to do for the endowment. There has not been one thing we&#39;ve asked for that they&#39;ve not come up with a way to address our request.&quot;</p> <p><b>Endowment Advisor<br>Wachovia Securities</b></p>';
quotes[4] = '<p>&quot;I&#39;ve always been impressed with the depth offered in terms of reporting and customization. They are so accommodating and always handle my report requests in a very timely manner.&quot;</p> <p><b>East Coast-based Hedge Fund Manager</b></p>';
quotes[5] = '<p>&quot;I looked at 15-20 admin firms, firms all over the country, but when I walked into Nottingham I knew. I had a very favorable, personable impression from the outset.&quot;</p> <p><b>Hedge Fund Manager</b></p>';
quotes[6] = '<p>&quot;What a pleasure talking with you yesterday. I am thrilled to have discovered Nottingham.&quot;</p> <p><b>VP Asset Management<br>West Coast</b></p>';
var qnumber = 6 ;

function getQ() {
	var randomnumber = Math.random() ;
	var rand1 = Math.round( (qnumber-1) * randomnumber) + 1 ;
	var qs = quotes[rand1]
	document.getElementById('quoteContainer').innerHTML = qs;
}

/* AJAX functions */
function ajaxReq(target,rType,action) {
	function createRequestObject() {
    	var ro;
    	var browser = navigator.appName;
    	if(browser == "Microsoft Internet Explorer"){
        	ro = new ActiveXObject("Microsoft.XMLHTTP");
    	}else{
        	ro = new XMLHttpRequest();
    	}
    	return ro;
	}

	var http = createRequestObject();

    http.open('get', action);
    http.onreadystatechange = processResponse;
    http.send(null);

	function processResponse() {
    	if(http.readyState == 4 & rType == 'list'){
    		var dlist;
    		var vals;
			document.getElementById(target).options.length = 0;
    		dlist = http.responseText.split("|");
			for (n=0;n<dlist.length;n++){
				if (dlist[n] != '') {
    				vals = dlist[n].split("~");
					document.getElementById(target).options[n] = new Option(vals[1],vals[0]);
				}
			}
    	}
    	if(http.readyState == 4 & rType == 'sel'){
    		var dsel;
    		dsel = http.responseText;
			for (n=0;n<document.getElementById(target).options.length - 1;n++){
				if (document.getElementById(target).options[n].value == dsel) {
					document.getElementById(target).selectedIndex = n;
				}
			}
    	}
    	if(http.readyState == 4 & rType == 'text'){
			document.getElementById(target).value = http.responseText;
    	}
    	if(http.readyState == 4 & rType == 'html'){
    		document.getElementById(target).innerHTML = http.responseText;
    	}
	}
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  obj.style.filter = "alpha(opacity:"+opacity+")";
  obj.style.KHTMLOpacity = opacity/100;
  obj.style.MozOpacity = opacity/100;
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 25);
    }
  }
}

