
				function Preview()
					{
						var f = document.form;
						f.targetPic.src = f.imgname.value;
						checktype();
						size();
				
					if(f.imgname.value=="")
					{
						f.targetPic.style.display="none";
					}else{
						f.targetPic.style.display="";}
						
					//	f.ProductName.focus()
					}

					function valid()
						{
							var f = document.form;
							if(f.imgname.value=="")
							{
								alert("กรุณาเลือกรูปที่ต้องการเพิ่ม ด้วยครับ   ");
								f.imgname.focus();
							}else{
							f.submit();
							}
						}

					function size()
						{
							var maxsize = 25000;
							var f = document.form;
							
							var img = new Image();
							img.src = f.imgname.value;

								if(img.src){
								alert("ขนาดของรูป = "+img.width +" x "+img.height+"\t");
								}

							/*	if(img.fileSize>maxsize)
								{
									alert("\nรูปภาพควรมีขนาดไม่เกิน "+maxsize+" bytes \nกรุณาเลือกรูปภาพใหม่ด้วยครับ เพราะ รูปภาพนี้มีขนาด "+img.fileSize+" bytes ใหญ่เกินไปครับ    ");
									f.reset();
								}     */
							}

				function checktype()
					{
						var f = document.form;
						var strfile = f.imgname.value;
						
						if(strfile.length>0)
						{
							var myIndex = strfile.indexOf(".");
							var FileType = strfile.substr(myIndex,4);
				
							arrFileType = new Array(".jpe",".JPE",".jpg",".JPG",".gif",".GIF",".bmp",".BMP");
							for(i=0;i<arrFileType.length;i++){
								if(FileType==arrFileType[i])
								{
									chk = true;
									break;
								}else{
									chk = false;
								}
							}
							if(!chk)
							{
								alert("กรุณาเลือกภาพที่เป็น ชนิด jpg ,jpeg , gif หรือ bmp เท่านั้นครับ  ");
								f.reset();
							}  
						}	
					}

					function Confirm(){
						var f = document.form;
						if (f.ProductName.value == "")
						{
								alert("กรุณากรอกชื่อสินค้าด้วยครับ")
								f.ProductName.focus();
						}
						else if(f.CodeNumber.value == "")
						{
							alert("กรุณากรอกรหัสสินค้าด้วยครับ")
							f.CodeNumber.focus();
						}
					//	else if(f.IdentId.value == "")
					//	{
					//		alert("กรุณาเลือกประเภทสินค้าด้วยครับ")
					//		f.IdentId.focus();
					//	}
						else if(f.ResellerPrice.value == "")
						{
							alert("กรุณากรอกราคาขายปลีกด้วยครับ")
							f.ResellerPrice.focus();
						}
						else if(f.DealerPrice.value == "")
						{
							alert("กรุณาราคาขายส่งด้วยครับ")
							f.DealerPrice.focus();
						}
						else
						{
							con = confirm(" Are you sure  ?");
							if(con){
						
			   				f.feature.value = obj1.getContentBody() 
							f.featureEn.value = obj2.getContentBody() 
							//f.txtPageProperties.value = obj1.getPageCSSText() 


								f.submit();
							}
						}
					}
					
					function ConfirmInformation(){
					var f = document.form;
					con = confirm(" Are you sure  ?");
							if(con){
						
							f.Desc.value = obj1.getContentBody() 
							//f.DescEn.value = obj2.getContentBody() 

								f.submit();
							}
					}
									
					function chk_unit(val)
					{
						var f = document.form;
						var fa=document.all;
						if(val == 1)
						{
							fa.punit.style.display='none';
						}
						else
						{
							fa.punit.style.display='';
						}
					}
					
					
					
					
					
					
					
					
					