Chosen Solution

Started to blackout after hour. Than after half our. Than after boot. Screen black, run in background. Replaced hard drive, put it together starts to beep one at time continuisly. Took out lcd screen and boots normaly, no shutting itself off. Im tottaly confused

Reseat your RAM to start with, but this also sounds identical to a failing power supply (check you diagnostic LEDs on the logic board.) If only #1 is lit, replace the power supply. Power supplies can partially fail. IMAC beep codes Apple Computer Beep Codes 1 tone, a 5-second pause, repeat = No RAM installed.3 successive tones, a 5-second pause, 3 successive tones = RAM does not pass data integrity check.1 long tone when holding down the power button = Firmware upgrade in process.3 long tones, 3 short tones, 3 long tones = Firmware restoration from CD in process.iMac Intel 21.5" EMC 2308 Power Supply Replacement