boot the machine with your finger pressing the letter r. when the choice of boot drives comes up use the online recovery to load the osx onto an external hdd name it different then the internal ( ie Mac 2)
when the osx is on the external hdd boot with it. then use that external hdd to erase the internal then partition the internal hdd. then boot with your finger on the letter r. once again pick the recovery and then load a new osx onto the internal hdd.