function validation(fld)
{
  var d=document.form;
if(d.itemno.value =="")
 {
  alert("Please Enter Product Item Number");
  d.itemno.focus();
  return false;
 }
if(d.pname.value =="")
 {
  alert("Please Enter Product Name");
  d.pname.focus();
  return false;
 }
 if(d.color.value =="")
 {
  alert("Please Enter Color");
  d.color.focus();
  return false;
 }
 if(d.weight.value =="")
 {
  alert("Please Enter Weight");
  d.weight.focus();
  return false;
 }
 
 if(d.description.value =="")
 {
  alert("Please Enter Description");
  d.description.focus();
  return false;
 }

// for(k=0;k<document.getElementById('fieldscnt').value;k++)
//  {
//	  if(document.getElementById('field'+k).value=="") {
//		  
//		var kkkk=true;  
//		break;
//	  }
//	  
//  }
//  
//  if(kkkk) {
//	 alert("Please Fill All Selected Fields"); 
//	  return false;
//  }

if((fld.value=="")) {
               alert("PLease Upload Image");
       
               fld.focus();
               return false;
       }
	   	   var maxWidth=100;
// height to resize large images to
var maxHeight=100;
// valid file types
var fileTypes=["gif","png","jpg","jpeg"];
// the id of the preview image tag
var outImage="previewField";
// what to display when the image is not valid
var defaultPic="spacer.gif";

/***** DO NOT EDIT BELOW *****/


var source=fld.value;
var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
globalPic=new Image();
if (i<fileTypes.length) globalPic.src=source;
else {
globalPic.src=defaultPic;
alert("THAT IS NOT A VALID IMAGE\nPlease load an image with an extention of one of the following:\n\n"+fileTypes.join(", "));
return false;
}

 

}

function validatephone(xxxxx) {
	 var maintainplus = '';
 	var numval = xxxxx.value
 	if ( numval.charAt(0)=='+' ){ var maintainplus = '+';}
 	curphonevar = numval.replace(/[\\A-Za-z!"£$%^&*+_{};:'@#,¦\/?|`¬\]\[]/g,'');
 	xxxxx.value = maintainplus + curphonevar;
 	var maintainplus = '';
 	xxxxx.focus;
}

