function ob_change_icons ( temp_node, imgSrc ) { while (temp_node != null ){ temp_node.previousSibling.firstChild.firstChild.src = ob_icons + "/" + imgSrc; if(document.getElementById("chkApplyToParents") && document.getElementById("chkApplyToParents").checked==false) { // if the checkbox is not checked - we don't need to change the icons of the parents // return from the function return; } temp_node = ob_getParentOfNode ( temp_node ); } }