/*   /Admin/html_res/js/globalUtils.js   */

Array.prototype.hasValue = function(v) {
	var i;
	
	for(i = 0; i < this.length; i++)
		if(this[i] == v)
			return true;
			
	return false; 
}

String.prototype.trim = function(value)
{
    return this.replace(/^\s*|\s*$/gi, ""); 
}

var browserInfo;

(function() {

    if(browserInfo == null) 
    {
        browserInfo = new Object();
    }

    // Browser check
    ua = navigator.userAgent;
    browserInfo.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
    browserInfo.isMSIE5 = browserInfo.isMSIE && (ua.indexOf('MSIE 5') != -1);
    browserInfo.isMSIE50 = browserInfo.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
    browserInfo.isMSIE55 = browserInfo.isMSIE && (ua.indexOf('MSIE 5.5') != -1);
    browserInfo.isMSIE60 = browserInfo.isMSIE && (ua.indexOf('MSIE 6.0') != -1);
    browserInfo.isMSIE70 = browserInfo.isMSIE && (ua.indexOf('MSIE 7') != -1);
    browserInfo.isMSIE80 = browserInfo.isMSIE && (ua.indexOf('MSIE 8') != -1);
    browserInfo.isMSIE90 = browserInfo.isMSIE && (ua.indexOf('MSIE 9') != -1); // lol
    browserInfo.isGecko = ua.indexOf('Gecko') != -1;
    browserInfo.isSafari = ua.indexOf('Safari') != -1;
    browserInfo.isOpera = ua.indexOf('Opera') != -1;
    browserInfo.isWebKit = BonaPage.Browser.isWebKit;
    browserInfo.isMac = ua.indexOf('Mac') != -1;
    browserInfo.isFirefox = ua.indexOf('Firefox') != -1;
    
    if (browserInfo.isFirefox)
    {
      var reVersion = /Firefox\/(\d)*\./;
      reVersion.test(ua);
      browserInfo.firefoxMajorVersion = RegExp.$1;
    }
    
    browserInfo.isNS7 = ua.indexOf('Netscape/7') != -1;
    browserInfo.isNS71 = ua.indexOf('Netscape/7.1') != -1;

    // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those
    if (browserInfo.isOpera) 
    {
        browserInfo.isMSIE = true;
        browserInfo.isGecko = false;
        browserInfo.isSafari =  false;
    }

    browserInfo.isIE = browserInfo.isMSIE;
    browserInfo.isRealIE = browserInfo.isMSIE && !browserInfo.isOpera;

    // Check if valid browser has execcommand support
    browserInfo.execCommand = (typeof(document.execCommand) != 'undefined');
    
}) ();


var globalUtils;

(function()
{

  if (globalUtils == null)
  {
    globalUtils = new Object();
  }

  var _UdDomainNames = 
  [
    'NET','COM','BIZ','ORG','EDU','MIL','GOV','PRO','INT','COOP','NAME','INFO','AERO','ARPA','TRAVEL','MUSEUM',
    'US','CA','UK','GB','FR','RU',
    'AC','AD','AE','AF','AG','AI','AL','AM','AN','AO','AQ','AR','AS','AT','AU','AW','AZ',
    'BA','BB','BD','BE','BF','BG','BH','BI','BJ','BM','BN','BO','BR','BS','BT','BV','BW','BY','BZ',
    'CC','CD','CF','CG','CH','CI','CK','CL','CM','CN','CO','CR','CU','CV','CX','CY','CZ',
    'DE','DJ','DK','DM','DO','DZ',
    'EC','EE','EG','ER','ES','ET','EU',
    'FI','FJ','FK','FM','FO',
    'GA','GD','GE','GF','GG','GH','GI','GL','GM','GN','GP','GQ','GR','GS','GT','GU','GW','GY',
    'HK','HM','HN','HR','HT','HU',
    'ID','IE','IL','IM','IN','IO','IQ','IR','IS','IT',
    'JE','JM','JO','JP',
    'KE','KG','KH','KI','KM','KN','KR','KW','KY','KZ',
    'LA','LB','LC','LI','LK','LR','LS','LT','LU','LV','LY',
    'MA','MC','MD','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MX','MY','MZ',
    'NA','NC','NE','NF','NG','NI','NL','NO','NP','NR','NU','NZ',
    'OM',
    'PA','PE','PF','PG','PH','PK','PL','PM','PN','PR','PS','PT','PW','PY',
    'QA',
    'RE','RO','RW',
    'SA','SB','SC','SD','SE','SG','SH','SI','SJ','SK','SL','SM','SN','SO','SR','ST','SU','SV','SY','SZ',
    'TC','TD','TF','TG','TH','TJ','TK','TL','TM','TN','TO','TP','TR','TT','TV','TW','TZ',
    'UA','UG','UM','UY','UZ',
    'VA','VC','VE','VG','VI','VN','VU',
    'WF','WS',
    'YE','YT','YU',
    'ZA','ZM','ZW'
  ];

  function _udTrim(s)
  {
    var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return m == null ? '' : m[1];
  }

  globalUtils.ValidateEmailFormat = function(source, args)
  {
    var s, m, i;
    args.IsValid = true;
    s = _udTrim(args.Value);
    if (s == '')
      return;
    m = s.match(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);
    if (m != null && m.length > 0)
    {
      if (args.ValidateDomains == null || !args.ValidateDomains)
        return;
      s = s.substr(s.lastIndexOf('.') + 1).toUpperCase();
      for (i = 0; i < _UdDomainNames.length; i++)
      {
        if (s == _UdDomainNames[i])
          return;
      }
    }
    args.IsValid = false;
  }
  globalUtils.validateCheckBoxList = function(validator)
  {
    var list = document.getElementById(validator.controltovalidate);
    var items = list.getElementsByTagName('INPUT');

    if (items != null)
    {
      for (var i = 0; i < items.length; i++)
      {
        if (items[i].checked)
          return true;
      }

      return false;
    }

    return true;
  }
  globalUtils.$ = function(id)
  {
    return (document.all) ? document.all[id] : document.getElementById(id);
  }

  globalUtils.handleCancalClick = function(myValidationGroup)
  {
    if (!DataChangeWatcher.confirmIfDataChanged())
    {
      globalUtils.updateValidators(myValidationGroup);
      return false;
    }
    else
    {
      Page_IsValid = true;
      Page_BlockSubmit = false;
      return true;
    }
  }

  globalUtils.updateValidators = function(myValidationGroup)
  {
    for (var i = 0; i < Page_Validators.length; i++)
    {
      ValidatorValidate(Page_Validators[i], myValidationGroup, null);
    }
  }

  globalUtils.stopEventPropogation = function(e)
  {
    if (document.all)
    {
      e.cancelBubble = true;
    }
    else
    {
      e.stopPropagation();
    }
  }

  globalUtils.addHandler = function(obj, event, handler)
  {
    if (typeof (obj.addEventListener) != 'undefined')
    {
      obj.addEventListener(event, handler, false);
    }
    else if (typeof (obj.attachEvent) != 'undefined')
    {
      obj.attachEvent('on' + event, handler);
    }
    else
    {
      var hProp = '_handlerStack_' + event;
      var eProp = 'on' + event;
      if (typeof (obj[hProp]) == 'undefined')
      {
        obj[hProp] = new Array();
        if (typeof (obj[eProp]) != 'undefined')
        {
          obj[hProp].push(object[eProp]);
        }
        obj[eProp] = function(e)
        {
          var ret = true;
          for (var i = 0; ret != false && i < obj[hProp].length; i++)
          {
            ret = obj[hProp][i](e);
          }
          return ret;
        }
      }
      obj[hProp].push(handler);
    }
  }

  globalUtils.removeHandler = function(obj, event, handler)
  {
    if (typeof (obj.removeEventListener) != 'undefined')
    {
      obj.removeEventListener(event, handler, false);
    }
    else if (typeof (obj.detachEvent) != 'undefined')
    {
      obj.detachEvent('on' + event, handler);
    }
    else
    {
      var hProp = '_handlerStack_' + event;
      if (typeof (obj[hProp]) != 'undefined')
      {
        for (var i = 0; i < obj[hProp].length; i++)
        {
          if (obj[hProp][i] == handler)
          {
            obj[hProp].splice(i, 1);
            return;
          }
        }
      }
    }
  }

  var scrollBarWidth = null;

  globalUtils.getScrollBarWidth = function()
  {
    if (!scrollBarWidth)
    {
      var objDiv = document.createElement('DIV');

      if (objDiv)
      {
        objDiv.style.position = 'absolute';
        objDiv.style.left = objDiv.style.top = '-1000px';
        objDiv.style.width = objDiv.style.height = '100px';
        objDiv.style.overflow = 'scroll';
        objDiv.style.visibility = 'hidden';

        if (document.body)
        {
          document.body.appendChild(objDiv);

          if (objDiv && objDiv.offsetWidth && objDiv.clientWidth)
          {
            scrollBarWidth = objDiv.offsetWidth - objDiv.clientWidth;
          }
        }
      }
    }

    if (objDiv)
    {
      objDiv.parentNode.removeChild(objDiv);
    }

    return scrollBarWidth;
  }

  globalUtils.isSetAdminViewMainContainerSizeHandler = false;
  globalUtils.timeoutSetAdminViewMainContainerSize = null;

  globalUtils.setAdminViewMainContainerSize = function()
  {
    if (globalUtils.timeoutSetAdminViewMainContainerSize)
      clearTimeout(globalUtils.timeoutSetAdminViewMainContainerSize);

    globalUtils.timeoutSetAdminViewMainContainerSize = setTimeout(globalUtils.setAdminViewMainContainerSizeDo, 100);
  }

  globalUtils.setAdminViewMainContainerSizeDo = function()
  {
    var isIE = (document.all) ? true : false;
    var adminViewMainContainer = document.getElementById('idAdminViewMainContainer');
    var adminViewPanelHolder = document.getElementById('idAdminPanelHolder');
    var adminViewContentFrame = document.getElementById('contentFrame');

    if (adminViewMainContainer && adminViewPanelHolder && adminViewContentFrame)
    {
      var newWidth = isIE ? globalUtils.getVisibleClientWidth() : window.innerWidth;
      var newHeight = isIE ? globalUtils.getVisibleClientHeight() : window.innerHeight;

      if (newWidth > 1)
        adminViewContentFrame.style.width = (newWidth - 1) + 'px';

      newHeight -= adminViewPanelHolder.offsetHeight;

      if (newHeight > 0)
        adminViewContentFrame.style.height = newHeight + 'px';

      if (!globalUtils.isSetAdminViewMainContainerSizeHandler)
      {
        if (isIE)
        {
          window.attachEvent('onresize', globalUtils.setAdminViewMainContainerSize);
        }
        else
        {
          window.addEventListener('resize', globalUtils.setAdminViewMainContainerSize, false);
        }

        globalUtils.isSetAdminViewMainContainerSizeHandler = true;
      }
    }
    else
    {
      setTimeout(globalUtils.setAdminViewMainContainerSizeDo, 10);
    }
  }

  globalUtils.docForSize = null;

  globalUtils.getDocForSize = function()
  {
    if (globalUtils.docForSize == null)
    {
      globalUtils.docForSize = document.getElementsByTagName('HTML');

      if (globalUtils.docForSize && globalUtils.docForSize.length)
        globalUtils.docForSize = globalUtils.docForSize[0];
      else
        globalUtils.docForSize = document.body;
    }

    return globalUtils.docForSize;
  }

  globalUtils.getVisibleClientWidth = function()
  {
    var docForSize = globalUtils.getDocForSize();
    return ((docForSize.clientWidth > 0) ? docForSize.clientWidth : document.body.clientWidth);
  }

  globalUtils.getVisibleClientHeight = function()
  {
    var docForSize = globalUtils.getDocForSize();
    return ((docForSize.clientHeight > 0) ? docForSize.clientHeight : document.body.clientHeight);
  }

  globalUtils.scrollIntoView = function(container, target)
  {
    if (typeof (container) == 'window')
    {
      globalUtils.getXY(target);
      container.scrollTo(0, target.Y + 20);
    }
    else
    {
      globalUtils.getXY(container);
      globalUtils.getXY(target);
      container.scrollTop = (target.Y - container.Y);
    }
  }



  globalUtils.getTextareaLength = function(obj)
  {
    var value = obj.value;

    value = value.replace(/\r\n/g, "\n");
    value = value.replace(/\n/g, "\r\n");

    return value.length;
  }

  globalUtils.getXY = function(obj)
  {
    var parTemp;
    obj.X = 0;
    obj.Y = 0;

    if (obj.offsetParent)
    {
      parTemp = obj;

      while (parTemp.offsetParent)
      {
        parTemp = parTemp.offsetParent;
        obj.X += parTemp.offsetLeft;
        obj.Y += parTemp.offsetTop;
      }
    }

    obj.X += obj.offsetLeft;
    obj.Y += obj.offsetTop;

    return { x: obj.X, y: obj.Y };
  }

  globalUtils.getAbsoluteXY = function(obj)
  {
    var parTemp;
    obj.X = 0;
    obj.Y = 0;

    if (obj.parentNode)
    {
      parTemp = obj;

      while (parTemp.nodeName.toUpperCase() != 'BODY')
      {
        parTemp = parTemp.parentNode;
        var position = BonaPage.getElementStyle(parTemp, 'position').toLowerCase();

        if (position == 'absolute' || position == 'relative')
        {
          obj.X += parTemp.offsetLeft;
          obj.Y += parTemp.offsetTop;
        }
      }
    }

    obj.X += obj.offsetLeft;
    obj.Y += obj.offsetTop;

    return { x: obj.X, y: obj.Y };
  }


  globalUtils.validateIntType = function(source, args)
  {
    var data = args.Value;
    args.IsValid = true;

    if (data.charAt(0) == '-')
    {
      args.IsValid = false;
    }
    if (args.IsValid && isNaN(data))
    {
      args.IsValid = false;
    }
  }

  globalUtils.validateIntTypePositive = function(source, args)
  {
    globalUtils.validateIntType(source, args);

    if (!args.IsValid)
    {
      return;
    }

    var data = args.Value;
    args.IsValid = data > 0;
  }

  globalUtils.validatePriceType = function(source, args)
  {
    args.IsValid = validatePrice(args.Value, false, false);
    return args.IsValid;
  }
  globalUtils.validatePriceTypeAllowZero = function(source, args)
  {
    args.IsValid = validatePrice(args.Value, true, false);
    return args.IsValid;
  }
  globalUtils.validatePriceTypeAllowNegatives = function(source, args)
  {
    args.IsValid = validatePrice(args.Value, true, true);
    return args.IsValid;
  }
  function validatePrice(value, allowZero, allowNegativeValues)
  {
    var maxPrice = 922337203685477.5807;
    // accepted patterns
    var money_exp1 = /^\s*-?(\d+\,?)*\.?\d*$/;
    var money_exp2 = /^\s*\((\d+\,?)*\.?\d*\)$/;
    
    if (value.search(money_exp1) == -1 &&
    		value.search(money_exp2) == -1)
    {
      return false;
    }
    
    var val, ndx, data;
    var pos1 = -1, pos2 = -1;
    val = '';
    data = value;
    // skip white spaces
    ndx = 0;

    while (ndx < data.length && 
			(data.charAt(ndx) == '(' || data.charAt(ndx) == ' '))
    {
      ndx++;
    }

    if (data.charAt(ndx - 1) == '(')
    {
      // negative value
      val += '-';
    }

    while (ndx < data.length)
    {
      if (data.charAt(ndx) != ',' && data.charAt(ndx) != ')')
        val += data.charAt(ndx);
      ndx++;
    }

    if (data.charAt(0) == '-' && !allowNegativeValues)
    {
      return false;
    }

    if (data == '')
    {
      return true;
    }
    
    var digitsPrice = parseFloat(val);
    
    if (isNaN(digitsPrice))
    {
      return false;
    }
    
    if (digitsPrice > maxPrice)
    {
      return false;
    }
    
    if (digitsPrice < 0.01 && !allowZero)
    {
      return false;
    }
    
    return true;
  }
  
  globalUtils.collectContainerDataState = function(containerId)
  {
    var control = document.getElementById(containerId);

    if (!control)
    {
      return '';
    }

    var state = '';
    var inputs = control.getElementsByTagName('INPUT');

    for (var i = 0; i < inputs.length; i++)
    {
      var input = inputs[i];

      if ((input.type == 'checkbox' || input.type == 'radio') && input.checked)
      {
        state += input.value;
      }
      else if (input.type == 'text')
      {
        state += input.value;
      }
    }

    var textAreas = control.getElementsByTagName('TEXTAREA');

    for (var i = 0; i < textAreas.length; i++)
    {
      state += textAreas[i].value;
    }

    var selects = control.getElementsByTagName('SELECT');

    for (var i = 0; i < selects.length; i++)
    {
      state += selects[i].selectedIndex;
    }

    return state;
  }
  globalUtils.validateStateChanged = function(args, containerId)
  {
    var control = document.getElementById(containerId);

    if (!control)
    {
      return '';
    }

    var state = globalUtils.collectContainerDataState(containerId);

    DataChangeWatcher.changeValidatorCustom(containerId, state, args);
  }
  var stopReplaceLinksForPreview = false;
  var intervalReplaceLinksForPreview = null;
  var countReplaceLinksForPreview = 0;

  globalUtils.replaceLinksForPreview = function()
  {
    var docLinks, linksHref;
    var emulModeMatch = window.location.search.match(/emulatemode=(\d+)/i);
    var emulMode = (emulModeMatch && emulModeMatch.length == 2) ? emulModeMatch[1] : 1;

    if (document.links && document.links.length > countReplaceLinksForPreview)
    {
      while (countReplaceLinksForPreview < document.links.length)
      {
        if (document.links[countReplaceLinksForPreview] && document.links[countReplaceLinksForPreview].href)
        {
          linksHref = document.links[countReplaceLinksForPreview].href;

          if (linksHref.indexOf('javascript:') == -1 && linksHref.indexOf('emulatemode=') == -1)
          {
            var filterRegex = /^([^#]+)(#?.*)$/ig;
            var querySeparator = (linksHref.indexOf('?') == -1) ? '?' : '&';

            document.links[countReplaceLinksForPreview].href = linksHref.replace(filterRegex, '$1' + querySeparator + 'emulatemode=' + emulMode + '$2');
          }
        }

        countReplaceLinksForPreview++;
      }
    }

    if (stopReplaceLinksForPreview)
    {
      if (intervalReplaceLinksForPreview)
      {
        clearInterval(intervalReplaceLinksForPreview);
      }

      return;
    }
  }

  globalUtils.startReplaceLinksForPreview = function()
  {
    if (document.all)
    {
      window.attachEvent('onload', function() { stopReplaceLinksForPreview = true; });
    }
    else
    {
      window.addEventListener('load', function() { stopReplaceLinksForPreview = true; }, false);
    }

    intervalReplaceLinksForPreview = setInterval(globalUtils.replaceLinksForPreview, 250);
  }

  globalUtils.getBrowserCapabilitiesData = function()
  {
    var clientCookiesEnabled = false;
    var javascriptEnabled = true;
    var isPlatformCompatible = false;

    setCookie("TestClientCookie", "TestClientCookieValue");
    clientCookiesEnabled = (getCookie("TestClientCookie") == "TestClientCookieValue");
    setCookie("TestClientCookie", "", (new Date("1/1/2000")).toGMTString());
    isPlatformCompatible = javascriptEnabled && (browserInfo.isMSIE60 || browserInfo.isMSIE70 || browserInfo.isMSIE80 || browserInfo.isMSIE90 || browserInfo.isFirefox || browserInfo.isWebKit) && browserInfo.execCommand;

    return (browserInfo.isMSIE60 ? "MSIE 6.0;" : "") +
           (browserInfo.isMSIE70 ? "MSIE 7.0;" : "") +
           (browserInfo.isMSIE80 ? "MSIE 8.0;" : "") +
           (browserInfo.isMSIE90 ? "MSIE 9.0;" : "") +
           (browserInfo.isWebKit ? "WebKit;" : "") +
           (browserInfo.isFirefox ? "Firefox;" : "") +
           (browserInfo.firefoxMajorVersion ? "FirefoxMajorVersion:" + browserInfo.firefoxMajorVersion + ";" : "") +
           (browserInfo.execCommand ? "Exec Command;" : "") +
           (clientCookiesEnabled ? "Client Cookies Enabled;" : "") +
           (isPlatformCompatible ? "Platform Compatible;" : "") +
           (javascriptEnabled ? "Javascript Enabled;" : "");
  }

  function setCookie(name, value, expires, path, domain, secure)
  {
    document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
  }

  function getCookie(name)
  {
    var cookie = " " + document.cookie;
    var search = " " + name + "=";
    var setStr = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0)
    {
      offset = cookie.indexOf(search);
      if (offset != -1)
      {
        offset += search.length;
        end = cookie.indexOf(";", offset)
        if (end == -1)
        {
          end = cookie.length;
        }
        setStr = unescape(cookie.substring(offset, end));
      }
    }
    return (setStr);
  }

  globalUtils.nop = function()
  {
  }

})();




/*   /Admin/html_res/js/dataChangeWatcher.js   */

var DataChangeWatcher;

(function() {

  if (DataChangeWatcher == null)
  {
    DataChangeWatcher = new Object();
    var validationGroup = "DataChangeWatcherValidationGroup";
    var warningMessage = "Cancel your changes?";
    var watch = false;
    var isInited = false;
    var savedValues = new Object();
    var debugDCW = false;
    var alreadyChanged = false;
    var initWhenValidatorsLoadedCounter = 0;
  }
  
  // public functions
  
  DataChangeWatcher.startWatching = startWatching;
  DataChangeWatcher.pauseWatching = pauseWatching;
  DataChangeWatcher.resumeWatching = resumeWatching;
  DataChangeWatcher.changeValidator = validate;
  DataChangeWatcher.changeValidatorSkipLineEndings = validateIgnoreLineEndings;
  DataChangeWatcher.changeValidatorCustom = validateCustom;
  DataChangeWatcher.checkIfDataChanged = checkIfDataChanged;
  DataChangeWatcher.confirmIfDataChanged = confirmIfDataChangedAndStopWatching;
  DataChangeWatcher.isWatching = isWatching;
  DataChangeWatcher.setChanged = setChanged;
  DataChangeWatcher.setNotChanged = setNotChanged;
  
  // private functions
  
  function isWatching()
  {
    if (typeof(watch) != 'undefined')
      return watch;
    else
      return null;
  }
  
  function startWatching(validationGroupName, message, forceInit)
  {
    if (forceInit)
    {
      isInited = false;
      watch = false;
    }
    
    if (isInited)
    {
      watch = true;
    }
    else
    {
      if (validationGroupName)
        validationGroup = validationGroupName;
      
      if (message)
        warningMessage  = message;
      
      // we have to start it with timeout - this is for Atlas
      setTimeout(initWhenValidatorsLoaded, 100);
    }
  }
  
  function pauseWatching(source)
  {
    if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('pause - ' + source);
    watch = false;
  }
  
  function resumeWatching(source)
  {
    if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('resume - ' + source);
    watch = true;
  }

  function initWhenValidatorsLoaded()
  {
    if (isInited) return;  
     
    initWhenValidatorsLoadedCounter++;
    if (typeof(debugDCW)  != 'undefined' && debugDCW && !BonaPage.isWidgetMode) 
    {
      alert("DCW: init started" +
            "\ntypeof(Page_ValidationActive) = " + typeof(Page_ValidationActive) + 
            "\ntypeof(BonaPage.topWindow.BonaEditor) == " + typeof(BonaPage.topWindow.BonaEditor));
            
      if (typeof(Page_ValidationActive) == 'boolean') 
        alert("DCW: Page_ValidationActive = " + Page_ValidationActive);
        
      if (typeof(BonaPage.topWindow.BonaEditor) != 'undefined')
        alert("DCW: = BonaPage.topWindow.BonaEditor.checkIfAllEditorsLoaded = " + BonaPage.topWindow.BonaEditor.checkIfAllEditorsReady());
   }
    
    // check of Page_ValidationActive is true
    // we can save initial values only if 
    if (typeof(Page_ValidationActive) == 'boolean' && Page_ValidationActive &&
        (BonaPage.isWidgetMode ||
         typeof(BonaPage.topWindow.BonaEditor) == 'undefined' ||
         initWhenValidatorsLoadedCounter > 10 ||
         (typeof(BonaPage.topWindow.BonaEditor) != 'undefined' && BonaPage.topWindow.BonaEditor.checkIfAllEditorsReady())))
    {
      initWhenValidatorsLoadedCounter = 0;
      watch = true;
      var origValidatorUpdateIsValid = ValidatorUpdateIsValid;
      var origValidatorUpdateDisplay = ValidatorUpdateDisplay;
      
      ValidatorUpdateIsValid = function() {};
      ValidatorUpdateDisplay = function() {};
      
      //call validate so validation is performed. 
      //isInited = false and thus DataChangeWatcher.changeValidator will save current values to the senders
      Page_ClientValidate(validationGroup);
      
      ValidatorUpdateIsValid = origValidatorUpdateIsValid;
      ValidatorUpdateDisplay = origValidatorUpdateDisplay;
      
      addOnBeforeUnloadHandler();
      isInited = true;
      initWhenValidatorsLoadedCounter = 0;
      
      if (typeof(debugDCW)  != 'undefined' && debugDCW) alert("DCW: init complete");
    }
    else if (typeof(BonaPage.topWindow.BonaEditor) != 'undefined' && !BonaPage.topWindow.BonaEditor.checkIfAllEditorsReady())
    {
      setTimeout(initWhenValidatorsLoaded, 100);
    }
  }
  
  function validate(sender, args)
  {
    validateCustom(sender.controltovalidate, args.Value, args);
  }
  
  function validateIgnoreLineEndings(sender, args)
  {
    validateCustom(sender.controltovalidate, args.Value, args, true);
  }
  
  function validateCustom(uniqueKey, value, args, ignoreLineEndings)
  {
    var isValid = true;
      
    if (typeof(watch) != 'undefined' && watch)
    {
      if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('DCW: validateCustom\n\nid = ' + uniqueKey);
      if (alreadyChanged) {
        isValid = false;
      } else {
          if (!isInited)
          {
            if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('DCW: validateCustom\n\ninit value = \n"' + value + '"');
            savedValues[uniqueKey] = value;
          }
          else if (savedValues[uniqueKey] != 'undefined')
          {
            if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('DCW: validateCustom\n\nvalueNew = \n"' + value + '"\n\nvalueOld = \n"' + savedValues[uniqueKey] + '"');
            isValid = checkValuesAreEqual(savedValues[uniqueKey] + '', value, ignoreLineEndings);
            if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('DCW: validateCustom\n\nisValid = ' + isValid);
          } 
      }
    }
    
    args.IsValid = isValid;
  }
  
  function checkValuesAreEqual(value1, value2, ignoreLineEndings)
  {
    var valuesEqual;
  
    if (ignoreLineEndings)
    {
        valuesEqual = (value1.replace(/[\n\r\t]+/g, '').replace(/^\s*(.*)\s*$/, '$1') == value2.replace(/[\n\r\t]+/g, '').replace(/^\s*(.*)\s*$/, '$1'));
    }
    else
    {
        valuesEqual = (value1 == value2);
    }
    
    return valuesEqual;
  }

  function checkIfDataChanged()
  {
    var changed = (alreadyChanged) ? true : false;
    
    if (typeof(Page_ClientValidate) != 'undefined')
    {
      changed = !Page_ClientValidate(validationGroup) || changed;    
    }
    
    if (typeof(BonaValidateIfChanged) != 'undefined')
    {
      changed = BonaValidateIfChanged() || changed;
    }
    
    if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('DCW: checkIfDataChanged = ' + changed);
    
    return changed;
  }

  function confirmIfDataChangedAndStopWatching()
  {
    var confirmed = true;
    
    if (checkIfDataChanged())
    {
      confirmed = confirm(warningMessage);
    }
      
    if (confirmed)
    {
       pauseWatching();
    }

    return confirmed;
  }
  
  function addOnBeforeUnloadHandler()
  {
    var isAdminPanelPresent = false;
    
    try
    {
      if(BonaPage.topWindow.adminpanel)
      {
        isAdminPanelPresent = true;
      }
    }
    catch(e){};

    if (isAdminPanelPresent)
    {
      if (document.all)
      {
        try
        {        
            BonaPage.topWindow.adminpanel.document.body.onbeforeunload = validateBeforeUnloadAdminFrame;
            BonaPage.topWindow.adminpanel.document.body.onunload = pauseWatching;        
            BonaPage.topWindow.contentarea.document.body.onbeforeunload = validateBeforeUnloadContentFrame;
            BonaPage.topWindow.contentarea.document.body.onunload = pauseWatching;        
            BonaPage.topWindow.document.body.onbeforeunload = validateBeforeUnloadFrameSet;
            BonaPage.topWindow.document.body.onunload = pauseWatching;
        }
        catch(e)
        {
            setTimeout(function() { addOnBeforeUnloadHandler(); }, 100);
        }
      }
      else
      {
        BonaPage.topWindow.adminpanel.onbeforeunload = validateBeforeUnloadAdminFrame;
        BonaPage.topWindow.adminpanel.onunload = pauseWatching;
        BonaPage.topWindow.contentarea.onbeforeunload = validateBeforeUnloadContentFrame;
        BonaPage.topWindow.contentarea.onunload = pauseWatching;
        BonaPage.topWindow.onbeforeunload = validateBeforeUnloadFrameSet;
        BonaPage.topWindow.onunload = pauseWatching;
      }
    }
    else
    {
      if (document.all)
      {
        window.document.body.onbeforeunload = validateBeforeUnloadNoFrames;
        window.document.body.onunload = pauseWatching;
      }
      else
      {
        window.onbeforeunload = validateBeforeUnloadNoFrames;
        window.onunload = pauseWatching;
      }
    }
  }
  
  function removeOnBeforeUnloadHandler()
  {
    //globalUtils.removeHandler(window, 'beforeunload', validateBeforeUnload);
  }
  
  function getWarningMessageIfDataChanged()
  {
    var dataChanged = checkIfDataChanged();
    if (dataChanged)
      return warningMessage;
  }
  
  function validateBeforeUnloadNoFrames()
  {
    if (typeof(watch) == 'undefined' || !watch) return;

    var message = getWarningMessageIfDataChanged();

    pauseWatching();
    
    if (document.all)
    {
        window.setTimeout(resumeWatching, 100);
    }
    else
    {
        window.setTimeout(resumeWatching, 100);
    }

    return message;
  }
  
  function validateBeforeUnloadAdminFrame()
  {
    if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('validateBeforeUnloadAdminFrame');

    if (typeof(watch) == 'undefined' || !watch) return;

    var message = getWarningMessageIfDataChanged();

    pauseWatching();
    
    if (document.all)
    {
        BonaPage.topWindow.adminpanel.setTimeout(resumeWatching, 100);
    }
    else
    {
        BonaPage.topWindow.adminpanel.setTimeout(resumeWatching, 100, 'admin');
    }

    return message;
  }
  
  function validateBeforeUnloadContentFrame()
  {
    if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('validateBeforeUnloadContentFrame');

    if (typeof(watch) == 'undefined' || !watch) return;

    var message = getWarningMessageIfDataChanged();

    pauseWatching();
    
    if (document.all)
    {
        setTimeout(resumeWatching, 100);
    }
    else
    {
       BonaPage.topWindow.contentarea.setTimeout(resumeWatching, 100, 'content');
    }

    return message;
  }
  
  function validateBeforeUnloadFrameSet()
  {
    if (typeof(debugDCW)  != 'undefined' && debugDCW) alert('validateBeforeUnloadFrameSet');

    if (typeof(watch) == 'undefined' || !watch) return;

    var message = getWarningMessageIfDataChanged();

    pauseWatching();
    
    if (BonaPage)
    {
      if (document.all)
      {
        BonaPage.topWindow.setTimeout(resumeWatching, 100);
      }
      else
      {
        BonaPage.topWindow.contentarea.setTimeout(resumeWatching, 100, 'content');
        BonaPage.topWindow.adminpanel.setTimeout(resumeWatching, 100, 'admin');
      }
    }
    else
    {
      try
      {
        if (document.all)
        {
          top.setTimeout(resumeWatching, 100);
        }
        else
        {
          top.contentarea.setTimeout(resumeWatching, 100, 'content');
          top.adminpanel.setTimeout(resumeWatching, 100, 'admin');
        }
      }
      catch (err) {}
    }

    return message;
  }

  function setChanged() {
    alreadyChanged = true;
  }
  function setNotChanged() {
    alreadyChanged = false;
  }
}) ();



/*   /Admin/html_res/js/customFieldsValidation.js   */

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;
  };
})();



