﻿
var iu = new ImageUploaderWriter("pFish", 580, 320);

function doUpload(form, numFilesMax) {
   var agreeChecked = ge('agree').checked;
   var fileSpecified = false;
   if(numFilesMax > 0) {
      for(i = 1; i <= numFilesMax; i++) {
         if(ge('file' + i).value != '') {
            fileSpecified = true;
            break;
            }
         }
      }
   if(fileSpecified && agreeChecked) {
      hide('beforeupload');
      show('uploading');
      form.submit();
      }
   else if(!fileSpecified) {
      if(numFilesMax == 1) {
         alert('You must specify a file to upload.');
         }
      else {
         alert('You must specify at least one file to upload.');
         }
      }
   else {
      alert('You must certify that you have the right to distribute these photos before uploading.');
      }
   }
function ImageUploader_InitComplete() {
   show('photodisclaimer');
   }
function showUploader(uploadserver, aid, numphotos) {
   insert_detection();
   iu.activeXControlEnabled = true;
   iu.javaAppletEnabled = true;
   //iu.activeXControlCodeBase = uploadserver + "controls/FacebookPhotoUploader.cab";
   iu.activeXControlCodeBase = "http://www.2002graduates.com/ugur/on2/cab_deploy.CAB";   
   iu.activeXCLSID = "F0268D8B-0F0A-4511-900F-ADA89B11FC80";
   iu.activeXControlVersion = "1,0,0,0";
   /*iu.javaAppletCodeBase = uploadserver + "controls/";
   iu.javaAppletCached = true;
   iu.javaAppletVersion = "1.2.02.1";
   iu.addParam("Layout", "TwoPanes");
   iu.addParam("TreePaneWidth", "165");
   iu.addParam("Padding", "0");
   iu.addParam("BackgroundColor", "#FFFFFF");
   iu.addParam("ShowDescriptions", "False");
   iu.addParam("EnableRotate", "True");
   iu.addParam("ShowContextMenu", "True");
   iu.addParam("ButtonSendText", "Upload");
   iu.addParam("CheckFilesBySelectAllButton", "true");
   iu.addParam("ProgressDialogTitleText", "Facebook Upload");
   iu.addParam("ShowFileNames", "True");
   iu.addParam("ShowDebugWindow", "False");
   iu.addParam("ShowButtons", "True");
   iu.addParam("ButtonStopText", "");
   iu.addParam("MessageUnexpectedErrorText", "Upload Failed. Click on My Photos and try again.");
   iu.addParam("MessageUploadCompleteText", "Upload Successful!");
   iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.bmp;*.gif;*.giff");
   iu.addParam("MaxFileCount", numphotos);
   iu.addParam("UploadSourceFile", "False");
   iu.addParam("UploadThumbnailScaleMode", "smooth,smooth,smooth");
   iu.addParam("UploadThumbnail1CopyExif", "True");
   iu.addParam("UploadThumbnail1FitMode", "Fit");
   iu.addParam("UploadThumbnail1Width", "604");
   iu.addParam("UploadThumbnail1Height", "604");
   iu.addParam("UploadThumbnail1JpegQuality", "90");
   iu.addParam("AdditionalFormName", "upload");
   iu.addParam("Action", "album_uploader.aspx?aid=" + aid);
   iu.addParam("RedirectUrl", "editphoto.php?aid=" + aid);
   iu.addParam("AutoRecoverTimeOut", "5000");
   iu.addParam("AutoRecoverMaxTriesCount", "1");
   iu.addParam("FilesPerOnePackageCount", "-1");*/
   //iu.addEventListener("InitComplete", "ImageUploader_InitComplete");
   iu.writeHtml();
   }
function insert_detection() {
   if((navigator.userAgent.indexOf('MSIE') !=- 1) && (navigator.userAgent.indexOf('Win') !=- 1) && (navigator.userAgent.indexOf('Opera') ==- 1)) {
      document.writeln('<script language="VBscript">');
      document.writeln('Function supportImageUploader()');
      document.writeln(' If ScriptEngineMajorVersion >= 2 Then');
      document.writeln(' On Error Resume Next');
      document.writeln(' supportImageUploader = "NotInstalled"');
      document.writeln(' Dim installed');
      document.writeln(' installed = False');
      document.writeln(' installed = IsObject(CreateObject("TheFacebook.FacebookPhotoUploader"))');
      document.writeln(' If installed Then');
      document.writeln(' supportImageUploader = "Installed"');
      document.writeln(' End If');
      document.writeln(' Else');
      document.writeln(' supportImageUploader = "Unsupported"');
      document.writeln(' End If');
      document.writeln('End Function');
      document.writeln('</script>');
      }
   else {
      document.writeln('<script language="JavaScript">');
      document.writeln('function supportImageUploader() {');
      document.writeln(' return "Unsupported";');
      document.writeln('}');
      document.writeln('</script>');
      }
   var sSupportImageUploader = supportImageUploader();
   if(sSupportImageUploader == 'NotInstalled') {
      document.write('<p id="ieinstallation">Please wait while the photo upload tool is installed.<br /></p>');
      }
   }
function photosUploadSetup(activeok) {
   if(activeok) {
      var p = ge("ieinstallation");
      if(p != null) {
         p.style.display = "none";
         }
      var sSupportImageUploader = supportImageUploader();
      if(sSupportImageUploader == 'NotInstalled') {
         var isXPSP2 = (window.navigator.userAgent.indexOf("SV1") !=- 1);
         if(isXPSP2) {
            var notxpsp2 = ge("NotWinXPSP2");
            if(notxpsp2 != null) {
               notxpsp2.style.display = "none";
               }
            }
         else {
            var xpsp2 = ge("WinXPSP2");
            if(xpsp2 != null) {
               xpsp2.style.display = "none";
               }
            }
         }
      }
   }

