What is wrong with this function..?

Hello, may i know what is wrong with this function? This is a function which I use to trigger an action with different time duration. When I call this function it just wont work.

function shoot1(){
x=random(2)+1;
trace(x);
if(x==1){
timera1= setInterval (shoota1,1000);
function shoota1() {
clearInterval(timera1);
_root.spider1.gotoAndPlay(2);
}
}
else if(x==2){
timera2= setInterval (shoota2,2000);
function shoota2() {
clearInterval(timera2);
_root.spider1.gotoAndPlay(2);
}
}
}