/*   /Admin/html_res/js/ResizingTextarea.js   */

var TextareaHashObject = new Array();

function TextareaResizer(TextareaID, TextareaContainerID, AutoExpandOnFocus, CollapsedHeight, ExpandedHeight, ExplicitHeight, WatermarkString, CanCollapseWhenNotEmpty)
{
    // private properties
    var pThis = this;
    this.intCurrHeight = 50;
    this.Textarea;
    this.TextareaContainer;
    this.objTextareaResizeInterval;
    
    if (TextareaID)             this.Textarea = document.getElementById(TextareaID);                // required
    if (!this.Textarea)         return null;
    if (TextareaContainerID)    this.objContainer = document.getElementById(TextareaContainerID);   // optional 
        
    this.SetAttribute = function(strAttribute, anyInitValue, anyDefaultValue)
    {
        if (!this.Textarea) return false;
        var anyExistingValue = this.Textarea[strAttribute];
        if ((anyInitValue != "undefined") && (anyInitValue || (anyInitValue == false))) 
        {
            this.Textarea[strAttribute] = anyInitValue;
        }
        else
        {
            if (!anyExistingValue) this.Textarea[strAttribute] = anyDefaultValue;
        }
        return true;
    }
        
    // public attrubutes initialization
    this.SetAttribute("TextareaContainerID", TextareaContainerID, null);    // optinal
    this.SetAttribute("TextareaContainerPadding", null, 10);                // optional
    this.SetAttribute("AutoExpandOnFocus", AutoExpandOnFocus, true);
    this.SetAttribute("CollapsedHeight", CollapsedHeight, 50);
    this.SetAttribute("ExpandedHeight", ExpandedHeight, 200);
    this.SetAttribute("ExplicitHeight", ExplicitHeight, false);
    this.SetAttribute("WatermarkString", WatermarkString, "Write your comments here...");
    this.SetAttribute("CanCollapseWhenNotEmpty", CanCollapseWhenNotEmpty, false);
    
    this.Textarea.style.overflow = (this.Textarea["ExplicitHeight"] ? "auto" : "visible");
        
    var isDOM = (document.getElementById) ? true : false;
    var isOpera = window.opera && isDOM;
    var isIE = document.all && document.all.item && !isOpera;
    
    // initializing private properties

    this.intCurrHeight = this.Textarea["CollapsedHeight"];
    this.Textarea.style.height = this.intCurrHeight + "px";
    
    if (this.Textarea.value.length == 0) this.Textarea.value = this.Textarea["WatermarkString"];

	// initializing event hendlers
	var strRE = ' ';
    strRE.match(/(((((.)))))/);
    ((this.Textarea.onfocus + '').replace(/\n/g, '')).match(/.*?\{(.*)\}.*?/);
    this.Textarea.onfocus = new Function(RegExp.$1 + '; TextareaHashObject["' + this.Textarea.id + '"].OnFocus()');
    strRE.match(/(((((.)))))/);
    ((this.Textarea.onblur + '').replace(/\n/g, '')).match(/.*?\{(.*)\}.*?/);
    this.Textarea.onblur = new Function(RegExp.$1 + '; TextareaHashObject["' + this.Textarea.id + '"].OnBlur()');
    
    if (isIE)
    {
      this.Textarea.attachEvent('onkeydown', function () { pThis.OnKeyDown(event); });
    }
    else
    {
      this.Textarea.addEventListener('keydown', function (e) { pThis.OnKeyDown(e); }, false);
    }
   

    // properties "Set"
    this.SetTextareaID = function(strNewTextareaID)
    {   
        if (!this.Textarea) return false;
        var objNewTextarea = document.getElementById(strNewTextareaID);
        if (objNewTextarea)
        {
            this.Textarea = objNewTextarea;
            return true;
        }
        return false;
	}
	
	this.SetContainerID = function(strNewContainerID)
    {   
        if (!this.Textarea) return false;
        var objNewContainer = document.getElementById(strNewContainerID);
        if (objNewContainer)
        {
            this.TextareaContainer = objNewContainer;
            this.SetAttribute("ContainerID", strNewContainerID);
            return true;
        }
        return false;
	}
	
	this.SetAutoExpandOnFocus = function(blnEnableAutoExpand)
    {   
        if (!this.Textarea) return false;
        return this.SetAttribute("AutoExpandOnFocus", blnEnableAutoExpand);
	}
	
	this.SetCollapsedHeight = function(intNewCollapsedHeight)
    {   
        if (!this.Textarea) return false;
        if (intNewCollapsedHeight < 1) return false;
        if (this.Textarea.style.height == this.Textarea.CollapsedHeight + "px") 
        {
            this.Resize(intNewExpandedHeight);
        }
        this.SetAttribute("CollapsedHeight", intNewCollapsedHeight);
        return true;
	}
	
	this.SetExpandedHeight = function(intNewExpandedHeight)
    {   
        if (!this.Textarea) return false;
        if (intNewExpandedHeight <= this.Textarea.CollapsedHeight) return false;
        if (this.Textarea.style.height == this.Textarea.ExpandedHeight + "px") 
        {
            this.Resize(intNewExpandedHeight);
        }
        this.SetAttribute("ExpandedHeight", intNewExpandedHeight);
        return true;
	}
	
	this.SetExplicitHeight = function(blnEnableExplicitHeight)
    {  
        if (!this.Textarea) return false;
        this.SetAttribute("ExplicitHeight", blnEnableExplicitHeight);
        if (this.blnEnableExplicitHeight == false)
        {
            this.Textarea.style.overflow = "visible";
        }
        else
        {
            this.Textarea.style.overflow = "auto";
        } 
        return true;
	}
	
	this.SetWatermarkString = function(strNewWatermarkString)
    {  
        if (!this.Textarea) return false;
        if (this.Textarea.value == this.Textarea.WatermarkString) this.Textarea.value = strNewWatermarkString;
        this.SetAttribute("WatermarkString", strNewWatermarkString); 
	}
	
	this.SetTextareaContainerPadding = function(intNewTextareaContainerPadding)
	{
	    if (!this.Textarea) return false;
        this.SetAttribute("TextareaContainerPadding", intNewTextareaContainerPadding); 
	}
	
	this.SetCanCollapseWhenNotEmpty = function(blnCanCollapseWhenNotEmpty)
	{
	    if (!this.Textarea) return false;
        this.SetAttribute("CanCollapseWhenNotEmpty", blnCanCollapseWhenNotEmpty); 
	}
	
   
    // properties "Get"
    
    this.Expanded = function()
    {
        return this.Textarea.style.height == this.Textarea.ExpandedHeight;
    }
    
    this.Collapsed = function()
    {
        return this.Textarea.style.height == this.Textarea.CollapsedHeight;
    }
    
    this.Resize = function(intNewHeight)
    {            
        var intResizeStep = 0;
        try
        {
            window.clearTimeout(this.objTextareaResizeInterval);
        }
        catch (err) { }  
        if (Math.abs(intNewHeight - this.intCurrHeight) < 2)
        {
            this.intCurrHeight = intNewHeight;
        }
        else
        {   
            this.intCurrHeight = (this.intCurrHeight / 2) + (intNewHeight / 2);
            this.objTextareaResizeInterval = window.setTimeout("TextareaHashObject['" + this.Textarea.id + "'].Resize(" + intNewHeight + ")", 30);
        }
        this.Textarea.style.height = this.intCurrHeight + 'px';
        if (this.objContainer) this.objContainer.style.height = (this.intCurrHeight + this.Textarea["TextareaContainerPadding"]) + 'px';
    }
    
    this.OnFocus = function()
    {
        if (this.Textarea["WatermarkString"] == this.Textarea.value) this.Textarea.value = "";
        if (this.Textarea.style.height != this.Textarea["ExpandedHeight"] + "px")
        {
            if (this.Textarea["AutoExpandOnFocus"] == true) this.Resize(this.Textarea["ExpandedHeight"]);
        }
    }
    
    this.OnBlur = function()
    {
        if (this.Textarea["AutoExpandOnFocus"] == true)
        {     
            if ((this.Textarea.value.length == 0) || (this.Textarea["CanCollapseWhenNotEmpty"])) 
            {
                this.Resize(this.Textarea["CollapsedHeight"]);
            }
        }
        if (this.Textarea.value.length == 0)
        {
            this.Textarea.value = this.Textarea["WatermarkString"];
        }
    }
    
    this.OnKeyDown = function (e)
    {    
        var key = (isIE) ? e.keyCode : e.which;
        
        if (key == 27)
        { 
            if(this.Textarea.value.length < 10)
            {
                this.Textarea.value = "";
                this.OnBlur();
                document.body.focus();
            }
            else
            {
                return false;
            }
        }        
    }
    
    this.Expand = function()
    {
        this.Resize(this.Textarea["ExpandedHeight"]);
    }
    
    this.Collapse = function()
    {
        this.Resize(this.Textarea["CollapsedHeight"]);
    }
    

    // initializing global chache
    TextareaHashObject[this.Textarea.id] = this;
}



