Can't upload programs.

I am not able to upload any program.It gives the error
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: failed to write flash memory, rc=-4
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
when I turn on the green led stays on and the red blinks once and goes off.when I upload a program the same repeats.

I am sure you googled on it, but did you come across this page:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?action=print;num=1287435600

What bootloader do you have?

have you ever been able to upload a sketch? (even just once)

what arduino board/bootloader do you have?

anyhow make sure you have the correct board selected under Tools>Board and correct com port too..Tools>Serial Port

and when trying to upload a sketch use File>Upload to I/O Board from the menu and just after you do this press the reset button on your arduino (it may take a couple of tries to get the timing right but worked for me)

(the second problem i had was 'the blink sketch' was blinking once about every 10 seconds and i thought it was stuffed, anyhow i got hold of another bootloaded chip and it worked fine, ended up reloading the bootloader on the first chip and it works just fine)

I have a Probots Freeduino USB w/ Atmega8 it is a replacement for ardiuno.I was able to upload once.I also tried pressing reset before,after pressing upload.I selected the right board and rom.

Or maybe is it possible to restore it to factory settings.

Get an USBtiny or USBasp programmer with a 6-pin cable. They're quite affordable and I wouldn't want to live without them anymore. Or if you have a 2nd arduino and you're desperate you may also look at ArduinoISP.

The other option is to take a big hammer.