// JScript source code
	function loadit(gopage) {
		if (opener == undefined || opener == "undefined") {
			this.location = gopage
		} else {
			tmp1 = this.location.href;
			opener.location.href=gopage;
			this.location.href=tmp1;
		}
	}

	function setQTSearchFocus() {
		document.qtsearch.ticker.focus();
	}

	function openPlayerSelection(windowURL) {
	   playerSelectWin = window.open(windowURL,'playerSelectWin','toolbar=no,titlebar=no,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=312,height=480,top=20,left=10');
    }

	function openUnivWin(windowName) {
	if ((navigator.appVersion.indexOf("Mac") != -1)) {
		newWindow = window.open(windowName, 'newWindow','toolbar=no,location=no,menubar=no,width=475,height=550,scrollbars=yes,resizable=no');
	} else {
		newWindow = window.open(windowName, 'newWindow','toolbar=no,location=no,menubar=no,width=493,height=550,scrollbars=yes,resizable=no');
	}}

	function openwin(windowName, width, height) {  
	    newWindow = window.open(windowName, 'newWindow','width='+width+',height='+height+',scrollbars=yes,top=10, left=10');  
	} 
	
	function openArticleWindow(htmFile,myname) {
	    var newWindow = window.open(htmFile, myname,'left,top,toolbar=yes,menubar=yes,location=yes,width=600,height=355,scrollbars=yes,resizable=yes');
	}
		
	function winOpen(url,width,height) {
	    //Incoming width and height are formatted for IE on windows platform.		
		if ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appName == "Microsoft Internet Explorer")) {
		    height = height * .892;
			window.open(url,'macie','menubar=no,scrollbars=no,status=no,width='+width+',height='+height); }
		if ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appName == "Netscape")) {
		    height = height * .941;
			window.open(url,'macNN','menubar=no,scrollbars=no,status=no,width='+width+',height='+height); }		
		if ((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName == "Netscape")) {
		    height = height * 1.059;
			window.open(url,'NN','menubar=no,scrollbars=no,status=no,width='+width+',height='+height); }
		if ((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName == "Microsoft Internet Explorer")) {
			window.open(url,'IE','menubar=no,scrollbars=no,status=no,width='+width+',height='+height); }	
	}
	 
	function getSelectedButton(buttonGroup) { 
		for (var i = 0; i < buttonGroup.length; i++) {			
			if(buttonGroup[i].checked) {
				return buttonGroup[i].value;
			}   
		}
		return 0;
	}            

   function openQuizAnswer(quesId, colId) {
     var answer = getSelectedButton(document.quizAnswer.userAnswer);
       if (answer == 0) {
          alert("Please answer the question.");
          return false;
       }
	 var destURL = "/article/quiz_answer.asp?quesId=" + quesId + "&answer=" + answer + "&colId=" + colId;	 
	 newWindow = window.open(destURL, 'newWindow','toolbar=no,menubar=no,width=411,height=245,scrollbars=yes,resizable=no');
     return false;
   }

	var browser_type=navigator.appName
	function popUpAndRedirect(windowName) {
		history.go(-1);
		if (browser_type=="Microsoft Internet Explorer") {
			newWindow = window.open(windowName, 'myWindow','toolbar=no,location=no,menubar=no,width=475,height=550,scrollbars=no,resizable=no');
		} else {
			newWindow = window.open(windowName, 'myWindow','toolbar=no,location=no,menubar=no,width=475,height=550,top=0,left=0,scrollbars=no,resizable=no');
		}		
	}
	
function srchTerm()
{
	sSearchType = document.searchForm.SrchType.value;

	if (sSearchType == "search") {
		document.searchForm.SrchTerm.value = document.searchForm.sSrchTerm.value;
  	document.searchForm.action = "http://search.morningstar.com/MstarSrch/MstarSrch2.aspx?topnav=search";
  	document.searchForm.submit();
	} else {
		document.searchForm.action = "http://quote.morningstar.com/switch.html?hsection=quote&ticker="+document.searchForm.sSrchTerm.value;
		document.searchForm.submit();
  }
}

function setSearchType(sSearchType)
{
	document.searchForm.SrchType.value = sSearchType;
}

function ClearSearchBox()
{
	var text = document.searchForm.sSrchTerm.value;
	if (text == "Enter ticker, name or topic")
		document.searchForm.sSrchTerm.value = "";
}	