/*   /Content/Pages/html_res/js/BonaPrint.js   */

(function() {

  if(window.BonaPrint == null) {
    window.BonaPrint = new Object();
  }
  
  var isIE = BonaPage.Browser.isIE;

  var iconWidth = 30;
  var iconLeftPosition;
  var startTimeout = 20;
  var counter = 1;
  var printLinkContainer;
  var timeout;
  var outTimeout;
  var initTimeout;
  var isIconShown = false;
  
  BonaPrint.enabled = true;
  BonaPrint.printMode = '0';
  BonaPrint.visibilityDefault = true;
  BonaPrint.iconVisibility = {  };
  BonaPrint.wizardReceiptPrintMessage = '';
  BonaPrint.customPageParser = null;

  BonaPrint.iconPosition =
  {
    id : 'idContentContainer',
    horizontalAlign : 'right', // left, center, right
    verticalAlign : 'top', // top, middle, bottom
    horizontalOffset : 45,
    verticalOffset : 0
  };
  
  BonaPrint.textTitle = '';

  BonaPrint.initPrintMessage = function()
  {
    if(BonaPrint.enabled)
    {
      var container = document.getElementById('idWizardReceiptMessage');
      
      if (container)
      {
        container.innerHTML = BonaPrint.wizardReceiptPrintMessage;
      }
    }
  }
  
  BonaPrint.initPrintIcon = function()
  {
    if (window.EmulateMode)
    {
        return;
    }
    
    CheckVisibility();
    
    if(!BonaPrint.enabled)
      return;
    
    if(BonaPrint.iconPosition.id)
    {
      BonaPage.addPageStateHandler(BonaPage.PAGE_LOADED, showPrintIcon);
      initTimeout = setTimeout(showPrintIcon, 15000);
    }
    else
    {
      showPrintIcon();
    }
  }
  
  BonaPrint.findChildByClassName = function(container, className)
  {
    var found = container.firstChild;

    if (!found || found == 'underfined')
    {
      return null;
    }
    
    while (found != null)
    {
      if (found.className && found.className != 'undefined' && found.className.indexOf(className) >= 0)
      {
        return found;
      }
      
      found = found.firstChild;
    }
    
    return null;
  }
  
  BonaPrint.findSiblingByClassName = function(container, className)
  {
    var found = container.nextSibling;
    
    if (!found || found == 'underfined')
    {
      return null;
    }
    
    while (found != null)
    {
      if (found.className && found.className != 'undefined' && found.className.indexOf(className) >= 0)
      {
        return found;
      }
      
      found = found.nextSibling;
    }
    
    return null;
  }
  
  BonaPrint.printPreview = function()
  {
    if(!BonaPrint.enabled)
      return;
    
    var i;
    var content;
    
    if(window.contentarea && window.contentarea.document)
    {
      content = window.contentarea.document;
    }
    else
    {
      content = document;
    }

    var mainContainerId = content.getElementById('idMainContainer') ? 'idMainContainer' : 'contentDiv';
    var obj = window.open("", "", "resizable=yes, menubar=yes, scrollbars=yes, toolbar=yes, directories=no");
    setTimeout(writeHtml, 1000);
    
    
    function writeHtml()
    {
      try
      {
        if (!obj || !obj.document)
        {
          setTimeout(writeHtml, 100);
          return;
        }
      }
      catch (err) {  return false;  }
      
      obj.document.open();
      obj.document.write(renderPreviewHtml());
      obj.document.close();
      
      setTimeout(processHtml, 1000);
    }
    
    
    function renderPreviewHtml()
    {
      var result = [];
      
      var title = content.title;
      var sts = content.styleSheets;
      
      var bodyClass = content.getElementsByTagName('body')[0].className;
      bodyClass = (bodyClass.indexOf('widgetMode') >= 0) ? ' widgetMode' : '';

      var JavaScriptEnvironment = content.getElementById('idJavaScriptEnvironment');
      var BonaPageSrc = content.getElementById('idBonaPageScript').src;
      var userJS = (content.getElementById('idCustomJsContainer')) ? content.getElementById('idCustomJsContainer').innerHTML.replace(/<scr[i]pt[^>]*>(?:.|\s)*?<\/scr[i]pt>/ig, '') : null;
    
      result.push('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n\r');
      result.push('<html xmlns="http://www.w3.org/1999/xhtml" >\n\r');
      result.push('<head>\n\r');
      result.push('<scr' + 'ipt id="idJavaScriptEnvironment" type="text/javascript">' + JavaScriptEnvironment.innerHTML + '</sc' + 'ript>');
      result.push('<scr' + 'ipt id="idBonaPageScript" type="text/javascript" src="' + BonaPageSrc + '"></sc' + 'ript>');
      result.push('<title>\n\r');
      result.push(title + '\n\r');
      result.push('</title>\n\r');
      
      for (i = 0; i < sts.length; i++)
      {
        result.push('<link href="' + sts[i].href + '" type="text/css" rel="stylesheet" />\n\r');
      }
      
      result.push('<style type="text/css" media="print">\n\r');
      result.push('.nonPrintableShading,\n\r');
      result.push('#idWizardReceiptMessage\n\r');
      result.push('{\n\r');
      result.push('display: none;\n\r');
      result.push('}\n\r');
      result.push('DIV, A\n\r');
      result.push('{\n\r');
      result.push('overflow: visible; !important\n\r');
      result.push('}\n\r');
      result.push('</style>\n\r');

      result.push('<style type="text/css" media="screen">\n\r');
      result.push('#idPrintPreviewContentContainer\n\r');
      result.push('{\n\r');
      result.push('padding: 5px;\n\r');
      result.push('}\n\r');
      result.push('</style>\n\r');
      
      result.push('<style type="text/css">\n\r');
      result.push('.nonPrintable, .HyperLinkNavigationBackContainer\n\r');
      result.push('{\n\r');
      result.push('display: none;\n\r');
      result.push('}\n\r');
      
      if (BonaPrint.customStyles)
      {
        result.push(BonaPrint.customStyles);
      }

      result.push('</style>\n\r');
      
      result.push('</head>\n\r');
      
      result.push('<body class="printContentView' + bodyClass + '" style="height: auto; float: none; visibility: visible;">\n\r');

      result.push('<table id="pleaseWait" style="width: 100%; height: 300px;">\n\r');
      result.push('<tr>\n\r');
      result.push('<td style="text-align: center; vertical-align: middle;"><img src="/admin/html_res/images/async-load-progress-01.gif"><br/><br/><strong>Please wait...</strong></td>\n\r');
      result.push('</tr>\n\r');
      result.push('</table>\n\r');
      
      result.push('<table cellspacing="0" cellpadding="0">\n\r');
      result.push('<tr>\n\r');
      result.push('<td id="idPrintPreviewContentContainer" style="float: none;">\n\r');
      
      result.push('<div id="' + mainContainerId + '" style="display: none;" class="mainContainerDiv">\n\r');
      result.push('</div>\n\r');

      result.push('</td>\n\r');
      result.push('</tr>\n\r');
      result.push('</table>\n\r');
      
      if (userJS != null)
      {
        result.push(userJS + '\n\r');
      }
      
      result.push('</body>\n\r');
      result.push('</html>\n\r');
      result.push('<sc' + 'ript type="text/javascript">if (window.BonaPage) BonaPage.setPageState(BonaPage.PAGE_PARSED);</scr' + 'ipt>\n\r');

      return result.join('');
    }
    
    
    function processHtml()
    {
      try
      {
        if(!obj || !obj.document || !obj.document.body || !obj.document.body.innerHTML)
        {
          setTimeout(processHtml, 100);
          return;
        }
      
        var pleaseWait = obj.document.getElementById('pleaseWait');
        
        var classes =
        {
          'publicWizardContainer' : true,
          'publicWizardNameContainer' : true,
          'introOuterContainer' : true,
          'introContainer' : true,
          'infoOuterContainer' : true,
          'infoContainer' : true,
          'infoSection' : true,
          'generalFormOuterContainer' : true,
          'generalFormContainer' : true,
          'formOuterContainer' : true,
          'formContainer' : true,
          'formTitleOuterContainer' : true,
          'formTitleContainer' : true,
          'generalFieldsOuterContainer' : true,
          'generalFieldsContainer' : true,
          'stepOuterContainer' : true,
          'stepContainer' : true,
          'captionOuterContainer' : true,
          'captionContainer' : true,
          'sectionOuterContainer' : true,
          'sectionContainer' : true,
          'fieldContainer' : true,
          'fieldSubContainer' : true,
          'groupContainer' : true,
          'fieldItem' : true,
          'navigationOuterContainer' : true,
          'navigationContainer' : true
        
        };
        
        var img = '<img id="nonPrintableShading" class="nonPrintableShading" src="/Admin/html_res/images/z.gif" style="position: absolute; top: 0; left: 0; z-index: 30000;" />';
        
        var mainContainer = obj.document.getElementById(mainContainerId);
        
        var cleanHtml;
        var contentNode = content.getElementById('idPrimaryContentBlock1ContentHolder') ? content.getElementById('idPrimaryContentBlock1ContentHolder') : content.getElementById('contentDiv');

        cleanHtml = contentNode.innerHTML + img;
        
        cleanHtml = cleanHtml.replace(/<scr[i]pt[^>]*>(?:.|\s)*?<\/scr[i]pt>/ig, '');
        
        if(contentNode.id != 'contentDiv')
        {
          var node = contentNode.parentNode;
          var needRemoveBg = false;
          
          while(node.id != mainContainerId)
          {
            cleanHtml = '<' + node.tagName + ' id="' + node.id + '" class="' + node.className + '" style="top: 0; left: 0;'  + (needRemoveBg ? ' margin: 0; padding: 0; background: none;' : '') + '">' + cleanHtml + '</' + node.tagName + '>';
            
            if(node.id == 'idPrimaryContentContainer')
            {
              needRemoveBg = true;
            }
            
            node = node.parentNode;
          }
        }
        
        mainContainer.innerHTML = cleanHtml;

        if (BonaPrint.customPageParser)
        {
          BonaPrint.customPageParser(obj, img);
        }
              
        if(isIE)
        {
          var elements = obj.document.getElementsByTagName('*');
          
          for(i = 0; i < elements.length; i++)
          {
            var firstClassName = elements[i].className.replace(/^(\S*).*/, "$1");
            
            if(classes[firstClassName])
            {
              elements[i].style.styleFloat = 'none';
            }
          }
        }
        
        pleaseWait.style.display = 'none';
        mainContainer.style.display = 'block';
        
        var shading = obj.document.getElementById('nonPrintableShading');
        
        if (shading)
        {
          shading.style.width = obj.document.body.scrollWidth + "px";
          shading.style.height = obj.document.body.scrollHeight + "px";
        }
        
        obj.print();
      }
      catch (err) { return false; }
    }
  }

  function CheckVisibility()
  {
    ProcessPrintWarning();
    
    if(!BonaPrint.enabled)
    {
      return;
    }
  
    if(BonaPrint.printMode == '1') // admin mode
    {
      BonaPrint.enabled = false;
      return;
    }
  
    if(BonaPrint.iconVisibility[document.body.id] != null)
    {
      BonaPrint.enabled = BonaPrint.iconVisibility[document.body.id];
    }
    else
    {
      BonaPrint.enabled = BonaPrint.visibilityDefault;
    }
  }

  function ProcessPrintWarning()
  {
    var printWarning = document.getElementById('idPrintWarningJS');
    var printWarningNoJS = document.getElementById('idPrintWarningNoJS');
    var printWarningContainer = document.getElementById('idPrintWarning');
    
    if(!BonaPrint.enabled)
    {
      if(BonaPrint.printMode == '0' && printWarningContainer)
      {
        printWarningContainer.style.display = 'none';
      }
      return;
    }

    if(printWarning && printWarningNoJS)
    {
      printWarning.style.display = 'inline';
      printWarningNoJS.style.display = 'none';
    }
  }

  function moveToPosition(obj)
  {
	    if(BonaPrint.iconPosition.id && document.getElementById(BonaPrint.iconPosition.id))
	    {
	      moveToRelativePosition(obj);
	    }
	    else
	    {
	      moveToFixedPosition(obj);
	    }
			
			obj.style.visibility = 'visible';
  }
  
  function moveToRelativePosition(obj)
  {
    var docForPosition = document.getElementById(BonaPrint.iconPosition.id);
    
    BonaPage.getElementXY(docForPosition);
    
    switch(BonaPrint.iconPosition.horizontalAlign)
    {
      default:
      case 'right':
      {
        obj.style.right = '';
        obj.style.left = ((( docForPosition.X + docForPosition.offsetWidth ) - printLinkContainer.offsetWidth) + BonaPrint.iconPosition.horizontalOffset) + 'px';
        break;
      }
      case 'center':
      {
        obj.style.right = '';
        obj.style.left = ((( docForPosition.X + (docForPosition.offsetWidth / 2) - (printLinkContainer.offsetWidth / 2) )) + BonaPrint.iconPosition.horizontalOffset) + 'px';
        break;
      }
      case 'left':
      {
        obj.style.left = (docForPosition.X + BonaPrint.iconPosition.horizontalOffset) + 'px';
        break;
      }
    }
    switch(BonaPrint.iconPosition.verticalAlign)
    {
      default:
      case 'top':
      {
        obj.style.top = (docForPosition.Y + BonaPrint.iconPosition.verticalOffset) + 'px';
        break;
      }
      case 'middle':
      {
        obj.style.top = (docForPosition.Y + ((docForPosition.offsetHeight / 2) - (printLinkContainer.offsetHeight / 2)) + BonaPrint.iconPosition.verticalOffset) + 'px';
        break;
      }
      case 'bottom':
      {
        obj.style.top = (docForPosition.Y + docForPosition.offsetHeight - printLinkContainer.offsetHeight + BonaPrint.iconPosition.verticalOffset) + 'px';
        break;
      }
    }
  }
  
  function moveToFixedPosition(obj)
  {
    if(!(isIE && isIE <= 6))
    {
      obj.style.position = 'fixed';
    }
    
    switch(BonaPrint.iconPosition.horizontalAlign)
    {
      default:
      case 'right':
      {
        obj.style.left = '';
        obj.style.right = (0 - BonaPrint.iconPosition.horizontalOffset) + 'px';
        break;
      }
      case 'center':
      {
        obj.style.left = '';
        obj.style.right = (BonaPage.getInnerWidth() - ( (BonaPage.getInnerWidth() / 2) + (printLinkContainer.offsetWidth / 2) ) - BonaPrint.iconPosition.horizontalOffset) + 'px';
        break;
      }
      case 'left':
      {
        obj.style.left = (0 + BonaPrint.iconPosition.horizontalOffset) + 'px';
        obj.style.right = '';
        break;
      }
    }

    switch(BonaPrint.iconPosition.verticalAlign)
    {
      default:
      case 'top':
      {
        obj.style.top = (BonaPrint.iconPosition.verticalOffset + ((isIE && isIE <= 6) ? BonaPage.getScrollTop() : 0)) + 'px';
        break;
      }
      case 'middle':
      {
        obj.style.top = ((BonaPage.getInnerHeight() / 2) + ((isIE && isIE <= 6) ? BonaPage.getScrollTop() : 0) - (printLinkContainer.offsetHeight / 2) + BonaPrint.iconPosition.verticalOffset) + 'px';
        break;
      }
      case 'bottom':
      {
        obj.style.top = (BonaPage.getInnerHeight() + ((isIE && isIE <= 6) ? BonaPage.getScrollTop() : 0) - printLinkContainer.offsetHeight + BonaPrint.iconPosition.verticalOffset + (!isIE ? -17 : 0)) + 'px';
        break;
      }
    }
  }
  
  function showPrintIcon()
  {
    if(initTimeout)
      clearTimeout(initTimeout);
      
    if(isIconShown)
      return;
    else
      isIconShown = true;
    
    printLinkContainer = document.getElementById('idPrintLinkContainer');
    
    if(printLinkContainer)
    {
      printLinkContainer.style.display = 'block';
      
      printLinkContainer.title = BonaPrint.textTitle;

      moveToPosition(printLinkContainer);
      BonaPage.addHandler(window, 'resize', onResize);
      if(isIE && isIE <= 6)
      {
        BonaPage.addHandler(window, 'scroll', onScroll);
      }
    }
  }
  
  function onResize()
  {
    printLinkContainer.style.visibility = 'hidden';
    setTimeout( function() { moveToPosition(printLinkContainer); }, 5);
  }
  
  function onScroll()
  {
    printLinkContainer.style.visibility = 'hidden';
    setTimeout( function() { moveToPosition(printLinkContainer); }, 5);
  }
  
  if(BonaPrint.enabled)
  {
    BonaPage.addPageStateHandler(BonaPage.PAGE_PARSED, BonaPrint.initPrintIcon);
  }
  
}) ();


