function getEl( myValue ){
var myObj = document.getElementById( myValue );
return myObj;
}
// **************************** formFieldToggle ****************************

/*
platform:
PC
Mac
Unix/Linux
Other

<select name="system_pc" id="pc">
<option value="Other">
<input id="other_pc"

<select name="system_mac" id="mac">
<option value="Other">
<input id="other_mac"

showHide( 'hide', myMac );
showHide( 'hide', otherMacField );
showHide( 'hide', myPc );
showHide( 'hide', otherPcField );
*/
document.onclick = test;



function showHide( state, myEl ){
if ( state == 'show' ){
myEl.setAttribute( 'class', 'showField' );
} else if ( state == 'hide' ){
myEl.setAttribute( 'class', 'hideField' );
}
}



function test() {
var mySystemPc = getEl( 'systemPc' );
var mySystemMac = getEl( 'systemMac' );
var myPc = getEl( 'pc' );
var otherPcField = getEl( 'other_pc' );
var myMac = getEl( 'mac' );
var otherMacField = getEl( 'other_mac' );

testPc( myPc, otherPcField );
testMac( myMac, otherMacField );

if ( mySystemPc.checked ) {
showHide( 'show', myPc );
testPc( myPc, otherPcField );
showHide( 'hide', myMac );
showHide( 'hide', otherMacField );
} else if ( mySystemMac.checked ) {
showHide( 'show', myMac );
testMac( myMac, otherMacField );
showHide( 'hide', myPc );
showHide( 'hide', otherPcField );
} else {
showHide( 'hide', myPc );
showHide( 'hide', otherPcField );
showHide( 'hide', myMac );
showHide( 'hide', otherMacField );
}

}

function testPc( myPc, otherPcField ){
if ( myPc.options[ 7 ].selected ){
otherPcField.setAttribute( 'class', 'showField' );
} else {
otherPcField.setAttribute( 'class', 'hideField' );
}
}

function testMac( myMac, otherMacField ){
if ( myMac.options[ 9 ].selected ){
otherMacField.setAttribute( 'class', 'showField' );
} else {
otherMacField.setAttribute( 'class', 'hideField' );
}
}

