Import and Material Question

Ok so i need to import .jpg images and apply them as a simple texture to a material, all from a javascript script. My question is, how would i import a .jpg as an asset? I will know the filname, "text1.jpg" ex...

My aim is to take simple .jpgs that i am generating elsewhere and apply them as textures to instantiated game objects.

Thanks for any help, this project is beginning to go beyond my skills.

http://forum.unity3d.com/threads/58564-WWW-class-image-import-timing-test http://unity3d.com/support/documentation/ScriptReference/WWW-texture.html

To generate a texture from downloaded data: WWW.texture

To overwrite an existing texture: WWW.LoadImageIntoTexture

To create a new Material and assign a shader and texture: Material