/*   /Admin/html_res/js/BonaDialog.js   */

var BonaDialog;

(function()
{
  var topWin = BonaPage.topWindow;
  var isIE = (document.all && window.clientInformation) ? parseInt(window.clientInformation.userAgent.substr(window.clientInformation.userAgent.indexOf('MSIE ') + 5, 3)) : 0;
  var uAgent = navigator.userAgent;
  var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
  var isMSIE5 = isMSIE && (uAgent.indexOf('MSIE 5') != -1);
  var isMSIE5_0 = isMSIE && (uAgent.indexOf('MSIE 5.0') != -1);
  var isMSIE7 = isMSIE && (uAgent.indexOf('MSIE 7') != -1);
  var isGecko = uAgent.indexOf('Gecko') != -1;
  var isSafari = uAgent.indexOf('Safari') != -1;
  var isOpera = uAgent.indexOf('Opera') != -1;
  var isMac = uAgent.indexOf('Mac') != -1;
  var isNS7 = uAgent.indexOf('Netscape/7') != -1;
  var isNS71 = uAgent.indexOf('Netscape/7.1') != -1;
  var $ = function (id) { return document.getElementById(id); };
  var $addHandler = function (o, e, h) { if (isIE) o.attachEvent('on' + e, h); else o.addEventListener(e, h, false); };
  var $removeHandler = function (o, e, h) { if (isIE) o.detachEvent('on' + e, h); else o.removeEventListener(e, h, false); };
  var $stopEvent = function (e) { if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; };
  var $getInnerWidth = function () { return ((isIE) ? ((document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth) : (($getScrollHeight() > window.innerHeight) ? window.innerWidth - ((window.globalUtils) ? globalUtils.getScrollBarWidth() : 0) : window.innerWidth)) };
  var $getInnerHeight = function () { return ((isIE) ? ((document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight) : (($getScrollWidth() > window.innerWidth) ? window.innerHeight - ((window.globalUtils) ? globalUtils.getScrollBarWidth() : 0) : window.innerHeight)) };
  var $getScrollLeft = function () { return ((typeof(window.pageXOffset) == 'number') ? window.pageXOffset : ((document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : ((document.body && document.body.scrollLeft) ? document.body.scrollLeft : 0))) };
  var $getScrollTop = function () { return ((typeof(window.pageYOffset) == 'number') ? window.pageYOffset : ((document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : ((document.body && document.body.scrollTop) ? document.body.scrollTop : 0))) };
  var $getScrollWidth = function () { return document.body.scrollWidth; }
  var $getScrollHeight = function () { return document.body.scrollHeight; }
  
  
  if(BonaDialog == null)
  {
    BonaDialog = new Object();
  }
  
  BonaDialog.pDialog = new Array();
  BonaDialog.isDialogOpened = false;

  BonaDialog.createDialog = function(parameters)
  {
    if (typeof(topWin.BonaDialog) == 'undefined' || !topWin.BonaDialog)
    {
        return null;
    }
        
    return topWin.BonaDialog.createInnerWindow(parameters.dialogName, parameters);    
  }

  
  BonaDialog.createInnerWindow = function (objId, pParameters, pCallBackSaveInit, pCallBackCloseInit)
  {
    var i;
    
    for (i = 0; i < BonaDialog.pDialog.length; i++)
    {
      if (BonaDialog.pDialog[i].id == objId)
      {
        if (BonaDialog.pDialog[i].dialog)
        {
            BonaDialog.pDialog[i].dialog.updateCallBackParameters(pParameters.callBackParameters);
        }
        
        return BonaDialog.pDialog[i].dialog;
      }
    }
    
    i = BonaDialog.pDialog.length;
    BonaDialog.pDialog[i] = new Object();
    BonaDialog.pDialog[i].id = objId;
    BonaDialog.pDialog[i].dialog = new InnerWindow(objId, pParameters, pCallBackSaveInit, pCallBackCloseInit);
    //if (objId == 'ImportConfirmationDialog') alert(BonaDialog.pDialog[i].dialog);
    return BonaDialog.pDialog[i].dialog;
  }
   
  BonaDialog.getObjectById = function (dialogId)
  {
    var i;
    
    for (i = 0; i < BonaDialog.pDialog.length; i++)
    {
      if (BonaDialog.pDialog[i].id == dialogId)
      {
        return BonaDialog.pDialog[i].dialog;
      }
    }
    
    return null;
  }
  
  
  BonaDialog.checkIfAllDialogsReady = function ()
  {
    var i;
    
    for (i = 0; i < BonaDialog.pDialog.length; i++)
    {
      if (!BonaDialog.pDialog[i].dialog.isObjValid)
      {
        return false;
      }
    }
    
    return true;
  }
  

  
  function InnerWindow (objId, pParameters, pCallBackSaveInit, pCallBackCloseInit)
  {
    this.isObjValid = false;
    this.isDataValid = false;
    
    this.openWindow = openWindow;
    this.showDialog = showDialog;
    this.refreshInnerWindow = refreshInnerWindow;
    this.closeWindow = closeWindow;
    this.getReturnedParameters = getReturnedParameters;
    this.setReturnedParameters = setReturnedParameters;
    this.updateCallBackParameters = updateCallBackParameters;
    this.getState = getState;
    this.gotoElement = gotoElement;
    this.showLoadingMessage = showLoadingMessage;
    this.hideLoadingMessage = hideLoadingMessage;
    this.setDialogTitle = setDialogTitle;
    this.getWindow = getWindow;
    
    var pThis = this;
    
    var i;
    var dialogId = objId;
    var directURL = pParameters.directURL;
    var reloadURL = (pParameters.reloadURL) ? pParameters.reloadURL : null;
    var isReloadUrlLoad = (pParameters.isReloadUrlLoad) ? pParameters.isReloadUrlLoad : false;
    var isReloadUrlNotReload = (pParameters.isReloadUrlNotReload) ? pParameters.isReloadUrlNotReload : false;
    var waitMessage = (pParameters.waitMessage !== undefined) ? pParameters.waitMessage : 'Please wait...';
    var waitMessageImgURL = (pParameters.waitMessageImgURL !== undefined) ? pParameters.waitMessageImgURL : '/Admin/html_res/images/async-load-progress-01.gif';
    var isSharedWaitMsg = (pParameters.isSharedWaitMsg !== undefined) ? pParameters.isSharedWaitMsg : false;
    var isCustomHideWaitMsg = (pParameters.isCustomHideWaitMsg !== undefined) ? pParameters.isCustomHideWaitMsg : false;
    var defWinLeft = (pParameters.left) ? pParameters.left : null;
    var winLeft = defWinLeft;
    var defWinTop = (pParameters.top) ? pParameters.top : null;
    var winTop = defWinTop;
    var defWinWidth = (pParameters.width) ? pParameters.width : null;
    var winWidth = defWinWidth;
    var defWinHeight = (pParameters.height) ? ((!isSafari) ? pParameters.height : pParameters.height + 7) : null;
    var winHeight = defWinHeight;
    var isWinModal = (pParameters.isModal) ? pParameters.isModal : false;
    var isWinMoveable = (pParameters.isMoveable) ? pParameters.isMoveable : false;
    var isWinResizeable = (pParameters.isResizeable) ? pParameters.isResizeable : false;
    var winMinWidth = (pParameters.minWidth) ? pParameters.minWidth : null;
    var winMinHeight = (pParameters.minHeight) ? pParameters.minHeight : null;
    var isReloadWinScrollable = (pParameters.isScrollable) ? pParameters.isScrollable : false;
    var isCustomFixWinHeight = (pParameters.isCustomFixWinHeight) ? pParameters.isCustomFixWinHeight : false;
    var remStateCookie = (pParameters.stateCookie) ? pParameters.stateCookie : null;
    var pCallBackSave = (pCallBackSaveInit && typeof(pCallBackSaveInit) == 'function') ? pCallBackSaveInit : null;
    var pCallBackClose = (pCallBackCloseInit && typeof(pCallBackCloseInit) == 'function') ? pCallBackCloseInit : pThis.closeWindow;
    var returnParameters = null;
    var pCallBackParameters = new Object();
    
    if (pParameters.callBackParameters)
    {
      for (i in pParameters.callBackParameters)
      {
        if (typeof(pParameters.callBackParameters[i]) != 'function')
        {
          pCallBackParameters[i] = pParameters.callBackParameters[i];
        }
      }
    }
    else
    {
      pCallBackParameters == null;
    }
  
    var strRE = ' ';
    var objShadingBox;
    var objMainBoxBg, objMainBox, mainBoxId, parentIFrame, eDataIFrame, dataIFrame, dataIFrameElement, reloadIFrameWaitMsg;
    var eDataIFrameWidth, eDataIFrameHeight, eDataIFrameInnerHtml;
    var clientLeft, clientTop;
    var saveScrollTopPosition = 0;
    var saveScrollLeftPosition = 0;
    var state = false;
    var loadAttemptsDirectURL, loadProgressAttemptsDirectURL, loadAttemptsReloadURL, loadProgressAttemptsReloadURL;
    
    var shadingBoxId = 'idShadingBox_' + dialogId;
    var mainBoxBgId = 'idMainBoxBg_' + dialogId;
    
    var baseIFrameId = 'idBaseIFrame_' + dialogId;
    var baseIFrameName = 'nmBaseIFrame_' + dialogId;
    var eDataIFrameId = 'idWinReloadIFrameContainer_' + dialogId;
    var reloadIFrameId = 'idReloadIFrame_' + dialogId;
    var reloadIFrameName = 'nmReloadIFrame_' + dialogId;
    var reloadIFrameWaitMsgId = 'idReloadIFrameWaitMsg_' + dialogId;
    
    var winStructure = 
    {
      parentTable :         null,
      titleRow :            null,
      headerRow :           null,
      mainRow :             null,
      scrollableContainer : null,
      actionRow :           null,
      footerRow :           null
    }
    
    var winStructureParts = 
    {
      TitleRow :  'titleRow',
      HeaderRow : 'headerRow',
      MainRow :   'mainRow',
      ActionRow : 'actionRow',
      FooterRow : 'footerRow'
    }
    
    var winTitleStruct = 
    {
      objWinTitle : null,
      winTitleSpan : null,
      winTitleSpanIn : null,
      winTitleSpanDots : null
    };
    
    var windowTitleParts = 
    {
      TitleEventContainer : ['idWinTitle_', 'objWinTitle'],
      TitleContainer :      ['idWinTitleSpan_', 'winTitleSpan'],
      Title :               ['idWinTitleSpanIn_', 'winTitleSpanIn'],
      TitleDots :           ['idWinTitleSpanDots_', 'winTitleSpanDots']
    };
    
    var windowResizeableParts = 
    {
      TopLeftCorner :     [6, 'nw-resize'],
      TopEdge :           [4, 'n-resize'],
      TopRightCorner :    [7, 'ne-resize'],
      RightEdge :         [3, 'e-resize'],
      BottomRightCorner : [9, 'nw-resize'],
      BottomEdge :        [5, 'n-resize'],
      BottomLeftCorner :  [8, 'ne-resize'],
      LeftEdge :          [2, 'e-resize']
    };
    
    var winCoord = new Object();
    var moveWindowStruct = { pushMouseLeftButton : false, X : 0, Y : 0, st : 0 };
    
    var tmSetXY = false;
    var tmMoveOut = false;
    
    var matchCookie;
    var aCookie = null;
    var reCookie = new RegExp('InnerWindows\\s*=\\s*[^;]*' + dialogId + ':([^&;]*)');
    
    if(remStateCookie)
    {
      getWindowCookie();
    }
    
    
    function getWindow()
    {
      return parentIFrame;
    }
    
    
    function initDialog ()
    {
      if (document && document.body && ((isIE && document.readyState == 'complete') || !isIE))
      {
        if (isWinModal)
        {
          objShadingBox = document.createElement('DIV');
          objShadingBox.id = shadingBoxId;
          objShadingBox.style.position = 'absolute';
          objShadingBox.style.left = '0px';
          objShadingBox.style.top = '0px';
          objShadingBox.style.width = '1px';
          objShadingBox.style.height = '1px';
          objShadingBox.style.backgroundColor = '#FFFFFF';
          
          if (isIE)
          {
            objShadingBox.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=37)';
          }
          else
          {
            objShadingBox.style.MozOpacity = 0.37;
            objShadingBox.style.KhtmlOpacity = 0.37;
            objShadingBox.style.opacity = 0.37;
          }
          
          objShadingBox.style.zIndex = 3000 + (BonaDialog.pDialog.length * 2 - 2);
          objShadingBox.style.visibility = 'hidden';
          document.body.appendChild(objShadingBox);
        }
      
        objMainBoxBg = document.createElement('DIV');
        mainBoxBgId = 'idMainBoxBg' + '_' + dialogId;
        objMainBoxBg.id = mainBoxBgId;
        objMainBoxBg.style.position = 'absolute';
        objMainBoxBg.style.left = '0px';
        objMainBoxBg.style.top = '0px';
        objMainBoxBg.style.width = '1px';
        objMainBoxBg.style.height = '1px';
        objMainBoxBg.style.overflow = 'hidden';
        objMainBoxBg.style.backgroundColor = 'transparent';
        objMainBoxBg.style.zIndex = 3000 + (BonaDialog.pDialog.length * 2 - 1);
        objMainBoxBg.style.visibility = 'hidden';
        document.body.appendChild(objMainBoxBg);
        
        objMainBoxBg.innerHTML = '<iframe id="' + baseIFrameId + '" name="' + baseIFrameName + '" src="' + directURL + '" frameborder="0" scrolling="no" style="position: absolute; left: 0px; top: 0px; width: ' + defWinWidth + 'px; height: ' + defWinHeight + 'px; z-index: ' + (3000 + (BonaDialog.pDialog.length * 2)) + '; background-color: #FFFFFF; border: none; padding: 0px; margin: 0px; visibility: hidden;"></iframe>';
        objMainBox = BonaPage.$(baseIFrameId);
        parentIFrame = frames[baseIFrameName];
        
        $addHandler(window, 'beforeunload', pageUnload);
            
        loadProgressAttemptsDirectURL = 1;
        loadAttemptsDirectURL = 10;
        setTimeout(initWindow, 100);
      }
      else
      {
        setTimeout(initDialog, 100);
      }
    }
    
      
    function initWindow ()
    {
      var i, att, allElements;
      var reWhiteColorTest = /(?:255.*?255.*?255|FFFFFF|white)/i;

      if(parentIFrame.document && parentIFrame.document.getElementById('idEndOfPageDiv'))
      {
        parentIFrame.parentId = dialogId;
        parentIFrame.dialogMainBoxIFrame = objMainBox;
        parentIFrame.innerIFrame = null;
        
        if (pCallBackSave)
        {
          parentIFrame.callBackSave = pCallBackSave;
        }
          
        if (pCallBackClose)
        {
          parentIFrame.callBackClose = pCallBackClose;
        }
        
        parentIFrame.stopProp = function (e)
        {
          if (!e && parentIFrame.event)
          {
            e = parentIFrame.event;
          }
          
          if (e)
          {
            $stopEvent(e);
          }
          
          return false;
        }
        
        winStructure.parentTable = new Object();
        winStructure.parentTable.element = parentIFrame.document.body.getElementsByTagName('TABLE')[0];
        
        allElements = parentIFrame.document.body.getElementsByTagName('*');
        
        for (i = 0; i < allElements.length; i++)
        {
          if (allElements[i].getAttribute('iwtype', 0) != null)
          {
            att = allElements[i].getAttribute('iwtype', 0);
            
            if (winStructureParts[att])
            {
              winStructure[winStructureParts[att]] = new Object();
              winStructure[winStructureParts[att]].element = allElements[i];
              winStructure[winStructureParts[att]].innerTable = winStructure[winStructureParts[att]].element.getElementsByTagName('TABLE')[0]; 
            }
            else if (windowTitleParts[att])
            {
              allElements[i].id = windowTitleParts[att][0] + dialogId;
              winTitleStruct[windowTitleParts[att][1]] = allElements[i];
              
              if (att == 'TitleContainer' && allElements[i].style.color && reWhiteColorTest.test(allElements[i].style.color))
              {
                allElements[i].style.color = '#2F331F';
              }
              else if (att == 'TitleEventContainer' && isWinMoveable)
              {
                allElements[i].iwstate = 1;
                
                allElements[i].onmousedown = function (e)
                  {
                    if(!e && parentIFrame.event)
                      e = parentIFrame.event;
                    
                    moveWindow(e, this);
                  };
                  
                allElements[i].onselectstart = parentIFrame.stopProp;
                allElements[i].ondragstart = parentIFrame.stopProp;
              }
            }
            else if (windowResizeableParts[att])
            {
              if (isWinResizeable)
              {
                allElements[i].iwstate = windowResizeableParts[att][0];
                allElements[i].style.cursor = windowResizeableParts[att][1];
                
                allElements[i].onmousedown = function (e)
                  {
                    if(!e && parentIFrame.event)
                      e = parentIFrame.event;
                      
                    moveWindow(e, this);
                  };
                  
                allElements[i].onselectstart = parentIFrame.stopProp;
                allElements[i].ondragstart = parentIFrame.stopProp;
              }
            }
            else if (att == 'CloseButton')
            {
              allElements[i].onclick = function () { parentIFrame.callBackClose(pThis); };
              allElements[i].style.cursor = (isIE) ? 'hand' : 'pointer';
            }
            else if (att == 'InnerIFrameContainer')
            {
              eDataIFrame = allElements[i];
              eDataIFrame.id = eDataIFrameId;
              
              winStructure.mainRow = new Object();
              winStructure.mainRow.element = allElements[i];
              while ((winStructure.mainRow.element = winStructure.mainRow.element.parentNode).nodeName.toUpperCase() != 'TD');
              winStructure.mainRow.innerTable = winStructure.mainRow.element.getElementsByTagName('TABLE')[0];
              winStructure.scrollableContainer = new Object();
              winStructure.scrollableContainer.element = null;
              eDataIFrameInnerHtml = eDataIFrame.innerHTML;
              
              if (reloadURL)
              {
                eDataIFrame.innerHTML = '<div id="idHWinScrollableDiv" class="hWinScrollableDiv">&nbsp;</div>';
                setReloadIFrameWaitMsgXY(null);
              }
              else
              {
                winStructure.scrollableContainer.element = parentIFrame.document.getElementById('idHWinScrollableDiv');
                
                if (isGecko && !isWinResizeable)
                {
                  if (!winStructure.scrollableContainer.element)
                  {
                    eDataIFrame.innerHTML = '<div id="idHWinScrollableDiv" class="hWinScrollableDiv"></div>';
                  }
                  else
                  {
                    eDataIFrameInnerHtml = null;
                  }
                  
                  setTimeout(initWindowGecko1, 10);
                }
                else
                {
                  if (!winStructure.scrollableContainer.element)
                  {
                    eDataIFrame.innerHTML = '<div id="idHWinScrollableDiv" class="hWinScrollableDiv">' + eDataIFrameInnerHtml + '</div>';
                  }
                  
                  setTimeout(initWindowIE, 10);
                }
              }
              
              winStructure.scrollableContainer.element = parentIFrame.document.getElementById('idHWinScrollableDiv');
              eDataIFrameWidth = eDataIFrame.offsetWidth;
              eDataIFrameHeight = eDataIFrame.offsetHeight;
              
              if (isWinResizeable && reloadURL)
              {
                if (!winMinWidth || winMinWidth < defWinWidth - eDataIFrameWidth + 207)
                {
                  winMinWidth = defWinWidth - eDataIFrameWidth + 207;
                }
                
                if (!winMinHeight || winMinHeight < defWinHeight - eDataIFrameHeight + 157)
                {
                  winMinHeight = defWinHeight - eDataIFrameHeight + 157;
                }
              }
            }
          }
        }
        
        if (reloadURL && isReloadUrlLoad)
        {
          createDataWindow();
        }
        
        pThis.isObjValid = true;
      }
      else
      {
        if (isSafari && loadAttemptsDirectURL < 0 && parentIFrame.document && parentIFrame.document.body &&
            parentIFrame.document.body.innerHTML.replace(/\s+/g, '') == '')
        {
          loadAttemptsDirectURL = 30 * loadProgressAttemptsDirectURL++;
          parentIFrame.location.replace(directURL);
        }
        
        loadAttemptsDirectURL--;
        setTimeout(initWindow, 100);
      }
    }
    
    function updateCallBackParameters(newParams)
    {
        pCallBackParameters = new Object();
        var i;
        
        if (newParams)
        {
          for (i in newParams)
          {
            if (typeof(newParams[i]) != 'function')
            {
              pCallBackParameters[i] = newParams[i];
            }
          }
        }
        else
        {
          pCallBackParameters == null;
        }    
    }
    
    function initWindowIE ()
    {
      if (winStructure.scrollableContainer.element.scrollHeight > winStructure.scrollableContainer.element.offsetHeight)
      {
        objMainBox.style.width = (winWidth + ((window.globalUtils) ? globalUtils.getScrollBarWidth() : 0)) + 'px';
      }
    }
    
    
    function initWindowGecko1 ()
    {
      objMainBox.style.left = '-3333px';
      objMainBox.style.top = '-3333px';
      winStructure.parentTable.element.removeAttribute('height', 0);
      winStructure.mainRow.element.removeAttribute('height', 0);
      winStructure.mainRow.innerTable.removeAttribute('height', 0);
      winStructure.scrollableContainer.element.style.height = '1px';
      objMainBox.style.visibility = 'visible';
      setTimeout(initWindowGecko2, 10);
    }
    
    
    function initWindowGecko2 ()
    {
      winStructure.parentTable.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.innerTable.setAttribute('height', '100%', 0);
      winStructure.scrollableContainer.element.style.height = eDataIFrame.offsetHeight + 'px'; //winStructure.mainRow.innerTable.offsetHeight + 'px';
      eDataIFrameHeight = eDataIFrame.offsetHeight;
      
      if (eDataIFrameHeight > winStructure.scrollableContainer.element.offsetHeight)
      {
        objMainBox.style.width = (winWidth + ((window.globalUtils) ? globalUtils.getScrollBarWidth() : 0)) + 'px';
      }
      
      objMainBox.style.visibility = 'hidden';
      objMainBox.style.left = winLeft + 'px';
      objMainBox.style.top = winTop + 'px';
      
      if (eDataIFrameInnerHtml)
      {
        winStructure.scrollableContainer.element.innerHTML = eDataIFrameInnerHtml;
      }
    }
    
    
    function createDataWindow ()
    {
      if (pThis.isObjValid && eDataIFrame)
      {
        if (isSafari)
        {
          winStructure.scrollableContainer.element.style.overflow = 'visible';
        }
        
        winStructure.scrollableContainer.element.innerHTML = '<iframe id="' + reloadIFrameId + '" name="' + reloadIFrameName + '" src="' + reloadURL + '" width="100%" height="' + ((isWinResizeable) ? '100%' : eDataIFrameHeight) + '" frameborder="0" ' + ((isReloadWinScrollable) ? 'scrolling="auto"' : 'scrolling="no"') + ' style="background-color: #FFFFFF;"></iframe>';
        dataIFrame = parentIFrame.frames[reloadIFrameName];
        parentIFrame.innerIFrame = dataIFrame;
        dataIFrameElement = parentIFrame.document.getElementById(reloadIFrameId);
        
        loadProgressAttemptsReloadURL = 1;
        loadAttemptsReloadURL = (isSafari) ? 10 : 377;
        setTimeout(initDataWindow, 100);
      }
      else
      {
        setTimeout(createDataWindow, 100);
      }
    }
    
    
    function initDataWindow ()
    {
      if(dataIFrame && dataIFrame.document && dataIFrame.document.body && dataIFrame.document.body.innerHTML && dataIFrame.document.body.innerHTML.match(/\S/))
      {
        dataIFrame.parentId = dialogId;
        dataIFrame.outerIFrame = parentIFrame;
        $addHandler(dataIFrame, 'unload', function() { setTimeout(initDataWindow, 100); });
        pThis.isDataValid = true;
        
        if(aCookie && aCookie[0] == 1)
        {
          pThis.openWindow();
          dataIFrame.scrollTo(((aCookie[5]) ? aCookie[5] : 0), ((aCookie[6]) ? aCookie[6] : 0));
        }
      }
      else
      {
        if (isSafari)
        {
          if (loadAttemptsReloadURL < 0 && dataIFrame.document && dataIFrame.document.body && dataIFrame.document.body.innerHTML.replace(/\s+/g, '') == '')
          {
            loadAttemptsReloadURL = 30 * loadProgressAttemptsReloadURL++;
            dataIFrame.location.replace(reloadURL);
          }
        }
        else if (loadAttemptsReloadURL < 0)
        {
          loadAttemptsReloadURL = 599;
          dataIFrame.location.replace(reloadURL);
        }
        
        loadAttemptsReloadURL--;
        setTimeout(initDataWindow, 100);
      }
    }
    
    
    function showDialog(windowParameters)
    {
        windowParameters = windowParameters || {};
    
        openWindow(
            windowParameters.pCallBackSaveNew || function() { pThis.closeWindow(); },
            windowParameters.pCallBackCloseNew || function() { pThis.closeWindow(); },
            windowParameters.newReloadUrl,
            windowParameters.winNewLeft,
            windowParameters.winNewTop,
            windowParameters.winNewWidth,
            windowParameters.winNewHeight,
            windowParameters.winNewTitle        
        );    
    }
    
    function openWindow (pCallBackSaveNew, pCallBackCloseNew, newReloadURL, winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle, newApplyReloadURL)
    {
      BonaDialog.isDialogOpened = true;
      
      if (pCallBackSaveNew && typeof(pCallBackSaveNew) == 'function')
      {
        pCallBackSave = pCallBackSaveNew;
      }
      
      if (pCallBackCloseNew && typeof(pCallBackCloseNew) == 'function')
      {
        pCallBackClose = pCallBackCloseNew;
      }
      
      if (newReloadURL != null && newReloadURL != '')
      {
        reloadURL = newReloadURL;
      }
      
      if (newApplyReloadURL != null)
      {
        applyReloadURL = newApplyReloadURL;
      }
      else
      {
        applyReloadURL = true;
      }
      
      pThis.isDataValid = false;
      
      if (dataIFrame && !isReloadUrlNotReload && applyReloadURL)
      {
        dataIFrame.isIFrameLoaded = false;
      }
      
      beforeOpenWindow(winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle);
    }
    
    
    function beforeOpenWindow (winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle)
    {
      if (pThis.isObjValid)
      {
        returnParameters = new Object();
        
        if (pCallBackParameters)
        {
          for (i in pCallBackParameters)
          {
            if (typeof(pCallBackParameters[i]) != 'function')
            {
              returnParameters[i] = pCallBackParameters[i];
            }
          }
          
          parentIFrame.callBackParameters = returnParameters;
        }
    
        parentIFrame.callBackSave = pCallBackSave;
        parentIFrame.callBackClose = pCallBackClose;
        
        if (typeof(parentIFrame.beforeStartOpenWindow) == 'function')
        {
          parentIFrame.beforeStartOpenWindow();
        }
        
        openWindowStep0();
        openWindowStep1(winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle);
      }
      else
      {
        setTimeout(function () { beforeOpenWindow(winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle); }, 100);
      }
    }
    
    
    function openWindowStep0 ()
    {
      if (isWinModal)
      {
        if (objShadingBox)
        {
          setShadingBoxXY(true);
        }
        else
        {
          setTimeout(openWindowStep0, 100);
        }
      }
    }
    
    
    function openWindowStep1 (winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle)
    {
      if (pThis.isObjValid)
      {
        if (winNewWidth != null && winNewWidth >= 0)
        {
          defWinWidth = winNewWidth;
          winWidth = defWinWidth;
          objMainBox.style.width = winWidth + 'px';
        }
        
        if (winNewHeight != null && winNewHeight >= 0)
        {
          defWinHeight = (!isSafari) ? winNewHeight : winNewHeight + 7;
          winHeight = defWinHeight;
          objMainBox.style.height = winHeight + 'px';
        }
        
        if (!isWinResizeable)
        {
          if (!winCoord[defWinWidth + defWinHeight])
          {
            winCoord[defWinWidth + defWinHeight] = new Object();
          }
          
          if (winNewLeft != null && winNewLeft >= 0)
          {
            winCoord[defWinWidth + defWinHeight].winLeft = winNewLeft;
          }
          else if (winCoord[defWinWidth + defWinHeight].winLeft != null && winCoord[defWinWidth + defWinHeight].winLeft >= 0)
          {
            winNewLeft = winCoord[defWinWidth + defWinHeight].winLeft;
          }
          else
          {
            defWinLeft = null;
            winLeft = null;
          }
          
          if (winNewTop != null && winNewTop >= 0)
          {
            winCoord[defWinWidth + defWinHeight].winTop = winNewTop;
          }
          else if (winCoord[defWinWidth + defWinHeight].winTop != null && winCoord[defWinWidth + defWinHeight].winTop >= 0)
          {
            winNewTop = winCoord[defWinWidth + defWinHeight].winTop;
          }
          else
          {
            defWinTop = null;
            winTop = null;
          }
        }
        
        if (winNewLeft != null && winNewLeft >= 0)
        {
          defWinLeft = winNewLeft;
          winLeft = defWinLeft;
          objMainBox.style.left = ($getScrollLeft() + Number(winLeft)) + 'px';
        }
      
        if (winNewTop != null && winNewTop >= 0)
        {
          defWinTop = winNewTop;
          winTop = defWinTop;
          objMainBox.style.top = ($getScrollTop() + Number(winTop)) + 'px';
        }
        
        if (winNewTitle != null && winNewTitle != 'undefined')
        {
          winTitleStruct.winTitleSpan.innerHTML = winNewTitle;
        }
        
        setTimeout(openWindowStep2, 10);
        //pThis.isObjValid = true;
        //changeState(1);
      }
      else
      {
        setTimeout(function () { openWindowStep1(winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle); }, 100);
      }
    }
    
    
    function openWindowStep2 ()
    {
      var dbWidth = $getInnerWidth();
      var dbHeight = $getInnerHeight();
      
      if (!isWinMoveable)
      {
        winLeft = defWinLeft;
        winRight = defWinRight;
      }
      
      if (!isWinResizeable)
      {
        winWidth = defWinWidth;
        winHeight = defWinHeight;
      }
      
      if(winLeft == null)
      {
        winLeft = Math.round((dbWidth - winWidth) / 2);
      }
      
      if(winTop == null)
      {
        winTop = Math.round((dbHeight - winHeight) / 2);
      }

      objMainBox.style.left = winLeft + 'px';
      objMainBox.style.top = winTop + 'px';
      objMainBox.style.width = winWidth + 'px';
      objMainBox.style.height = ((winHeight > dbHeight) ? ((winMinHeight && winMinHeight > dbHeight) ? winMinHeight : dbHeight) : winHeight) + 'px';
      
      if (reloadURL && dataIFrame && !isReloadUrlNotReload && applyReloadURL)
      {
        //dataIFrame.document.body.innerHTML = '';
        dataIFrame.document.body.style.visibility = 'hidden';
      }
      
      if (!isWinResizeable)
      {
        if (isGecko)
        {
          if (objMainBox.style.visibility != 'visible')
          {
            openWindowStep2Gecko();
          }
          else
          {
            setTimeout(openWindowStep3, 10);
          }
        }
        else
        {
          setTimeout(openWindowStep2IE, 10);
        }
      }
      else
      {
        setTimeout(openWindowStep3, 10);
      }
    }
    
    
    function openWindowStep2IE ()
    {
      if (winStructure.scrollableContainer.element.scrollHeight > winStructure.scrollableContainer.element.offsetHeight && !isCustomFixWinHeight)
      {
        objMainBox.style.width = (winWidth + ((window.globalUtils) ? globalUtils.getScrollBarWidth() : 0)) + 'px';
      }
      
      winTitleStruct.winTitleSpan.style.width = '1px';
      
      setTimeout(openWindowStep3, 10);
    }
    
    
    function openWindowStep2Gecko ()
    {
      objMainBox.style.left = '-3700px';
      objMainBox.style.top = '-3700px';
      winStructure.parentTable.element.removeAttribute('height', 0);
      winTitleStruct.objWinTitle.removeAttribute('width', 0);
      winTitleStruct.winTitleSpan.style.width = '1px';
      winStructure.mainRow.element.removeAttribute('height', 0);
      winStructure.mainRow.innerTable.removeAttribute('height', 0);
      winStructure.scrollableContainer.element.style.height = '1px';
      objMainBox.style.visibility = 'visible';
      setTimeout(openWindowStep3Gecko, 10);
    }
    
    
    function openWindowStep25Gecko ()
    {
      winStructure.parentTable.element.setAttribute('height', '100%', 0);
      winTitleStruct.objWinTitle.setAttribute('width', '100%', 0);
      winStructure.mainRow.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.innerTable.setAttribute('height', '100%', 0);
      setTimeout(openWindowStep3Gecko, 10);
    }
    
    
    function openWindowStep3Gecko ()
    {
      winStructure.parentTable.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.innerTable.setAttribute('height', '100%', 0);
      winStructure.scrollableContainer.element.style.height = eDataIFrame.offsetHeight + 'px'; //winStructure.mainRow.innerTable.offsetHeight + 'px';
      
      if (eDataIFrameHeight > winStructure.scrollableContainer.element.offsetHeight && !isCustomFixWinHeight)
      {
        objMainBox.style.width = (winWidth + ((window.globalUtils) ? globalUtils.getScrollBarWidth() : 0)) + 'px';
      }
      
      objMainBox.style.left = winLeft + 'px';
      objMainBox.style.top = winTop + 'px';
      
      setTimeout(openWindowStep3, 10);
    }
    
    
    function openWindowStep31Gecko ()
    {
      winStructure.parentTable.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.element.setAttribute('height', '100%', 0);
      winStructure.mainRow.innerTable.setAttribute('height', '100%', 0);
      winStructure.scrollableContainer.element.style.height = eDataIFrame.offsetHeight + 'px';
    }
    
    
    function openWindowStep3 ()
    {
      setWindowXY();
      
      if (reloadURL && !isReloadUrlNotReload && applyReloadURL)
      {
        setReloadIFrameWaitMsgXY(true);
      }
      
      objMainBoxBg.style.visibility = 'visible';
      objMainBox.style.visibility = 'visible';
      
      if (!isWinResizeable)
      {
        if (isGecko)
        {
          openWindowStep31Gecko();
        }
      }
      
      if (typeof(parentIFrame.refreshState) == 'function')
      {
        parentIFrame.refreshState();
      }
      
      winTitleStruct.winTitleSpan.style.width = (winTitleStruct.objWinTitle.offsetWidth - 100)  + 'px';
      
      if (winTitleStruct.winTitleSpan && winTitleStruct.winTitleSpanIn && winTitleStruct.winTitleSpanDots)
      {
        winTitleStruct.winTitleSpanDots.innerHTML = (winTitleStruct.winTitleSpanIn.offsetWidth > winTitleStruct.winTitleSpan.offsetWidth) ? '...' : '';
      }
      
      $addHandler(window, 'resize', setWindowXY);
      $addHandler(window, 'scroll', setWindowXY);
      $addHandler(((isIE) ? parentIFrame.document.body : parentIFrame), 'keypress', keyPress);
        
      parentIFrame.focus();
      changeState(1);
      
      if (reloadURL && !isReloadUrlNotReload && applyReloadURL)
      {
        setTimeout(openWindowStep4, 10);
      }
    }
    
    
    function openWindowStep4 ()
    {
      if (dataIFrame)
      {
        dataIFrame.isIFrameLoaded = false;
        dataIFrame.location.replace(reloadURL);
      }
      else
      {
        createDataWindow();
      }
      
      setTimeout(openWindowStep5, 100);
    }
    
    
    function openWindowStep5 ()
    {
      if (reloadURL && !pThis.isDataValid)
      {
        setTimeout(openWindowStep5, 100);
        return false;
      }
      
      if (dataIFrame && dataIFrame.document && dataIFrame.document.body)
      {
        $addHandler(((isIE) ? dataIFrame.document.body : dataIFrame), 'keypress', keyPress);
      }
      
      if (!isCustomHideWaitMsg)
      {
        setReloadIFrameWaitMsgXY(false);
      }
    }
    
    
    function refreshInnerWindow (newReloadURL)
    {
      if (newReloadURL)
      {
        reloadURL = newReloadURL;
      }
      
      pThis.isDataValid = false;
      setReloadIFrameWaitMsgXY(true);
      dataIFrame.document.body.innerHTML = '';
      openWindowStep4();
    }
    
    
    function setWindowXY ()
    {
      if(!pThis.isObjValid)
      {
        return false;
      }
        
      if (tmSetXY)
      {
        clearTimeout(tmSetXY);
      }

      var dbWidth = $getInnerWidth();
      var dbHeight = $getInnerHeight();
      var dbScrollLeft = $getScrollLeft();
      var dbScrollTop = $getScrollTop();
      var dbScrollWidth = $getScrollWidth();
      var dbScrollHeight = $getScrollHeight();
      var winOffsetLeft = objMainBox.offsetLeft;
      var winOffsetTop = objMainBox.offsetTop;
      var winClientOffsetLeft = winOffsetLeft;
      var winClientOffsetTop = winOffsetTop;

      winLeft = winOffsetLeft;
      winTop = winOffsetTop;
      winWidth = objMainBox.offsetWidth;
      winHeight = objMainBox.offsetHeight;
    
    
      if(winClientOffsetLeft > dbWidth - 100)
      {
        winLeft = dbWidth - 100;
      }
      else if(winClientOffsetLeft + winWidth < 100)
      {
        winLeft = 100 - winWidth;
      }
      
      if(winClientOffsetTop < 0)
      {
        winTop = 0;
      }
      else if(winClientOffsetTop > dbHeight - 100)
      {
        winTop = dbHeight - 100;
      }
      
      objMainBox.style.left = winLeft + 'px';
      objMainBox.style.top = winTop + 'px';
      
      clientLeft = winClientOffsetLeft;
      clientTop = winClientOffsetTop;
      
      objMainBoxBg.style.left = dbScrollLeft + 'px';
      objMainBoxBg.style.top = dbScrollTop + 'px';
      objMainBoxBg.style.width = dbWidth + 'px';
      objMainBoxBg.style.height = dbHeight + 'px';
      //objMainBoxBg.style.overflow = 'hidden';
      
      setShadingBoxXY(true);
    }
    
    
    function setShadingBoxXY (state)
    {
      var dbWidth = $getInnerWidth();
      var dbHeight = $getInnerHeight();
      var dbScrollLeft = $getScrollLeft();
      var dbScrollTop = $getScrollTop();
      var dbScrollWidth = $getScrollWidth();
      var dbScrollHeight = $getScrollHeight();
      var dbScrollBarWidth = (window.globalUtils) ? globalUtils.getScrollBarWidth() : 0;
      
      if (state)
      {
        objShadingBox.style.width = (dbScrollWidth > dbWidth) ? dbScrollWidth + 'px' : dbWidth  + 'px';
        objShadingBox.style.height = (dbScrollHeight > dbHeight) ? dbScrollHeight + 'px' : dbHeight + 'px';
        objShadingBox.style.visibility = 'visible';
      }
      else
      {
        objShadingBox.style.visibility = 'hidden';
        objShadingBox.style.width = objShadingBox.style.height = '1px';
      }
    }
    
    
    function showLoadingMessage()
    {
      setReloadIFrameWaitMsgXY (null); // create if not exits
      setReloadIFrameWaitMsgXY (true); // show
    }
    
    
    function hideLoadingMessage()
    {
      setReloadIFrameWaitMsgXY (false);
    }
    
    function setDialogTitle(newTitle)
    {
        winTitleStruct.winTitleSpan.innerHTML = newTitle;
    }
    
    
    function setReloadIFrameWaitMsgXY (state)
    {
      if (state == null)
      {
        if (parentIFrame.document.getElementById(reloadIFrameWaitMsgId))
        {
            return;
        }
      
        reloadIFrameWaitMsg = parentIFrame.document.createElement('DIV');
        reloadIFrameWaitMsg.id = reloadIFrameWaitMsgId;
        reloadIFrameWaitMsg.style.position = 'absolute';
        reloadIFrameWaitMsg.style.left = '0px';
        reloadIFrameWaitMsg.style.top = '0px';
        reloadIFrameWaitMsg.style.width = '1px';
        reloadIFrameWaitMsg.style.height = '1px';
        reloadIFrameWaitMsg.style.zIndex = 23003;
        reloadIFrameWaitMsg.style.overflow = 'hidden';
        reloadIFrameWaitMsg.style.visibility = 'hidden';
        reloadIFrameWaitMsg.innerHTML = '<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="100%" height="100%" align="center" valign="middle" style="vertical-align:middle;background-color: #FFFFFF; ' + ((isIE) ? 'filter: progid:DXImageTransform.Microsoft.Alpha(opacity=77);' : '-moz-opacity: 0.77; -khtml-opacity: 0.77; opacity: 0.77;') + '">' + ((waitMessageImgURL) ? '<img src="' + waitMessageImgURL + '" border="0"><br>&nbsp;<br>&nbsp;&nbsp;' : '') + '<span style="font-size: 12px; font-weight: bold;">' + ((waitMessage) ? waitMessage : '') + '</span>' + '</td></tr></table>';
        parentIFrame.document.body.appendChild(reloadIFrameWaitMsg);
      }
      else if (state == true)
      {
        var waitMsgSize = getWaitMsgContainerSize();
        
        reloadIFrameWaitMsg.style.left = waitMsgSize.left + 'px';
        reloadIFrameWaitMsg.style.top = waitMsgSize.top + 'px';
        reloadIFrameWaitMsg.style.width = waitMsgSize.width + 'px';
        reloadIFrameWaitMsg.style.height = waitMsgSize.height + 'px';
        reloadIFrameWaitMsg.style.visibility = 'visible'; 
      
        if (!isIE)
        {
          setTimeout(function ()
          {
            if (reloadIFrameWaitMsg.style.visibility.toLowerCase() == 'visible')
            {
              var waitMsgSize = getWaitMsgContainerSize();
              reloadIFrameWaitMsg.style.left = waitMsgSize.left + 'px';
              reloadIFrameWaitMsg.style.top = waitMsgSize.top + 'px';
              reloadIFrameWaitMsg.style.width = waitMsgSize.width + 'px';
              reloadIFrameWaitMsg.style.height = waitMsgSize.height + 'px';
            }
          }, 100);
        }   
      }
      else
      {
        reloadIFrameWaitMsg.style.visibility = 'hidden';
        reloadIFrameWaitMsg.style.top = '0px';
        reloadIFrameWaitMsg.style.left = '0px';
        reloadIFrameWaitMsg.style.width = '1px';
        reloadIFrameWaitMsg.style.height = '1px';
      }
    }
    
    
    function getWaitMsgContainerSize ()
    {
      var x, y, w, h;
      var firstTable, innerTable;
      
      if (isSharedWaitMsg)
      {
        firstTable = parentIFrame.document.body.getElementsByTagName('TABLE');
        
        if (firstTable)
        {
          firstTable = firstTable[0];
          
          if (firstTable.rows[1])
          {
            getXY(firstTable.rows[1]);
            y = firstTable.rows[1].Y;
          }
          
          if (firstTable.rows[firstTable.rows.length - 1])
          {
            getXY(firstTable.rows[firstTable.rows.length - 1]);
            h = firstTable.rows[firstTable.rows.length - 1].Y - y;
            innerTable = firstTable.rows[firstTable.rows.length - 1].cells[0].getElementsByTagName('TABLE');
            
            if (innerTable)
            {
              innerTable = innerTable[0];
              getXY(innerTable.rows[0].cells[0]);
              x = innerTable.rows[0].cells[0].X + innerTable.rows[0].cells[0].offsetWidth;
              
              if (innerTable.rows[0].cells[1])
              {
                w = innerTable.rows[0].cells[1].offsetWidth;
                
                return {'left': x, 'top': y, 'width': w, 'height': h};
              }
            }
          }
        }
      }
      else
      {
        getXY(eDataIFrame);
        x = eDataIFrame.X;
        y = eDataIFrame.Y;
        w = eDataIFrame.offsetWidth;
        h = eDataIFrame.offsetHeight;
        
        return {'left': x, 'top': y, 'width': w, 'height': h};
      }
      
      return {'left': 0, 'top': 0, 'width': 0, 'height': 0};
    }
        
    
    function moveWindowSetMouseOver ()
    {
      if (tmMoveOut)
      {
        clearTimeout(tmMoveOut);
      }
    }
    
    
    function moveWindowSetMouseOut ()
    {
      if (tmMoveOut)
      {
        clearTimeout(tmMoveOut);
      }
      
      tmMoveOut = setTimeout(function () { moveWindowDo(null); }, 100);
    }
    
    
    function moveWindow (e, currentTarget)
    {
      var eType, eCurrentTarget, eButton, eX, eY;
      
      if(tmMoveOut)
      {
        clearTimeout(tmMoveOut);
      }
        
      if(!e && window.event)
      {
        e = window.event;
      }
      
      if(e)
      {
        $stopEvent(e);
        eType = e.type;
        eCurrentTarget = (currentTarget) ? currentTarget : null;
        eButton = e.button;
        eX = e.screenX;
        eY = e.screenY;
        moveWindowDo(eType, eCurrentTarget, eButton, eX, eY);
      }
      else
      {
        moveWindowDo(null);
      }
    }
    
    
    function moveWindowDo (eType, eCurrentTarget, eButton, eX, eY)
    {
      var tmpWidth, tmpHeight, tmpScrollLeft, tmpScrollTop;
      
      if(tmMoveOut)
      {
        clearTimeout(tmMoveOut);
      }
        
      if(eType == null)
      {
        moveWindowStruct.pushMouseLeftButton = false;
        removeWindowMoveHandlers();
        setWindowXY();
      }
      else
      {
        if(eType == 'mousedown')
        {
          if(eButton == 0 || eButton == 1)
          {
            moveWindowStruct.X = eX;
            moveWindowStruct.Y = eY;
            moveWindowStruct.pushMouseLeftButton = true;
            moveWindowStruct.st = eCurrentTarget.iwstate;
            addWindowMoveHandlers();
          }
          else
          {
            moveWindowStruct.pushMouseLeftButton = false;
            moveWindowStruct.st = 0;
            removeWindowMoveHandlers();
            setWindowXY();
          }
        }
        else if(eType == 'mouseup' || eType == 'mouseout')
        {
          moveWindowStruct.pushMouseLeftButton = false;
          moveWindowStruct.st = 0;
          removeWindowMoveHandlers();
          setWindowXY();
        }
        else if(eType == 'mousemove' && moveWindowStruct.pushMouseLeftButton)
        {
          if(moveWindowStruct.st == 1)
          {
            objMainBox.style.left = (objMainBox.offsetLeft + (eX - moveWindowStruct.X)) + 'px';
            objMainBox.style.top = (objMainBox.offsetTop + (eY - moveWindowStruct.Y)) + 'px';
            moveWindowStruct.X = eX;
            moveWindowStruct.Y = eY;
          }
          else
          {
            if(isIE && dataIFrame && dataIFrame.document && dataIFrame.document.body)
            {
              tmpScrollLeft = dataIFrame.document.body.scrollLeft;
              tmpScrollTop = dataIFrame.document.body.scrollTop;
            }
            
            if(moveWindowStruct.st == 2 || moveWindowStruct.st == 6 || moveWindowStruct.st == 8)
            {
              tmpWidth = objMainBox.offsetWidth + (moveWindowStruct.X - eX);
              
              if(tmpWidth > winMinWidth)
              {
                objMainBox.style.left = (objMainBox.offsetLeft + (eX - moveWindowStruct.X)) + 'px';
              }
            }
            else if(moveWindowStruct.st == 3 || moveWindowStruct.st == 7 || moveWindowStruct.st == 9)
            {
              tmpWidth = objMainBox.offsetWidth + (eX - moveWindowStruct.X);
            }
            
            if(moveWindowStruct.st == 4 || moveWindowStruct.st == 6 || moveWindowStruct.st == 7)
            {
              tmpHeight = objMainBox.offsetHeight + (moveWindowStruct.Y - eY);
              
              if(tmpHeight > winMinHeight)
              {
                objMainBox.style.top = (objMainBox.offsetTop + (eY - moveWindowStruct.Y)) + 'px';
              }
            }
            else if(moveWindowStruct.st == 5 || moveWindowStruct.st == 8 || moveWindowStruct.st == 9)
            {
              tmpHeight = objMainBox.offsetHeight + (eY - moveWindowStruct.Y);
            }
            
            if(moveWindowStruct.st == 2 || moveWindowStruct.st == 3 || moveWindowStruct.st > 5)
            {
              if(tmpWidth > winMinWidth)
              {
                objMainBox.style.width = tmpWidth + 'px';
                winTitleStruct.winTitleSpan.style.width = (winTitleStruct.objWinTitle.offsetWidth - 100)  + 'px';
                
                if (winTitleStruct.winTitleSpan && winTitleStruct.winTitleSpanIn && winTitleStruct.winTitleSpanDots)
                {
                  winTitleStruct.winTitleSpanDots.innerHTML = (winTitleStruct.winTitleSpanIn.offsetWidth > winTitleStruct.winTitleSpan.offsetWidth) ? '...' : '';
                }
              }
              
              moveWindowStruct.X = eX;
            }
            
            if(moveWindowStruct.st > 3)
            {
              if(tmpHeight > winMinHeight)
              {
                objMainBox.style.height = tmpHeight + 'px';
              }
              
              moveWindowStruct.Y = eY;
            }
            
            if(isIE && dataIFrame)
            {
              dataIFrame.scrollTo(tmpScrollLeft, tmpScrollTop);
            }
          }
        }
      }
    }
    
    
    function addWindowMoveHandlers ()
    {
      $addHandler(document.body, 'mousemove', moveWindow);
      $addHandler(document.body, 'mouseup', moveWindow);
      $addHandler(document.body, 'mouseout', moveWindowSetMouseOut);
      $addHandler(document.body, 'mouseover', moveWindowSetMouseOver);
      
      $addHandler(parentIFrame.document.body, 'mousemove', moveWindow);
      $addHandler(parentIFrame.document.body, 'mouseup', moveWindow);
      
      if (dataIFrame && dataIFrame.document && dataIFrame.document.body)
      {
        $addHandler(dataIFrame.document.body, 'mousemove', moveWindow);
        $addHandler(dataIFrame.document.body, 'mouseup', moveWindow);
      }
    }
    
    
    function removeWindowMoveHandlers ()
    {
      $removeHandler(document.body, 'mousemove', moveWindow);
      $removeHandler(document.body, 'mouseup', moveWindow);
      $removeHandler(document.body, 'mouseout', moveWindowSetMouseOut);
      $removeHandler(document.body, 'mouseover', moveWindowSetMouseOver);
  
      $removeHandler(parentIFrame.document.body, 'mousemove', moveWindow);
      $removeHandler(parentIFrame.document.body, 'mouseup', moveWindow);
      
      if (dataIFrame && dataIFrame.document && dataIFrame.document.body)
      {
        $removeHandler(dataIFrame.document.body, 'mousemove', moveWindow);
        $removeHandler(dataIFrame.document.body, 'mouseup', moveWindow);
      }
    }
    
    
    function keyPress (e)
    {
      if(e && e.keyCode == 27)
      {
        parentIFrame.callBackClose();
      }
    }
    
    
    function closeWindow ()
    {
      BonaDialog.isDialogOpened = false;
      
      if(!this.isObjValid)
      {
        return false;
      }
        
      if (typeof(parentIFrame.beforeCloseWindow) == 'function')
      {
        parentIFrame.beforeCloseWindow();
        setTimeout(closeWindowStep1, 10);
        return;
      }
      
      closeWindowStep1();
    }
    
    
    function closeWindowStep1 ()
    {
      $removeHandler(window, 'resize', setWindowXY);
      $removeHandler(window, 'scroll', setWindowXY);
      $removeHandler(((isIE) ? parentIFrame.document.body : parentIFrame), 'keypress', keyPress);
      
      if (dataIFrame && dataIFrame.document && dataIFrame.document.body)
      {
        $removeHandler(((isIE) ? dataIFrame.document.body : dataIFrame), 'keypress', keyPress);
        setReloadIFrameWaitMsgXY(false);
      }
      
      if (!isWinResizeable && winCoord[defWinWidth + defWinHeight])
      {
        winCoord[defWinWidth + defWinHeight].winLeft = (winLeft != null) ? winLeft : null;
        winCoord[defWinWidth + defWinHeight].winTop = (winTop != null) ? winTop : null;
      }
        
      objMainBox.style.visibility = 'hidden';
      objMainBoxBg.style.visibility = 'hidden';
      objMainBoxBg.style.left = objMainBoxBg.style.top = '0px';
      objMainBoxBg.style.width = objMainBoxBg.style.height = '1px';
      
      if (isWinModal)
      {
        setShadingBoxXY(false);
      }
      
      setTimeout(function () { changeState(0); }, 100);
    }
    
    
    function gotoElement (cId, winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle)
    {
      if(!this.isObjValid || !dataIFrame)
      {
        return false;
      }
      
      var nElement;
      
      if(!state)
      {
        this.openWindow(winNewLeft, winNewTop, winNewWidth, winNewHeight, winNewTitle);
      }
      
      if(cId)
      {
        nElement = dataIFrame.document.getElementById(cId);
        getXY(nElement);
        dataIFrame.scrollTo(0, nElement.Y);
        parentIFrame.document.body.focus();
      }
    }
    
    function getReturnedParameters ()
    {
      return returnParameters;
    }
    
    function setReturnedParameters (param, value)
    {
      pCallBackParameters[param] = value;
    }
  
    
    function changeState (st)
    {
      state = (st) ? true : false;
    }
    
    function getState ()
    {
      return state;
    }
    
    
    function getWindowCookie ()
    {
      matchCookie = reCookie.exec(document.cookie);
      
      if(matchCookie != null && matchCookie.length > 1)
      {
        aCookie = matchCookie[1].split(/:/);
      }
    
      if(aCookie && aCookie[1] != null)
      {
        winLeft = Number(aCookie[1]);
      }
      
      if(aCookie && aCookie[2] != null)
      {
        winTop = Number(aCookie[2]);
      }
      
      if(aCookie && aCookie[3] != null)
      {
        winWidth = Number(aCookie[3]);
      }
      else
      {
        winWidth = (winWidth) ? Number(winWidth) : 500;
      }
      
      if(aCookie && aCookie[4] != null)
      {
        winHeight = Number(aCookie[4]);
      }
      else
      {
        winHeight = (winHeight) ? Number(winHeight) : 300;
      }
    }
    
    
    function pageUnload ()
    {
      if(!this.isObjValid)
        return;
      
      if(remStateCookie && dataIFrame)
      {
        var i;
        var aAllCookie = new Array();
        var strCookie = dialogId + ':' + ((state) ? 1 : 0) + ':' + (objMainBox.offsetLeft - $getScrollLeft()) + ':' + (objMainBox.offsetTop - $getScrollTop()) + ':' + objMainBox.offsetWidth + ':' + objMainBox.offsetHeight + ':' + dataIFrame.document.body.scrollLeft + ':' + dataIFrame.document.body.scrollTop;
        matchCookie = document.cookie.match(/InnerWindows=([^;]*)/);
        
        if(matchCookie && matchCookie.length && matchCookie.length > 1)
        {
          aAllCookie = matchCookie[1].split(/&/);
          
          for(i = 0; i < aAllCookie.length; i++)
          {
            if(aAllCookie[i].indexOf(dialogId) != -1)
            {
              aAllCookie[i] = strCookie;
              break;
            }
          }
          
          if(i == aAllCookie.length)
            aAllCookie.push(strCookie);
        }
        else
        {
          aAllCookie.push(strCookie);
        }
        
        document.cookie = 'InnerWindows=' + aAllCookie.join('&') + ';path=/';
      }
      
      destructor();
    }
    
    
    function destructor ()
    {
      if (parentIFrame)
      {
        if (parentIFrame.parentId)
          parentIFrame.parentId = null;
        
        if (parentIFrame.innerIFrame)
          parentIFrame.innerIFrame = null;
        
        if (parentIFrame.stopProp)
          parentIFrame.stopProp = null;
      }
      
      if (dataIFrame)
      {
        if (dataIFrame.parentId)
          dataIFrame.parentId = null;
        
        if (dataIFrame.outerIFrame)
          dataIFrame.outerIFrame = null;
      }
    }
    
    
    function getXY (obj)
    {
      var parTemp;
      obj.X = 0;
      obj.Y = 0;
      
      if(obj.offsetParent)
      {
        parTemp = obj;
        
        while(parTemp.offsetParent)
        {
          parTemp = parTemp.offsetParent;
          obj.X += parTemp.offsetLeft;
          obj.Y += parTemp.offsetTop;
        }
      }
      
      obj.X += obj.offsetLeft;
      obj.Y += obj.offsetTop;
    }
    
    
    setTimeout(initDialog, 200);
    
  }
  

}) ();



/*   /Content/Members/PictureUploader/PictureUploader.js   */

function startUpload(btnId)
{
  var upload = document.getElementById('upload');
  var process = document.getElementById('process');
  upload.style.display = 'none';
  process.style.display = 'block';
  
  try
  {
    document.getElementById(btnId).click();
  }
  catch(e)
  {
    upload.style.display = 'block';
    process.style.display = 'none';
  }
}
function hideWaitMessage(waitControlId)
{
  if (!parent)
  {
    return;
  }
  
  var waitControl = parent.document.getElementById(waitControlId);
  
  if (!waitControl)
  {
    return;
  }
  
  waitControl.style.display = 'none';
}
function increaseHeight(frameId)
{
  setFrameHeight(frameId, '110px');
}
function decreaseHeight(frameId)
{
  setFrameHeight(frameId, '45px');
}
function setFrameHeight(frameId, height)
{
  if (!parent)
  {
    return;
  }
  
  var frame = parent.document.getElementById(frameId);
  
  if (!frame)
  {
    return;
  }
  
  frame.style.height = height;
}
window.getState = function(frameName)
{
  if (!parent)
  {
    return 0;
  }
  
  if (!parent.pictureState)
  {
    return 0;
  }
  
  if (!parent.pictureState[frameName])
  {
    return 0;
  }
  
  return parent.pictureState[frameName];
}
window.isPicturePresent = function(frameName)
{
  return (parent.pictureState[frameName] == 2 || parent.pictureState[frameName] == 1);
}
function stateNoPicture(frameId)
{
  changeState(frameId, 0);
}
function statePictureDefault(frameId)
{
  changeState(frameId, 1);
}
function statePictureUploaded(frameId)
{
  changeState(frameId, 2);
}
function changeState(frameId, value)
{
  if (!parent)
  {
    return;
  }
  
  var name = parent.document.getElementById(frameId).getAttribute('name');
  
  if (!parent.pictureState)
  {
    parent.pictureState = new Object();
  }
  
  parent.pictureState[name] = value;  
}
function registerUploader(frameId)
{
  if (!parent || !parent.registerPictureUploader)
  {
    return;
  }
  
  parent.registerPictureUploader(frameId, window);
}
function setDataChangeWatcherChanged()
{
  if (typeof(BonaPage.topWindow.DataChangeWatcher) != "undefined")
  {
    BonaPage.topWindow.DataChangeWatcher.setChanged();
    return;
  }
  if (typeof(BonaPage.topWindow.contentarea) != "undefined" && typeof(BonaPage.topWindow.contentarea.DataChangeWatcher) != "undefined")
  {
    BonaPage.topWindow.contentarea.DataChangeWatcher.setChanged();
  }
}


/*   /Content/Events/EventListPreferences.js   */

var EventListPreferences;

(function()
{
  if (EventListPreferences == null)
  {
    EventListPreferences = new Object();
  }

  EventListPreferences.tagsTableId = '';
  EventListPreferences.showAllRadioId = '';
  EventListPreferences.selectAll = selectAll;
  EventListPreferences.clearAll = clearAll;
  EventListPreferences.preventClick = preventClick;
  EventListPreferences.disableTagsSelection = disableTagsSelection;
  EventListPreferences.enableTagsSelection = enableTagsSelection;
  EventListPreferences.atLeastOneTagShouldBeSelected = atLeastOneTagShouldBeSelected;
  EventListPreferences.validateInputsStateChanged = validateInputsStateChanged;

  function validateInputsStateChanged(sender, args)
  {
    validateStateChanged(args, 'preferencesHolder');
  }

  function selectAll(evt)
  {
    setCheckboxesInCheckedState(true);
    
    if (evt.preventDefault)
    {
      evt.preventDefault();
    }
    else
    {
      evt.returnValue = false;
    }
  }
  function clearAll(evt)
  {
    setCheckboxesInCheckedState(false);
    
    if (evt.preventDefault)
    {
      evt.preventDefault();
    }
    else
    {
      evt.returnValue = false;
    }
  }
  function disableTagsSelection()
  {
    setCheckboxesInEnabledState(false);
    var selectAllAnchor = BonaPage.$('selectAll');
    var clearAllAnchor = BonaPage.$('clearAll');
    clearHandlers(selectAllAnchor);
    clearHandlers(clearAllAnchor);
    BonaPage.addHandler(selectAllAnchor, 'click', preventClick);
    BonaPage.addHandler(clearAllAnchor, 'click', preventClick);
  }
  function enableTagsSelection()
  {
    setCheckboxesInEnabledState(true);
    var selectAllAnchor = BonaPage.$('selectAll');
    var clearAllAnchor = BonaPage.$('clearAll');
    clearHandlers(selectAllAnchor);
    clearHandlers(clearAllAnchor);
    BonaPage.addHandler(selectAllAnchor, 'click', selectAll);
    BonaPage.addHandler(clearAllAnchor, 'click', clearAll);
  }
  function clearHandlers(anchor)
  {
    BonaPage.removeHandler(anchor, 'click', preventClick);
    BonaPage.removeHandler(anchor, 'click', selectAll);
    BonaPage.removeHandler(anchor, 'click', clearAll);
  }
  function atLeastOneTagShouldBeSelected(sender, args)
  {
    var tags = document.getElementById(EventListPreferences.tagsTableId);
    var checkboxes = tags.getElementsByTagName('input');
    var showAllEvents = BonaPage.$(EventListPreferences.showAllRadioId);

    if (showAllEvents.checked)
    {
      args.IsValid = true;
      return;
    }
    else
    {
      for (var i = 0; i < checkboxes.length; i++)
      {
        if (checkboxes[i].checked)
        {
          args.IsValid = true;
          return;
        }
      }
    }

    args.IsValid = false;
  }
  function validateStateChanged(args, containerId)
  {
    var state = '';
    var control = document.getElementById(containerId);

    if (!control)
    {
      return;
    }

    var children = control.getElementsByTagName('INPUT');

    for (var i = 0; i < children.length; i++)
    {
      if (children[i].checked)
      {
        state += children[i].value;
      }
    }

    DataChangeWatcher.changeValidatorCustom(containerId, state, args);
  }

  function setCheckboxesInCheckedState(state)
  {
    var tags = document.getElementById(EventListPreferences.tagsTableId);
    var checkboxes = tags.getElementsByTagName('input');

    for (var i = 0; i < checkboxes.length; i++)
    {
      checkboxes[i].checked = state;
    }
  }
  function setCheckboxesInEnabledState(state)
  {
    var tags = document.getElementById(EventListPreferences.tagsTableId);
    var checkboxes = tags.getElementsByTagName('input');

    for (var i = 0; i < checkboxes.length; i++)
    {
      if (state == false)
      {
        checkboxes[i].checked = false;
      }

      checkboxes[i].disabled = !state;
    }
  }
  function preventClick(evt)
  {
    if (evt.preventDefault)
    {
      evt.preventDefault();
    }
    else
    {
      evt.returnValue = false;
    }
  }
})();



/*   /Content/Events/EventRegistration.js   */

var EventRegistration;

(function() {

  var $ = function (id) { return document.getElementById(id); };
  
  if(EventRegistration == null) 
  {
    EventRegistration = new Object();
  }

  var additionalBasePrice = 0; 
  var eventBasePrice = 0;
  var currentPrice = 0; 
  var paymentInstructionsDiv;
  var paymentTypeSelectorTR;
  var currencySymbol = '';
  var currencyCode = '';
  var totalPriceLabel;
  var isOnlinePayPalPaymentForEventSupported = false;

  // public properties
  EventRegistration.paymentInstructionsDiv = paymentInstructionsDiv;
  EventRegistration.paymentTypeSelectorTR = paymentTypeSelectorTR;
  EventRegistration.currencySymbol = currencySymbol;
  EventRegistration.currencyCode = currencyCode;
  EventRegistration.totalPriceLabel = totalPriceLabel;
  EventRegistration.isOnlinePayPalPaymentForEventSupported = isOnlinePayPalPaymentForEventSupported;
  
  // public methods
  EventRegistration.initializePrice = initializePrice;
  EventRegistration.calcTotalPrice = calcTotalPrice;
  EventRegistration.clickCustomRadioButton = clickCustomRadioButton;
  EventRegistration.clickCustomCheckBox = clickCustomCheckBox;
  EventRegistration.clickRegType = clickRegType;

  function initializePrice(additional, eventBase, priceLabelId)
  {
    eventBasePrice = eventBase ? new Number(eventBase) : 0;
    if (priceLabelId)
    {
      EventRegistration.totalPriceLabel = $get(priceLabelId);
    }
    additionalBasePrice = 0; 
    currentPrice = 0; 
    calcTotalPrice(additional);
  }
  
  function calcTotalPrice(additional)
  {
    if (!EventRegistration.totalPriceLabel)
    {
      return;
    }
    additionalBasePrice += additional ? new Number(additional) : 0;
    currentPrice =  additionalBasePrice + new Number(eventBasePrice);
    EventRegistration.totalPriceLabel.innerHTML = EventRegistration.currencySymbol + currentPrice + EventRegistration.currencyCode;
    EventRegistration.totalPriceLabel.style.fontWeight = 'bold';
    setPaymentTypeSelectorVisibility();
  }
  
  function clickCustomRadioButton(sender, args)
  {
    var clickedRadioButton = args.target;
    var previouslyClickedRadioButton = args.previous;

    calcTotalPrice(new Number(clickedRadioButton.parentNode.getAttribute('price')));
    
    if (previouslyClickedRadioButton)
    {
      calcTotalPrice(new Number(previouslyClickedRadioButton.parentNode.getAttribute('price')) * -1);  
    }
  }
  function clickCustomCheckBox(sender, args)
  {
    var clickedCheckBox = args.target;
    if (clickedCheckBox.checked)
    {
      calcTotalPrice(clickedCheckBox.parentNode.getAttribute('price'));  
    }
    else
    {
      calcTotalPrice(clickedCheckBox.parentNode.getAttribute('price') * -1);    
    }
  }
  function clickRegType(newPrice)
  {
    objFakeRadioGroupValue.value = "1";
    for (var i = 0; i < Page_Validators.length; i++) {
        ValidatorValidate(Page_Validators[i], "EventRegistrationValidation", null);
    }
    ValidatorUpdateIsValid();
    Page_BlockSubmit = !Page_IsValid;
    eventBasePrice = new Number(newPrice);
    calcTotalPrice();  
  }
  function setPaymentTypeSelectorVisibility()
  {
    if (EventRegistration.paymentInstructionsDiv)
    {
      EventRegistration.paymentInstructionsDiv.style.display = currentPrice > 0 ? 'block':'none';;
    }
    if(EventRegistration.paymentTypeSelectorTR)
    {
      if(document.all)
      {
        EventRegistration.paymentTypeSelectorTR.style.display = currentPrice > 0 ? 'block':'none';
      }
      else
      {
        EventRegistration.paymentTypeSelectorTR.style.display = currentPrice > 0 ? 'table-row':'none';
      }  
    }
  }
}) ();



/*   /Content/Members/MemberDirectoryProfile.js   */

var MemberDirectoryProfile;

( function() {

  if (MemberDirectoryProfile == null) 
  {
    MemberDirectoryProfile = new Object();
  }
  
  /****************************************************************/
  /***  PUBLIC PROPERTIES AND METHODS                           ***/
  /****************************************************************/
  
  MemberDirectoryProfile.validateStateChanged = validateStateChanged;
  /****************************************************************/
  /***  PRIVATE FIELDS AND METHODS                              ***/
  /****************************************************************/

  var commentResizer;
  
  function $(id)
  { 
    return document.getElementById(id);
  }
  function validateStateChanged (src, args)
  {
    var state = '';
    var control = $(MemberDirectoryProfile.includeMeInMemberDirectoryContainer);
    if (control)
    {
      var children = control.getElementsByTagName('INPUT');
      
      for (var i=0; i<children.length; i++)
      {
        if (children[i].checked)
        {
          state += children[i].value;
        }
      }

      DataChangeWatcher.changeValidatorCustom(MemberDirectoryProfile.includeMeInMemberDirectoryContainer, state, args);
    }
  }
}) ();



/*   /Content/Pages/html_res/js/GoogleAdSense.js   */

(function() {

  var adsId, ads, mainCont, cont;
  
  if(window.BonaGoogleAdSense == null) {
    window.BonaGoogleAdSense = new Object();
  }
  
  BonaGoogleAdSense.init = function(adsClientId)
  {
    adsId = adsClientId;
  }
  
  BonaGoogleAdSense.showRight = function()
  {
    if ((ads = getAds()) && (cont = getCont()) && (mainCont = getMainCont()))
    {
      show(true);
    }
  }
  
  BonaGoogleAdSense.showLeft = function()
  {
    if ((ads = getAds()) && (cont = getCont()) && (mainCont = getMainCont()))
    {
      show(false);
    }
  }

  function getAds()
  {
    return document.getElementById(adsId);
  }

  function getCont()
  {
    return document.getElementById('idContentContainer');
  }
  
  function getMainCont()
  {
    return document.getElementById('idMainContainer');
  }

  function show(right)
  {
    BonaPage.getElementXY(cont);
    BonaPage.getElementXY(mainCont);
    ads.style.display = 'block';
    ads.style.left = (((right) ? cont.X + cont.offsetWidth : cont.X - ads.offsetWidth) - mainCont.X) + 'px';
    ads.style.top = (cont.Y + 45 - mainCont.Y) + 'px';
    ads.style.visibility = 'visible';
  }
}) ();

/*   /Content/PhotoGallery/PhotoGallery.js   */

(function()
{
  if (!window.PhotoGallery)
  {
    window.PhotoGallery = {};
  }

  var albumParam = '';
  var processingText = 'Please wait...';
  var deleteConfirmation = 'Are you sure you want to delete?';
  var deletePhotoConfirmation = 'Are you sure you want to delete this photo?';
  var saveAction = false;
  var photosHolder = false;
  var photosHolderHeight = false;
  var titleTextBox = false;
  var descriptionTextBox = false;
  var saveButton = false;
  var altSaveButton = false;
  var saveLinkButton = false;
  var deleteButton = false;
  var cancelButton = false;
  var uploadButton = false;
  var uploadAction = false;
  var viewModeRadioContainer = false;
  var uploadButtonContainer = false;
  var descriptionContainer = false;
  var descriptionHeightUrlKey = false;
  var countPhotosPerRowUrlKey = false;
  var pagingKey = false;
  var saveAlbumDialogInited = false;
  var uploadPhotosDialogInited = false;
  var photoItemId = false;
  var photoItemTimeout = false;
  var actionIsRunning = false;
  var pendingSender = false;
  var pendingImageDivId = false;
  var pendingFullDescriptionDivId = false;
  var pendingSmallDescriptionDivId = false;

  PhotoGallery.InitPhotoGallery = initPhotoGallery;
  PhotoGallery.InitJsFunctions = initJsFunctions;
  PhotoGallery.Page_Parsed = pageParsed;
  PhotoGallery.Page_Unloading = pageUnloading;
  PhotoGallery.CloseSaveAlbumDialog = closeSaveAlbumDialog;
  PhotoGallery.CloseUploadPhotosDialog = closeUploadPhotosDialog;
  PhotoGallery.Get_SaveAction = getSaveAction;
  PhotoGallery.Get_SaveTitle = getSaveTitle;
  PhotoGallery.Get_SaveDescription = getSaveDescription;
  PhotoGallery.Get_SaveButton = getSaveButton;
  PhotoGallery.Get_DeleteButton = getDeleteButton;
  PhotoGallery.Get_UploadButton = getUploadButton;
  PhotoGallery.Get_UploadAction = getUploadAction;
  PhotoGallery.ProcessingButton_OnClick = processingButtonClick;
  PhotoGallery.DeleteButton_OnClick = deleteButtonClick;
  PhotoGallery.UploadButton_OnClick = uploadButtonClick;
  PhotoGallery.SaveButton_OnClick = saveButtonClick;
  PhotoGallery.ImageMenu_OnMouseOver = imageMenuMouseOver;
  PhotoGallery.ImageMenu_OnMouseOut = imageMenuMouseOut;
  PhotoGallery.MenuButton_OnMouseOver = menuButtonMouseOver;
  PhotoGallery.MenuButton_OnMouseOut = menuButtonMouseOut;
  PhotoGallery.MenuButton_OnClick = menuButtonClick;
  PhotoGallery.NavigateToList = navigateToList;
  PhotoGallery.CheckLength = checkLength;

  function initPhotoGallery(p)
  {
    if (p.albumParam) albumParam = p.albumParam;
    if (p.processingText) processingText = p.processingText;
    if (p.deleteConfirmation) deleteConfirmation = p.deleteConfirmation;
    if (p.deletePhotoConfirmation) deletePhotoConfirmation = p.deletePhotoConfirmation;
    if (p.photosHolderId) photosHolder = BonaPage.$(p.photosHolderId);
    if (p.saveActionId) saveAction = BonaPage.$(p.saveActionId);
    if (p.titleTextBoxId) titleTextBox = BonaPage.$(p.titleTextBoxId);
    if (p.descriptionTextBoxId) descriptionTextBox = BonaPage.$(p.descriptionTextBoxId);
    if (p.saveButtonId) saveButton = BonaPage.$(p.saveButtonId);
    if (p.altSaveButtonId) altSaveButton = BonaPage.$(p.altSaveButtonId);
    if (p.saveLinkButtonId) saveLinkButton = BonaPage.$(p.saveLinkButtonId);
    if (p.deleteButtonId) deleteButton = BonaPage.$(p.deleteButtonId);
    if (p.cancelButtonId) cancelButton = BonaPage.$(p.cancelButtonId);
    if (p.uploadButtonId) uploadButton = BonaPage.$(p.uploadButtonId);
    if (p.uploadActionId) uploadAction = BonaPage.$(p.uploadActionId);
    if (p.viewModeRadioContainerId) viewModeRadioContainer = BonaPage.$(p.viewModeRadioContainerId);
    if (p.uploadButtonContainerId) uploadButtonContainer = BonaPage.$(p.uploadButtonContainerId);
    if (p.descriptionContainerId) descriptionContainer = BonaPage.$(p.descriptionContainerId);
    if (p.descriptionHeightUrlKey) descriptionHeightUrlKey = p.descriptionHeightUrlKey;
    if (p.countPhotosPerRowUrlKey) countPhotosPerRowUrlKey = p.countPhotosPerRowUrlKey;
    if (p.pagingUrlKey) pagingKey = p.pagingUrlKey;
  }

  function initJsFunctions()
  {
    setDisplayInline(saveLinkButton);
    setDisplayInline(uploadButton);
    setDisplay(viewModeRadioContainer);
    setDisplay(uploadButtonContainer);
  }

  function pageParsed()
  {
    initJsFunctions();
  }

  function pageUnloading()
  {
    setDisabled(saveButton);
    setDisabled(uploadButton);
    setDisabled(deleteButton);

    if (saveLinkButton)
    {
      setDisabled(saveLinkButton);
      setDisabled(altSaveButton);
      setDisabled(cancelButton);
    }
  }

  function setDisplay(element)
  {
    if (element)
    {
      element.style.display = '';
    }
  }

  function setDisplayInline(element)
  {
    if (element)
    {
      element.style.display = 'inline';
    }
  }

  function setDisplayBlock(element)
  {
    if (element)
    {
      element.style.display = 'block';
    }
  }

  function setDisplayNone(element)
  {
    if (element)
    {
      element.style.display = 'none';
    }
  }

  function setDisabled(element)
  {
    if (element)
    {
      element.disabled = true;
    }
  }

  function closeSaveAlbumDialog()
  {
    PhotoAlbumsDialog.saveAlbumDialog.close();
  }

  function closeUploadPhotosDialog()
  {
    PhotoAlbumsDialog.uploadPhotosDialog.close();
  }

  function getSaveAction()
  {
    return saveAction;
  }

  function getSaveTitle()
  {
    return titleTextBox;
  }

  function getSaveDescription()
  {
    return descriptionTextBox;
  }

  function getSaveButton()
  {
    return saveButton;
  }

  function getDeleteButton()
  {
    return deleteButton;
  }

  function getUploadButton()
  {
    return uploadButton;
  }

  function getUploadAction()
  {
    return uploadAction;
  }

  function processingButtonClick(sender, otherIds)
  {
    if (sender)
    {
      sender.value = processingText;
    }

    if (otherIds && otherIds.length)
    {
      for (var i = 0; i < otherIds.length; i++)
      {
        var btn = BonaPage.$(otherIds[i]);

        if (btn && btn.id != sender.id)
        {
          btn.disabled = true;
        }
      }
    }
    return true;
  }

  function deleteButtonClick(sender, otherIds)
  {
    if (confirm(deleteConfirmation))
    {
      return processingButtonClick(sender, otherIds);
    }
    return false;
  }

  function uploadButtonClick()
  {
    if (!uploadPhotosDialogInited)
    {
      PhotoAlbumsDialog.uploadPhotosDialog.initialize({ albumParam: albumParam });
      uploadPhotosDialogInited = true;
    }

    if (uploadAction.value == '1')
    {
      uploadAction.value = '';

      if (uploadButton)
      {
        uploadButton.value = processingText;
      }

      BonaPage.reloadCurrentPage(pagingKey);
      return;
    }

    PhotoAlbumsDialog.uploadPhotosDialog.open(null, {'PhotoGallery': PhotoGallery});
  }

  function saveButtonClick()
  {
    if (!saveAlbumDialogInited)
    {
      PhotoAlbumsDialog.saveAlbumDialog.initialize({ albumParam: albumParam });
      saveAlbumDialogInited = true;
    }

    if (saveAction.value == '1')
    {
      saveAction.value = '';

      if (saveButton)
      {
        saveButton.value = processingText;
      }

      return true;
    }

    PhotoAlbumsDialog.saveAlbumDialog.open(null, {'PhotoGallery': PhotoGallery});
    return false;
  }

  function imageMenuMouseOver(sender, imageDivId, fullDescriptionDivId, smallDescriptionDivId)
  {
    if (photoItemTimeout && photoItemId == imageDivId)
    {
      clearTimeout(photoItemTimeout);
      photoItemTimeout = false;
      return;
    }

    if (actionIsRunning)
    {
      return;
    }

    sender.parentNode.style.height = sender.offsetHeight + 'px';
    BonaPage.$(imageDivId).className = 'photoAlbumItemThumbnailPhotoHover';
    sender.className = 'photoInnerContainerOver';
    sender.style.zIndex = sender.style.zIndex + 1;
    var fullDescriptionDiv = BonaPage.$(fullDescriptionDivId);
    setDisplayBlock(fullDescriptionDiv);
    setDisplayNone(BonaPage.$(smallDescriptionDivId));

    if (photosHolder)
    {
      photosHolderHeight = photosHolder.offsetHeight;
      if (!photosHolder.Y) BonaPage.Utils.getXY(photosHolder);
      if (!fullDescriptionDiv.Y) BonaPage.Utils.getXY(fullDescriptionDiv);
      var outHeigth = fullDescriptionDiv.Y + fullDescriptionDiv.offsetHeight - photosHolder.Y - photosHolderHeight;

      if (outHeigth > 0)
      {
        photosHolder.style.height = (photosHolderHeight + outHeigth + 10) + 'px';
      }
    }
  }

  function doImageMenuMouseOut(sender, imageDivId, fullDescriptionDivId, smallDescriptionDivId)
  {
    BonaPage.$(imageDivId).className = 'photoAlbumItemThumbnailPhoto';
    sender.className = 'photoInnerContainer';
    sender.style.zIndex = sender.style.zIndex - 1;
    setDisplayNone(BonaPage.$(fullDescriptionDivId));
    setDisplayBlock(BonaPage.$(smallDescriptionDivId));

    if (photosHolderHeight && photosHolder.offsetHeight > photosHolderHeight)
    {
        photosHolder.style.height = photosHolderHeight + 'px';
    }
    
    photoItemId = false;
    photoItemTimeout = false;
  }

  function imageMenuMouseOut(sender, imageDivId, fullDescriptionDivId, smallDescriptionDivId)
  {
    if (actionIsRunning)
    {
      if (!pendingSender)
      {
        pendingSender = sender;
        pendingImageDivId = imageDivId;
        pendingFullDescriptionDivId = fullDescriptionDivId;
        pendingSmallDescriptionDivId = smallDescriptionDivId;
      }

      return;
    }

    if (photoItemTimeout && photoItemId == imageDivId)
    {
      return;
    }

    photoItemId = imageDivId;
    photoItemTimeout = setTimeout(function() { doImageMenuMouseOut(sender, imageDivId, fullDescriptionDivId, smallDescriptionDivId); }, 10);
  }

  function menuButtonMouseOver(sender)
  {
    sender.className = 'overButton';
  }

  function menuButtonMouseOut(sender)
  {
    sender.className = 'outButton';
  }

  function menuButtonClick(linkId, secondButtonId, processingContainerId, confirmVariableName)
  {
    var linkobj = BonaPage.$(linkId);

    if (linkobj)
    {
      setDisplayNone(linkobj);

      var secondButton = BonaPage.$(secondButtonId);
      var processingContainer = BonaPage.$(processingContainerId);
      setDisplayNone(secondButton);
      setDisplayBlock(processingContainer);

      if (confirmVariableName)
      {
        actionIsRunning = true;
  
        if (!confirm(eval(confirmVariableName)))
        {
          actionIsRunning = false;

          setDisplayNone(processingContainer);
          setDisplay(secondButton);
          setDisplay(linkobj);

          if (pendingSender)
          {
            imageMenuMouseOut(pendingSender, pendingImageDivId, pendingFullDescriptionDivId, pendingSmallDescriptionDivId);
            pendingSender = false;
          }

          return;
        }
      }

      actionIsRunning = false;
      eval(linkobj.href.substr(11).replace(/\%20/g, ' ').replace(/\%22/g, '"'));
    }
  }

  function navigateToList(url)
  {
    var descriptionHeight = (descriptionContainer) ? descriptionContainer.offsetHeight : 0;
    var countPhotosPerRow = 0;

    if (photosHolder)
    {
      var y = 0;
      var bulets = photosHolder.getElementsByTagName('LI');
      for (var i = 0; i < bulets.length; i++)
      {
        BonaPage.Utils.getXY(bulets[i]);
        if (i == 0)
        {
          y = bulets[i].Y;
        }
        else if (y < bulets[i].Y)
        {
          countPhotosPerRow = i;
          break;
        }
      }
    }

    if (descriptionHeightUrlKey && countPhotosPerRowUrlKey)
    {
      url += '&' + descriptionHeightUrlKey + '=' + descriptionHeight + '&' + countPhotosPerRowUrlKey + '=' + countPhotosPerRow;
    }

    window.location = url;
  }

  function checkLength(e, oObject, maxLength)
  {
    if (oObject.value.length < maxLength)
    {
      return true;
    }
    else
    {
      var keyID = (window.event) ? event.keyCode : e.keyCode;
      if ((keyID >= 37 && keyID <= 40) || (keyID == 8) || (keyID == 46))
      {
        if (window.event) e.returnValue = true;
      }
      else
      {
        if (window.event) e.returnValue = false;
        else e.preventDefault();
      }
    }
  }
}) ();



/*   /Content/PhotoGallery/SaveAlbumDialog.js   */

(function() {

  if (!window.PhotoAlbumsDialog)
  {
    window.PhotoAlbumsDialog = {};
  }
    
  window.PhotoAlbumsDialog.saveAlbumDialog = new BonaPage.topWindow.BonaDialogHandler({
    name: 'PhotoAlbumsDialog.SaveAlbumDialog',
    dialogParameters: 
    {
      clipContainerId: 'idPrimaryContentContainer',
      mainContainerId: 'idMainContainer',

      directURLTemplate: '/Content/Members/PhotoGallery/CreateAlbumDialog.aspx?frameMode=0{albumParam}&version=' + BonaPage.version,
      reloadURLTemplate: '/Content/Members/PhotoGallery/CreateAlbumDialog.aspx?frameMode=1{albumParam}&version=' + BonaPage.version,

      top: null,
      left: null,
      width: 500,
      height: 270,
      minWidth: 500,
      minHeight: 270,
      isMoveable: true,
      isResizeable: false,
      isModal: true,
      isScrollable: true,

      callBackParameters: {}
    }
  });
    
}) ();



/*   /Content/PhotoGallery/UploadPhotosDialog.js   */

(function() {

  if (!window.PhotoAlbumsDialog)
  {
    window.PhotoAlbumsDialog = {};
  }

  PhotoAlbumsDialog.uploadPhotosDialog = new BonaPage.topWindow.BonaDialogHandler({
    name: 'PhotoAlbumsDialog.UploadPhotosDialog',
    dialogParameters:
    {
      clipContainerId: 'idClipMainContainer',
      mainContainerId: 'contentDiv',

      directURLTemplate: '/Content/Members/PhotoGallery/UploadPhotosDialog.aspx?frameMode=0{albumParam}&version=' + BonaPage.version,
      reloadURLTemplate: '/Content/Pictures/PhotoGallery/UploadPhotosInnerDialog.aspx?version=' + BonaPage.version + '{albumParam}',

      top: null,
      left: null,
      width: 430,
      height: 315,
      minWidth: 430,
      minHeight: 315,
      isMoveable: true,
      isResizeable: false,
      isModal: true,
      isScrollable: false,

      callBackParameters: {}
    },
    onDialogClose: function()
    {    
      if (PhotoGallery.Get_UploadAction().value == '1')
      {
        PhotoGallery.Get_UploadButton().click();
      }
    }
  });

}) ();



/*   /Content/PhotoGallery/DeleteAlbumDialog.js   */

(function() {

  if (!window.PhotoAlbumsDialog)
  {
    window.PhotoAlbumsDialog = {};
  }

  deleteConfirmationDialogInited = false;
  PhotoAlbumsDialog.DeletePhotoAlbumsMethod = false;

  PhotoAlbumsDialog.deleteConfirmationDialog = new BonaPage.topWindow.BonaDialogHandler({
    name: 'PhotoAlbumsDialog.DeleteConfirmationDialog',
    dialogParameters:
    {
      directURLTemplate: '/Content/Pages/Admin/DeletePhotoAlbumConfirmationDialog.aspx?frameMode=0{albumParam}&version=' + BonaPage.version,
      reloadURLTemplate: '/Content/Pages/Admin/DeletePhotoAlbumConfirmationDialog.aspx?frameMode=1{albumParam}&version=' + BonaPage.version,
      top: null,
      left: null,
      width: 610,
      height: 200,
      minWidth: 610,
      minHeight: 200,
      isMoveable: true,
      isResizeable: false,
      isModal: true,
      isScrollable: false,
      callBackParameters: {}
    }
  });

  PhotoAlbumsDialog.ConfirmDeletion = function(albumParam, deleteMethod)
  {
    if (!deleteConfirmationDialogInited)
    {
      PhotoAlbumsDialog.deleteConfirmationDialog.initialize({ albumParam: albumParam });
      deleteConfirmationDialogInited = true;
    }
    
    PhotoAlbumsDialog.DeletePhotoAlbumsMethod = deleteMethod;
    PhotoAlbumsDialog.deleteConfirmationDialog.open(null, {'PhotoAlbumsDialog': PhotoAlbumsDialog});
    return false;
  }

  PhotoAlbumsDialog.CloseDeleteConfirmationDialog = function()
  {
    PhotoAlbumsDialog.deleteConfirmationDialog.close();
  }

  PhotoAlbumsDialog.DoneConfirmedPhotoAlbumsDeletion = function()
  {
    if (PhotoAlbumsDialog.DeletePhotoAlbumsMethod)
    {
      PhotoAlbumsDialog.DeletePhotoAlbumsMethod();
    }

    PhotoAlbumsDialog.CloseDeleteConfirmationDialog();
  }

}) ();



BonaPage.notifyScriptLoaded();
