	var n = document.layers;
	var ie = document.all;
	var n6 = document.getElementById&&!document.all;

	function onImageSelect(obj,img){
			imgPath = obj.value;
			
			if (obj.value == "") {
				return false;
			}
			if (imgPath.charAt(0,7).toLowerCase() == "http://" || imgPath.charAt(0,6).toLowerCase() == "ftp://") {
				alert("Pictures from a web page cannot be upload - " + " : " + ImgPath);
				return false;
			}
			if(!isValidImageExt(imgPath)) {
					if(0) alert("請選入圖片檔案格式為 .jpg .png .gif 或 .swf(flash動畫)"); 
					else alert("請選入圖片檔案格式為 .jpg .png 或 .gif"); 									
					return false;
			}
			if(ie) {
				if (imgPath.substring(imgPath.length - 3, imgPath.length).toLowerCase() == "swf") {
					document.all(img).src='imgs/flash.gif';
				}else {
					document.all(img).src=imgPath;
				}
			}
			
	}			
			
	function isValidImageExt(imageName) {
			if (imageName.substring(imgPath.length - 3, imageName.length).toLowerCase() != "jpg" &&
				imageName.substring(imgPath.length - 3, imageName.length).toLowerCase() != "gif" &&
			 	imageName.substring(imgPath.length - 3, imageName.length).toLowerCase() != "png" &&
				imageName.substring(imgPath.length - 3, imageName.length).toLowerCase() != "swf" &&
			 	imageName.substring(imgPath.length - 4, imageName.length).toLowerCase() != "jpeg" 			 	
			 	) {
			 		if (imageName.substring(imgPath.length - 3, imageName.length).toLowerCase() == "swf" && 0 ) return true;
					else return false;
			} 
			return true;
	}

function isValidImageExt2(imageName,iValue) {
	 arrayValue = iValue.split("、");
	 var checkValue = 0;
	 for(i=0;i<arrayValue.length;i++){
		if (imageName.substring(imageName.length - 3, imageName.length).toLowerCase() != arrayValue[i]) 
		 {
		   checkValue++;		   	   
         }
     }

     if(checkValue == arrayValue.length ){return false;}else{return true;}
	 
	}

