var elStateSelector;
var elHowDidHearAboutSelector;
var elContactMethodSelector;



function disableReferredByText() {
	if(document.getElementById('HowDidHearAboutSelector').value == 'Referral') {
		document.getElementById('ReferredBy').disabled=false;
		document.getElementById('ReferredBy').style.backgroundColor = "#FFFFFF";
	} else {
		document.getElementById('ReferredBy').disabled=true;
		document.getElementById('ReferredBy').style.backgroundColor = "#F0F0F0";
		document.getElementById('ReferredBy').value="";
	}
}


function loadAllSelectors (State, HowDidHearAbout, ContactMethod) {
	elStateSelector = document.getElementById('stateSelector');
	elHowDidHearAboutSelector = document.getElementById('HowDidHearAboutSelector');
	elContactMethodSelector = document.getElementById('ContactMethodSelector');
	
	loadSelector(elStateSelector, State);
	loadSelector(elHowDidHearAboutSelector, HowDidHearAbout);
	loadSelector(elContactMethodSelector, ContactMethod);
	
	disableReferredByText();
	
}

function loadSelector (elSelector, strOption) {
	setOption(elSelector, strOption);
}

function setOption (elSelector, strOption) {
	for (var i = 0; i < elSelector.options.length; i++) {
		if (elSelector.options[i].value == strOption) {
			elSelector.options[i].selected = true;
		}
	}
}
	
function openWin(link,w,h) {
	//where 's' =  scrollbars - 'yes' or 'no'
	window.open(link,"tc","toolbar=0,status=no,menuBar=0,scrollbars=yes,resizable=yes,width="+w+",height="+h+",left=20,top=20");
}

function showPasswordField() {
	var pwdText = document.getElementById("inipassText");
	var pwd = document.getElementById("inipass");
	
	pwdText.style.display = "none";
	pwd.style.display = "block";
	pwd.focus();
}


