﻿function ExpandCollapse(eID, hfDisplay, imgID, imgFolder, imgExpand, imgCollapse) {
   var e = document.getElementById(eID);
   var img = document.getElementById(imgID);
   var hf = document.getElementById(hfDisplay);

   if (e != null &&
       img != null &&
       hf != null) {

      e.style.display = e.style.display == 'block' ? 'none' : 'block';
      hf.value = e.style.display;

      if (e.style.display == 'none') {
         img.src = imgFolder + imgExpand;
      }
      else {
         img.src = imgFolder + imgCollapse;
      }

      window.location.hash = "frmReferrer";
   }
}

function GetNewValidationCode(imgID) {
   var img = document.getElementById(imgID);

   if (img != null) {
      img.src = "";
      img.src = "images/ValidationCode.aspx";
   }
}

function SetDisplay(eID, hfDisplay, imgID, imgFolder, imgExpand, imgCollapse) {
   var e = document.getElementById(eID);
   var hf = document.getElementById(hfDisplay);
   var img = document.getElementById(imgID);

   if (e != null &&
       img != null &&
       hf != null) {
      e.style.display = hf.value;
      img.src = e.style.display == 'none' ? imgFolder + imgExpand : imgFolder + imgCollapse;
   }
}

function SwapImage(imgID, imageName) {
   var img = document.getElementById(imgID);

   if (img != null) {
      img.src = imageName;
   }
}

// Creates Object HTML tag that doesn't need to be clicked to activate it
function CreateObject(DivID, ObjectID, CLSID, CODEBASE,
                      WIDTH, HEIGHT, CSSCLASS, VIEWASTEXT, URL, AUTOSTART, PLAY, LOOP,
                      MOVIE, QUALITY, MENU, SCALE, FLASHVARS, PLUGINSPAGE) {
//   var e = document.getElementById(DivID);

//   var clsid = "";
//   var codeBase = "";
//   var width = "";
//   var height = "";
//   var cssClass = "";
//   var viewAsText = "";
//   var url = "";
//   var autoStart = "";
//   var play = "";
//   var loop = "";
//   var movie = "";
//   var data = "";
//   var quality = "";
//   var menu = "";
//   var scale = "";
//   var flashVars = "";
//   var pluginsPage = "";
//   var html = "";
//   var embed = "";
//   var embedPlay = "";
//   var embedLoop = "";
//   var embedMovie = "";
//   var embedQuality = "";
//   var embedWidth = "";
//   var embedHeight = "";
//   var embedPluginsPage = "";

//   
//   if (e != null) {
//      if (CLSID != null && CLSID != "") {
//         clsid = ' classid="' + CLSID + '"';
//      }
//      if (CODEBASE != null && CODEBASE != "") {
//         codeBase = ' codebase="' + CODEBASE + '"';
//      }
//      if ((VIEWASTEXT != null && VIEWASTEXT != "") || VIEWASTEXT == true) {
//         viewAsText = " VIEWASTEXT";
//      }
//      if (URL != null && URL != "") {
//         url = '<param name="URL" value="' + URL + '"/>';
//      }
//      if ((AUTOSTART != null && AUTOSTART != "") || typeof (AUTOSTART) == "boolean") {
//         autoStart = '<param name="autoStart" value="' + AUTOSTART + '"/>';
//      }
//      if ((PLAY != null && PLAY != "") || typeof (PLAY) == "boolean") {
//         play = '<param name="play" value="' + PLAY + '"/>';
//         embedPlay = 'play="' + PLAY + '" ';
//      }
//      if ((LOOP != null && LOOP != "") || typeof (LOOP) == "boolean") {
//         loop = '<param name="loop" value="' + LOOP + '"/>';
//         embedLoop = 'loop="' + LOOP + '" ';
//      }
//      if (MOVIE != null && MOVIE != "") {
//         movie = '<param name="movie" value="' + MOVIE + '"/>';
//         data = ' data="' + MOVIE + '"';
//         embedMovie = 'src="' + MOVIE + '" ';
//      }
//      if (QUALITY != null && QUALITY != "") {
//         quality = '<param name="quality" value="' + QUALITY + '"/>';
//         embedQuality = 'quality="' + QUALITY + '" ';
//      }
//      if ((MENU != null && MENU != "") || typeof (MENU) == "boolean") {
//         menu = '<param name="menu" value="' + MENU + '"/>';
//      }
//      if (SCALE != null && SCALE != "") {
//         scale = '<param name="scale" value="' + SCALE + '"/>';
//      }
//      if (FLASHVARS != null && FLASHVARS != "") {
//         flashVars = '<param name="flashvars" value="' + FLASHVARS + '"/>';
//      }
//      if (WIDTH != null && WIDTH != "") {
//         width = ' width="' + WIDTH + '"';
//         embedWidth = 'width="' + WIDTH + '" '; ;
//      }
//      if (HEIGHT != null && HEIGHT != "") {
//         height = ' height="' + HEIGHT + '"';
//         embedHeight = 'height="' + HEIGHT + '" ';
//      }
//      if (CSSCLASS != null && CSSCLASS != "") {
//         cssClass = ' class="' + CSSCLASS + '"';
//      }
//      if (PLUGINSPAGE != null && PLUGINSPAGE != "") {
//         pluginsPage = PLUGINSPAGE;
//         embedPluginsPage = 'pluginspage="' + PLUGINSPAGE + '" ';
//      }

//      embed = '<embed ' + embedMovie + embedQuality + embedWidth + embedHeight + embedPlay + embedLoop + embedPluginsPage + 'type="application/x-shockwave-flash" ></embed>';

//      html =
//         '<object id="' + ObjectID + '"' + clsid +
//         codeBase + width + height + viewAsText + cssClass + data + ' type="application/x-shockwave-flash">' +
//         url + autoStart + play + loop + movie + quality + scale +
//         menu + flashVars + embed + '</object>';

//      e.innerHTML = html;
//   }
}

