There are a lot of things to comment on here, but I'll just hit on a few:
First:
vikram solanki wrote:
renderSection('false');
If the function is expecting a boolean, why are you passing a
string? Did you realize that if you use the string argument in a if clause that 'string" is truthy?
Be sure to be consistent with data typing. Use
false not "false" for boolean values.
The most likely cause of failure is:
document.getElementById("{!$component.thePageBlock.state}").focus()
That's one bizarre id value and I suspect it's not real. This should cause an exception when the focus() method is attempted on an undefined reference.
Do you have the JavaScript console open so you can see any script errors?