buttonLoc = relativePath + "images/btn_";
buttonName = new Array ('build_eco','conserve','evolve','finance_eco','generate','home','learn','move','reuse','water');


for (var cnt=0; cnt < buttonName.length; cnt++) {
	eval ('var '+buttonName[cnt]+'_on = new Image();');
	eval (buttonName[cnt] + '_on.src = "'+buttonLoc + buttonName[cnt] + '_on.gif"');
	eval ('var '+buttonName[cnt]+'_off = new Image();');
	eval (buttonName[cnt] + '_off.src = "'+buttonLoc + buttonName[cnt] + '_off.gif"');
}	

function buttonAction (imgName, isItOn) {   
     if (isItOn) {
        document[imgName].src = eval(imgName + "_on.src");
     } else {
        document[imgName].src = eval (imgName + "_off.src");
     }
}

function replaceInput (formName,fieldname,oldValue,myValue)
{
	var myForm = eval("document."+formName);
	if (myForm[fieldname].value == oldValue)
		myForm[fieldname].value = myValue;
}

function doCollapse (idName, status)
{
	document.getElementById(idName).className = status;	
	if (status == "visible_error")
	{
		location.href = "#"+(idName).replace("error_","");
	}
}

function validatePassword (formName)
{
	var myForm = eval("document."+formName);
	
	if (myForm["password"].value == "")
	{
		doCollapse ('true_password','invisible');
		doCollapse ('dummy_password','visible');
	}
}

function goPopup(url,width,height,scroll,menu)
{
	if (menu == "yes")
		window.open(url, 'newWin', 'width='+width+',height='+height+',scrollbars='+scroll+',menubar=yes,toolbar=yes');	
	else
		window.open(url, 'newWin', 'width='+width+',height='+height+',scrollbars='+scroll);
}