/*
=======================================================================
Copyright W3Now Web Design, Inc.  
W3WebForms.com    W3Now.com   W3SiteBuilder.com   W3WebTemplates.com
This information must remain in tact as presented here

Visit http://W3WebForms.com/  
to easily generate functional online forms for your web pages. 

The form information can be emailed to you or stored in a CSV file in your web site directory
Making an online form for your web page is easy...just log in, make a few entries, then copy the 
generated HTML code into your web page for a fully functional, spam-proof online form 

Forms generated by W3WebForms.com are spam-proof and fully functional.

=======================================================================
*/ 
 // THIS WORKS NOW
function validFileUpload(zFile, docTypesAccepted, mimeTypesAccepted_ignored) { 
	// spec1: docTypesAccepted is like:   jpg^gif^png
	// spec2: mimeTypesAccepted (ignored here) is like: image/gif^image/jpg^image/jpeg^image/pjpeg^image/png 
	if (!zFile || zFile== '') return true; // let server side handle it 
	if (!docTypesAccepted)  return false; 
    zFile = zFile.toLowerCase();   
	docTypesAccepted=docTypesAccepted.toLowerCase(); 
	var periodPos = zFile.indexOf(".",1); // myimage.jpg 
	if (periodPos == -1) return false;  
	var FileArray = zFile.split('.'); //  0 = file root and paths    1 = jpg  
	var fixx=(FileArray.length - 1); // 1 FileArray[fixx] = 'jpg'
	var zFileExt = FileArray[fixx];
	// alert ("ext is: " + zFileExt );
	var TypeArray = docTypesAccepted.split('^'); //  0 = jpg    1 = gif      2 = png  
	var nbrTypes=TypeArray.length; // 3 
	for (d=0; d < nbrTypes; d++) { // loop thru array, jpg,gif,png
			var thisExt = TypeArray[d]; // jpg 
			if (zFileExt == thisExt) return true; 
	} 
	return false;
}
