/*
 JavaScript file for Available Resources
 Copyright Available Resources, 2000 ALL RIGHTS RESERVED
*/

// Quick Help Function
	function quickHelp(t,a) {
		var loc = 'index_help.php?helptopic=' + escape(t) + '&helpid=' + a + '#a' + a;
		var helpwin = 
	window.open(loc,'helpwin','scrollbars=yes,resizable=yes,height=300,width=250,menubar=yes');
		helpwin.focus();
	}
	
	// Map Quest Pop-up
	function getMap(address,zip) {
		var loc = 'http://maps.yahoo.com/py/maps.p?Pyt=Tmap&addr=' + escape(address) + '&csz=' + zip + '&Get%A0Map=Get+Map&rand=2%2F6%2F2002+2%3A54%3A16+PM';
        var findmap =
	window.open(loc,'findmap','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=450,height=600,resizable=yes');
		findmap.focus();
	}
	
		
	// Display Web Page
	function showPage(userid,pageid) {
		var loc = 'register_page_preview.php?&userid=' + userid + '&pageid=' + pageid;
		var webpage = 
	window.open(loc,'webpage','toolbar=no,menubar=no,scrollbars=yes,resizable=yes,height=300,width=500');
		webpage.focus();
	}
	
	// Display Planner's Net Web Site
	function showWeb(userid,pageid) {
		var loc = 'register_web_preview.php?&userid=' + userid + '&pageid=' + pageid;
		var website = 
	window.open(loc,'website','toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,height=550,width=700');
		website.focus();
	}		
	
	// Display Tutorial Page
	function showTutorial() {
		var loc = 'slide.php';
		var tutorialpage = 
	window.open(loc,'tutorialpage','toolbar=no,menubar=no,scrollbars=yes,resizable=yes,height=400,width=630');
		tutorialpage.focus();
	}
	
	// Display Download Descriptions
	function showDownload(id,act) {
		var loc = 'index_download.php?act=' + escape(act) + '&downid=' + id;
		var downloadpage = 
	window.open(loc,'downloadpage','toolbar=no,menubar=no,scrollbars=yes,resizable=yes,height=400,width=630');
		downloadpage.focus();
	}	
	
	// Display Contact Planner Form
	function contactPlanner(userid) {
		var loc = 'contact.php?&userid=' + userid + '&act=start';
		var contactpage = 
	window.open(loc,'contactpage','scrollbars=yes,resizable=yes,height=500,width=450,menubar=yes');
		contactpage.focus();
	}
	
	// News popup Function
	function showArticle(homeform) {
		var t = "Tips";
		var a = homeform.tip.options[homeform.tip.selectedIndex].value;
		var loc = 'index_home_news.php?&act=showtopic&topic=' + escape(t) + '&newsid=' + a + '#a' + a;
		var helpwin = 
	window.open(loc,'helpwin','scrollbars=yes,resizable=yes,height=460,width=480,menubar=yes');
		helpwin.focus();
	}
	
	// Information about professionals popup Function
	function showProf(homeform) {
		var t = "Tips";
		var a = homeform.prof.options[homeform.prof.selectedIndex].value;
		var loc = 'index_home_news.php?&act=showtopic&topic=' + escape(t) + '&newsid=' + a + '#a' + a;
		var helpwin = 
	window.open(loc,'helpwin','scrollbars=yes,resizable=yes,height=460,width=480,menubar=yes');
		helpwin.focus();
	}	
	
	// Fade Off Text
	var message = "Did you know..."
	var character = 0;
	var to_print = "";
	var next = 0 ;
	var fade = 100 ;
	var next_message = new Array() ;
	next_message[0] = "5 in every 9 Americans will retire with incomes at or below the poverty level."
	next_message[1] = "3 in 9 will retire with incomes just barely sufficient to meet their daily needs."
	next_message[2] = "Only 1 in every 9 are expected to enjoy a comfortable life style during retirement."
	next_message[3] = "30% or more of income is lost to taxes. Over $400,000 during the course of our working lives."
	next_message[4] = "You can expect to pay 50,000 to 100,000 dollars or more in tuition or related expenses by the time your two children have a college degree."
	next_message[5] = "Half of all Americans will spend up to 20% of their annual household income on interest charges."
	next_message[6] = "If you are between the ages of 25 to 55, the time to start planning is right now!."
	
	function doText(text) {
		if (document.all) { // IE
			if (character <= text.length - 1) {
				to_print += text.charAt(character);
				teletext.innerHTML = to_print;
				character++;
			}
			else scrollIt();
		}else if (document.layers) {  // NS4
			if (character <= text.length - 1) {
				to_print += text.charAt(character);
				document.NS4teletext1.document.NS4teletext2.document.write("<font class=home-note>" + to_print + "</font>"); 
				document.NS4teletext1.document.NS4teletext2.document.close();
				character++;
			}else {
				character = 0;
				to_print = "";
				nextMessage();
			}
		}else if (document.getElementById) {  // NS6
			if (character <= text.length - 1) {
				to_print += text.charAt(character);
				document.getElementById("teletext").firstChild.nodeValue = to_print;
				character++;
			}else scrollIt();
		}
		setTimeout("doText(message)", 100);
	}
	
	function scrollIt() {
		if (fade >= -60) {
			fade -= 4;
			if (fade < 0) {
				teletext.innerHTML = "" ;
		   }
		}else {
			character = 0;
			to_print = "";
			nextMessage();
			fade = 100;
		}
		teletext.filters.alpha.opacity = fade;
	}
	
	function nextMessage() {
		message = next_message[next]
		if (next == 6) {
			next = 0;
		} else next++;
	}

