if (!window.pictureUploaders)
{
  window.pictureUploaders = new Object();
}
window.registerPictureUploader = function(frameId, win)
{
  var frame = document.getElementById(frameId);

  if (!frame)
  {
    return;
  }
  
  var name = frame.getAttribute('name');
  initPictureUploaders(name);
  window.pictureUploaders[name].win = win;
  hidePleaseWait(name);  
  invokeValidator(name);
}
function invokeValidator(name)
{
  initPictureUploaders(name);
  var validatorId = window.pictureUploaders[name].validatorId;    
  
  if (validatorId == null || validatorId == undefined)
  {
    setTimeout(function(){invokeValidator(name)}, 100);
    return;
  }

  if (validatorId == '')
    return;

  var val = document.getElementById(validatorId);

  if (val)
  {
    ValidatorValidate(val);
  } 
}
function hidePleaseWait(name)
{
  initPictureUploaders(name);
  var win = window.pictureUploaders[name].win;
  var pleaseWaitId = window.pictureUploaders[name].pleaseWaitId;
  
  if (!win || !pleaseWaitId)
  {
    setTimeout(function(){hidePleaseWait(name)}, 100);  
    return;
  }
  
  if (pleaseWaitId == '')
    return;
  
  var pleaseWait = document.getElementById(pleaseWaitId);
  
  if (!pleaseWait)
  {
    return;
  }
  
  pleaseWait.wasHideByFrame = 't';
  pleaseWait.style.display = 'none';
}
function showPleaseWait(pleaseWaitId, frameName)
{
  var pleaseWait = document.getElementById(pleaseWaitId);
  
  if (!pleaseWait) 
  {
    return;
  }
  
  var wasHideByFrame = pleaseWait.getAttribute('wasHideByFrame');
  
  if (wasHideByFrame == 't')
  {
    return;
  }
  
  pleaseWait.style.display = 'block';
}
function setControlIds(pleaseWaitId, validatorId, frameName)
{
  initPictureUploaders(frameName);
  window.pictureUploaders[frameName].pleaseWaitId = pleaseWaitId;
  window.pictureUploaders[frameName].validatorId = validatorId;
}
function initPictureUploaders(frameName)
{
  if (!window.pictureUploaders[frameName])
  {
    window.pictureUploaders[frameName] = new Object();
  }
}
function validatePictureRequired(src, args, frameName)
{
  var frame = window.pictureUploaders[frameName].win;
  args.IsValid = frame.isPicturePresent(frameName);
}
function syncronizeEmailCheckboxesState(subscribedToEmailsCheckBoxId, otherCheckBoxesContainerId)
{
  var subscribedToEmailsCheckBox = document.getElementById(subscribedToEmailsCheckBoxId);
  var otherCheckBoxesContainer = document.getElementById(otherCheckBoxesContainerId);
  
  if (!subscribedToEmailsCheckBox || !otherCheckBoxesContainer)
  {
    return;
  }
  
  var otherCheckBoxes = otherCheckBoxesContainer.getElementsByTagName('input');
  var otherCheckBoxesLabels = otherCheckBoxesContainer.getElementsByTagName('label');
  var length = otherCheckBoxes.length;
  
  if (subscribedToEmailsCheckBox.checked)
  {
    for(var i = 1; i < length; i++)// from the first!!
    {
      otherCheckBoxes[i].disabled = false;
      otherCheckBoxesLabels[i].className = "";
    } 
  }
  else
  {
    for(var i = 1; i < length; i++)// from the first!!
    {
      otherCheckBoxes[i].checked = false; 
      otherCheckBoxes[i].disabled = true;
      otherCheckBoxesLabels[i].className = "disabled";
    } 
  }
}

var MemberPasswordHelper;
(function()
{
  if (!MemberPasswordHelper)
  {
    var MemberPasswordHelper = new Object();
    var minPasswordLength = 3;
    var passwordLength = 8;
  }
  
  function minPasswordLengthValidate(sender, args)
  {
      args.IsValid = args.value.trim().length >= minPasswordLength;
  };
})();


if(typeof(Sys) !== "undefined")
  Sys.Application.notifyScriptLoaded();


