updates to attachment
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index 828beab..ca64d59 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -103,26 +103,19 @@
 // a table with both image and attachment in HTML
 // in the "alternate_description" field
 cur_frm.cscript.add_image = function(doc, dt, dn) {
-	if(!doc.file_list) {
-		msgprint('Please attach a file first!');
+	if(!doc.image) {
+		msgprint('Please select an "Image" first');
 		return;
 	}
 
-	var f = doc.file_list.split('\n')[0];
-	var fname = f.split(',')[0];
-	var fid = f.split(',')[1];
-	if(!in_list(['jpg','jpeg','gif','png'], fname.split('.')[1].toLowerCase())) {
-		msgprint('File must be of extension jpg, jpeg, gif or png'); return;
-	}
-
 	doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">'+
 	'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
 	'<td>%(desc)s</td></tr>'+
-	'</table>', {imgurl: wn.urllib.get_file_url(fid), desc:doc.description});
+	'</table>', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description});
 
 	refresh_field('description_html');
 }
-//===================== Quotation to validation - either customer or lead mandatory ====================
+// Quotation to validation - either customer or lead mandatory
 cur_frm.cscript.weight_to_validate = function(doc,cdt,cdn){
 
   if((doc.nett_weight || doc.gross_weight) && !doc.weight_uom)
@@ -131,13 +124,11 @@
     validated=0;
   }
 }
-//===================validation function =================================
 
 cur_frm.cscript.validate = function(doc,cdt,cdn){
   cur_frm.cscript.weight_to_validate(doc,cdt,cdn);
 }
 
-//===========Fill Default Currency in "Item Prices====================
 cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
 	locals[cdt][cdn].ref_currency = sys_defaults.currency;
 	refresh_field('ref_currency',cdn,'ref_rate_details');
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index cabf7fa..8225680 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -2,9 +2,9 @@
  {
   "owner": "Administrator", 
   "docstatus": 0, 
-  "creation": "2012-12-06 15:57:02", 
+  "creation": "2012-12-11 15:58:47", 
   "modified_by": "Administrator", 
-  "modified": "2012-12-11 15:56:37"
+  "modified": "2012-12-11 16:08:49"
  }, 
  {
   "allow_attach": 1, 
@@ -141,13 +141,20 @@
   "permlevel": 0
  }, 
  {
+  "doctype": "DocField", 
+  "label": "Image View", 
+  "options": "image", 
+  "fieldname": "image_view", 
+  "fieldtype": "Image", 
+  "permlevel": 0
+ }, 
+ {
   "oldfieldtype": "Text", 
   "doctype": "DocField", 
   "label": "Description", 
   "oldfieldname": "description", 
-  "width": "300px", 
   "fieldname": "description", 
-  "fieldtype": "Text", 
+  "fieldtype": "Small Text", 
   "search_index": 0, 
   "reqd": 1, 
   "permlevel": 0, 
@@ -157,13 +164,13 @@
   "doctype": "DocField", 
   "label": "Description HTML", 
   "fieldname": "description_html", 
-  "fieldtype": "Text", 
+  "fieldtype": "Small Text", 
   "permlevel": 0
  }, 
  {
-  "description": "Generates HTML to include image (1st attachment) in the description", 
+  "description": "Generates HTML to include selected image in the description", 
   "doctype": "DocField", 
-  "label": "Add Image", 
+  "label": "Generate Description HTML", 
   "fieldname": "add_image", 
   "fieldtype": "Button", 
   "permlevel": 0
@@ -790,10 +797,50 @@
   "permlevel": 0
  }, 
  {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "cancel": 0, 
+  "role": "Material Manager", 
+  "permlevel": 1
+ }, 
+ {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "cancel": 0, 
+  "role": "Material Manager", 
+  "permlevel": 0
+ }, 
+ {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "cancel": 0, 
+  "role": "Material User", 
+  "permlevel": 1
+ }, 
+ {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "cancel": 0, 
+  "role": "Material User", 
+  "permlevel": 0
+ }, 
+ {
   "create": 1, 
   "doctype": "DocPerm", 
   "write": 1, 
-  "role": "System Manager", 
+  "role": "Material Master Manager", 
   "cancel": 1, 
   "permlevel": 0
  }, 
@@ -808,7 +855,7 @@
   "create": 1, 
   "doctype": "DocPerm", 
   "write": 1, 
-  "role": "Material Master Manager", 
+  "role": "System Manager", 
   "cancel": 1, 
   "permlevel": 0
  }, 
@@ -816,45 +863,5 @@
   "doctype": "DocPerm", 
   "role": "System Manager", 
   "permlevel": 1
- }, 
- {
-  "amend": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 0, 
-  "role": "Material Manager", 
-  "cancel": 0, 
-  "permlevel": 1
- }, 
- {
-  "amend": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 0, 
-  "role": "Material Manager", 
-  "cancel": 0, 
-  "permlevel": 0
- }, 
- {
-  "amend": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 0, 
-  "role": "Material User", 
-  "cancel": 0, 
-  "permlevel": 1
- }, 
- {
-  "amend": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 0, 
-  "role": "Material User", 
-  "cancel": 0, 
-  "permlevel": 0
  }
 ]
\ No newline at end of file