
var fullPath = '/imageuploader/';
document.write('<script type="text/javascript" src="' + fullPath + 'iuembed.js"></script>');

function imageUploaderSend()
{
  var imageUploader1 = getImageUploader("ImageUploader1");
  if(imageUploader1)
  {
    imageUploader1.Send();
  }
  else
  {
    document.location='preview_and_send.php';
  }
}

function imageUploader(maxFileCount)
{
  //<![CDATA[
  var bgColor = '#eef2e1';
  var uploadPage = fullPath + '_final/upload.php?aid='+window.aid;
  var redirectPage = '/personalize_photos_crop.php?aid='+window.aid;
  // var lk = '5654-8013-7724-6656'; // dev    
  //var lk = '7067-9286-6060-6540';
  //var maxFileSize = '307200';
  var maxFileSize = '0';

  //Create JavaScript object that will embed Image Uploader to the page.
  var iu = new ImageUploaderWriter("ImageUploader1", 650, 400);
  iu.addParam("LicenseKey", "7692-7253-5668-6222;7067-9286-6060-6540");
  
  //For ActiveX control full path to CAB file (including file name) should be specified.
  iu.activeXControlCodeBase = fullPath + "ImageUploader4.cab";
  iu.activeXControlVersion = "4,5,4,0";
  iu.activeXControlEnabled = false;
  
  //For Java applet only path to directory with JAR files should be specified (without file name).
  iu.javaAppletCodeBase = fullPath;
  iu.javaAppletCached = true;
  iu.javaAppletVersion = "2.5.4.0";
  iu.javaAppletEnabled = true;
  
  iu.showNonemptyResponse = "off";
  
  //Configure appearance.
  //iu.addParam("ButtonSendImageFormat", "Width=79;Height=29;UrlNormal=/img/button_continue.gif");
  iu.addParam("ShowButtons", "false");
  iu.addParam("PaneLayout", "TwoPanes");
  iu.addParam("ShowDebugWindow", "true");
  iu.addParam("AllowRotate", "true");
  iu.addParam("BackgroundColor", bgColor);
  
  //Configure thumbnail settings.
  iu.addParam("UploadThumbnail1FitMode", "Fit");
  iu.addParam("UploadThumbnail1Width", "200");
  iu.addParam("UploadThumbnail1Height", "200");
  iu.addParam("UploadThumbnail1JpegQuality", "60");
  
  iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.gif");
  
  iu.addParam("AllowRotate", "true");

  //Configure restrictions
  iu.addParam("MaxFileCount", maxFileCount);
  iu.addParam("MessageMaxFileCountExceededText", "You cannot select more than "+maxFileCount+" files.");
  iu.addParam("MaxFileSize", maxFileSize);
  
  //Configure URL files are uploaded to.
  iu.addParam("Action", uploadPage);
  
  //Configure URL where to redirect after upload.
  iu.addParam("RedirectUrl", redirectPage);
  
  //Tell Image Uploader writer object to generate all necessary HTML code to embed 
  //Image Uploader to the page.
  iu.writeHtml();
  //]]>
}
