var req = 0; var JSargs = ""; var ScriptURL = ""; var ScriptCmd1 = ""; var ScriptCmd2 = "progress"; var UID = new Date(); UID = UID.getTime(); var types = new Array(); types[0] = "htm"; types[1] = "html"; types[2] = "txt"; types[3] = "jpeg"; types[4] = "jpg"; types[5] = "gif"; types[6] = "doc"; types[7] = "pdf"; function transInit(b){ if(arguments.length > 1 && arguments[1] == false){ return; } f = b.form; ScriptURL = f.action; totalFiles = 0; fileName = ""; fileNames = ""; typeOK = 0; same1 = 0; same2 = 0; same3 = 0; ScriptCmd1 = ScriptURL.indexOf("?"); ScriptCmd1 = ScriptURL.substr(ScriptCmd1 + 1); ScriptURL = ScriptURL.replace(/\?.*/ig, ""); for(a = 0; a < f.elements.length; a++){ if(f.elements[a].name.search(/^FILE\d+$/) >= 0){ if(f.elements[a].value.length > 1){ totalFiles++; typeOK = 0; same1 = 0; same2 = 0; same3 = 0; f.elements[a].style.color = "#000000"; fileName = f.elements[a].value; fileName = fileName.replace(/^.*(\\|\/)/ig, ""); fileNames += fileName + '++'; ext = f.elements[a].value.lastIndexOf("."); ext = f.elements[a].value.substr(ext + 1); ext = ext.toLowerCase(); for(c = 0; c < types.length; c++){ if(ext == types[c] || types[c] == "all"){ typeOK++; } } if(!typeOK){ msg = "Illegal file type.\n\nWe do not allow " + ext + " "; msg += "file uploads.\n\nPlease change or remove the selected "; msg += "file from the hilighted field."; alert(msg); f.elements[a].style.color = "#00aa00"; return; } typeOK = 0; } for(aa = a + 1; aa < f.elements.length - 1; aa++){ nextF = f.elements[aa].value; if(f.elements[a].value == nextF && nextF.length > 0){ same1++; same2 = a; same3 = aa; } if(same1){ msg = "Duplicate file name.\n\nTwo or more fields contain "; msg += "identical file names\n\nPlease change or remove the "; msg += "Duplicate file."; alert(msg); f.elements[same2].style.color = "#00aa00"; f.elements[same3].style.color = "#00aa00"; return; } } } } fileNames = fileNames.substr(0, fileNames.length - 2); JSargs = f.id.value + '=' + UID; f.action = ScriptURL + '?' + ScriptCmd1 + '=' + JSargs; f.submit(); }