function setAllVisibility() { setVisibility('whatyouwant1', 'contact_pcwork'); setVisibility('whatyouwant2', 'contact_telecom'); setVisibility('whatyouwant3', 'contact_other'); setVisibility('whatyouwant4', 'contact_comment'); } function setVisibility(parent, child) { radio = document.getElementById(parent); div = document.getElementById(child); if (radio.checked) { div.style.display = 'block'; } else { div.style.display = 'none'; } } function switchDiv(div_id) { var style_sheet = getStyleObject(div_id); if (style_sheet) { hideAll(); changeObjectVisibility(div_id, "block"); } else { alert("sorry, this only works in browsers that do Dynamic HTML"); } } function getStyleObject(objectId) { // checkW3C DOM, then MSIE 4, then NN 4. // if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) { return document.layers[objectId]; } else { return false; } } function changeObjectVisibility(objectId, newVisibility) { // first get the object's stylesheet var styleObject = getStyleObject(objectId); // then if we find a stylesheet, set its visibility // as requested // if (styleObject) { // styleObject.visibility = newVisibility; styleObject.display = newVisibility; return true; } else { return false; } } function hideAll() { changeObjectVisibility("contact_pcwork","none"); changeObjectVisibility("contact_telecom","none"); changeObjectVisibility("contact_other","none"); changeObjectVisibility("contact_comment","none"); }