If your panels are named as Panel1 and Panel2, you will not find them by using GameObject.Find("secondPanel") and GameObject.Find("firstPanel"). If "Panel1" and "Panel2" is the only name in the game scene(No other Panel1 or Panel2), then you can try to use
void OnClick(){
GameObject panel2 = GameObject.Find("Panel2");
NGUITools.SetActive(panel2,true);
GameObject panel1 = GameObject.Find("Panel1");
NGUITools.SetActive(panel1,false);
}