Cant assign animation to script

So, i coded a basic script, that plays a walking animation when i move, and an idle animation, when i not moving. I think i coded it correctly, but i dont know. Here is the code i wrote:

var idleanim : Animation;

var walkanim : Animation;

function Start () {

}

function Update () {
//Input key "w"
if (Input.GetKeyDown("w")) {

}
if (Input.GetKeyUp("w")) {

}

//Input key "a"
if (Input.GetKeyDown("a")) {

}
if (Input.GetKeyUp("a")) {

}

//Input key "s"
if (Input.GetKeyDown("s")) {

}
if (Input.GetKeyUp("s")) {

}

//Input key "d"
if (Input.GetKeyDown("d")) {

}
if (Input.GetKeyUp("d")) {

}
}

But for some reason when i try to assign the animation to the script it won’t let me.
The animation is of course a .anim

i believe you working with legacy animation system.

check this:
http://docs.unity3d.com/412/Documentation/Manual/Animations40.html

and this:
http://docs.unity3d.com/412/Documentation/Manual/AnimationScripting40.html