layer textures by distance?

Do you think its possible to write a script to allow you to add a texture and assign it a distance that it can be viewed until the next texture is viewed.
for example I would toss on a 2300x2300 brick wall texture to be viewed at a far. I would throw the same one on again to be viewed at a point blank range so it doesnt get that pixelated look when your to close to it so you get that realistic viewing viewing field %| . does it sound like a bad idea or if its even possible?

Its called LOD, Level of Detail, and yes its possible in python, just amke the materials and take the distance from camera and work from there.

Not useful, in the image texture, the MipMap option does it for you automatically .

an article about LOD and python :
http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_LOD_en.htm