/**
 ** FundFindr Signup Form Controller JavaScript
 **/
function newBusType()
{
	var t = document.getElementById("fm-bstage");
	var tt = t.options[t.selectedIndex].value;
	if( tt == "Not Applicable" ) {
		document.getElementById("entinfo").style.display = "none";
	} else {
		document.getElementById("entinfo").style.display = "block";
	}
}

function newUserType()
{
	var t = document.getElementById("usertype");
	var tt = t.options[t.selectedIndex].value;

	showHide( "dd", tt );
	showHide( "dt", tt );
	showHide( "p", tt );
	showHide( "div", tt );
}

function ih( id, text )
{
	if( !document.getElementById(id) )
		alert( id );

	document.getElementById(id).innerHTML = text;
}

function show( what ) { document.getElementById(what).style.display = "block"; }
function hide( what ) { document.getElementById(what).style.display = "none"; }

function showHide( tag, type )
{
	var w = document.getElementsByTagName(tag);
	for( x=0;x<w.length;x++ ) {
		if( (w[x].className.indexOf("_ent") != -1) ||
		    (w[x].className.indexOf("_inv") != -1) ||
		    (w[x].className.indexOf("_sp") != -1) ) {
			if( type == 1 ) {
				if( w[x].className.indexOf("_ent") == -1 )
					w[x].style.display = "none";
				else
					w[x].style.display = "block";
				ih("amount_label", "Amount Sought:" );
				ih("comp_title", "Company Information" );
				ih("bios_label", "Management Bios" );
				ih("other_title", "Other Needs");
				ih("defns_title", "Defensibility and IP" );
				ih("compadv_title", "Competetive Advantage" );
				ih("bm_title", "Business Model" ); 
			} else if( (type == 2) || (type == 4) ) {
				if( w[x].className.indexOf("_inv") == -1 )
					w[x].style.display = "none";
				else
					w[x].style.display = "block";
				ih("amount_label", "Funding Available:" );
				ih("comp_title", "Company/Firm Information" );
				ih("bios_label", "Investor Bios" );
				ih("yesno_label", "Accredited investor:" );
				ih("comp_title", "Further Information" );
			} else if( type == 3 ) {
				if( w[x].className.indexOf("_sp") == -1 )
					w[x].style.display = "none";
				else
					w[x].style.display = "block";
				ih("comp_title", "Company Information" );
				ih("bios_label", "Management Bios" );
				ih("other_title", "Associations &amp; Certifications" );
				ih("yesno_label", "I am a freelancer:" );
				ih("defns_title", "Markets/Areas You Service" );
				ih("compadv_title", "About Your Clients" );
				ih("bm_title", "Other Needs" );
			}
		}
	}
}
