function ShowProgressBar() {
  var ID = (new Date()).getTime() % 1000000000;
  document.promonew.id.value = ID;
  document.promonew.action = "/scripts/upload_promo.asp?ID=" + ID;
  var URL = "/scripts/progress.asp?ID=" + ID;
  var Ver = navigator.appVersion;
  var I = Ver.indexOf("MSIE");
  if (I > -1 && Ver.charAt(I + 5) > 4) // IE 5 or later
    window.showModelessDialog(URL, null, "dialogWidth=320px; dialogHeight:170px; help:no; status:no; resizable:yes; scroll:no");
  else
    window.open(URL, "_blank", "left=240,top=240,width=320,height=150,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,directories=no");
}

function GetFileExtension(Filename) {
  var I = Filename.lastIndexOf(".");
  return (I > -1) ? Filename.substring(I + 1, Filename.length).toLowerCase() : "";
}

function BeforeSubmit() {
  var Form = document.promonew;
  var dateipfad = Form.dateipfad.value;
  var dateipfad1 = Form.dateipfad1.value;
  var dateipfad2 = Form.dateipfad2.value;
  var dateipfad3 = Form.dateipfad3.value;
  var dateipfad4 = Form.dateipfad4.value;
  var bildpfad = Form.bildpfad.value;
  var agb = Form.agb.checked;
  //alert(Form.agb.checked);
var Ext = "";
  //if (dateipfad + bildpfad == "") { alert("No files to upload"); return false; }
  if (agb == false) { alert("Bitte stimmen Sie den AGBs zu!"); return false;
    //Ext = GetFileExtension(dateipfad4);
   //if (Ext != "mp3") { }
  }
  if (dateipfad == "") { alert("Bitte mindestens die Hauptdatei auswählen"); return false; }

  // The following html validation of file types serves as just a reminder for careless users (not a security measure).
  // In order to ENSURE users can upload only allowed file types, you must set ValidFileTypes property in "Example3.asp".
  if (dateipfad != "") {
    Ext = GetFileExtension(dateipfad);
    if (Ext != "mp3") { alert("Bitte wählen Sie eine gültige MP3 Datei aus!"); return false; }
  }
  if (dateipfad1 != "") {
    Ext = GetFileExtension(dateipfad1);
    if (Ext != "mp3") { alert("Bitte wählen Sie eine gültige MP3 Datei aus!"); return false; }
  }
  if (dateipfad2 != "") {
    Ext = GetFileExtension(dateipfad2);
    if (Ext != "mp3") { alert("Bitte wählen Sie eine gültige MP3 Datei aus!"); return false; }
  }
  if (dateipfad3 != "") {
    Ext = GetFileExtension(dateipfad3);
    if (Ext != "mp3") { alert("Bitte wählen Sie eine gültige MP3 Datei aus!"); return false; }
  }
  if (dateipfad4 != "") {
    Ext = GetFileExtension(dateipfad4);
    if (Ext != "mp3") { alert("Bitte wählen Sie eine gültige MP3 Datei aus!"); return false; }
  }
  if (bildpfad != "") {
    Ext = GetFileExtension(bildpfad);
    if (Ext != "gif" && Ext != "jpg") { alert("Bitte wählen Sie eine gültige JPG oder GIF Datei aus!"); return false; }
  }

  ShowProgressBar();
  return true;
}
