/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  Utf8 class: encode / decode between multi-byte Unicode characters and UTF-8 multiple          */
/*              single-byte character encoding (c) Chris Veness 2002-2009                         */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var Utf8 = {};  // Utf8 namespace

/**
 * Encode multi-byte Unicode string into utf-8 multiple single-byte characters 
 * (BMP / basic multilingual plane only)
 *
 * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars
 *
 * @param {String} strUni Unicode string to be encoded as UTF-8
 * @returns {String} encoded string
 */
Utf8.encode = function(strUni) {
  // use regular expressions & String.replace callback function for better efficiency 
  // than procedural approaches
  var strUtf = strUni.replace(
      /[\u0080-\u07ff]/g,  // U+0080 - U+07FF => 2 bytes 110yyyyy, 10zzzzzz
      function(c) { 
        var cc = c.charCodeAt(0);
        return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); }
    );
  strUtf = strUtf.replace(
      /[\u0800-\uffff]/g,  // U+0800 - U+FFFF => 3 bytes 1110xxxx, 10yyyyyy, 10zzzzzz
      function(c) { 
        var cc = c.charCodeAt(0); 
        return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); }
    );
  return strUtf;
}

/**
 * Decode utf-8 encoded string back into multi-byte Unicode characters
 *
 * @param {String} strUtf UTF-8 string to be decoded back to Unicode
 * @returns {String} decoded string
 */
Utf8.decode = function(strUtf) {
  var strUni = strUtf.replace(
      /[\u00c0-\u00df][\u0080-\u00bf]/g,                 // 2-byte chars
      function(c) {  // (note parentheses for precence)
        var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f;
        return String.fromCharCode(cc); }
    );
  strUni = strUni.replace(
      /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,  // 3-byte chars
      function(c) {  // (note parentheses for precence)
        var cc = ((c.charCodeAt(0)&0x0f)<<12) | ((c.charCodeAt(1)&0x3f)<<6) | ( c.charCodeAt(2)&0x3f); 
        return String.fromCharCode(cc); }
    );
  return strUni;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  *//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  Base64 class: Base 64 encoding / decoding (c) Chris Veness 2002-2009                          */
/*    note: depends on Utf8 class                                                                 */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var Base64 = {};  // Base64 namespace

Base64.code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

/**
 * Encode string into Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648]
 * (instance method extending String object). As per RFC 4648, no newlines are added.
 *
 * @param {String} str The string to be encoded as base-64
 * @param {Boolean} [utf8encode=false] Flag to indicate whether str is Unicode string to be encoded 
 *   to UTF8 before conversion to base64; otherwise string is assumed to be 8-bit characters
 * @returns {String} Base64-encoded string
 */ 
Base64.encode = function(str, utf8encode) {  // http://tools.ietf.org/html/rfc4648
  utf8encode =  (typeof utf8encode == 'undefined') ? false : utf8encode;
  var o1, o2, o3, bits, h1, h2, h3, h4, e=[], pad = '', c, plain, coded;
  var b64 = Base64.code;
   
  plain = utf8encode ? str.encodeUTF8() : str;
  
  c = plain.length % 3;  // pad string to length of multiple of 3
  if (c > 0) { while (c++ < 3) { pad += '='; plain += '\0'; } }
  // note: doing padding here saves us doing special-case packing for trailing 1 or 2 chars
   
  for (c=0; c<plain.length; c+=3) {  // pack three octets into four hexets
    o1 = plain.charCodeAt(c);
    o2 = plain.charCodeAt(c+1);
    o3 = plain.charCodeAt(c+2);
      
    bits = o1<<16 | o2<<8 | o3;
      
    h1 = bits>>18 & 0x3f;
    h2 = bits>>12 & 0x3f;
    h3 = bits>>6 & 0x3f;
    h4 = bits & 0x3f;

    // use hextets to index into code string
    e[c/3] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
  }
  coded = e.join('');  // join() is far faster than repeated string concatenation in IE
  
  // replace 'A's from padded nulls with '='s
  coded = coded.slice(0, coded.length-pad.length) + pad;
   
  return coded;
}

/**
 * Decode string from Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648]
 * (instance method extending String object). As per RFC 4648, newlines are not catered for.
 *
 * @param {String} str The string to be decoded from base-64
 * @param {Boolean} [utf8decode=false] Flag to indicate whether str is Unicode string to be decoded 
 *   from UTF8 after conversion from base64
 * @returns {String} decoded string
 */ 
Base64.decode = function(str, utf8decode) {
  utf8decode =  (typeof utf8decode == 'undefined') ? false : utf8decode;
  var o1, o2, o3, h1, h2, h3, h4, bits, d=[], plain, coded;
  var b64 = Base64.code;

  coded = utf8decode ? str.decodeUTF8() : str;
  
  
  for (var c=0; c<coded.length; c+=4) {  // unpack four hexets into three octets
    h1 = b64.indexOf(coded.charAt(c));
    h2 = b64.indexOf(coded.charAt(c+1));
    h3 = b64.indexOf(coded.charAt(c+2));
    h4 = b64.indexOf(coded.charAt(c+3));
      
    bits = h1<<18 | h2<<12 | h3<<6 | h4;
      
    o1 = bits>>>16 & 0xff;
    o2 = bits>>>8 & 0xff;
    o3 = bits & 0xff;
    
    d[c/4] = String.fromCharCode(o1, o2, o3);
    // check for padding
    if (h4 == 0x40) d[c/4] = String.fromCharCode(o1, o2);
    if (h3 == 0x40) d[c/4] = String.fromCharCode(o1);
  }
  plain = d.join('');  // join() is far faster than repeated string concatenation in IE
   
  return utf8decode ? plain.decodeUTF8() : plain; 
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  *//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  AES implementation in JavaScript (c) Chris Veness 2005-2010                                   */
/*   - see http://csrc.nist.gov/publications/PubsFIPS.html#197                                    */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var Aes = {};  // Aes namespace

/**
 * AES Cipher function: encrypt 'input' state with Rijndael algorithm
 *   applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage
 *
 * @param {Number[]} input 16-byte (128-bit) input state array
 * @param {Number[][]} w   Key schedule as 2D byte-array (Nr+1 x Nb bytes)
 * @returns {Number[]}     Encrypted output state array
 */
Aes.Cipher = function(input, w) {    // main Cipher function [§5.1]
  var Nb = 4;               // block size (in words): no of columns in state (fixed at 4 for AES)
  var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys

  var state = [[],[],[],[]];  // initialise 4xNb byte-array 'state' with input [§3.4]
  for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];

  state = Aes.AddRoundKey(state, w, 0, Nb);

  for (var round=1; round<Nr; round++) {
    state = Aes.SubBytes(state, Nb);
    state = Aes.ShiftRows(state, Nb);
    state = Aes.MixColumns(state, Nb);
    state = Aes.AddRoundKey(state, w, round, Nb);
  }

  state = Aes.SubBytes(state, Nb);
  state = Aes.ShiftRows(state, Nb);
  state = Aes.AddRoundKey(state, w, Nr, Nb);

  var output = new Array(4*Nb);  // convert state to 1-d array before returning [§3.4]
  for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
  return output;
}

/**
 * Perform Key Expansion to generate a Key Schedule
 *
 * @param {Number[]} key Key as 16/24/32-byte array
 * @returns {Number[][]} Expanded key schedule as 2D byte-array (Nr+1 x Nb bytes)
 */
Aes.KeyExpansion = function(key) {  // generate Key Schedule (byte-array Nr+1 x Nb) from Key [§5.2]
  var Nb = 4;            // block size (in words): no of columns in state (fixed at 4 for AES)
  var Nk = key.length/4  // key length (in words): 4/6/8 for 128/192/256-bit keys
  var Nr = Nk + 6;       // no of rounds: 10/12/14 for 128/192/256-bit keys

  var w = new Array(Nb*(Nr+1));
  var temp = new Array(4);

  for (var i=0; i<Nk; i++) {
    var r = [key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]];
    w[i] = r;
  }

  for (var i=Nk; i<(Nb*(Nr+1)); i++) {
    w[i] = new Array(4);
    for (var t=0; t<4; t++) temp[t] = w[i-1][t];
    if (i % Nk == 0) {
      temp = Aes.SubWord(Aes.RotWord(temp));
      for (var t=0; t<4; t++) temp[t] ^= Aes.Rcon[i/Nk][t];
    } else if (Nk > 6 && i%Nk == 4) {
      temp = Aes.SubWord(temp);
    }
    for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t];
  }

  return w;
}

/*
 * ---- remaining routines are private, not called externally ----
 */
 
Aes.SubBytes = function(s, Nb) {    // apply SBox to state S [§5.1.1]
  for (var r=0; r<4; r++) {
    for (var c=0; c<Nb; c++) s[r][c] = Aes.Sbox[s[r][c]];
  }
  return s;
}

Aes.ShiftRows = function(s, Nb) {    // shift row r of state S left by r bytes [§5.1.2]
  var t = new Array(4);
  for (var r=1; r<4; r++) {
    for (var c=0; c<4; c++) t[c] = s[r][(c+r)%Nb];  // shift into temp copy
    for (var c=0; c<4; c++) s[r][c] = t[c];         // and copy back
  }          // note that this will work for Nb=4,5,6, but not 7,8 (always 4 for AES):
  return s;  // see asmaes.sourceforge.net/rijndael/rijndaelImplementation.pdf
}

Aes.MixColumns = function(s, Nb) {   // combine bytes of each col of state S [§5.1.3]
  for (var c=0; c<4; c++) {
    var a = new Array(4);  // 'a' is a copy of the current column from 's'
    var b = new Array(4);  // 'b' is a•{02} in GF(2^8)
    for (var i=0; i<4; i++) {
      a[i] = s[i][c];
      b[i] = s[i][c]&0x80 ? s[i][c]<<1 ^ 0x011b : s[i][c]<<1;
    }
    // a[n] ^ b[n] is a•{03} in GF(2^8)
    s[0][c] = b[0] ^ a[1] ^ b[1] ^ a[2] ^ a[3]; // 2*a0 + 3*a1 + a2 + a3
    s[1][c] = a[0] ^ b[1] ^ a[2] ^ b[2] ^ a[3]; // a0 * 2*a1 + 3*a2 + a3
    s[2][c] = a[0] ^ a[1] ^ b[2] ^ a[3] ^ b[3]; // a0 + a1 + 2*a2 + 3*a3
    s[3][c] = a[0] ^ b[0] ^ a[1] ^ a[2] ^ b[3]; // 3*a0 + a1 + a2 + 2*a3
  }
  return s;
}

Aes.AddRoundKey = function(state, w, rnd, Nb) {  // xor Round Key into state S [§5.1.4]
  for (var r=0; r<4; r++) {
    for (var c=0; c<Nb; c++) state[r][c] ^= w[rnd*4+c][r];
  }
  return state;
}

Aes.SubWord = function(w) {    // apply SBox to 4-byte word w
  for (var i=0; i<4; i++) w[i] = Aes.Sbox[w[i]];
  return w;
}

Aes.RotWord = function(w) {    // rotate 4-byte word w left by one byte
  var tmp = w[0];
  for (var i=0; i<3; i++) w[i] = w[i+1];
  w[3] = tmp;
  return w;
}

// Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion [§5.1.1]
Aes.Sbox =  [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76,
             0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0,
             0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15,
             0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75,
             0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84,
             0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf,
             0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8,
             0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2,
             0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73,
             0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb,
             0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79,
             0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08,
             0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a,
             0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e,
             0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf,
             0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16];

// Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2]
Aes.Rcon = [ [0x00, 0x00, 0x00, 0x00],
             [0x01, 0x00, 0x00, 0x00],
             [0x02, 0x00, 0x00, 0x00],
             [0x04, 0x00, 0x00, 0x00],
             [0x08, 0x00, 0x00, 0x00],
             [0x10, 0x00, 0x00, 0x00],
             [0x20, 0x00, 0x00, 0x00],
             [0x40, 0x00, 0x00, 0x00],
             [0x80, 0x00, 0x00, 0x00],
             [0x1b, 0x00, 0x00, 0x00],
             [0x36, 0x00, 0x00, 0x00] ]; 

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  *//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  AES Counter-mode implementation in JavaScript (c) Chris Veness 2005-2009                      */
/*   - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf                       */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var AesCtr = {};  // AesCtr namespace

/** 
 * Encrypt a text using AES encryption in Counter mode of operation
 *
 * Unicode multi-byte character safe
 *
 * @param {String} plaintext Source text to be encrypted
 * @param {String} password  The password to use to generate a key
 * @param {Number} nBits     Number of bits to be used in the key (128, 192, or 256)
 * @returns {string}         Encrypted text
 */
AesCtr.encrypt = function(plaintext, password, nBits) {
  var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
  if (!(nBits==128 || nBits==192 || nBits==256)) return '';  // standard allows 128/192/256 bit keys
  plaintext = Utf8.encode(plaintext);
  password = Utf8.encode(password);
  //var t = new Date();  // timer
	
  // use AES itself to encrypt password to get cipher key (using plain password as source for key 
  // expansion) - gives us well encrypted key
  var nBytes = nBits/8;  // no bytes in key
  var pwBytes = new Array(nBytes);
  for (var i=0; i<nBytes; i++) {
    pwBytes[i] = isNaN(password.charCodeAt(i)) ? 0 : password.charCodeAt(i);
  }
  var key = Aes.Cipher(pwBytes, Aes.KeyExpansion(pwBytes));  // gives us 16-byte key
  key = key.concat(key.slice(0, nBytes-16));  // expand key to 16/24/32 bytes long

  // initialise counter block (NIST SP800-38A §B.2): millisecond time-stamp for nonce in 1st 8 bytes,
  // block counter in 2nd 8 bytes
  var counterBlock = new Array(blockSize);
  var nonce = (new Date()).getTime();  // timestamp: milliseconds since 1-Jan-1970
  var nonceSec = Math.floor(nonce/1000);
  var nonceMs = nonce%1000;
  // encode nonce with seconds in 1st 4 bytes, and (repeated) ms part filling 2nd 4 bytes
  for (var i=0; i<4; i++) counterBlock[i] = (nonceSec >>> i*8) & 0xff;
  for (var i=0; i<4; i++) counterBlock[i+4] = nonceMs & 0xff; 
  // and convert it to a string to go on the front of the ciphertext
  var ctrTxt = '';
  for (var i=0; i<8; i++) ctrTxt += String.fromCharCode(counterBlock[i]);

  // generate key schedule - an expansion of the key into distinct Key Rounds for each round
  var keySchedule = Aes.KeyExpansion(key);
  
  var blockCount = Math.ceil(plaintext.length/blockSize);
  var ciphertxt = new Array(blockCount);  // ciphertext as array of strings
  
  for (var b=0; b<blockCount; b++) {
    // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
    // done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB)
    for (var c=0; c<4; c++) counterBlock[15-c] = (b >>> c*8) & 0xff;
    for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8)

    var cipherCntr = Aes.Cipher(counterBlock, keySchedule);  // -- encrypt counter block --
    
    // block size is reduced on final block
    var blockLength = b<blockCount-1 ? blockSize : (plaintext.length-1)%blockSize+1;
    var cipherChar = new Array(blockLength);
    
    for (var i=0; i<blockLength; i++) {  // -- xor plaintext with ciphered counter char-by-char --
      cipherChar[i] = cipherCntr[i] ^ plaintext.charCodeAt(b*blockSize+i);
      cipherChar[i] = String.fromCharCode(cipherChar[i]);
    }
    ciphertxt[b] = cipherChar.join(''); 
  }

  // Array.join is more efficient than repeated string concatenation in IE
  var ciphertext = ctrTxt + ciphertxt.join('');
  ciphertext = Base64.encode(ciphertext);  // encode in base64
  
  //alert((new Date()) - t);
  return ciphertext;
}

/** 
 * Decrypt a text encrypted by AES in counter mode of operation
 *
 * @param {String} ciphertext Source text to be encrypted
 * @param {String} password   The password to use to generate a key
 * @param {Number} nBits      Number of bits to be used in the key (128, 192, or 256)
 * @returns {String}          Decrypted text
 */
AesCtr.decrypt = function(ciphertext, password, nBits) {
  var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
  if (!(nBits==128 || nBits==192 || nBits==256)) return '';  // standard allows 128/192/256 bit keys
  ciphertext = Base64.decode(ciphertext);
  password = Utf8.encode(password);
  //var t = new Date();  // timer
  
  // use AES to encrypt password (mirroring encrypt routine)
  var nBytes = nBits/8;  // no bytes in key
  var pwBytes = new Array(nBytes);
  for (var i=0; i<nBytes; i++) {
    pwBytes[i] = isNaN(password.charCodeAt(i)) ? 0 : password.charCodeAt(i);
  }
  var key = Aes.Cipher(pwBytes, Aes.KeyExpansion(pwBytes));
  key = key.concat(key.slice(0, nBytes-16));  // expand key to 16/24/32 bytes long

  // recover nonce from 1st 8 bytes of ciphertext
  var counterBlock = new Array(8);
  ctrTxt = ciphertext.slice(0, 8);
  for (var i=0; i<8; i++) counterBlock[i] = ctrTxt.charCodeAt(i);
  
  // generate key schedule
  var keySchedule = Aes.KeyExpansion(key);

  // separate ciphertext into blocks (skipping past initial 8 bytes)
  var nBlocks = Math.ceil((ciphertext.length-8) / blockSize);
  var ct = new Array(nBlocks);
  for (var b=0; b<nBlocks; b++) ct[b] = ciphertext.slice(8+b*blockSize, 8+b*blockSize+blockSize);
  ciphertext = ct;  // ciphertext is now array of block-length strings

  // plaintext will get generated block-by-block into array of block-length strings
  var plaintxt = new Array(ciphertext.length);

  for (var b=0; b<nBlocks; b++) {
    // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
    for (var c=0; c<4; c++) counterBlock[15-c] = ((b) >>> c*8) & 0xff;
    for (var c=0; c<4; c++) counterBlock[15-c-4] = (((b+1)/0x100000000-1) >>> c*8) & 0xff;

    var cipherCntr = Aes.Cipher(counterBlock, keySchedule);  // encrypt counter block

    var plaintxtByte = new Array(ciphertext[b].length);
    for (var i=0; i<ciphertext[b].length; i++) {
      // -- xor plaintxt with ciphered counter byte-by-byte --
      plaintxtByte[i] = cipherCntr[i] ^ ciphertext[b].charCodeAt(i);
      plaintxtByte[i] = String.fromCharCode(plaintxtByte[i]);
    }
    plaintxt[b] = plaintxtByte.join('');
  }

  // join array of blocks into single plaintext string
  var plaintext = plaintxt.join('');
  plaintext = Utf8.decode(plaintext);  // decode from UTF8 back to Unicode multi-byte chars
  
  //alert((new Date()) - t);
  return plaintext;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
var browser = function ()
{
}

browser.get = function ()
{
	var s  = window.location.search;
	var res = new Object;
	if (s != "") s = s.substr(1);	// remove leading '?'
	while (s != "")
	{
		var in_key = true;
		var key = "";
		var value = "";
		while (s != "" && s.substr (0,1) != "&")
		{
			var c = s.substr(0,1);
			s = s.substr(1);
			if (in_key)
			{
				if (c == "=")
					in_key = false;
				else
					key += c;
			}
			else
			{
				value += c;
			}
		}
		value = value.replace ("+", " ");
		value = decodeURIComponent(value);
		res[key] = decodeURIComponent(value);
		if (s.substr(0,1) == "&") s = s.substr(1);
	}
	return res;
}

browser.server = function ()
{
	var res = new Object;
	res.REQUEST_URI = window.location.href;
	res.HTTP_HOST = window.location.hostname;
	return res;
}


browser.reload = function (del_args, add_args)
{
	var args = browser.get();
	var res = "";
	for (var key in args)
	{
		found = false;
		for (var j in del_args)
			if (del_args[j] == key)
				found = true;
		if (!found)
		{
			if (res.length) res += "&";
			res += key + "=" + (encodeURIComponent (args[key]).replace (" ","+"));
		}
	}
	for (var key in add_args)
	{
		if (res.length) res += "&";
		res += key + "=" + (encodeURIComponent (add_args[key]).replace (" ","+"));
	}
	window.location = "?"+res;
}

browser.redirect = function (url)
{
	window.location = url;
}

browser.scroll_left = function ()
{
	return $(window).scrollLeft();
//	if (document.body && (document.body.scrollLeft || document.body.scrollTop))
//		return document.body.scrollLeft;
//	else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
//		return document.documentElement.scrollLeft;
//	return 0;
}

browser.scroll_top = function ()
{
	return $(window).scrollTop();
//	if (document.body && (document.body.scrollLeft || document.body.scrollTop))
//		return document.body.scrollTop;
//	else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
//		return document.documentElement.scrollTop;
//	return 0;
}

browser.window_width = function ()
{
	if (typeof (window.innerWidth) == 'number')
		return window.innerWidth;
	else
		return document.documentElement.clientWidth;
}

browser.window_height = function ()
{
	if (typeof (window.innerWidth) == 'number')
		return window.innerHeight;
	else
		return document.documentElement.clientHeight;
}

browser.document_height = function ()
{
	return Math.max (
		Math.max (document.body.scrollHeight, document.documentElement.scrollHeight),
		Math.max (document.body.offsetHeight, document.documentElement.offsetHeight),
		Math.max (document.body.clientHeight, document.documentElement.clientHeight));
}

browser.set_alpha = function (el, val)
{
	if (val < 0) val = 0;
	if (val > 100) val = 100;
	if (document.all)
	{
		el.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(Opacity="+val+")\"";
		el.style.filter = "alpha(opacity="+val+")";
	}
	else
	{
		if (val == 100)
		{
			el.style.MozOpacity = "1.00";
			el.style.opacity = "1.00";
		}
		else
		{
			if (val < 10) val = "0"+val;
			el.style.MozOpacity = "0."+val;
			el.style.opacity = "0."+val;
		}
	}
}

function beginDrag (elementToDrag, event, onlyY, parent)
{
	if (!event) event = window.event;
	var deltaX = event.clientX - parseInt (elementToDrag.style.left);
	var deltaY = event.clientY - parseInt (elementToDrag.style.top);
	var old_movehandler;
	var old_uphandler;
	var old_onselectstart;

	function retfalse ()
	{
		return false;
	}

	if (document.addEventListener)
	{
		document.addEventListener ("mousemove", moveHandler, true);
		document.addEventListener ("mouseup", upHandler, true);
	}
	else if (document.attachEvent)
	{
		document.attachEvent ("onmousemove", moveHandler);
		document.attachEvent ("onmouseup", upHandler);
		old_onselectstart = document.onselectstart;
		document.onselectstart = retfalse;
	}
	else
	{
		old_movehandler = document.onmousemove;
		old_uphandler = document.onmouseup;
		document.onmousemove = moveHandler;
		document.onmouseup = upHandler;
	}

	if (event.stopPropagation)
	{
		event.stopPropagation();
		event.preventDefault();
	}
	else event.cancelBubble = true;

	function moveHandler (e)
	{
		if (!e) e = window.event;
		if (!onlyY)
			elementToDrag.style.left = (e.clientX - deltaX) + "px";
		elementToDrag.style.top = (e.clientY - deltaY) + "px";
		if (e.stopPropagation) e.stopPropagation();
		else e.cancelBubble = true;
		if (parent)
		{
			parent.move_action();
//			deltaX = event.clientX - parseInt (elementToDrag.style.left);
			deltaY = e.clientY - parseInt (elementToDrag.style.top);
		}
	}

	function upHandler (e)
	{
		if (!e) e = window.event;
		if (document.removeEventListener)
		{
			document.removeEventListener ("mouseup", upHandler, true);
			document.removeEventListener ("mousemove", moveHandler, true);
		}
		else if (document.detachEvent)
		{
			document.detachEvent ("onmouseup", upHandler);
			document.detachEvent ("onmousemove", moveHandler);
			document.onselectstart = old_onselectstart;
		}
		else
		{
			document.onmouseup = old_uphandler;
			document.onmousemove = old_movehandler;
		}
		if (e.stopPropagation) e.stopPropagation();
		else e.cancelBubble = true;

		if (parent)
		{
			parent.release_action ();
			parent = null;
		}
	}
}
/*
  DOM Ranges for Internet Explorer (m2)
  
  Copyright (c) 2009 Tim Cameron Ryan
  Released under the MIT/X License
 */
 
/*
  Range reference:
    http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
    http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsRange.cpp
    https://developer.mozilla.org/En/DOM:Range
  Selection reference:
    http://trac.webkit.org/browser/trunk/WebCore/page/DOMSelection.cpp
  TextRange reference:
    http://msdn.microsoft.com/en-us/library/ms535872.aspx
  Other links:
    http://jorgenhorstink.nl/test/javascript/range/range.js
    http://jorgenhorstink.nl/2006/07/05/dom-range-implementation-in-ecmascript-completed/
    http://dylanschiemann.com/articles/dom2Range/dom2RangeExamples.html
*/

//[TODO] better exception support

if (document.createRange == undefined)
(function () {	// sandbox

/*
  DOM functions
 */

var DOMUtils = {
	findChildPosition: function (node) {
		for (var i = 0; node = node.previousSibling; i++)
			continue;
		return i;
	},
	isDataNode: function (node) {
		return node && node.nodeValue !== null && node.data !== null;
	},
	isAncestorOf: function (parent, node) {
		return !DOMUtils.isDataNode(parent) &&
		    (parent.contains(DOMUtils.isDataNode(node) ? node.parentNode : node) ||		    
		    node.parentNode == parent);
	},
	isAncestorOrSelf: function (root, node) {
		return DOMUtils.isAncestorOf(root, node) || root == node;
	},
	findClosestAncestor: function (root, node) {
		if (DOMUtils.isAncestorOf(root, node))
			while (node && node.parentNode != root)
				node = node.parentNode;
		return node;
	},
	getNodeLength: function (node) {
		return DOMUtils.isDataNode(node) ? node.length : node.childNodes.length;
	},
	splitDataNode: function (node, offset) {
		if (!DOMUtils.isDataNode(node))
			return false;
		var newNode = node.cloneNode(false);
		node.deleteData(offset, node.length);
		newNode.deleteData(0, offset);
		node.parentNode.insertBefore(newNode, node.nextSibling);
	}
};

/*
  Text Range utilities
  functions to simplify text range manipulation in ie
 */

var TextRangeUtils = {
	convertToDOMRange: function (textRange, document) {
		function adoptBoundary(domRange, textRange, bStart) {
			// iterate backwards through parent element to find anchor location
			var cursorNode = document.createElement('a'), cursor = textRange.duplicate();
			cursor.collapse(bStart);
			var parent = cursor.parentElement();
			do {
				parent.insertBefore(cursorNode, cursorNode.previousSibling);
				cursor.moveToElementText(cursorNode);
			} while (cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd', textRange) > 0 && cursorNode.previousSibling);

			// when we exceed or meet the cursor, we've found the node
			if (cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd', textRange) == -1 && cursorNode.nextSibling) {
				// data node
				cursor.setEndPoint(bStart ? 'EndToStart' : 'EndToEnd', textRange);
				domRange[bStart ? 'setStart' : 'setEnd'](cursorNode.nextSibling, cursor.text.length);
			} else {
				// element
				domRange[bStart ? 'setStartBefore' : 'setEndBefore'](cursorNode);
			}
			cursorNode.parentNode.removeChild(cursorNode);
		}
	
		// return a DOM range
		var domRange = new DOMRange(document);
		adoptBoundary(domRange, textRange, true);
		adoptBoundary(domRange, textRange, false);
		return domRange;
	},

	convertFromDOMRange: function (domRange) {
		function adoptEndPoint(textRange, domRange, bStart) {
			// find anchor node and offset
			var container = domRange[bStart ? 'startContainer' : 'endContainer'];
			var offset = domRange[bStart ? 'startOffset' : 'endOffset'], textOffset = 0;
			var anchorNode = DOMUtils.isDataNode(container) ? container : container.childNodes[offset];
			var anchorParent = DOMUtils.isDataNode(container) ? container.parentNode : container;
			// visible data nodes need a text offset
			if (container.nodeType == 3 || container.nodeType == 4)
				textOffset = offset;

			// create a cursor element node to position range (since we can't select text nodes)
			var cursorNode = domRange._document.createElement('a');
			anchorParent.insertBefore(cursorNode, anchorNode);
			var cursor = domRange._document.body.createTextRange();
			cursor.moveToElementText(cursorNode);
			cursorNode.parentNode.removeChild(cursorNode);
			// move range
			textRange.setEndPoint(bStart ? 'StartToStart' : 'EndToStart', cursor);
			textRange[bStart ? 'moveStart' : 'moveEnd']('character', textOffset);
		}
		
		// return an IE text range
		var textRange = domRange._document.body.createTextRange();
		adoptEndPoint(textRange, domRange, true);
		adoptEndPoint(textRange, domRange, false);
		return textRange;
	}
};

/*
  DOM Range
 */
 
function DOMRange(document) {
	// save document parameter
	this._document = document;
	
	// initialize range
//[TODO] this should be located at document[0], document[0]
	this.startContainer = this.endContainer = document.body;
	this.endOffset = DOMUtils.getNodeLength(document.body);
}
DOMRange.START_TO_START = 0;
DOMRange.START_TO_END = 1;
DOMRange.END_TO_END = 2;
DOMRange.END_TO_START = 3;

DOMRange.prototype = {
	// public properties
	startContainer: null,
	startOffset: 0,
	endContainer: null,
	endOffset: 0,
	commonAncestorContainer: null,
	collapsed: false,
	// private properties
	_document: null,
	
	// private methods
	_refreshProperties: function () {
		// collapsed attribute
		this.collapsed = (this.startContainer == this.endContainer && this.startOffset == this.endOffset);
		// find common ancestor
		var node = this.startContainer;
		while (node && node != this.endContainer && !DOMUtils.isAncestorOf(node, this.endContainer))
			node = node.parentNode;
		this.commonAncestorContainer = node;
	},
	
	// range methods
//[TODO] collapse if start is after end, end is before start
	setStart: function(container, offset) {
		this.startContainer = container;
		this.startOffset = offset;
		this._refreshProperties();
	},
	setEnd: function(container, offset) {
		this.endContainer = container;
		this.endOffset = offset;
		this._refreshProperties();
	},
	setStartBefore: function (refNode) {
		// set start to beore this node
		this.setStart(refNode.parentNode, DOMUtils.findChildPosition(refNode));
	},
	setStartAfter: function (refNode) {
		// select next sibling
		this.setStart(refNode.parentNode, DOMUtils.findChildPosition(refNode) + 1);
	},
	setEndBefore: function (refNode) {
		// set end to beore this node
		this.setEnd(refNode.parentNode, DOMUtils.findChildPosition(refNode));
	},
	setEndAfter: function (refNode) {
		// select next sibling
		this.setEnd(refNode.parentNode, DOMUtils.findChildPosition(refNode) + 1);
	},
	selectNode: function (refNode) {
		this.setStartBefore(refNode);
		this.setEndAfter(refNode);
	},
	selectNodeContents: function (refNode) {
		this.setStart(refNode, 0);
		this.setEnd(refNode, DOMUtils.getNodeLength(refNode));
	},
	collapse: function (toStart) {
		if (toStart)
			this.setEnd(this.startContainer, this.startOffset);
		else
			this.setStart(this.endContainer, this.endOffset);
	},

	// editing methods
	cloneContents: function () {
		// clone subtree
		return (function cloneSubtree(iterator) {
			for (var node, frag = document.createDocumentFragment(); node = iterator.next(); ) {
				node = node.cloneNode(!iterator.hasPartialSubtree());
				if (iterator.hasPartialSubtree())
					node.appendChild(cloneSubtree(iterator.getSubtreeIterator()));
				frag.appendChild(node);
			}
			return frag;
		})(new RangeIterator(this));
	},
	extractContents: function () {
		// cache range and move anchor points
		var range = this.cloneRange();
		if (this.startContainer != this.commonAncestorContainer)
			this.setStartAfter(DOMUtils.findClosestAncestor(this.commonAncestorContainer, this.startContainer));
		this.collapse(true);
		// extract range
		return (function extractSubtree(iterator) {
			for (var node, frag = document.createDocumentFragment(); node = iterator.next(); ) {
				iterator.hasPartialSubtree() ? node = node.cloneNode(false) : iterator.remove();
				if (iterator.hasPartialSubtree())
					node.appendChild(extractSubtree(iterator.getSubtreeIterator()));
				frag.appendChild(node);
			}
			return frag;
		})(new RangeIterator(range));
	},
	deleteContents: function () {
		// cache range and move anchor points
		var range = this.cloneRange();
		if (this.startContainer != this.commonAncestorContainer)
			this.setStartAfter(DOMUtils.findClosestAncestor(this.commonAncestorContainer, this.startContainer));
		this.collapse(true);
		// delete range
		(function deleteSubtree(iterator) {
			while (iterator.next())
				iterator.hasPartialSubtree() ? deleteSubtree(iterator.getSubtreeIterator()) : iterator.remove();
		})(new RangeIterator(range));
	},
	insertNode: function (newNode) {
		// set original anchor and insert node
		if (DOMUtils.isDataNode(this.startContainer)) {
			DOMUtils.splitDataNode(this.startContainer, this.startOffset);
			this.startContainer.parentNode.insertBefore(newNode, this.startContainer.nextSibling);
		} else {
			this.startContainer.insertBefore(newNode, this.startContainer.childNodes[this.startOffset]);
		}
		// resync start anchor
		this.setStart(this.startContainer, this.startOffset);
	},
	surroundContents: function (newNode) {
		// extract and surround contents
		var content = this.extractContents();
		this.insertNode(newNode);
		newNode.appendChild(content);
		this.selectNode(newNode);
	},

	// other methods
	compareBoundaryPoints: function (how, sourceRange) {
		// get anchors
		var containerA, offsetA, containerB, offsetB;
		switch (how) {
		    case DOMRange.START_TO_START:
		    case DOMRange.START_TO_END:
			containerA = this.startContainer;
			offsetA = this.startOffset;
			break;
		    case DOMRange.END_TO_END:
		    case DOMRange.END_TO_START:
			containerA = this.endContainer;
			offsetA = this.endOffset;
			break;
		}
		switch (how) {
		    case DOMRange.START_TO_START:
		    case DOMRange.END_TO_START:
			containerB = sourceRange.startContainer;
			offsetB = sourceRange.startOffset;
			break;
		    case DOMRange.START_TO_END:
		    case DOMRange.END_TO_END:
			containerB = sourceRange.endContainer;
			offsetB = sourceRange.endOffset;
			break;
		}
		
		// compare
		return containerA.sourceIndex < containerB.sourceIndex ? -1 :
		    containerA.sourceIndex == containerB.sourceIndex ?
		        offsetA < offsetB ? -1 : offsetA == offsetB ? 0 : 1
		        : 1;
	},
	cloneRange: function () {
		// return cloned range
		var range = new DOMRange(this._document);
		range.setStart(this.startContainer, this.startOffset);
		range.setEnd(this.endContainer, this.endOffset);
		return range;
	},
	detach: function () {
//[TODO] Releases Range from use to improve performance. 
	},
	toString: function () {
		return TextRangeUtils.convertFromDOMRange(this).text;
	},
	createContextualFragment: function (tagString) {
		// parse the tag string in a context node
		var content = (DOMUtils.isDataNode(this.startContainer) ? this.startContainer.parentNode : this.startContainer).cloneNode(false);
		content.innerHTML = tagString;
		// return a document fragment from the created node
		for (var fragment = this._document.createDocumentFragment(); content.firstChild; )
			fragment.appendChild(content.firstChild);
		return fragment;
	}
};

/*
  Range iterator
 */

function RangeIterator(range) {
	this.range = range;
	if (range.collapsed)
		return;

//[TODO] ensure this works
	// get anchors
	var root = range.commonAncestorContainer;
	this._next = range.startContainer == root && !DOMUtils.isDataNode(range.startContainer) ?
	    range.startContainer.childNodes[range.startOffset] :
	    DOMUtils.findClosestAncestor(root, range.startContainer);
	this._end = range.endContainer == root && !DOMUtils.isDataNode(range.endContainer) ?
	    range.endContainer.childNodes[range.endOffset] :
	    DOMUtils.findClosestAncestor(root, range.endContainer).nextSibling;
}

RangeIterator.prototype = {
	// public properties
	range: null,
	// private properties
	_current: null,
	_next: null,
	_end: null,

	// public methods
	hasNext: function () {
		return !!this._next;
	},
	next: function () {
		// move to next node
		var current = this._current = this._next;
		this._next = this._current && this._current.nextSibling != this._end ?
		    this._current.nextSibling : null;

		// check for partial text nodes
		if (DOMUtils.isDataNode(this._current)) {
			if (this.range.endContainer == this._current)
				(current = current.cloneNode(true)).deleteData(this.range.endOffset, current.length - this.range.endOffset);
			if (this.range.startContainer == this._current)
				(current = current.cloneNode(true)).deleteData(0, this.range.startOffset);
		}
		return current;
	},
	remove: function () {
		// check for partial text nodes
		if (DOMUtils.isDataNode(this._current) &&
		    (this.range.startContainer == this._current || this.range.endContainer == this._current)) {
			var start = this.range.startContainer == this._current ? this.range.startOffset : 0;
			var end = this.range.endContainer == this._current ? this.range.endOffset : this._current.length;
			this._current.deleteData(start, end - start);
		} else
			this._current.parentNode.removeChild(this._current);
	},
	hasPartialSubtree: function () {
		// check if this node be partially selected
		return !DOMUtils.isDataNode(this._current) &&
		    (DOMUtils.isAncestorOrSelf(this._current, this.range.startContainer) ||
		        DOMUtils.isAncestorOrSelf(this._current, this.range.endContainer));
	},
	getSubtreeIterator: function () {
		// create a new range
		var subRange = new DOMRange(this.range._document);
		subRange.selectNodeContents(this._current);
		// handle anchor points
		if (DOMUtils.isAncestorOrSelf(this._current, this.range.startContainer))
			subRange.setStart(this.range.startContainer, this.range.startOffset);
		if (DOMUtils.isAncestorOrSelf(this._current, this.range.endContainer))
			subRange.setEnd(this.range.endContainer, this.range.endOffset);
		// return iterator
		return new RangeIterator(subRange);
	}
};

/*
  DOM Selection
 */
 
//[NOTE] This is a very shallow implementation of the Selection object, based on Webkit's
// implementation and without redundant features. Complete selection manipulation is still
// possible with just removeAllRanges/addRange/getRangeAt.

function DOMSelection(document) {
	// save document parameter
	this._document = document;
	
	// add DOM selection handler
	var selection = this;
	document.attachEvent('onselectionchange', function () { selection._selectionChangeHandler(); });
}

DOMSelection.prototype = {
	// public properties
	rangeCount: 0,
	// private properties
	_document: null,
	
	// private methods
	_selectionChangeHandler: function () {
		// check if there exists a range
		this.rangeCount = this._selectionExists(this._document.selection.createRange()) ? 1 : 0;
	},
	_selectionExists: function (textRange) {
		// checks if a created text range exists or is an editable cursor
		return textRange.compareEndPoints('StartToEnd', textRange) != 0 ||
		    textRange.parentElement().isContentEditable;
	},
	
	// public methods
	addRange: function (range) {
		// add range or combine with existing range
		var selection = this._document.selection.createRange(), textRange = TextRangeUtils.convertFromDOMRange(range);
		if (!this._selectionExists(selection))
		{
			// select range
			textRange.select();
		}
		else
		{
			// only modify range if it intersects with current range
			if (textRange.compareEndPoints('StartToStart', selection) == -1)
				if (textRange.compareEndPoints('StartToEnd', selection) > -1 &&
				    textRange.compareEndPoints('EndToEnd', selection) == -1)
					selection.setEndPoint('StartToStart', textRange);
			else
				if (textRange.compareEndPoints('EndToStart', selection) < 1 &&
				    textRange.compareEndPoints('EndToEnd', selection) > -1)
					selection.setEndPoint('EndToEnd', textRange);
			selection.select();
		}
	},
	removeAllRanges: function () {
		// remove all ranges
		this._document.selection.empty();
	},
	getRangeAt: function (index) {
		// return any existing selection, or a cursor position in content editable mode
		var textRange = this._document.selection.createRange();
		if (this._selectionExists(textRange))
			return TextRangeUtils.convertToDOMRange(textRange, this._document);
		return null;
	},
	toString: function () {
		// get selection text
		return this._document.selection.createRange().text;
	}
};

/*
  scripting hooks
 */

document.createRange = function () {
	return new DOMRange(document);
};

var selection = new DOMSelection(document);
window.getSelection = function () {
	return selection;
};

//[TODO] expose DOMRange/DOMSelection to window.?

})();
/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);

function debugout (s)
{
	s = ""+s;
//	s = s.replace (/\n/g, "N");
//	s = s.replace (/\r/g, "R");
//	s = s.replace (/\t/g, "T");
//	s = s.replace (/ /g, "/");

	s = s.replace (/&/g, "&amp;");
	s = s.replace (/</g, "&lt;");
	var div = document.getElementById ("debug");
	if (div) div.innerHTML += s+"<br/>";

//	netscape.security.PrivilegeManager.enablePrivilege ("UniversalXPConnect");
//	var consoleServce = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interface.nsIConsoleService);
//	consoleService.logStringMessage (s);
}

function builtin__serialize (obj)
{
//	debugout ("typeof obj = "+(typeof obj));
	if (builtin__is_array (obj))
	{
		var res = "a:"+obj.length+":{";
		var i;
		for (i = 0; i < obj.length; i++)
		{
			res += builtin__serialize (i);
			res += builtin__serialize (obj[i]);
		}
		return res+"}";
	}
	else if (typeof obj == "object")
	{
		var count = 0;
		for (key in obj)
			count++;
		var res = "a:"+count+":{";
		for (key in obj)
		{
			res += builtin__serialize (key);
			res += builtin__serialize (obj[key]);
		}
		return res+"}";
	}
	else if (typeof obj == "string")
	{
		return "s:"+obj.length+":\""+obj+"\";";
	}
	else if (typeof obj == "number")
	{
		return "i:"+obj+";";
	}
	else if (typeof obj == "boolean")
	{
		return "b:"+(obj?"1":"0")+";";
	}
	else
	{
		return "N;";
	}
}

function builtin__unserializer (s)
{
	this.str = s;

	this.pop_to_term = function ()
	{
		var res = this.str.match (/^([^;\:]*)[;\:](.*)$/);
		if (res === null) this.die ("Failed to pop to term on '"+this.str+"'");
		this.str = res[2];
		return res[1];
	}

	this.pop_count = function (n)
	{
		var res = this.str.substr (0,n);
		this.str = this.str.substr (n);
		return res;
	}

	this.die = function (msg)
	{
		alert (msg);
		throw msg;
	}

	this.evaluate = function ()
	{
		var code = this.pop_to_term ();
		if (code == "i")
		{
			var val = this.pop_to_term ();
			return parseInt(val,10);
		}
		else if (code == "N")
		{
			return null;
		}
		else if (code == "b")
		{
			var val = this.pop_to_term ();
			return val == 1;
		}
		else if (code == "s")
		{

			var len = this.pop_to_term ();
			var quote = this.pop_count (1);
			if (quote != "\"") this.die ("Expected open quote");
			var res = this.pop_count (len);
			var quote = this.pop_count (2);
			if (quote != "\";") this.die ("Expected close quote");
			return res;
		}
		else if (code == "a")
		{
			var n = this.pop_to_term ();
			if (this.pop_count (1) != "{") this.die ("Expected {");
			var is_struct = false;
			var sobj = new Object;
			var aobj = new Array;
			for (var i = 0; i < n; i++)
			{
				var key = this.evaluate ();
				var val = this.evaluate ();
				if (key != i) is_struct = true;
				sobj[key] = val;
				aobj[i] = val;
			}
			if (this.pop_count (1) != "}") this.die ("Expected }");
			return is_struct ? sobj : aobj;
		}
		else
		{
			this.die ("Don't know what an "+code+" is");
		}
	}
}

function builtin__unserialize (s)
{
	var u = new builtin__unserializer (s);
	return u.evaluate ();
}


function builtin__md5 (str)
{
	return hex_md5 (str);
}

function builtin__sha1 (str)
{
	return SHA1 (str);
}


function builtin__error_log (str)
{
	debugout (str);
}

function builtin__set_focus (id)
{
	document.getElementById (id).focus();
}

function builtin__get_class (obj)
{
	return rpcclass.get_classname (obj);
}

function builtin__is_numeric (s)
{
	return builtin__preg_match ("/^\\d+$/", s);
}

/*
function builtin__call_static_method (classname, method, arg)
{
	if (rpcclass.classes2[classname].statics[method] == undefined) throw "Attempt to call static method "+classname+"::"+method+" which does not exist";
	return rpcclass.classes2[classname].statics[method] (arg);
}
*/

function builtin__array ()
{
	var res = new Array;
	for (var i = 0; arguments[i] != undefined; i++)
		res[i] = arguments[i];
	return res;
}

function builtin__count (a)
{
	if (a.constructor == Array) return a.length;
	var res = 0;
	for (key in a)
		res++;
	return res;
}

function rpcclass_save ()
{
	xmlrpc_init ();
	xmlrpc_action ();
}

function builtin__is_object (obj)
{
	if (typeof obj != "object") return false;
	if (obj == null) return false;
	if (obj.constructor == Array) return false;
	return true;
}

function builtin__is_array (obj)
{
	if (typeof obj != "object") return false;
	if (obj == null) return false;
	if (obj.constructor != Array) return false;
	return true;
}

function builtin__is_string (obj)
{
	return typeof obj == "string";
}


function builtin__substr (s, start, len)
{
	s = "" + s;
	if (arguments.length == 3)
		return s.substr(start,len);
	else
		return s.substr (start);
}

function builtin__str_replace (p, r, s)
{
	s = ""+s;
	var res = "";
	for (;;)
	{
		var i = s.indexOf (p);
		if (i == -1) return res + s;
		res += s.substr (0, i) + r;
		s = s.substr (i + p.length);
	}
}

function builtin__strlen (s)
{
	return s.length;
}

function builtin__strstr (haystack, needle)
{
	var pos = haystack.indexOf (needle);
	if (pos == -1)
		return null;
	else
		return haystack.substr (pos);
}

function builtin__strpos (haystack, needle)
{
	var pos = haystack.indexOf (needle);
	if (pos == -1)
		return false;
	else
		return pos;
}


function builtin__strtolower (s)
{
	return s.toLowerCase();
}


function builtin__rtrim (s, charlist)
{
	if (arguments.length == 1) charlist = " \t\n\r\0\x0b";
	s = ""+s;

	for (;;)
	{
		if (s.length == 0 || charlist.indexOf(s.substr(s.length-1,1)) == -1) break;
		s = s.substr(0,s.length-1);
	}

//	if (s.match (/^\s+$/)) return "";
//	var matches = s.match (/^(.*\S)\s*$/);
//	if (matches)
//	{
//		return matches[1];
//	}
	return s;
}

function builtin__ltrim (s, charlist)
{
	if (arguments.length == 1) charlist = " \t\n\r\0\x0b";
	s = ""+s;

	for (;;)
	{
		if (s.length == 0 || charlist.indexOf(s.substr(0,1)) == -1) break;
		s = s.substr(1);
	}

//	if (s.match (/^\s+$/)) return "";
//	var matches = s.match (/^\s+(\S.*)$/);
//	if (matches)
//	{
//		return matches[1];
//	}
	return s;
}


function builtin__trim (s, charlist)
{
	if (arguments.length == 1) charlist = " \t\n\r\0\x0b";
	return builtin__rtrim (builtin__ltrim (s, charlist), charlist);
}

function builtin__isset (o)
{
	return typeof o !== "undefined";
}

function builtin__aarray ()
{
	return new Object;
}

function builtin__debugout (s)
{
	debugout(s);
}

function builtin__make_uniq ()
{
	if (window.rpcclass_uniq === undefined) window.rpcclass_uniq = 4314;
	return "JSX"+(++window.rpcclass_uniq);
}

function builtin__addslashes (s)
{
	return s.replace (/"/g, "\\\"");
}


function builtin__explode (boundary, string)
{
	var res = string.split (boundary);
	return res;
}

function builtin__time ()
{
	var d = new Date ();
	return parseInt(d.getTime()/1000);
}

function builtin__cal_days_in_month (calendar, month, year)
{
	return (month == 2) ? (year % 4 ? 28 : (year % 100 ? 29 : (year % 400 ? 28 : 29))) : (((month - 1) % 7 % 2) ? 30 : 31);
}

// var builtin__sprintf = sprintf;

function builtin__date (fmt, parm)
{
	if (arguments.length == 1)
		var value = new Date ();
	else
		var value = new Date (parm*1000);
	var res = "";
	for (i = 0; i < fmt.length; i++)
	{
		switch (fmt.substr(i,1))
		{
		case 'r':
			res += value.toLocaleString();
			break;

		case 'Y':
			res += value.getFullYear();
			break;

		case 'y':
			var n = value.getFullYear() % 100;
			if (n < 10)
				res += "0"+n;
			else
				res += n;
			break;


		case 'm':
			if (value.getMonth() < 9)
				res += "0" + (1 + value.getMonth());
			else
				res += 1 + value.getMonth();
			break;

		case 'F':
			var months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
			res += months[value.getMonth()];
			break;


		case 'M':
			var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
			res += months[value.getMonth()];
			break;

		case 'j':
			res += value.getDate();
			break;

		case 'S':
			var units = value.getDate() % 10;
			var tens = parseInt ((value.getDate() % 100) / 10, 10);
			if (tens == 1)
			{
				res += "th";
			}
			else
			{
				if (units == 1)
					res += "st";
				else if (units == 2)
					res += "nd";
				else if (units == 3)
					res += "rd";
				else
					res += "th";
			}
			break;

		case 'd':
			if (value.getDate() < 10)
				res += "0"+value.getDate();
			else
				res += value.getDate();
			break;

		case 'w':
			res += value.getDay();
			break;


		case 'D':
			var days = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];
			res += days[value.getDay()];
			break;

		case 'i':	// minutes with leading zeros
			if (value.getMinutes() < 10)
				res += "0"+value.getMinutes();
			else
				res += value.getMinutes();
			break;

		case 's':	// seconds with leading zeros
			if (value.getSeconds() < 10)
				res += "0"+value.getSeconds();
			else
				res += value.getSeconds();
			break;

		case 'H':	// 24 hour hours with leading zeros
			if (value.getHours() < 10)
				res += "0"+value.getHours();
			else
				res += value.getHours();
			break;

		default:
			res += fmt.substr(i,1);
			break;
		}
	}
//		var n = this.datetime;
//		var d = new Date (n*1000);
//		return d.toTimeString().substr(0,5);
	return res;
}

function builtin__htmlentities (text)
{
	text = ""+text;
	text = text.replace (/&/g, "&amp;");
	text = text.replace (/"/g, "&quot;");
	text = text.replace (/'/g, "&apos;");
	text = text.replace (/</g, "&lt;");
	text = text.replace (/>/g, "&gt;");
	return text;
}

function builtin__floatval (text)
{
	return parseFloat (text);
}

function builtin__str_pad (str, len, pad, end)
{
	if (arguments.length < 3) pad = " ";
	if (arguments.length < 4) end = 1;
	pad = ""+pad;
	str = ""+str;
	if (end == 0)
	{
		while (str.length < len) str = pad+str;
	}
	else if (end == 1)
	{
		while (str.length < len) str += pad;
	}
	else
	{
		throw "STR_PAD_BOTH not implemented yet";
	}
	return str;
}

function builtin__alert (text)
{
	alert (text);
}

function builtin__die (text)
{
	alert (text);
	throw text;
}

function builtin__method_exists (obj, method)
{
	if (obj.constructor == String)
	{
		// must be a class name
		var c = eval (obj);
		return c[method] !== undefined || c["inst__"+method] !== undefined;
	}
	return obj[method] !== undefined || obj.constructor["pinst__"+method] !== undefined;
}

function builtin__in_array (item, arr)
{
	for (var i in arr)
	{
		if (arr[i] == item)
		{
			return true;
		}
	}
	return false;
}

function builtin__array_search (item, arr)
{
	for (var i in arr)
	{
		if (arr[i] == item)
		{
			return i;
		}
	}
	return false;
}


function builtin__preg_match (phppattern, string, matches)
{
	var splitter = phppattern.substr(0,1);
	if (phppattern.substr(phppattern.length-1,1) != splitter) throw "Can't do this yet";
	var pattern = phppattern.substr(1,phppattern.length-2);
	var attribs = "";
	var re = new RegExp (pattern, attribs);
	string = ""+string;
	var res = string.match (re);
	if (res == null) return false;
	if (matches != undefined)
	{
		for (var i in res)
			matches[i] = res[i];
	}
	return true;
}

function builtin__preg_match_all (phppattern, string, matches, flags)
{
	if (arguments.length < 4) flags = 1;
	var splitter = phppattern.substr(0,1);
	if (phppattern.substr(phppattern.length-1,1) != splitter) throw "Can't do this yet";
	var pattern = phppattern.substr(1,phppattern.length-2);
	var attribs = "g";
	var re = new RegExp (pattern, attribs);
	var count = 0;
	string = ""+string;
	if (flags == 1)
	{
		// PREG_PATTERN_ORDER mode
		while (null != (m = re.exec (string)))
		{
			for (var i in m)
			{
				if (matches[i] == undefined) matches[i] = new Array;
				matches[i][count] = m[i];
			}
			count++;
		}
	}
	else
	{
		// PREG_SET_ORDER mode
		while (null != (m = re.exec (string)))
		{
			matches[count] = new Array;
			for (var i in m)
			{
				matches[count][i] = m[i];
			}
			count++;
		}
	}
	return count;
}

function builtin__preg_replace (phppattern, replace, str)
{
	var splitter = phppattern.substr(0,1);
	if (phppattern.substr(phppattern.length-1,1) != splitter) throw "Can't do this yet";
	var pattern = phppattern.substr(1,phppattern.length-2);
	var re = new RegExp (pattern, "g");
	var res = str.replace (re, replace);
	return res;
}

function builtin__preg_replace_callback (phppattern, fn, str)
{
	var splitter = phppattern.substr(0,1);
	if (phppattern.substr(phppattern.length-1,1) != splitter) throw "Can't do this yet";
	var pattern = phppattern.substr(1,phppattern.length-2);
	var re = new RegExp (pattern, "g");

	function replacer (s)
	{
		if (builtin__is_array (fn))
		{
			obj = fn[0];
			method = fn[1];
			return obj[method] (arguments);
		}
		else
		{
			return fn (arguments);
		}
	}

	var res = str.replace (re, replacer);
	return res;
}


function builtin__mktime (hour, min, sec, month, day, year)
{
	var d = new Date (year, month-1, day, hour, min, sec, 0);
	return d.getTime()/1000;
}

function builtin__parse_mysql_datetime (mt)
{
	if (mt == "") return 0;
	if (mt == "0000-00-00 00:00:00") return 0;
	res = builtin__mktime (mt.substr(11,2),mt.substr(14,2),mt.substr(17,2),mt.substr(5,2),mt.substr(8,2),mt.substr(0,4));
	return res;
}

function builtin__ord (ch)
{
	return ch.charCodeAt (0);
}

function builtin__urlencode (s)
{
	s = encodeURIComponent (s);
	return s.replace ("/ /g", "+");
}

function builtin__urldecode (s)
{
	s = s.replace (/\+/g, " ");
	return decodeURIComponent(s);
}

function builtin__base64_encode (s)
{
	return Base64.encode (s);
}

function builtin__base64_decode (s)
{
	return Base64.decode (s);
}


function builtin__array_splice (arr, offset, len, replace)
{
	if (len) arr.splice (offset, len);
	if (arguments.length == 4)
	{
		if (replace.constructor == Array)
		{
			for (i in replace)
			{
				var item = replace[i];
				arr.splice (parseInt(offset,10)+parseInt(i,10), 0, item);
			}
		}
		else
		{
			arr.splice (offset, 0, replace);
		}
	}
	return arr;
}

function builtin__usort (arr, fn)
{
	if (builtin__is_array (fn))
	{
		if (fn[0].constructor == String)
		{
			var cls = eval (fn[0]);
			var sortfn = cls[fn[1]];
			arr.sort (sortfn);
		}
		else
		{
			throw "Object method comparison fn not implemented yet";
		}
	}
	else
	{
		throw "global comparison fn not implemented yet";
	}
}

function builtin__implode (sep, arr)
{
	return arr.join (sep);
}


/*
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321.
 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
 */

/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */

/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }

/* 
 * Perform a simple self-test to see if the VM is working 
 */
function md5_vm_test()
{
  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}

/*
 * Calculate the MD5 of an array of little-endian words, and a bit length
 */
function core_md5(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;
  
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;
 
    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);

    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);

    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);

    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
  }
  return Array(a, b, c, d);
  
}

/*
 * These functions implement the four basic operations the algorithm uses.
 */
function md5_cmn(q, a, b, x, s, t)
{
  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}

/*
 * Calculate the HMAC-MD5, of a key and some data
 */
function core_hmac_md5(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++) 
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md5(opad.concat(hash), 512 + 128);
}

/*
 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
 * to work around bugs in some JS interpreters.
 */
function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

/*
 * Bitwise rotate a 32-bit number to the left.
 */
function bit_rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

/*
 * Convert a string to an array of little-endian words
 * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
 */
function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}

/*
 * Convert an array of little-endian words to a string
 */
function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}

/*
 * Convert an array of little-endian words to a hex string.
 */
function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}

/*
 * Convert an array of little-endian words to a base-64 string
 */
function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

function php_frame (name, instrs)
{
	this.fnname = name;
	this.instrs = instrs;
	this.pc = 0;
	this.s = new Array;
	this.v = new Object;
}

function php_engine (name, instrs)
{
	this.old_frames = new Array;
	this.old_frames_depth = 0;
	this.frame = new php_frame (name, instrs);
	this.running = false;
	this.thread_id = ++php_engine.started_threads;

	this.backtrace = function (error)
	{
		debugout ("Backtrace....");
		debugout (error+" in function "+this.frame.fnname);
		if (this.m !== undefined) debugout ("Marker is "+this.frame.m);
		for (var i = 0; i < this.old_frames_depth; i++)
		{
			debugout ("called from "+this.old_frames[this.old_frames_depth-i-1].fnname+" at marker "+this.old_frames[this.old_frames_depth-i-1].m);
		}
	}

	this.destroy = function ()
	{
		var i;
		var found = false;
		for (i = 0; i < php_engine.threads.length; i++)
		{
			if (php_engine.threads[i] == this)
			{
				php_engine.threads.splice (i,1);
				found = true;
				break;
			}
		}
		if (!found)
			throw "Failed to find thread during thread stop";
		asyncnotify.thread_stopping();
	}

	this.run = function ()
	{
//		debugout ("Running......\n\n");

		php_engine.current_thread = this;
		var saved_onerror = window.onerror;
		window.onerror = php_engine.error_handler;

		var max = 100000;
		this.running = true;
		this.tracing = 0;
		while (this.running)
		{
			if (this.tracing)
			{
				var text = "";
				for (varname in this.frame.v) text += varname+":"+this.frame.v[varname]+",";
				debugout ("v "+text);
debugout ("this.frame.pc = "+this.frame.pc);
debugout ("this.frame.instrs = "+this.frame.instrs);
				if (this.frame.pc >= 0 && this.frame.instrs != null)
					debugout ("execute "+this.frame.pc+":"+this.frame.instrs[this.frame.pc]);
			}

 			if (this.frame.instrs == null)
			{
				this.destroy ()
				break;
			}
			if (this.frame.pc == -1)
				this.php_return_void (0);
			else
			{
				var pc = this.frame.pc++;
				if (this.frame.instrs[this.frame.pc] == null) this.frame.pc = -1;
				this.frame.instrs[pc] (this, this.frame);
			}
		}
//		debugout ("Quit run loop\n\n");
		window.onerror = saved_onerror;
		php_engine.current_thread = null;
	}

	this.php_return_void = function (stack_depth)
	{
		if (this.old_frames_depth == 0)
		{
			debugout ("Finished executing PHP\n");
			this.running = false;
		}
		else
		{
//			debugout ("returning from PHP function - depth = "+this.old_frames_depth+"\n");
			this.frame = this.old_frames[--this.old_frames_depth];
			this.old_frames[this.old_frames_depth] = null;
		}
	}

	this.return_pop = function (res)
	{
		if (this.old_frames_depth == 0)
		{
			debugout ("Finished executing PHP\n");
			this.running = false;
		}
		else
		{
//			debugout ("returning from PHP function - depth = "+this.old_frames_depth+"\n");
			this.frame = this.old_frames[--this.old_frames_depth];
			this.old_frames[this.old_frames_depth] = null;
			stack_depth = this.frame.saved_sp;
			this.php_push (stack_depth++, res);
		}
	}


	this.php_return_pop = function (stack_depth)
	{
		if (this.old_frames_depth == 0)
		{
			debugout ("Finished executing PHP\n");
			this.running = false;
		}
		else
		{
//			debugout ("returning from PHP function - depth = "+this.old_frames_depth+"\n");
			res = this.php_pop(stack_depth--);
			this.frame = this.old_frames[--this.old_frames_depth];
			this.old_frames[this.old_frames_depth] = null;
			stack_depth = this.frame.saved_sp;
			this.php_push (stack_depth++, res);
		}
	}

	this.smcall = function (stack_depth, classobj, methodname, args)
	{
		var nargs = args.length;
		stack_depth -= nargs;

		if (typeof classobj != "function")
		{
			this.backtrace ("Classobj is not a function but a '"+(typeof classobj)+"'");
			throw "Classobj is not a function but a '"+(typeof classobj)+"' in call to method "+methodname;
		}

		var codegroup = classobj.codegroup;
		if (codegroup !== undefined)
		{
			classobj.codegroup = undefined;
			var dlargs = ([codegroup, classobj.prototype.classname, methodname, args]);
			this.smcall (stack_depth+dlargs.length, dynloader, "load_codegroup_smcall", dlargs);
			return;
		}

		var instrs = classobj["inst__"+methodname];
		var arg_names = classobj["args__"+methodname];
//		debugout ("calling "+classobj.prototype.classname+":"+methodname+", arg_names = "+arg_names);
		if (arg_names === undefined)
		{
			// need to fix this
			if (classobj[methodname] === undefined)
			{
				alert ("Bad method "+methodname+" : "+typeof classobj[methodname]+" in class "+classobj);
			}
			else
			{
				var res = classobj[methodname].apply (null, args);
				this.php_push (stack_depth++, res);
			}
		}
		else
		{
			if (nargs < arg_names.length)
			{
				var err = "argument missing in call to "+methodname+" ";
				for (var xi = 0; xi < arg_names.length; xi++)
					err += arg_names[xi]+",";
				err += " = ";
				for (var xi = 0; xi < nargs; xi++)
					err += args[xi]+",";
//				debugout (err);
				this.backtrace (err);

				while (args.length < arg_names.length)
					args[args.length] = null;
			}

//			var args = new Array;
//			for (var i = 0; i < arg_names.length; i++)
//				args[i] = this.php_pop();

			this.frame.saved_sp = stack_depth;

			this.old_frames[this.old_frames_depth++] = this.frame;
			this.frame = new php_frame (classobj.prototype.classname+"::"+methodname, instrs);
			for (var i = 0; i < arg_names.length; i++)
			{
				this.frame.v[arg_names[i]] = args[i];
			}
		}
	}

	this.php_static_method_call = function (stack_depth, classobj, methodname, nargs)
	{
		var args = new Array;
		var sd = stack_depth;
		for (var i = 0; i < nargs; i++)
			args[i] = this.php_pop(sd--);

		this.smcall (stack_depth, classobj, methodname, args);
	}

	this.mcall = function (stack_depth, obj, methodname, args)
	{
		var nargs = args.length;
		stack_depth -= 2+nargs;

		if (obj === undefined || obj === null)
		{
			this.backtrace ("Bad object in call to "+methodname);
			throw "Bad object";
		}

		var classname = obj.classname;
		if (classname !== undefined)
		{
			var cls = eval(classname);
			var codegroup = cls.codegroup;
			if (codegroup !== undefined)
			{
				cls.codegroup = undefined;
				var dlargs = ([codegroup, obj, methodname, args]);
				this.smcall (stack_depth+dlargs.length, dynloader, "load_codegroup_mcall", dlargs);
				return;
			}
		}

//		debugout ("calling method "+classname+"::"+methodname);

		// warning: IE7 doesn't have a constructor attribute on builtins
		if (obj.constructor === undefined || obj.constructor["pargs__"+methodname] === undefined)
		{
			// need to fix this
			if (obj[methodname] === undefined)
			{
				alert ("Bad method "+methodname+" : "+typeof obj[methodname]+" in object "+obj);
			}
			else
			{
//				debugout ("Calling native method "+obj+":"+methodname);

				/* IE is a bit rubbish here, apply is not available on native methods */

				var res = null;

				switch (nargs)
				{
				case 0:
					res = obj[methodname] ();
					break;
				case 1:
					res = obj[methodname] (args[0]);
					break;
				case 2:
					res = obj[methodname] (args[0], args[1]);
					break;
				case 3:
					res = obj[methodname] (args[0], args[1], args[2]);
					break;
				case 4:
					res = obj[methodname] (args[0], args[1], args[2], args[3]);
					break;
				case 5:
					res = obj[methodname] (args[0], args[1], args[2], args[3], args[4]);
					break;

				default:
					alert ("Native method - too many arguments - call John");
					throw "Native method - too many arguments - call John";
				}

				this.php_push (stack_depth++, res);
			}
		}
		else
		{
			var instrs = obj.constructor["pinst__"+methodname];
			var arg_names = obj.constructor["pargs__"+methodname];
			if (nargs < arg_names.length)
			{
				var err = "argument missing in call to "+methodname+" ";
				for (var xi = 0; xi < arg_names.length; xi++)
					err += arg_names[xi]+",";
				err += " = ";
				for (var xi = 0; xi < nargs; xi++)
					err += args[xi]+",";
//				debugout (err);
				this.backtrace (err);

				while (args.length < arg_names.length)
					args[args.length] = null;
			}

			this.frame.saved_sp = stack_depth;
			this.old_frames[this.old_frames_depth++] = this.frame;
			this.frame = new php_frame (classname+"::"+methodname, instrs);
			this.frame.v["this"] = obj;
			for (var i = 0; i < arg_names.length; i++)
				this.frame.v[arg_names[i]] = args[i];
		}
	}

	this.php_method_call = function (stack_depth, nargs)
	{
		var sd = stack_depth;
		var obj = this.php_pop(sd--);
		var methodname = this.php_pop(sd--);
		var args = new Array;
		for (var i = 0; i < nargs; i++)
			args[i] = this.php_pop(sd--);

		this.mcall (stack_depth, obj, methodname, args);
	}

	this.php_array = function (stack_depth, n)
	{
		var res = new Array;
		var i;
		for (i = 0; i < n; i++)
			res[res.length] = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, res);
	}

	this.php_aarray = function (stack_depth, n)
	{
		var res = new Object;
		var i;
		for (i = 0; i < n; i++)
		{
			var key = this.php_pop(stack_depth--);
			var val = this.php_pop(stack_depth--);
			res[key] = val;
		}
		this.php_push (stack_depth++, res);
	}

	this.php_unset = function (stack_depth)
	{
		var target = this.php_pop(stack_depth--);
		delete target.obj[target.field];
	}

	this.php_builtin = function (stack_depth, fn, nargs)
	{
		switch (fn)
		{
		case "intval":
			var s = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, parseInt(s,10));
			break;

		case "die":
			var s = this.php_pop(stack_depth--);
			alert ("Die "+s);
			this.running = false;
			break;

		case "document_getElementById":
			var el = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, document.getElementById (el));
			break;

		case "document_getInnerHTML":
			var el = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, el.innerHTML);
			break;

		case "document_setInnerHTML":
			var el = this.php_pop(stack_depth--);
			var val = this.php_pop(stack_depth--);
			el.innerHTML = val;
			break;

		case "wait_for_completion":
			this.cover = new cover;
			this.cover.open ();
			this.running = false;
			this.frame.saved_sp = stack_depth;
//			debugout ("suspending thread "+this.thread_id);
			break;

		case "wait_for_input":
			this.running = false;
//			debugout ("Suspending......\n\n");
			this.frame.saved_sp = stack_depth;
			break;

		case "alert":
			var msg = this.php_pop(stack_depth--);
			alert (msg);
			break;

		case "debugout":
			var msg = this.php_pop(stack_depth--);
			debugout (msg);
			break;

		case "strlen":
			var str = this.php_pop(stack_depth--);
			if (str === null) this.backtrace ("str is null");
			this.php_push (stack_depth++, str.length);
			break;

//		case "urlencode":
//			var s = this.php_pop(stack_depth--);
//			this.php_push (stack_depth++, encodeURIComponent(s));
//			break;

		case "addslashes":
			var s = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, builtin__addslashes (s));
			break;

		case "htmlentities":
			var s = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, builtin__htmlentities (s));
			break;

		case "urldecode":
			var s = this.php_pop(stack_depth--);
			s = s.replace (/\+/g, " ");
			this.php_push (stack_depth++, decodeURIComponent(s));
			break;

		case "is_array":
			var arr = this.php_pop(stack_depth--);
			if (arr === undefined || arr === null)
			{
				this.php_push (stack_depth++, false);
				break;
			}
			this.php_push (stack_depth++, arr.constructor == Array);
			break;

		case "in_array":
			var item = this.php_pop(stack_depth--);
			var arr = this.php_pop(stack_depth--);
			var res = false;
			for (var i in arr)
			{
				if (arr[i] == item)
				{
					res = true;
					break;
				}
			}
			this.php_push (stack_depth++, res);
			break;

		case "isset":
			var obj = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, obj !== undefined);
			break;

		case "count":
			var obj = this.php_pop(stack_depth--);
			if (obj === undefined || obj === null)
			{
				this.backtrace ("obj is undefined");
				this.php_push (stack_depth++, 0);
				break;
			}
			this.php_push (stack_depth++, obj.length);
			break;

		case "intval":
			var n = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, parseInt(n,10));
			break;


		case "get_class":
			var obj = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, obj.classname);
			break;

		case "strstr":
			var haystack = this.php_pop(stack_depth--);
			var needle = this.php_pop(stack_depth--);
			var pos = haystack.indexOf (needle);
			if (pos == -1)
				this.php_push (stack_depth++, null);
			else
				this.php_push (stack_depth++, haystack.substr (pos));
			break;

		case "str_replace":
			var pattern = this.php_pop(stack_depth--);
			var replacement = this.php_pop(stack_depth--);
			var str = this.php_pop(stack_depth--);
			str = str.replace (pattern, replacement);
			this.php_push(stack_depth++, str);
			break;

		case "substr":
			if (nargs == 3)
			{
				var s = this.php_pop(stack_depth--);
				var start = this.php_pop(stack_depth--);
				var len = this.php_pop(stack_depth--);
				s = ""+s;
				var res = s.substr(start,len);
				this.php_push (stack_depth++, res);
			}
			else
			{
				var s = this.php_pop(stack_depth--);
				var start = this.php_pop(stack_depth--);
				s = ""+s;
				var res = s.substr(start,s.length-start);
				this.php_push (stack_depth++, res);
			}
			break;

		case "mktime":
			var hours = this.php_pop(stack_depth--);
			var mins = this.php_pop(stack_depth--);
			var secs = this.php_pop(stack_depth--);
			var month = this.php_pop(stack_depth--);
			var day = this.php_pop(stack_depth--);
			var year = this.php_pop(stack_depth--);
			var d = new Date (year, month-1, day, hours, mins, secs, 0);
			this.php_push (stack_depth++, d.valueOf() / 1000);
			break;

		case "date":
			var fmt = this.php_pop(stack_depth--);
			var val = builtin__time();
			if (nargs == 2)
				val = this.php_pop(stack_depth--);
			var res = builtin__date (fmt, val);
			this.php_push (stack_depth++, res);
			break;

		case "explode":
			var boundary = this.php_pop(stack_depth--);
			var str = "" + this.php_pop(stack_depth--);
			var res = str.split (boundary);
			this.php_push (stack_depth++, res);
			break;

		case "trace":
			this.tracing = this.php_pop(stack_depth--);
			break;

		case "array_splice":
			var arr = this.php_pop(stack_depth--);
			var offset = this.php_pop(stack_depth--);
			var len = this.php_pop(stack_depth--);
			if (len) arr.splice (offset, len);
			if (nargs == 4)
			{
				var replace = this.php_pop(stack_depth--);
				if (replace.constructor == Array)
				{
					for (i in replace)
					{
						var item = replace[i];
						arr.splice (parseInt(offset,10)+parseInt(i,10), 0, item);
					}
				}
				else
				{
					arr.splice (offset, 0, replace);
				}
			}
			this.php_push (stack_depth++, arr);
			break;

		case "sleep":
			var args = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, args);
			this.php_static_method_call (stack_depth, lib, "sleep", 1);
			break;

		case "phpengine_call_static_method":
			var classname = this.php_pop(stack_depth--);
			var methodname = this.php_pop(stack_depth--);
			var args = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, args);
			this.php_static_method_call (stack_depth, eval(classname), methodname, 1);
			break;

		case "phpengine_call_method":
			var nargs = this.php_pop(stack_depth--);
			var obj = this.php_pop(stack_depth--);
			var methodname = this.php_pop(stack_depth--);
			var args = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, args);
			this.php_push (stack_depth++, methodname);
			this.php_push (stack_depth++, obj);
			this.php_method_call (stack_depth, nargs);
			break;

		case "call_user_func_array":
			var fn = this.php_pop(stack_depth--);
			var args = this.php_pop(stack_depth--);
			if (typeof(fn) == "object" && fn.constructor == Array)
			{
				var obj = fn[0];
				var method = fn[1];
				if (obj.constructor === String)
				{
					var classobj = eval(obj);
					this.smcall (stack_depth+args.length, classobj, method, args);
				}
				else
				{
					this.mcall (stack_depth+2+args.length, obj, method, args);
				}
			}
			else
			{
				throw "call_user_func_array can only do class members";
			}
			break;

		case "ob_start":
			if (window.__outbuffer !== undefined)
			{
				if (window.__outbuffer_stack === undefined)
					window.__outbuffer_stack = new Array;
				window.__outbuffer_stack.push (window.__outbuffer);
			}
			window.__outbuffer = "";
			break;

		case "ob_get_clean":
			var value = window.__outbuffer;
			if (window.__outbuffer_stack !== undefined)
				window.__outbuffer = window.__outbuffer_stack.pop();
			this.php_push (stack_depth++, value);
			break;

		case "trim":
			var str = this.php_pop(stack_depth--);
			this.php_push (stack_depth++, builtin__trim(str));
			break;

		case "aarray":
			this.php_push (stack_depth++, new Object);
			break;

		default:
			var args = new Array;
			var i;
			for (i = 0; i < nargs; i++)
				args[args.length] = this.php_pop(stack_depth--);
			var f = eval("builtin__"+fn);
			var res = f.apply (null, args);
			this.php_push (stack_depth++, res);
			break;
		}
	}

	this.php_new = function (stack_depth, classname)
	{	
		this.php_push (stack_depth++, eval ("new "+classname));
	}

	this.php_deref_lvalue = function (stack_depth)
	{
		var obj = this.php_pop(stack_depth--);
		var fieldname = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, ({obj:obj, field:fieldname}));
	}

	this.php_push_int = function (stack_depth, i)
	{
		this.php_push (stack_depth++, i);
	}

	this.php_push_null = function (stack_depth)
	{
		this.php_push (stack_depth++, null);
	}

	this.php_push_true = function (stack_depth)
	{
		this.php_push (stack_depth++, true);
	}

	this.php_push_false = function (stack_depth)
	{
		this.php_push (stack_depth++, false);
	}

	this.php_push_static_var_lvalue = function (stack_depth, classobj, name)
	{
		this.php_push (stack_depth++, ({obj:classobj, field:name}));
	}

	this.php_push_var_lvalue = function (stack_depth, name)
	{
		this.php_push (stack_depth++, ({obj:this.frame.v, field:name}));
	}

	this.php_push_global_lvalue = function (stack_depth, name)
	{
		this.php_push (stack_depth++, ({obj:null, field:name}));
	}

	this.php_push_static_var = function (stack_depth, classobj, name)
	{
		var val = classobj[name];
		this.php_push (stack_depth++, val);
	}

	this.php_push_var = function (stack_depth, name)
	{
		var val = this.frame.v[name];
		this.php_push (stack_depth++, val);
	}

	this.php_push_global = function (stack_depth, name)
	{
		var val = eval(name);
		this.php_push (stack_depth, val);
	}

	this.enumkeys = function (arr)
	{
		var keys = new Array;
		for (key in arr) keys[keys.length] = key;
		return keys;
	}


	this.php_enumerate_keys = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		var keys = this.enumkeys(arr);
		this.php_push (stack_depth++, keys);
	}

	this.php_shift = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, arr.shift());
	}

	this.php_self = function (stack_depth, classname)
	{
		this.php_push (stack_depth++, classname);
	}

	this.php_postinc = function (stack_depth)
	{
		var target = this.php_pop (stack_depth--);
		this.php_push (stack_depth++, target.obj[target.field]++);
	}

	this.php_index = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		var ind = this.php_pop(stack_depth--);
		if (arr === null || arr === undefined || ind === undefined) this.backtrace ("index");
		this.php_push (stack_depth++, arr[ind]);
	}

	this.php_index_lvalue = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		var ind = this.php_pop(stack_depth--);
		var res = {obj:arr, field: ind};
		this.php_push (stack_depth++, res);
	}


	this.php_nextindex = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, arr[arr.length-1]);
	}

	this.php_nextindex_lvalue = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		if (arr == undefined) this.backtrace("arr is undefined in nextindex_lvalue");
		var res = {obj:arr, field: (arr.length)};
		this.php_push (stack_depth++, res);
	}

	this.php_array_count = function (stack_depth)
	{
		var arr = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, arr.length);
	}

	this.php_postdec = function (stack_depth)
	{
		var target = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, target.obj[target.field]);
		target.obj[target.field]--;
	}

	this.php_assign = function (stack_depth)
	{
		var target = this.php_pop (stack_depth--);
		var value = this.php_pop (stack_depth--);
		if (value === undefined) this.backtrace ("value written to "+target.obj+" field "+target.field+" is undefined ");
		if (target.obj === undefined) this.backtrace ("Target is undefined");
		try
		{
			target.obj[target.field] = value;
		}
		catch (err)
		{
			this.backtrace (err);
		}
		this.php_push (stack_depth++, value);
	}

	this.php_not = function (stack_depth)
	{
		var value = this.php_pop(stack_depth--);
		this.php_push (stack_depth++, !value);
	}

	this.php_two_op = function (stack_depth, op)
	{
		var value1 = this.php_pop(stack_depth--);
		var value2 = this.php_pop(stack_depth--);
		var res;
		if (op == ".")
		{
			res = (""+value1)+value2;
		}
		else if (op == "==")
		{
			res = value1 == value2;
		}
		else if (op == "===")
		{
			res = value1 === value2;
		}
		else if (op == "!==")
		{
			res = value1 !== value2;
		}
		else if (op == "!=")
		{
			res = value1 != value2;
		}
		else if (op == "+")
		{
			res = parseInt(value1,10) + parseInt(value2,10);
		}
		else if (op == "||")
		{
			res = value1 || value2;
		}
		else if (op == "&&")
		{
			res = value1 && value2;
		}
		else
		{
			if (typeof value1 == "string")
				res = eval ("\""+value1+"\" "+op+" \""+value2+"\"");
			else
				res = eval (value1+" "+op+" "+value2);
		}
		this.php_push (stack_depth++, res);
	}

	this.php_deref = function (stack_depth)
	{
		var obj = this.php_pop(stack_depth--);
		var field = this.php_pop(stack_depth--);
		if (obj === undefined || obj === null)
		{
			this.backtrace ("obj is not valid in deref of field "+field);
			this.php_push (stack_depth++, null);
			return;
		}
		this.php_push (stack_depth++, obj[field]);
	}

	this.php_push = function (stack_depth, val)
	{
		this.frame.s[stack_depth] = val;
	}

	this.php_pop = function (stack_depth)
	{
		var value = this.frame.s[stack_depth-1];
		this.frame.s[stack_depth-1] = null;
		return value;
	}

	this.php_push_string = function (stack_depth, str)
	{
		this.php_push (stack_depth++, str);
	}

	this.php_echo = function (stack_depth)
	{
		window.__outbuffer += this.php_pop(stack_depth);
	}

	this.php_array_first = function (stack_depth)
	{
		var arr = this.php_pop (stack_depth--);
		this.php_push (stack_depth++, 0);	// FIXME
	}

	this.resume = function (action,parm)
	{
		if (this.cover)
		{
			this.cover.close ();
			this.cover = null;
		}
		var stack_depth = this.frame.saved_sp;
		this.php_push (stack_depth++, {"action":action, "parm":parm});
//		debugout ("Resume called, action = "+action+", parm = "+parm);
		this.run();
		return false;
	}

}

php_engine.started_threads = 1;

php_engine.start_static = function (classname, funcname, args)
{
	asyncnotify.thread_starting();
//	debugout ("start_static called with classname="+classname+", funcname="+funcname);
//	var p = new php_engine (eval (classname+".inst__"+funcname));
	var p = new php_engine (null);
	var stack_depth = 0;
	php_engine.threads.push(p);
	for (i = args.length; i; i--)
		p.php_push (stack_depth++, args[i-1]);
	p.php_static_method_call (stack_depth, eval(classname), funcname, args.length);
	p.run();
}

php_engine.start = function (obj, funcname, args)
{
	asyncnotify.thread_starting();
//	debugout ("start called on method"+funcname);
	var p = new php_engine (null);
	php_engine.threads.push(p);
	var stack_depth = 0;
	for (i = args.length; i; i--)
		p.php_push (stack_depth++, args[i-1]);
	p.php_push (stack_depth++, funcname);
	p.php_push (stack_depth++, obj);
	p.php_method_call (stack_depth, args.length);
	p.run();
}

php_engine.get_current_thread_id = function ()
{
	return php_engine.current_thread.thread_id;
}

php_engine.find_thread = function (tid)
{
	var i;
	for (i = 0; i < php_engine.threads.length; i++)
	{
		var t = php_engine.threads[i];
		if (t.thread_id == tid)
		{
			return t;
		}
	}
	return null;
}

php_engine.destroy_thread = function (tid)
{
	var t = php_engine.find_thread (tid);
	if (t) t.destroy ();
}

php_engine.resume_thread = function (tid, action, parm)
{
//	debugout ("Trying to resume thread "+tid+" with action "+action);
	var t = php_engine.find_thread (tid);
	if (t !== null)
	{
		t.resume (action, parm);
		return false;
	}
//	alert ("Failed to resume thread "+tid);
	debugout ("Failed to resume thread "+tid);
	return false;
}


php_engine.resume = function (action, parm)
{
	php_engine.threads[php_engine.threads.length-1].resume (action,parm);
	return false;
}

php_engine.error_handler = function (msg, file, line)
{
	alert ("Internal error: "+msg+", "+file+", "+line);
	php_engine.current_thread.backtrace (msg);
}

php_engine.threads = new Array;




function popup_card ()
{
	this.popup = new popup(this);

	this.render_popup = function ()
	{
		var p = rpc_get_user_info (this.uid);

		html = "<div class=\"addressCard\">";
		html += "<div class=\"addressCardTitle\" style=\"font-size:16px\">"+p.nname+" "+p.sname+"</div>";
		html += "<div class=\"addressCardInfo\">";
		if (p.address1 != "") html += p.address1+"<br/>";
		if (p.address2 != "") html += p.address2+"<br/>";
		if (p.address3 != "") html += p.address3+"<br/>";
		if (p.address4 != "") html += p.address4+"<br/>";
		if (p.postalcode != "")
		{
			var mapref = "http://maps.google.co.uk/maps?q="+encodeURIComponent (p.postalcode);
			html += "<a href=\""+mapref+"\" target=\"_blank\">"+p.postalcode+"</a><br/>";
		}
		html += "</div>";
		if (p.telephone != "")
		{
			var num = p.telephone.replace (/ /, "");
			var callref = "callto:"+num+"+type=phone";
			html += "<div class=\"addressCardInfo\">Telephone: <a href=\""+callref+"\">"+p.telephone+"</a></div>";
		}
		if (p.mobile != "")
		{
			var num = p.mobile.replace (/ /, "");
			var callref = "callto:"+num+"+type=phone";
			html += "<div class=\"addressCardInfo\">Mobile: <a href=\""+callref+"\">"+p.mobile+"</a></div>";
		}
		if (p.email != "") html += "<div class=\"addressCardInfo\">Email: <a href=\"mailto:"+p.email+"\">"+p.email+"</a></div>";
		html += "</div>";
		return html;
	}

	this.popup_event = function (event, uid)
	{
		this.uid = uid;
		this.popup.popup (event,300,200);
	}

	this.popup_at = function (x, y, uid)
	{
		this.uid = uid;
		this.popup.popup_at (x,y,300,200);
	}

	this.popup_over = function (el, uid)
	{
		this.uid = uid;
		this.popup.popup_over (el, 300, 200);
	}
}


/**
 * *
 * *  Secure Hash Algorithm (SHA1)
 * *  http://www.webtoolkit.info/
 * *
 * **/
 
function SHA1 (msg) {
 
	function rotate_left(n,s) {
		var t4 = ( n<<s ) | (n>>>(32-s));
		return t4;
	};
 
	function lsb_hex(val) {
		var str="";
		var i;
		var vh;
		var vl;
 
		for( i=0; i<=6; i+=2 ) {
			vh = (val>>>(i*4+4))&0x0f;
			vl = (val>>>(i*4))&0x0f;
			str += vh.toString(16) + vl.toString(16);
		}
		return str;
	};
 
	function cvt_hex(val) {
		var str="";
		var i;
		var v;
 
		for( i=7; i>=0; i-- ) {
			v = (val>>>(i*4))&0x0f;
			str += v.toString(16);
		}
		return str;
	};
 
 
	function Utf8Encode(string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	};
 
	var blockstart;
	var i, j;
	var W = new Array(80);
	var H0 = 0x67452301;
	var H1 = 0xEFCDAB89;
	var H2 = 0x98BADCFE;
	var H3 = 0x10325476;
	var H4 = 0xC3D2E1F0;
	var A, B, C, D, E;
	var temp;
 
	msg = Utf8Encode(msg);
 
	var msg_len = msg.length;
 
	var word_array = new Array();
	for( i=0; i<msg_len-3; i+=4 ) {
		j = msg.charCodeAt(i)<<24 | msg.charCodeAt(i+1)<<16 |
		msg.charCodeAt(i+2)<<8 | msg.charCodeAt(i+3);
		word_array.push( j );
	}
 
	switch( msg_len % 4 ) {
		case 0:
			i = 0x080000000;
		break;
		case 1:
			i = msg.charCodeAt(msg_len-1)<<24 | 0x0800000;
		break;
 
		case 2:
			i = msg.charCodeAt(msg_len-2)<<24 | msg.charCodeAt(msg_len-1)<<16 | 0x08000;
		break;
 
		case 3:
			i = msg.charCodeAt(msg_len-3)<<24 | msg.charCodeAt(msg_len-2)<<16 | msg.charCodeAt(msg_len-1)<<8	| 0x80;
		break;
	}
 
	word_array.push( i );
 
	while( (word_array.length % 16) != 14 ) word_array.push( 0 );
 
	word_array.push( msg_len>>>29 );
	word_array.push( (msg_len<<3)&0x0ffffffff );
 
 
	for ( blockstart=0; blockstart<word_array.length; blockstart+=16 ) {
 
		for( i=0; i<16; i++ ) W[i] = word_array[blockstart+i];
		for( i=16; i<=79; i++ ) W[i] = rotate_left(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1);
 
		A = H0;
		B = H1;
		C = H2;
		D = H3;
		E = H4;
 
		for( i= 0; i<=19; i++ ) {
			temp = (rotate_left(A,5) + ((B&C) | (~B&D)) + E + W[i] + 0x5A827999) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B,30);
			B = A;
			A = temp;
		}
 
		for( i=20; i<=39; i++ ) {
			temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B,30);
			B = A;
			A = temp;
		}
 
		for( i=40; i<=59; i++ ) {
			temp = (rotate_left(A,5) + ((B&C) | (B&D) | (C&D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B,30);
			B = A;
			A = temp;
		}
 
		for( i=60; i<=79; i++ ) {
			temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B,30);
			B = A;
			A = temp;
		}
 
		H0 = (H0 + A) & 0x0ffffffff;
		H1 = (H1 + B) & 0x0ffffffff;
		H2 = (H2 + C) & 0x0ffffffff;
		H3 = (H3 + D) & 0x0ffffffff;
		H4 = (H4 + E) & 0x0ffffffff;
 
	}
 
	var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
 
	return temp.toLowerCase();
 
}

function uploadCompleted ()
{
	uploader.upload_completed();
}

function rpcclass () { this.do_construct (arguments); }
rpcclass.init_methods = function (c) {
	var cp = c.prototype;
	cp.get_id =  function ()
	{
{
		return (this.obj_id);
		}
			}

;
	c.args__flatten = c.pargs__flatten =  ["parm"];
	c.inst__flatten = c.pinst__flatten =  [
/*0*/	function (e,f) { if (builtin__is_array (f.v.parm)) f.pc=1; else f.pc=26; },
	function (e,f) {
		f.v.res = "(";
		f.v.numeric_keys = true;
		f.v.max = 0;
		f.v._k2 = e.enumkeys (f.v.parm);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k2).length)) f.pc=3;
	},
	function (e,f) { if (f.v.numeric_keys) f.pc=22; else f.pc=23; },
	function (e,f) {
		f.v.key = (f.v._k2).shift();
		f.v.value = (f.v.parm)[(f.v.key)];
		if (!(builtin__is_numeric (f.v.key))) f.pc=5; else f.pc=6;
	},
/*5*/	function (e,f) {
		f.pc=3;
		f.v.numeric_keys = false;
	},
	function (e,f) { if (((f.v.key)) > ((f.v.max))) f.pc=7; else f.pc=2; },
	function (e,f) {
		f.pc=2;
		f.v.max = f.v.key;
	},
	function (e,f) {
		f.v.res = "" + (f.v.res) + ("[");
		f.v.need_comma = false;
		f.v._k4 = e.enumkeys (f.v.parm);
	},
	function (e,f) {
		f.pc=11;
		if (!((f.v._k4).length)) f.pc=10;
	},
/*10*/	function (e,f) {
		f.pc=25;
		f.v.res = "" + (f.v.res) + ("]");
	},
	function (e,f) {
		f.v._i5 = (f.v._k4).shift();
		f.v.p = (f.v.parm)[(f.v._i5)];
		if (f.v.need_comma) f.pc=12; else f.pc=13;
	},
	function (e,f) { f.v.res = "" + (f.v.res) + (","); },
	function (e,f) { e.smcall (1, rpcclass,"flatten", ([f.v.p])); },
	function (e,f) {
		f.pc=9;
		var t16 = f.s[0]; 
		f.v.res = "" + (f.v.res) + (t16);
		f.v.need_comma = true;
	},
/*15*/	function (e,f) {
		f.v.res = "" + (f.v.res) + ("{");
		f.v.need_comma = false;
		f.v._k6 = e.enumkeys (f.v.parm);
	},
	function (e,f) {
		f.pc=18;
		if (!((f.v._k6).length)) f.pc=17;
	},
	function (e,f) {
		f.pc=25;
		f.v.res = "" + (f.v.res) + ("}");
	},
	function (e,f) {
		f.v.key = (f.v._k6).shift();
		f.v.p = (f.v.parm)[(f.v.key)];
		if (f.v.need_comma) f.pc=19; else f.pc=20;
	},
	function (e,f) { f.v.res = "" + (f.v.res) + (","); },
/*20*/	function (e,f) { e.smcall (1, rpcclass,"flatten", ([f.v.p])); },
	function (e,f) {
		f.pc=16;
		var t26 = f.s[0]; 
		f.v.res = "" + (f.v.res) + (("'") + ("" + (f.v.key) + (("':") + (t26))));
		f.v.need_comma = true;
	},
	function (e,f) {
		f.pc=24;
		f.s[0] = ((parseInt((f.v.max),10) + parseInt((1),10))) == ((builtin__count (f.v.parm)));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t29 = f.s[0]; if (t29) f.pc=8; else f.pc=15; },
/*25*/	function (e,f) {
		f.v.res = "" + (f.v.res) + (")");
		e.return_pop (f.v.res);
	},
	function (e,f) { if (((f.v.parm)) === ((null))) f.pc=27; else f.pc=28; },
	function (e,f) {
		f.pc=32;
		f.v.res = "null";
	},
	function (e,f) { if (((f.v.parm).obj_id) !== undefined) f.pc=29; else f.pc=31; },
	function (e,f) { e.mcall (2, f.v.parm, "render_gobi", ([])); },
/*30*/	function (e,f) {
		f.pc=32;
		var t33 = f.s[0]; f.v.res = t33;
	},
	function (e,f) {
		f.v.parm = builtin__str_replace ("\\","\\\\",f.v.parm);
		f.v.parm = builtin__str_replace ("'","\\'",f.v.parm);
		f.v.parm = builtin__str_replace ("\"","\\x22",f.v.parm);
		f.v.res = ("'") + ("" + (f.v.parm) + ("'"));
	},
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	cp.make_start_engine =  function (method,parm)
	{
		var me = this;
		return function () { return rpcclass.start_engine (me, null, me.classname, me.get_id(), method, null); };
			}

;
	cp.bind =  function (el,eventtype,handler)
	{
		$(el).bind (eventtype, handler);
			}

;
	cp.unbind =  function (el,eventtype,handler)
	{
		$(el).unbind (eventtype, handler);
			}

;
	c.pargs__handler =  ["method","parm"];
	c.pinst__handler =  [
/*0*/	function (e,f) {
		f.s[0] = ")";
		e.smcall (2, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t38 = f.s[1]; var t39 = f.s[0]; 
		f.s[0] = ("', '") + ("" + (f.v.method) + (("', ") + ("" + (t38) + (t39))));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t40 = f.s[1]; var t41 = f.s[0]; 
		e.return_pop (("return rpcclass.call_handler (this, event, '") + ("" + ((f.v["this"]).classname) + (("', '") + ("" + (t40) + (t41)))));
	},
null	];

;
	c.pargs__render_start_sync =  ["method","parm"];
	c.pinst__render_start_sync =  [
/*0*/	function (e,f) {
		f.s[0] = ")";
		e.smcall (2, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t42 = f.s[1]; var t43 = f.s[0]; 
		f.s[0] = ("', '") + ("" + (f.v.method) + (("', ") + ("" + (t42) + (t43))));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t44 = f.s[1]; var t45 = f.s[0]; 
		e.return_pop (("return rpcclass.call_sync (this, event, '") + ("" + ((f.v["this"]).classname) + (("', '") + ("" + (t44) + (t45)))));
	},
null	];

;
	c.pargs__render_start =  ["method","parm"];
	c.pinst__render_start =  [
/*0*/	function (e,f) {
		f.s[0] = ")";
		e.smcall (2, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t46 = f.s[1]; var t47 = f.s[0]; 
		f.s[0] = ("', '") + ("" + (f.v.method) + (("', ") + ("" + (t46) + (t47))));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t48 = f.s[1]; var t49 = f.s[0]; 
		e.return_pop (("return rpcclass.start_engine (this, event, '") + ("" + ((f.v["this"]).classname) + (("', '") + ("" + (t48) + (t49)))));
	},
null	];

;
	c.args__render_start_static = c.pargs__render_start_static =  ["classname","method","parm"];
	c.inst__render_start_static = c.pinst__render_start_static =  [
/*0*/	function (e,f) {
		f.s[0] = ")";
		e.smcall (2, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t50 = f.s[1]; var t51 = f.s[0]; 
		e.return_pop (("return rpcclass.start_engine_static (this, event, '") + ("" + (f.v.classname) + (("', '") + ("" + (f.v.method) + (("', ") + ("" + (t50) + (t51)))))));
	},
null	];

;
	c.args__render_resume = c.pargs__render_resume =  ["action","parm"];
	c.inst__render_resume = c.pinst__render_resume =  [
/*0*/	function (e,f) {
		f.s[0] = ")";
		e.smcall (2, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t52 = f.s[1]; var t53 = f.s[0]; 
		f.s[0] = (",'") + ("" + (f.v.action) + (("',") + ("" + (t52) + (t53))));
		e.smcall (1, php_engine,"get_current_thread_id", ([]));
	},
	function (e,f) {
		var t54 = f.s[1]; var t55 = f.s[0]; 
		e.return_pop (("return rpcclass.resume_thread (this, event, ") + ("" + (t54) + (t55)));
	},
null	];

;
	c.resume_thread = cp.resume_thread =  function (el,event,threadid,action,parm)
	{
		if (typeof event === "undefined") event = window.event;
//		if (el) popup.set_default_element (el);
//		popup.set_default_event (event);
		return php_engine.resume_thread (threadid, action, parm);
			}

;
	c.args__render_resume_ev = c.pargs__render_resume_ev =  ["action","parm"];
	c.inst__render_resume_ev = c.pinst__render_resume_ev =  [
/*0*/	function (e,f) {
		f.s[0] = ")";
		e.smcall (2, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t56 = f.s[1]; var t57 = f.s[0]; 
		f.s[0] = (",'") + ("" + (f.v.action) + (("',") + ("" + (t56) + (t57))));
		e.smcall (1, php_engine,"get_current_thread_id", ([]));
	},
	function (e,f) {
		var t58 = f.s[1]; var t59 = f.s[0]; 
		e.return_pop (("return rpcclass.resume_thread_ev (this, event, ") + ("" + (t58) + (t59)));
	},
null	];

;
	c.resume_thread_ev = cp.resume_thread_ev =  function (el,event,threadid,action,parm)
	{
		if (typeof event === "undefined") event = window.event;
//		if (el) popup.set_default_element (el);
		rpcclass.last_resume_el = el;
		rpcclass.last_resume_x = event.clientX;
		rpcclass.last_resume_y = event.clientY;
		rpcclass.last_resume_ctrlkey = event.ctrlKey;
		popup.set_default_event (event);
		return php_engine.resume_thread (threadid, action, parm);
			}

;
	c.call_sync = cp.call_sync =  function (el,event,classname,objid,method,args)
	{
		if (typeof event === "undefined") event = window.event;
//		if (el) popup.set_default_element (el);
		if (event !== null) popup.set_default_event (event);
		if (rpcclass.classes[classname] == undefined)
		{
			alert ("Unexpected unknown class "+classname);
			throw new Error ("Unexpected unknown class "+classname);
		}
		if (objid == null)
		{
			alert ("Attempt to call method of "+classname+" with null objid");
			throw new Error ("Attempt to call "+classname+"::"+method+" with null objid");
		}
		if (rpcclass.classes[classname].objects[objid] == undefined)
			throw new Error ("Attempt to start engine on "+classname+"::"+objid+" which does not exist");
		return rpcclass.classes[classname].objects[objid][method] (el, args, event);
			}

;
	c.start_engine = cp.start_engine =  function (el,event,classname,objid,method,args)
	{
		if (typeof event === "undefined") event = window.event;
		if (event !== null)
		{
			rpcclass.last_start_el = el;
			rpcclass.last_start_x = event.clientX + browser.scroll_left();
			rpcclass.last_start_y = event.clientY + browser.scroll_top();
			rpcclass.last_start_ctrlkey = event.ctrlKey;
			popup.set_default_event (event);
			if (event.preventDefault) event.preventDefault();
			else event.returnResult = false;
			if (event.stopPropagation) event.stopPropagation();
			else event.cancelBubble = true;
		}
		if (rpcclass.classes[classname] == undefined)
		{
			alert ("Unexpected unknown class "+classname);
			throw new Error ("Unexpected unknown class "+classname);
		}
		if (objid == null)
		{
			alert ("Attempt to call method of "+classname+" with null objid");
			throw new Error ("Attempt to call "+classname+"::"+method+" with null objid");
		}
		if (rpcclass.classes[classname].objects[objid] == undefined)
			throw new Error ("Attempt to start engine on "+classname+"::"+objid+" which does not exist");
		var all_args = [el, args, event];
		php_engine.start (rpcclass.classes[classname].objects[objid], method, all_args);
		return false;
			}

;
	cp.start_timeout_callback_sync =  function (interval,method,parm)
	{
{
		;
		return (window.setTimeout  ("rpcclass.start_engine (this, null, '" + builtin__get_class (this) + "', '" + this.get_id  () + "', '" + method + "', null)",interval));
		}
			}

;
	c.pargs__start_timeout_callback =  ["interval","method","parm"];
	c.pinst__start_timeout_callback =  [
/*0*/	function (e,f) {
		f.s[0] = f.v.interval;
		f.s[1] = ")";
		e.smcall (3, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t60 = f.s[2]; var t61 = f.s[1]; 
		f.s[1] = ("', '") + ("" + (f.v.method) + (("', ") + ("" + (t60) + (t61))));
		e.mcall (4, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t62 = f.s[2]; var t63 = f.s[1]; 
		var t64 = f.s[0]; e.mcall (4, window, "setTimeout", ([("rpcclass.start_engine (this, null, '") + ("" + ((f.v["this"]).classname) + (("', '") + ("" + (t62) + (t63)))), t64]));
	},
	function (e,f) { var t65 = f.s[0]; e.return_pop (t65); },
null	];

;
	c.pargs__stop_timeout =  ["timer"];
	c.pinst__stop_timeout =  [
/*0*/	function (e,f) { e.mcall (3, window, "clearTimeout", ([f.v.timer])); },
null	];

;
	c.pargs__start_interval_timer_callback =  ["interval","method","parm"];
	c.pinst__start_interval_timer_callback =  [
/*0*/	function (e,f) {
		f.s[0] = f.v.interval;
		f.s[1] = ")";
		e.smcall (3, rpcclass,"flatten", ([f.v.parm]));
	},
	function (e,f) {
		var t66 = f.s[2]; var t67 = f.s[1]; 
		f.s[1] = ("', '") + ("" + (f.v.method) + (("', ") + ("" + (t66) + (t67))));
		e.mcall (4, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t68 = f.s[2]; var t69 = f.s[1]; 
		var t70 = f.s[0]; e.mcall (4, window, "setInterval", ([("rpcclass.start_engine (this, null, '") + ("" + ((f.v["this"]).classname) + (("', '") + ("" + (t68) + (t69)))), t70]));
	},
	function (e,f) { var t71 = f.s[0]; e.return_pop (t71); },
null	];

;
	c.interval_timer = cp.interval_timer =  function (tid,val)
	{
		php_engine.resume_thread (tid, val, null);
			}

;
	c.args__stop_interval_timer = c.pargs__stop_interval_timer =  ["timer"];
	c.inst__stop_interval_timer = c.pinst__stop_interval_timer =  [
/*0*/	function (e,f) { e.mcall (3, window, "clearInterval", ([f.v.timer])); },
null	];

;
	c.args__start_interval_timer = c.pargs__start_interval_timer =  ["interval","resume_val"];
	c.inst__start_interval_timer = c.pinst__start_interval_timer =  [
/*0*/	function (e,f) {
		f.s[0] = f.v.interval;
		f.s[1] = (", '") + ("" + (f.v.resume_val) + ("')"));
		e.smcall (2, php_engine,"get_current_thread_id", ([]));
	},
	function (e,f) {
		var t72 = f.s[2]; var t73 = f.s[1]; 
		var t74 = f.s[0]; e.mcall (4, window, "setInterval", ([("rpcclass.interval_timer (") + ("" + (t72) + (t73)), t74]));
	},
	function (e,f) { var t75 = f.s[0]; e.return_pop (t75); },
null	];

;
	c.start_engine_static = cp.start_engine_static =  function (el,event,classname,method,args)
	{
//		if (el) popup.set_default_element (el);
		if (typeof event === "undefined") event = window.event;
		if (event !== null)
		{
			popup.set_default_event (event);
			rpcclass.last_start_el = el;
			rpcclass.last_start_x = event.clientX + browser.scroll_left();
			rpcclass.last_start_y = event.clientY + browser.scroll_top();
			rpcclass.last_start_ctrlkey = event.ctrlKey;
		}
		if (rpcclass.classes[classname] == undefined)
		{
			alert ("Unexpected unknown class "+classname);
			throw new Error ("Unexpected unknown class "+classname);
		}
		var all_args = [el, args, event];
		php_engine.start_static (classname, method, all_args);
		return false;
			}

;
	cp.call_self_using_engine =  function (method,args)
	{
		php_engine.start (this, method, args);
			}

;
	c.do_call_on_load = cp.do_call_on_load =  function ()
	{
		for (i in rpcclass.call_on_load_list)
		{
			var item = rpcclass.call_on_load_list[i];
			var cls = eval (item.classname);
			if (item.sync)
				cls[item.method] (eval (item.arg));
			else
				rpcclass.start_engine_static (null, null, item.classname, item.method, eval (item.arg));
		}
			}

;
	c.lookup_object = cp.lookup_object =  function (classname,field,value)
	{
		if (rpcclass.classes[classname] === undefined) throw "Undefined class: "+classname;
		for (objid in rpcclass.classes[classname].objects)
		{
			if (rpcclass.classes[classname].objects[objid][field] == value)
				return rpcclass.classes[classname].objects[objid];
		}
		return null;
			}

;
	cp.toString =  function ()
	{
		return "["+this.classname+" object "+this.obj_id+"]";
			}

;
	cp.do_construct =  function (args)
	{
		if (args.length != 0)
			this.obj_id = args[0];
		else
			this.obj_id = "JS"+(rpcclass.uniq());
		rpcclass.register (this);
			}

;
	c.register = cp.register =  function (obj)
	{
		if (obj == undefined || rpcclass.classes[obj.classname] == undefined)
		{
			debugout ("rpcclass::register called with bad argument from "+arguments.callee.caller.toString());
			return;
		}
		rpcclass.classes[obj.classname].objects[obj.obj_id] = obj;
			}

;
	c.call_method_by_name = cp.call_method_by_name =  function (classname,objid,method,args)
	{
		if (rpcclass.classes[classname] == undefined)
		{
			alert ("Unexpected unknown class "+classname);
			throw new Error ("Unexpected unknown class "+classname);
		}
		if (objid == null)
		{
			alert ("Attempt to call method of "+classname+" with null objid");
			throw new Error ("Attempt to call "+classname+"::"+method+" with null objid");
		}
		if (rpcclass.classes[classname].objects[objid] == undefined)
		{
			debugout ("class "+classname+" object "+objid+" is not defined during call_method_by_name method = "+method);
			throw new Error ("class "+classname+" object "+objid+" is not defined during call_method_by_name method = "+method);
		}
		return rpcclass.classes[classname].objects[objid][method] (args);
			}

;
	c.args__call_static_method = c.pargs__call_static_method =  ["classname","method","args"];
	c.inst__call_static_method = c.pinst__call_static_method =  [
/*0*/	function (e,f) {
		f.s[0] = f.v.args;
		f.s[1] = f.v.method;
		f.s[2] = f.v.classname;
		e.php_builtin (3, "phpengine_call_static_method", 3);
	},
	function (e,f) { var t76 = f.s[0]; e.return_pop (t76); },
null	];

;
	c.uniq = cp.uniq =  function ()
	{
		if (window.rpc_uniq === undefined)
		{
			var d = new Date;
			window.rpc_uniq = (d.getTime() % 10000) * 100;
		}
		return ++window.rpc_uniq;
			}

;
	c.define_classes = cp.define_classes =  function (classnames)
	{
	}

;
	c.setup_class = cp.setup_class =  function (cls,classname,is_readonly,props,proptypes)
	{
		var cp = cls.prototype;
		cp.classname = classname;
		cp.props = props;
		cp.proptypes = proptypes;
		cp.class_is_readonly = is_readonly;
		var classdef = new Object;
		classdef.classname = classname;
		classdef.constructor = cp.constructor;
		classdef.objects = new Object;
		if (rpcclass.classes == undefined) rpcclass.classes = new Object;
		rpcclass.classes[classname] = classdef;
			}

;
	c.get_classname = cp.get_classname =  function (obj)
	{
		var i;
		for (name in rpcclass.classes)
		{
			if (rpcclass.classes[name].constructor == obj.constructor)
			{
				return name;
			}
		}
		return null;
			}

;
	cp.uji =  function (fields)
	{
		this.unserialize_js_init (fields);
			}

;
	c.download_object = cp.download_object =  function (classname,objid,fields)
	{
		var xobj = rpcclass.get_object_by_id (classname, objid);
		xobj.unserialize_js_init (fields);
			}

;
	c.object_present = cp.object_present =  function (classname,objid)
	{
		return (rpcclass.classes[classname].objects[objid] !== undefined);
			}

;
	c.get_object_by_id = cp.get_object_by_id =  function (classname,objid)
	{
		if (objid == 0) return null;
		if (rpcclass.classes[classname].objects[objid] == undefined)
		{
			var obj = new rpcclass.classes[classname].constructor (objid);
			rpcclass.classes[classname].objects[objid] = obj;
		}
		return rpcclass.classes[classname].objects[objid];
			}

;
	c.dobj = cp.dobj =  function (id,fields)
	{
		return rpcclass.download_object (this.prototype.classname, id, fields);
			}

;
	c.pargs__render_calc_gobi =  [];
	c.pinst__render_calc_gobi =  [
/*0*/	function (e,f) {
		f.s[0] = "')";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t77 = f.s[1]; var t78 = f.s[0]; 
		e.return_pop ("" + ((f.v["this"]).classname) + ((".gobi('") + ("" + (t77) + (t78))));
	},
null	];

;
	c.pargs__render_gobi =  [];
	c.pinst__render_gobi =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "render_calc_gobi", ([])); },
	function (e,f) { var t79 = f.s[0]; e.return_pop (t79); },
null	];

;
	c.gobi = cp.gobi =  function (id)
	{
		return rpcclass.get_object_by_id (this.prototype.classname, id);
			}

;
	c.object_loaded = cp.object_loaded =  function (obj)
	{
//		debugout ("*** Object "+obj.classname+":"+obj.obj_id+" loaded from server");
			}

;
	c.call_handler = cp.call_handler =  function (el,event,classname,objid,method,args)
	{
		if (typeof event === "undefined") event = window.event;
		if (rpcclass.classes[classname] == undefined)
		{
			alert ("Unexpected unknown class "+classname);
			throw new Error ("Unexpected unknown class "+classname);
		}
		if (objid == null)
		{
			alert ("Attempt to call method of "+classname+" with null objid");
			throw new Error ("Attempt to call "+classname+"::"+method+" with null objid");
		}
		if (rpcclass.classes[classname].objects[objid] == undefined)
			throw new Error ("Attempt to use object "+classname+"::"+objid+" which does not exist");
		if (rpcclass.classes[classname].objects[objid][method] == undefined)
			throw new Error ("Attempt to call "+classname+"::"+method+" which does not exist");
		rpcclass.classes[classname].objects[objid][method] (el, args, event);
		return false;
			}

;
	c.convert_xml_to_object = cp.convert_xml_to_object =  function (node)
	{
		if (node.tagName == "array")
		{
			var res = new Array();
			for (var i = 0; i < node.childNodes.length; i++)
			{
				res[i] = rpcclass.convert_xml_to_object (node.childNodes[i]);
			}
			return res;
		}
		else if (node.tagName == "struct")
		{
			var res = new Object;
			for (var i = 0; i < node.childNodes.length; i++)
			{
				var fieldname = node.childNodes[i].getAttribute ("name");
				res[fieldname] = rpcclass.convert_xml_to_object (node.childNodes[i].firstChild);
			}
			return res;
		}
		else if (node.tagName == "classref")
		{
			var classname = node.getAttribute("classname");
			var obj_id = node.getAttribute ("id");
			return new rpcclassloader (classname, obj_id);
		}
		else if (node.tagName == "object")
		{
			var classname = node.getAttribute("classname");
			var obj_id = node.getAttribute ("id");
			var res = rpcclass.get_object_by_id (classname, obj_id);
			return res;
		}
		else if (node.tagName == "int")
		{
			return parseInt(node.firstChild.nodeValue);
		}
		else if (node.tagName == "string")
		{
			if (node.firstChild)
				return node.firstChild.nodeValue;
			else
				return "";
		}
		else if (node.tagName == "bool")
		{
			return (node.firstChild.nodeValue == 1);
		}
		else if (node.tagName == "null")
		{
			return null;
		}
		else if (node.tagName == "htmlelement")
		{
			return document.getElementById (node.getAttribute("id"));
		}
		else
		{
			alert ("Don't know how to convert node "+node.tagName);
			return null;
		}
			}

;
	c.load_object_from_class3 = cp.load_object_from_class3 =  function (node)
	{
		var classname = node.getAttribute("classname");
		var obj_id = node.getAttribute ("id");
		var text = "";
		for (var j = 0; node.childNodes[j] != undefined; j++)
		{
			if (node.childNodes[j].nodeType == 3)
				text += node.childNodes[j].nodeValue;
		}

//		var values = node.firstChild.nodeValue;
		var values = text;

//		debugout ("Got class3 = "+classname+": "+obj_id+"="+values);
		var res = rpcclass.get_object_by_id (classname, obj_id);
		var evalues = eval ("("+values+")");
		res.unserialize_js_rpc (evalues);
		rpcclass.object_loaded (res);
			}

;
	c.load_object_from_xml = cp.load_object_from_xml =  function (node)
	{
		var classname = node.getAttribute("classname");
		var obj_id = node.getAttribute ("id");

		var res = rpcclass.get_object_by_id (classname, obj_id);

//		debugout ("========================================");
//		debugout ("unserialize "+classname+":"+obj_id);
		res.classname = classname;
		for (var j = 0; j < node.childNodes.length; j++)
		{
			var field = node.childNodes[j];
			var fieldname = field.getAttribute ("name");
			if (fieldname != "listeners" && fieldname != "messages")	// NASTY HACK
				res[fieldname] = rpcclass.convert_xml_to_object (field.firstChild);
//			debugout (fieldname+"="+res[fieldname]);
		}
		rpcclass.object_loaded (res);
			}

;
	c.pargs__call_function_async =  ["meth","margs"];
	c.pinst__call_function_async =  [
/*0*/	function (e,f) { e.smcall (3, ajax,"do_call_function_async", ([f.v["this"], f.v.meth, f.v.margs])); },
	function (e,f) { var t80 = f.s[0]; e.return_pop (t80); },
null	];

;
	c.args__call_static_function_async = c.pargs__call_static_function_async =  ["classname","meth","margs"];
	c.inst__call_static_function_async = c.pinst__call_static_function_async =  [
/*0*/	function (e,f) { e.smcall (3, ajax,"do_call_static_function_async", ([f.v.classname, f.v.meth, f.v.margs])); },
	function (e,f) { var t81 = f.s[0]; e.return_pop (t81); },
null	];

;
	c.pargs__listen_msg =  ["msg_type","obj","notify_method"];
	c.pinst__listen_msg =  [
/*0*/	function (e,f) {
		f.v.listener = ({});
		f.v.listener.msg_type = f.v.msg_type;
		f.v.listener.obj = f.v.obj;
		f.v.listener.notify_method = f.v.notify_method;
		if (!(((f.v["this"]).listeners) !== undefined)) f.pc=1; else f.pc=2;
	},
	function (e,f) { f.v["this"].listeners = ([]); },
	function (e,f) { (f.v["this"]).listeners[(f.v["this"]).listeners.length] = f.v.listener; },
null	];

;
	c.pargs__send_msg =  ["msg_type","args"];
	c.pinst__send_msg =  [
/*0*/	function (e,f) { if (!(((f.v["this"]).listeners) !== undefined)) f.pc=1; else f.pc=2; },
	function (e,f) { f.v["this"].listeners = ([]); },
	function (e,f) { f.v._k8 = e.enumkeys ((f.v["this"]).listeners); },
	function (e,f) { if (!((f.v._k8).length)) f.pc=-1; },
	function (e,f) {
		f.v._i9 = (f.v._k8).shift();
		f.v.listener = ((f.v["this"]).listeners)[(f.v._i9)];
		if ((((f.v.listener).msg_type)) == ((f.v.msg_type))) f.pc=5; else f.pc=3;
	},
/*5*/	function (e,f) {
		f.pc=3;
		f.v.method = (f.v.listener).notify_method;
		e.mcall (3, (f.v.listener).obj, f.v.method, ([f.v.args]));
	},
null	];

;
	cp.serialize =  function (closure)
	{
		var res = "";
		var j = 0;
		for (i = 0; i < this.props.length; i++)
		{
			var name = this.props[i];
			var pt = this.proptypes[i];
			if (pt != 2)
			{
				var sobj = (pt == 1) ? ajax.stub_object (this[name]) : ajax.serialize_object (this[name], closure);
				res += "{f:"+name+":"+encodeURIComponent (sobj)+"}";
			}
		}
		return res;
			}

;
	cp.unserialize_js_init =  function (values)
	{
		var i;
		for (i = 0; i < this.props.length; i++)
			this[this.props[i]] = values[i];
			}

;
	cp.unserialize_js_rpc =  function (values)
	{
		var j = 0;
		var i;
		for (i = 0; i < this.props.length; i++)
		{
			if (this.proptypes[i] == 0)
			{
				this[this.props[i]] = values[j++];
			}
		}
			}

;
};
rpcclass.init_methods (rpcclass);
rpcclass.setup_class (rpcclass, "rpcclass",0, (["obj_id","listeners"]), ([0,2]));
function rootpath () { this.do_construct (arguments); }
rootpath.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.map = cp.map =  function (path)
	{
{
		return (rootpath.root_path + path);
		}
			}

;
};
rootpath.init_methods (rootpath);
rpcclass.setup_class (rootpath, "rootpath",0, (["listeners"]), ([2]));
function auth () { this.do_construct (arguments); }
auth.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__logged_in = c.pargs__logged_in =  [];
	c.inst__logged_in = c.pinst__logged_in =  [
/*0*/	function (e,f) {
		e.php_push_static_var (0, auth,"is_system");
		var t1 = f.s[0]; if (t1) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.pc=3;
		f.s[0] = true;
	},
	function (e,f) {
		e.php_push_static_var (1, auth,"euid");
		var t2 = f.s[1]; f.s[0] = ((t2)) != ((0));
	},
	function (e,f) { var t3 = f.s[0]; e.return_pop (t3); },
null	];

;
	c.args__my_uid = c.pargs__my_uid =  [];
	c.inst__my_uid = c.pinst__my_uid =  [
/*0*/	function (e,f) {
		e.php_push_static_var (0, auth,"euid");
		var t4 = f.s[0]; e.return_pop (t4);
	},
null	];

;
	c.args__agree_t_and_c =  [];
	c.inst__agree_t_and_c =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "agree_t_and_c", ([])])); },
	function (e,f) { var t5 = f.s[0]; e.return_pop (t5); },
null	];

;
	c.args__open_t_and_c_dialog = c.pargs__open_t_and_c_dialog =  ["el","arg","ev"];
	c.inst__open_t_and_c_dialog = c.pinst__open_t_and_c_dialog =  [
/*0*/	function (e,f) {
		f.v.tc = builtin__urldecode (f.v.arg);
		f.v.fields = ([({name:"tandc", type:"html", label:"", html:f.v.tc})]);
		f.v.pop = new popupform;
		e.mcall (6, f.v.pop, "initialise", ([0, 0, "Terms and Conditions", f.v.fields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([true, false])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
/*5*/	function (e,f) {
		var t10 = f.s[0]; f.v.event = t10;
		f.v.action = (f.v.event).action;
		if (((f.v.action)) == (("OK"))) f.pc=6; else f.pc=4;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { e.smcall (0, auth,"agree_t_and_c", ([])); },
null	];

;
	c.launch_t_and_c_dialog = cp.launch_t_and_c_dialog =  function (tandc)
	{
{
		popup.set_default_coordinates  (200,200);;
		rpcclass.start_engine_static  (null,null,"auth","open_t_and_c_dialog",tandc);;
		}
			}

;
	c.launch_login_dialog = cp.launch_login_dialog =  function ()
	{
{
		popup.set_default_coordinates  (150,150);;
		rpcclass.start_engine_static  (null,null,"auth","open_login_dialog",null);;
		}
			}

;
	c.args__handle_simple_login =  ["username","password","save_authority"];
	c.inst__handle_simple_login =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "handle_simple_login", ([f.v.username, f.v.password, f.v.save_authority])])); },
	function (e,f) { var t12 = f.s[0]; e.return_pop (t12); },
null	];

;
	c.args__get_challenge =  ["username"];
	c.inst__get_challenge =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "get_challenge", ([f.v.username])])); },
	function (e,f) { var t13 = f.s[0]; e.return_pop (t13); },
null	];

;
	c.args__handle_response =  ["username","challenge","response","save_authority"];
	c.inst__handle_response =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "handle_response", ([f.v.username, f.v.challenge, f.v.response, f.v.save_authority])])); },
	function (e,f) { var t14 = f.s[0]; e.return_pop (t14); },
null	];

;
	c.args__is_valid_mobile = c.pargs__is_valid_mobile =  ["identifier"];
	c.inst__is_valid_mobile = c.pinst__is_valid_mobile =  [
/*0*/	function (e,f) { e.return_pop (builtin__preg_match ("/^07[0-9 ]{8,10}$/",f.v.identifier)); },
null	];

;
	c.args__is_valid_email = c.pargs__is_valid_email =  ["identifier"];
	c.inst__is_valid_email = c.pinst__is_valid_email =  [
/*0*/	function (e,f) { e.return_pop (builtin__preg_match ("/^[0-9a-zA-Z\\.\\+\\-_']+@[-0-9a-zA-Z\\.]+$/",f.v.identifier)); },
null	];

;
	c.args__try_identification =  ["identifier"];
	c.inst__try_identification =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "try_identification", ([f.v.identifier])])); },
	function (e,f) { var t15 = f.s[0]; e.return_pop (t15); },
null	];

;
	c.args__test_confirmation_code =  ["code"];
	c.inst__test_confirmation_code =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "test_confirmation_code", ([f.v.code])])); },
	function (e,f) { var t16 = f.s[0]; e.return_pop (t16); },
null	];

;
	c.args__identity_chosen =  ["authority","phandle"];
	c.inst__identity_chosen =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "identity_chosen", ([f.v.authority, f.v.phandle])])); },
	function (e,f) { var t17 = f.s[0]; e.return_pop (t17); },
null	];

;
	c.args__get_my_username =  [];
	c.inst__get_my_username =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "get_my_username", ([])])); },
	function (e,f) { var t18 = f.s[0]; e.return_pop (t18); },
null	];

;
	c.args__try_set_username_and_password =  ["username","epwd"];
	c.inst__try_set_username_and_password =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "try_set_username_and_password", ([f.v.username, f.v.epwd])])); },
	function (e,f) { var t19 = f.s[0]; e.return_pop (t19); },
null	];

;
	c.args__set_username_and_password = c.pargs__set_username_and_password =  [];
	c.inst__set_username_and_password = c.pinst__set_username_and_password =  [
/*0*/	function (e,f) { e.smcall (0, auth,"get_my_username", ([])); },
	function (e,f) {
		var t21 = f.s[0]; f.v.username = t21;
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:"<p>Please set a username and password.</p>"});
		if (((f.v.username)) == ((""))) f.pc=2; else f.pc=3;
	},
	function (e,f) {
		f.pc=4;
		f.v.fields[f.v.fields.length] = ({type:"text", name:"username", label:"Username", focus:"true"});
		f.v.fields[f.v.fields.length] = ({type:"password", name:"password", label:"Password"});
	},
	function (e,f) {
		f.v.fields[f.v.fields.length] = ({type:"text", name:"username", label:"Username", value:f.v.username});
		f.v.fields[f.v.fields.length] = ({type:"password", name:"password", label:"Password", focus:"true"});
	},
	function (e,f) {
		f.v.fields[f.v.fields.length] = ({type:"password", name:"password2", label:"Retype password"});
		e.mcall (6, f.v.pop, "initialise", ([0, 0, "Account details", f.v.fields]));
	},
/*5*/	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([true, false])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t31 = f.s[0]; f.v.ev = t31;
		if ((((f.v.ev).action)) == (("OK"))) f.pc=10; else f.pc=8;
	},
/*10*/	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t33 = f.s[0]; f.v.values = t33;
		if ((((f.v.values).password)) != (((f.v.values).password2))) f.pc=12; else f.pc=13;
	},
	function (e,f) {
		f.pc=8;
		e.smcall (1, popupok,"run", (["Passwords do not match"]));
	},
	function (e,f) { e.smcall (1, aes,"encrypt", ([(f.v.values).password])); },
	function (e,f) {
		f.s[1] = (f.v.values).username;
		e.php_static_method_call (2, auth,"try_set_username_and_password", 2);
	},
/*15*/	function (e,f) {
		var t36 = f.s[0]; f.v.testres = t36;
		if (((f.v.testres)) === ((null))) f.pc=16; else f.pc=18;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) {
		f.pc=8;
		e.smcall (1, popupok,"run", ([f.v.testres]));
	},
null	];

;
	c.args__select_candidate = c.pargs__select_candidate =  ["res","identifier"];
	c.inst__select_candidate = c.pinst__select_candidate =  [
/*0*/	function (e,f) {
		f.v.candidates = (f.v.res).candidates;
		f.v.authority = (f.v.res).authority;
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:"<p>Please select which person you are...</p>"});
		f.v._k2 = e.enumkeys (f.v.candidates);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k2).length)) f.pc=2;
	},
	function (e,f) {
		f.pc=5;
		f.s[0] = "\">None of the above</a>";
		e.smcall (3, auth,"render_resume", (["select_one", ""]));
	},
	function (e,f) {
		f.v.handle = (f.v._k2).shift();
		f.v.nicename = (f.v.candidates)[(f.v.handle)];
		f.s[0] = ("\">") + ("" + (f.v.nicename) + ("</a>"));
		e.smcall (3, auth,"render_resume", (["select_one", f.v.handle]));
	},
	function (e,f) {
		f.pc=1;
		var t45 = f.s[1]; var t46 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:("<a href=\"#\" onclick=\"") + ("" + (t45) + (t46))});
	},
/*5*/	function (e,f) {
		var t48 = f.s[1]; var t49 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:("<a href=\"#\" onclick=\"") + ("" + (t48) + (t49))});
		e.mcall (6, f.v.pop, "initialise", ([0, 0, "Who are you?", f.v.fields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([false, true])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
/*10*/	function (e,f) {
		var t52 = f.s[0]; f.v.ev = t52;
		if ((((f.v.ev).action)) == (("cancel"))) f.pc=11; else f.pc=13;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("select_one"))) f.pc=14; else f.pc=9; },
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
/*15*/	function (e,f) {
		f.v.handle = (f.v.ev).parm;
		if (((f.v.handle)) == ((""))) f.pc=16; else f.pc=18;
	},
	function (e,f) { e.smcall (1, auth,"open_signup_dialog", ([f.v.identifier])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { e.smcall (2, auth,"identity_chosen", ([f.v.authority, f.v.handle])); },
	function (e,f) { e.smcall (0, auth,"set_username_and_password", ([])); },
/*20*/	function (e,f) { e.smcall (2, browser,"reload", ([([]), ({})])); },
null	];

;
	c.args__secure_post = c.pargs__secure_post =  ["values"];
	c.inst__secure_post = c.pinst__secure_post =  [
/*0*/	function (e,f) {
		f.v.res = ({});
		f.v._k4 = e.enumkeys (f.v.values);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k4).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.s[0] = f.v.key = (f.v._k4).shift();
		f.s[1] = f.v.val = (f.v.values)[(f.v.key)];
		e.smcall (3, aes,"encrypt", ([f.v.val]));
	},
	function (e,f) {
		f.pc=1;
		var t59 = f.s[2]; f.v.res[f.v.key] = t59;
	},
null	];

;
	c.args__do_account_activation =  ["p","newdata","identifier"];
	c.inst__do_account_activation =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "do_account_activation", ([f.v.p, f.v.newdata, f.v.identifier])])); },
	function (e,f) { var t60 = f.s[0]; e.return_pop (t60); },
null	];

;
	c.args__use_this_account = c.pargs__use_this_account =  ["el","args","ev"];
	c.inst__use_this_account = c.pinst__use_this_account =  [
/*0*/	function (e,f) {
		f.v.p = (f.v.args)[(0)];
		f.v.values = (f.v.args)[(1)];
		if (((f.v.p)) === ((""))) f.pc=1; else f.pc=4;
	},
	function (e,f) { e.smcall (0, siteauth,"lookup", ([])); },
	function (e,f) {
		var t64 = f.s[0]; f.v.p = t64;
		if (((f.v.p)) === ((null))) f.pc=3; else f.pc=4;
	},
	function (e,f) { f.pc=-1; },
	function (e,f) { if (((f.v.p)) === ((null))) f.pc=5; else f.pc=14; },
/*5*/	function (e,f) {
		f.pc=7;
		e.smcall (1, popupokcancel,"run", ([("Create new person ") + ("" + ((f.v.values).nname) + ((" ") + ("" + ((f.v.values).sname) + ("?"))))]));
	},
	function (e,f) { f.pc=-1; },
	function (e,f) {
		var t65 = f.s[0]; 
		if (!(t65)) f.pc=6; else f.pc=8;
	},
	function (e,f) {
		f.pc=11;
		f.v.newdata = ({fname:(f.v.values).nname, nname:(f.v.values).nname, sname:(f.v.values).sname});
		e.smcall (1, auth,"is_valid_email", ([(f.v.values).identifier]));
	},
	function (e,f) {
		f.pc=12;
		f.v.newdata.email = (f.v.values).identifier;
	},
/*10*/	function (e,f) {
		f.pc=12;
		f.v.newdata.mobile = (f.v.values).identifier;
	},
	function (e,f) { var t69 = f.s[0]; if (t69) f.pc=9; else f.pc=10; },
	function (e,f) { e.smcall (3, auth,"do_account_activation", ([null, f.v.newdata, (f.v.values).identifier])); },
	function (e,f) {
		f.pc=-1;
		var t71 = f.s[0]; f.v.res = t71;
		e.smcall (1, popupok,"run", ([f.v.res]));
	},
	function (e,f) {
		f.pc=17;
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.adjustments = ([]);
		f.v.adjustments.fname = ({name:"nname", "default":"replace"});
		f.v.adjustments.nname = ({name:"nname", "default":"replace"});
		f.v.adjustments.sname = ({name:"sname", "default":"replace"});
		e.smcall (1, auth,"is_valid_email", ([(f.v.values).identifier]));
	},
/*15*/	function (e,f) {
		f.pc=18;
		f.v.adjustments.email = ({name:"identifier", "default":"replace"});
		f.v.adjustments.other_email = ({name:"identifier", "default":"keep"});
		f.v.adjustments.mobile = null;
	},
	function (e,f) {
		f.pc=18;
		f.v.adjustments.email = null;
		f.v.adjustments.other_email = null;
		f.v.adjustments.mobile = ({name:"identifier", "default":"replace"});
	},
	function (e,f) { var t84 = f.s[0]; if (t84) f.pc=15; else f.pc=16; },
	function (e,f) { f.v._k6 = e.enumkeys (f.v.adjustments); },
	function (e,f) {
		f.pc=21;
		if (!((f.v._k6).length)) f.pc=20;
	},
/*20*/	function (e,f) {
		f.pc=28;
		e.mcall (6, f.v.pop, "initialise", ([600, 200, ("Update existing account for ") + ((f.v.p).nicename), f.v.fields]));
	},
	function (e,f) {
		f.v.key = (f.v._k6).shift();
		f.v.rule = (f.v.adjustments)[(f.v.key)];
		e.smcall (1, siteauth,"get_field_info", ([f.v.key]));
	},
	function (e,f) {
		var t89 = f.s[0]; f.v.fi = t89;
		f.v.lab = "" + ((f.v.fi).label) + ((" '") + ("" + ((f.v.p)[(f.v.key)]) + ("'")));
		if (((f.v.rule)) !== ((null))) f.pc=25; else f.pc=26;
	},
	function (e,f) {
		f.pc=19;
		f.v.options = ({replace:("Set to '") + ("" + ((f.v.values)[((f.v.rule).name)]) + ("'")), keep:"Keep existing"});
		f.v.fields[f.v.fields.length] = ({type:"enum", name:("change_") + (f.v.key), label:f.v.lab, value:(f.v.rule)[("default")], options:f.v.options});
	},
	function (e,f) {
		f.pc=19;
		f.v.fields[f.v.fields.length] = ({type:"label", name:"", label:f.v.lab, value:""});
	},
/*25*/	function (e,f) {
		f.pc=27;
		f.s[0] = (((f.v.p)[(f.v.key)])) != (((f.v.values)[((f.v.rule).name)]));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t94 = f.s[0]; if (t94) f.pc=23; else f.pc=24; },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
/*30*/	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t96 = f.s[0]; f.v.ev = t96;
		if ((((f.v.ev).action)) == (("cancel"))) f.pc=32; else f.pc=34;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("OK"))) f.pc=35; else f.pc=30; },
/*35*/	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t98 = f.s[0]; f.v.fill_values = t98;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		f.v.newdata = ({});
		f.v._k8 = e.enumkeys (f.v.adjustments);
	},
	function (e,f) {
		f.pc=40;
		if (!((f.v._k8).length)) f.pc=39;
	},
	function (e,f) {
		f.pc=46;
		e.smcall (3, auth,"do_account_activation", ([f.v.p, f.v.newdata, (f.v.values).identifier]));
	},
/*40*/	function (e,f) {
		f.v.key = (f.v._k8).shift();
		f.v.rule = (f.v.adjustments)[(f.v.key)];
		if (((f.v.rule)) !== ((null))) f.pc=43; else f.pc=44;
	},
	function (e,f) { if ((((f.v.fill_values)[(("change_") + (f.v.key))])) == (("replace"))) f.pc=42; else f.pc=38; },
	function (e,f) {
		f.pc=38;
		f.v.newdata[f.v.key] = (f.v.values)[((f.v.rule).name)];
	},
	function (e,f) {
		f.pc=45;
		f.s[0] = (((f.v.p)[(f.v.key)])) != (((f.v.values)[((f.v.rule).name)]));
	},
	function (e,f) { f.s[0] = false; },
/*45*/	function (e,f) { var t104 = f.s[0]; if (t104) f.pc=41; else f.pc=38; },
	function (e,f) {
		var t106 = f.s[0]; f.v.res = t106;
		e.smcall (1, popupok,"run", ([f.v.res]));
	},
	function (e,f) { f.pc=-1; },
null	];

;
	c.args__signup =  ["values"];
	c.inst__signup =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "signup", ([f.v.values])])); },
	function (e,f) { var t107 = f.s[0]; e.return_pop (t107); },
null	];

;
	c.args__open_signup_dialog = c.pargs__open_signup_dialog =  ["identifier"];
	c.inst__open_signup_dialog = c.pinst__open_signup_dialog =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = ({type:"text", name:"nname", label:"First name", focus:true});
		f.v.fields[f.v.fields.length] = ({type:"text", name:"sname", label:"Surname"});
		f.v.fields[f.v.fields.length] = ({type:"text", name:"identifier", label:"Email address or mobile number", value:f.v.identifier});
		f.v.fields[f.v.fields.length] = ({type:"text", name:"leader", label:"Name of a church leader who knows you"});
		e.mcall (6, f.v.pop, "initialise", ([300, 200, "Request an account", f.v.fields]));
	},
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t115 = f.s[0]; f.v.ev = t115;
		if ((((f.v.ev).action)) == (("cancel"))) f.pc=5; else f.pc=7;
	},
/*5*/	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("OK"))) f.pc=8; else f.pc=3; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t117 = f.s[0]; f.v.values = t117;
		if (((builtin__trim ((f.v.values).nname))) == ((""))) f.pc=15; else f.pc=16;
	},
/*10*/	function (e,f) {
		f.pc=3;
		e.smcall (1, popupok,"run", (["Please fill in all fields"]));
	},
	function (e,f) { e.smcall (1, auth,"signup", ([f.v.values])); },
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { e.smcall (1, popupok,"run", (["An email has been sent to an administrator. You should hear back shortly."])); },
	function (e,f) { f.pc=-1; },
/*15*/	function (e,f) {
		f.pc=21;
		f.s[0] = true;
	},
	function (e,f) { if (((builtin__trim ((f.v.values).sname))) == ((""))) f.pc=17; else f.pc=18; },
	function (e,f) {
		f.pc=21;
		f.s[0] = true;
	},
	function (e,f) { if (((builtin__trim ((f.v.values).identifier))) == ((""))) f.pc=19; else f.pc=20; },
	function (e,f) {
		f.pc=21;
		f.s[0] = true;
	},
/*20*/	function (e,f) { f.s[0] = ((builtin__trim ((f.v.values).leader))) == (("")); },
	function (e,f) { var t118 = f.s[0]; if (t118) f.pc=10; else f.pc=11; },
null	];

;
	c.args__try_confirmation_code = c.pargs__try_confirmation_code =  ["code"];
	c.inst__try_confirmation_code = c.pinst__try_confirmation_code =  [
/*0*/	function (e,f) { e.smcall (1, auth,"test_confirmation_code", ([f.v.code])); },
	function (e,f) {
		var t120 = f.s[0]; f.v.res = t120;
		if (((f.v.res)) === ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) {
		f.pc=-1;
		e.smcall (1, popupok,"run", (["Invalid confirmation code"]));
	},
	function (e,f) { e.smcall (2, auth,"select_candidate", ([f.v.res, f.v.identifier])); },
null	];

;
	c.args__open_identify_dialog = c.pargs__open_identify_dialog =  [];
	c.inst__open_identify_dialog = c.pinst__open_identify_dialog =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = ({type:"text", name:"identifier", label:"Mobile number or email address or confirmation code", focus:"true"});
		f.v.is_mobile = false;
		f.v.is_email = false;
		e.mcall (6, f.v.pop, "initialise", ([300, 150, "Identify yourself", f.v.fields]));
	},
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) {
		f.pc=5;
		e.mcall (2, f.v.pop, "run", ([]));
	},
	function (e,f) {
		f.pc=24;
		e.smcall (1, auth,"try_identification", ([f.v.identifier]));
	},
/*5*/	function (e,f) {
		var t127 = f.s[0]; f.v.ev = t127;
		if ((((f.v.ev).action)) == (("cover"))) f.pc=8; else f.pc=9;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) {
		f.pc=10;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v.ev).action)) == (("cancel")); },
/*10*/	function (e,f) { var t128 = f.s[0]; if (t128) f.pc=6; else f.pc=11; },
	function (e,f) { if ((((f.v.ev).action)) == (("OK"))) f.pc=12; else f.pc=3; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		f.pc=23;
		var t130 = f.s[0]; f.v.values = t130;
		f.v.identifier = (f.v.values).identifier;
		f.v.identifier = builtin__preg_replace ("/ /","",f.v.identifier);
		e.smcall (1, auth,"is_valid_mobile", ([f.v.identifier]));
	},
	function (e,f) {
		f.pc=4;
		f.v.is_mobile = true;
	},
/*15*/	function (e,f) {
		f.pc=22;
		e.smcall (1, auth,"is_valid_email", ([f.v.identifier]));
	},
	function (e,f) {
		f.pc=4;
		f.v.is_email = true;
	},
	function (e,f) { if (builtin__preg_match ("/^\\d+$/",f.v.identifier)) f.pc=18; else f.pc=21; },
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { e.smcall (1, auth,"try_confirmation_code", ([f.v.identifier])); },
/*20*/	function (e,f) { f.pc=-1; },
	function (e,f) {
		f.pc=3;
		e.smcall (1, popupok,"run", (["Please enter a mobile number starting 07 or a valid email address or a confirmation key"]));
	},
	function (e,f) { var t135 = f.s[0]; if (t135) f.pc=16; else f.pc=17; },
	function (e,f) { var t136 = f.s[0]; if (t136) f.pc=14; else f.pc=15; },
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
/*25*/	function (e,f) {
		f.v.fields = ([]);
		f.v.instrs = "";
		if (f.v.is_mobile) f.pc=26; else f.pc=27;
	},
	function (e,f) {
		f.pc=28;
		f.v.instrs = "" + (f.v.instrs) + ("<p>If the website knows about you, you should receive a text message containing an confirmation code within the next minute</p>");
		f.v.instrs = "" + (f.v.instrs) + ("<p>Depending on the time of day, your text may get delayed so please be patient</p>");
	},
	function (e,f) {
		f.v.instrs = "" + (f.v.instrs) + ("<p>If the website knows about you, you should receive an email containing an confirmation code within the next 10 minutes.</p>");
		f.v.instrs = "" + (f.v.instrs) + ("<p>Sometimes email can get delayed by spam filters or can be put in your spam folder, please check there before giving up.</p>");
	},
	function (e,f) {
		f.v.instrs = "" + (f.v.instrs) + ("<p>When you receive the confirmation code, type it in here...</p>");
		f.v.instrs = "" + (f.v.instrs) + ("<p>If you have waited for an confirmation code but nothing arrived then click 'Cancel'</p>");
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", html:f.v.instrs});
		f.v.fields[f.v.fields.length] = ({type:"text", name:"code", label:"Confirmation code", focus:true});
		e.mcall (6, f.v.pop, "initialise", ([0, 0, "Enter confirmation code", f.v.fields]));
	},
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
/*30*/	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t148 = f.s[0]; f.v.ev = t148;
		if ((((f.v.ev).action)) == (("cancel"))) f.pc=33; else f.pc=36;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { e.smcall (1, auth,"open_signup_dialog", ([f.v.identifier])); },
/*35*/	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("OK"))) f.pc=37; else f.pc=31; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t150 = f.s[0]; f.v.values = t150;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) { e.smcall (1, auth,"try_confirmation_code", ([(f.v.values).code])); },
/*40*/	function (e,f) { f.pc=-1; },
null	];

;
	c.args__open_login_dialog = c.pargs__open_login_dialog =  [];
	c.inst__open_login_dialog = c.pinst__open_login_dialog =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = ({type:"text", name:"username", label:"Username", focus:true});
		f.v.fields[f.v.fields.length] = ({type:"password", name:"password", label:"Password"});
		f.v.fields[f.v.fields.length] = ({type:"yesno", name:"save_authority", label:"Remember password"});
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:"<div style=\"font-size:75%\">Do not remember password on a shared computer</div>"});
		f.s[0] = "\">Login</button>";
		e.smcall (3, auth,"render_resume", (["OK", null]));
	},
	function (e,f) {
		var t157 = f.s[1]; var t158 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:("<button style=\"float:right\" onclick=\"") + ("" + (t157) + (t158))});
		e.smcall (1, siteauth,"add_login_fields", ([f.v.fields]));
	},
	function (e,f) {
		e.php_push_static_var (0, auth,"allow_signup");
		var t160 = f.s[0]; if (t160) f.pc=3; else f.pc=6;
	},
	function (e,f) {
		f.s[0] = ("\">I have a confirmation code...</a><br/>") + ("</div>");
		e.smcall (3, auth,"render_resume", (["confcode", null]));
	},
	function (e,f) {
		var t161 = f.s[1]; var t162 = f.s[0]; 
		f.s[0] = ("\">Help, I can't get in...</a><br/>") + (("<a href=\"#\" onclick=\"") + ("" + (t161) + (t162)));
		e.smcall (3, auth,"render_resume", (["unknown", null]));
	},
/*5*/	function (e,f) {
		var t163 = f.s[1]; var t164 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"html", name:"", label:"", html:("<div style=\"border:solid #c0c0c0 1px;padding:3px;margin:5px\">") + (("<a href=\"#\" onclick=\"") + ("" + (t163) + (t164)))});
	},
	function (e,f) { e.mcall (6, f.v.pop, "initialise", ([0, 0, "Login", f.v.fields])); },
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([false, true])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
/*10*/	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t167 = f.s[0]; f.v.ev = t167;
		if ((((f.v.ev).action)) == (("cover"))) f.pc=48; else f.pc=49;
	},
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("unknown"))) f.pc=15; else f.pc=18; },
/*15*/	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { e.smcall (0, auth,"open_identify_dialog", ([])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("confcode"))) f.pc=19; else f.pc=24; },
	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
/*20*/	function (e,f) { e.smcall (4, popupeditbox,"run", ([0, 0, "Enter confirmation code", ""])); },
	function (e,f) {
		var t169 = f.s[0]; f.v.identifier = t169;
		if (((f.v.identifier)) !== ((null))) f.pc=22; else f.pc=10;
	},
	function (e,f) { e.smcall (1, auth,"try_confirmation_code", ([f.v.identifier])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { if ((((f.v.ev).action)) == (("OK"))) f.pc=25; else f.pc=42; },
/*25*/	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t171 = f.s[0]; f.v.values = t171;
		if ((((f.v.values).username)) == ((""))) f.pc=27; else f.pc=28;
	},
	function (e,f) {
		f.pc=10;
		e.smcall (1, popupok,"run", (["Please enter a username"]));
	},
	function (e,f) { if ((((f.v.values).password)) == ((""))) f.pc=29; else f.pc=30; },
	function (e,f) {
		f.pc=10;
		e.smcall (1, popupok,"run", (["Please enter a password"]));
	},
/*30*/	function (e,f) { if (!(builtin__method_exists ("siteauth","use_challenge_response"))) f.pc=36; else f.pc=37; },
	function (e,f) {
		f.v.password = builtin__md5 ((f.v.values).password);
		e.smcall (1, auth,"get_challenge", ([(f.v.values).username]));
	},
	function (e,f) {
		var t174 = f.s[0]; f.v.challenge = t174;
		e.smcall (4, auth,"handle_response", ([(f.v.values).username, f.v.challenge, builtin__sha1 ("" + (f.v.challenge) + (("|") + (f.v.password))), (f.v.values).save_authority]));
	},
	function (e,f) {
		f.pc=39;
		var t176 = f.s[0]; f.v.res = t176;
	},
	function (e,f) { e.smcall (3, auth,"handle_simple_login", ([(f.v.values).username, (f.v.values).password, (f.v.values).save_authority])); },
/*35*/	function (e,f) {
		f.pc=39;
		var t178 = f.s[0]; f.v.res = t178;
	},
	function (e,f) {
		f.pc=38;
		f.s[0] = true;
	},
	function (e,f) { e.smcall (0, siteauth,"use_challenge_response", ([])); },
	function (e,f) { var t179 = f.s[0]; if (t179) f.pc=31; else f.pc=34; },
	function (e,f) { if (f.v.res) f.pc=40; else f.pc=41; },
/*40*/	function (e,f) {
		f.pc=10;
		e.smcall (2, browser,"reload", ([([]), ({})]));
	},
	function (e,f) {
		f.pc=10;
		e.smcall (1, popupok,"run", (["Wrong username or password"]));
	},
	function (e,f) {
		f.pc=47;
		e.smcall (1, siteauth,"recognise_login_action", ([f.v.ev]));
	},
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t181 = f.s[0]; f.v.values = t181;
		e.mcall (2, f.v.pop, "close", ([]));
	},
/*45*/	function (e,f) { e.smcall (2, siteauth,"handle_login_action", ([f.v.ev, f.v.values])); },
	function (e,f) { f.pc=-1; },
	function (e,f) { var t182 = f.s[0]; if (t182) f.pc=43; else f.pc=10; },
	function (e,f) {
		f.pc=50;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v.ev).action)) == (("cancel")); },
/*50*/	function (e,f) { var t183 = f.s[0]; if (t183) f.pc=12; else f.pc=14; },
null	];

;
	c.args__login_facebook =  ["fbid","email","fname","sname","token"];
	c.inst__login_facebook =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["auth", "login_facebook", ([f.v.fbid, f.v.email, f.v.fname, f.v.sname, f.v.token])])); },
	function (e,f) { var t184 = f.s[0]; e.return_pop (t184); },
null	];

;
};
auth.init_methods (auth);
rpcclass.setup_class (auth, "auth",0, (["listeners"]), ([2]));
function ajax () { this.do_construct (arguments); }
ajax.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	cp.cancel =  function ()
	{
		if (this.req !== undefined)
			this.req.abort();
			}

;
	c.create = cp.create =  function (rpc_method,args,completion,completion_arg)
	{
var aj;{
		aj = new ajax();;
		aj.rpc_method = rpc_method;;
		aj.args = args;;
		aj.completion = completion;;
		aj.completion_arg = completion_arg;;
		return (aj);
		}
			}

;
	c.args__do_call_function_async = c.pargs__do_call_function_async =  ["obj","meth","margs"];
	c.inst__do_call_function_async = c.pinst__do_call_function_async =  [
/*0*/	function (e,f) {
		f.v.args = ([]);
		f.v.args[f.v.args.length] = f.v.meth;
		f.v.args[f.v.args.length] = f.v.obj;
		f.v.args[f.v.args.length] = f.v.margs;
		e.smcall (0, php_engine,"get_current_thread_id", ([]));
	},
	function (e,f) {
		f.s[1] = "php_engine.resume_thread";
		f.s[2] = f.v.args;
		f.s[3] = "rpc_call_method";
		e.php_static_method_call (4, ajax,"create", 4);
	},
	function (e,f) {
		var t283 = f.s[0]; f.v.aj = t283;
		e.mcall (2, f.v.aj, "initiate", ([]));
	},
	function (e,f) {  },
	function (e,f) { e.php_builtin (0, "wait_for_completion", 0); },
/*5*/	function (e,f) {
		var t285 = f.s[0]; f.v.res = t285;
		if ((((f.v.res).action)) == (("ajax-complete"))) f.pc=6; else f.pc=4;
	},
	function (e,f) { e.return_pop ((f.v.res).parm); },
null	];

;
	c.args__do_call_static_function_async = c.pargs__do_call_static_function_async =  ["classname","meth","margs"];
	c.inst__do_call_static_function_async = c.pinst__do_call_static_function_async =  [
/*0*/	function (e,f) {
		f.v.args = ([]);
		f.v.args[f.v.args.length] = f.v.classname;
		f.v.args[f.v.args.length] = f.v.meth;
		f.v.args[f.v.args.length] = f.v.margs;
		e.smcall (0, php_engine,"get_current_thread_id", ([]));
	},
	function (e,f) {
		f.s[1] = "php_engine.resume_thread";
		f.s[2] = f.v.args;
		f.s[3] = "rpc_call_static_method";
		e.php_static_method_call (4, ajax,"create", 4);
	},
	function (e,f) {
		var t292 = f.s[0]; f.v.aj = t292;
		e.mcall (2, f.v.aj, "initiate", ([]));
	},
	function (e,f) {  },
	function (e,f) { e.php_builtin (0, "wait_for_completion", 0); },
/*5*/	function (e,f) {
		var t294 = f.s[0]; f.v.res = t294;
		if ((((f.v.res).action)) == (("ajax-complete"))) f.pc=6; else f.pc=4;
	},
	function (e,f) { e.return_pop ((f.v.res).parm); },
null	];

;
	cp.handle_response =  function (data)
	{
		var compound = data.firstChild;
		for (var i = 0; i < compound.childNodes.length; i++)
		{
			node = compound.childNodes[i];
			if (node.tagName == "result")
			{
				var text = "";
				for (var j = 0; node.childNodes[j] != undefined; j++)
				{
					if (node.childNodes[j].nodeType == 3)
						text += node.childNodes[j].nodeValue;
				}
				var result = ajax.convert_xml_to_object (text);
				var completion = eval (this.completion);
				completion (this.completion_arg, "ajax-complete", result);
			}
			else if (node.tagName == "result3")
			{
				var text = "";
				for (var j = 0; node.childNodes[j] != undefined; j++)
				{
					if (node.childNodes[j].nodeType == 3)
						text += node.childNodes[j].nodeValue;
				}
//					debugout ("Got result "+text);
				var result = eval ("("+text+")");
//					debugout ("Value is '"+result+"'");
				var completion = eval (this.completion);
				completion (this.completion_arg, "ajax-complete", result);
			}
			else if (node.tagName == "debug")
			{
				var div = document.getElementById ("debug");
				if (div) div.innerHTML += node.firstChild.nodeValue;
			}
			else if (node.tagName == "error")
			{
				alert (node.firstChild.nodeValue);
				throw new Error (node.firstChild.nodeValue);
			}
//				else if (node.tagName == "class")
//				{
//					ajax.load_object_from_xml (node);
//				}
			else if (node.tagName == "class3")
			{
				ajax.load_object_from_class3 (node);
			}
		}
		window.status = "";
		return false;
			}

;
	cp.complete2 =  function (data)
	{
		return this.handle_response (data);
			}

;
	cp.complete =  function (req)
	{
//		debugout ("AJAX transaction "+this.corr+" completed with status "+req.status);
		if (req.status == 0)
		{
			// aborted
			return;
		}

		if (req.status != 200)
		{
			alert ("Failed when contacting server ("+req.status+")");
			throw new Error ("Failed when contacting server ("+req.status+")");
		}

		if (req.responseXML == null || req.responseXML.firstChild == null)
		{
			debugout (req.responseText);
			alert ("RPC call failed: "+req.responseText);
			throw new Error ("RPC call failed");
		}


		window.status = "Decoding response";
//				alert (req.responseText);

		if (req.responseXML.firstChild.tagName == "compound")
		{
			return this.handle_response (req.responseXML);
		}
		else
		{
			alert ("Unexpected response "+req.responseXML.firstChild.tagName+":"+req.responseText);
			throw new Error ("Unexpected response "+req.responseXML.firstChild.tagName);
		}
			}

;
	cp.initiate =  function ()
	{
		var msg = new Object;
		var closure = new Array;

		var sargs = ajax.serialize_object (this.args, closure);
		msg.method = this.rpc_method;
		msg.args = sargs;

		var i;
		for (i = 0; i < closure.length; i++)
		{
			var obj = closure[i];
			msg["object"+i] = "classname="+encodeURIComponent(obj.classname)+"&obj_id="+encodeURIComponent(obj.obj_id)+"&fields="+encodeURIComponent(obj.serialize(closure));
		}


		this.corr = builtin__make_uniq();
		var myobj = this;

		$.post(rootpath.map("/pj/ajax.php?page_version="+window.page_version), msg, function (data, textStatus) {myobj.complete2 (data);}, "xml");

			}

;
	c.stub_object = cp.stub_object =  function (obj)
	{
//		debugout ("stubbing object "+obj);
		if (obj === null || obj === undefined)
		{
			return "{n}";
		}
		else if (obj.constructor == Array)
		{
			var res = "{a:";
			for (var i = 0; i < obj.length; i++)
			{
				var childtag = ajax.stub_object (obj[i]);
				if (childtag == null)
					alert ("Failed to encode array index "+i+" of "+obj);
				else
				{
					res += "["+encodeURIComponent (childtag)+"]";
				}	
			}
			return res + "}";
		}
		else
		{
			if (obj.serialize == undefined)
			{
				debugout ("Object to stub is not an object, it is a "+typeof obj+" = "+obj.constructor);
			}
			return "{o:"+obj.classname+":"+encodeURIComponent(obj.obj_id)+"}";
		}
			}

;
	c.add_to_closure = cp.add_to_closure =  function (closure,obj)
	{
		for (var i in closure)
			if (closure[i] == obj)
				return;
		closure[closure.length] = obj;
			}

;
	c.serialize_object1 = cp.serialize_object1 =  function (obj,closure,structures)
	{
//		debugout ("serializing object "+obj);
		if (++antirecurse == 1000)
		{
			alert ("Too much recursion");
			throw ("Too much recursion");
		}
		if (typeof obj == "string")
		{
			return "{s:"+encodeURIComponent (obj)+"}";
		}
		else if (typeof obj == "number")
		{
			return "{i:"+encodeURIComponent (obj)+"}";
		}
		else if (typeof obj == "boolean")
		{
			return "{b:"+(obj?"1":"0")+"}";
		}
		else if (obj === undefined)
		{
			return "{n}";
		}
		else if (typeof obj == "object")
		{
			if (obj == null)
			{
				return "{n}";
			}
			else if (obj.constructor == Array)
			{
				var res = "{a:";
				for (var i = 0; i < obj.length; i++)
				{
					var childtag = ajax.serialize_object1 (obj[i], closure, structures);
					if (childtag == null)
						alert ("Failed to encode array index "+i+" of "+obj);
					else
					{
						res += "["+encodeURIComponent (childtag)+"]";
					}	
				}
				return res + "}";
			}
			else
			{
				var classname = rpcclass.get_classname (obj);
				if (classname)
				{
					if (obj.classname !== classname)
					{
						alert ("Class name should be "+classname+" but is "+obj.classname);
						throw ("Class name should be "+classname+" but is "+obj.classname);
					}
					if (obj.class_is_readonly == 0)
						ajax.add_to_closure (closure, obj);
					return "{o:"+classname+":"+encodeURIComponent(obj.obj_id)+"}";
				}
				else if (obj.nodeName != null)
				{
					if (obj.id == undefined) obj.id = "HTML"+builtin__make_uniq();
					return "{h:"+encodeURIComponent(obj.id)+"}";
				}
				else
				{
					for (var o in structures)
					{
						if (o == obj)
						{
							alert ("Object is recursive");
							throw ("Object is recursive");
						}
					}
					structures[structures.length] = obj;

					var res = "{t:";
					for (var p in obj)
					{
						if (typeof (obj[p]) != "function")
						{
							res += "["+encodeURIComponent(p)+"="+encodeURIComponent(ajax.serialize_object1(obj[p], closure, structures))+"]";
						}
					}
					return res+"}";
				}
			}
		}
		else
		{
			debugout ("Cannot convert type "+(typeof obj)+" to XML");
			return null;
		}
			}

;
	c.serialize_object = cp.serialize_object =  function (obj,closure)
	{
		antirecurse = 0;
		var structures = new Array;
		return ajax.serialize_object1 (obj, closure, structures);
			}

;
};
ajax.init_methods (ajax);
rpcclass.setup_class (ajax, "ajax",0, (["listeners"]), ([2]));
function dynloader () { this.do_construct (arguments); }
dynloader.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__load_codegroup = c.pargs__load_codegroup =  ["name"];
	c.inst__load_codegroup = c.pinst__load_codegroup =  [
/*0*/	function (e,f) {
		e.php_push_static_var (1, dynloader,"codegroups");
		var t295 = f.s[1]; 
		if (((t295)) === ((null))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.s[0] = ({});
		e.php_push_static_var_lvalue (1, dynloader,"codegroups");
		e.php_assign (2);
	},
	function (e,f) {
		e.php_push_static_var (1, dynloader,"codegroups");
		var t297 = f.s[1]; 
		if (((t297)[(f.v.name)]) !== undefined) f.pc=3; else f.pc=4;
	},
	function (e,f) { f.pc=-1; },
	function (e,f) {
		e.php_push_static_var (2, dynloader,"codegroups");
		var t298 = f.s[2]; t298[f.v.name] = true;
		e.mcall (3, document, "getElementsByTagName", (["head"]));
	},
/*5*/	function (e,f) {
		var t301 = f.s[0]; f.v.heads = t301;
		f.v.head = (f.v.heads)[(0)];
		e.mcall (3, document, "createElement", (["script"]));
	},
	function (e,f) {
		var t304 = f.s[0]; f.v.script = t304;
		e.mcall (4, f.v.script, "setAttribute", (["type", "text/javascript"]));
	},
	function (e,f) { e.mcall (4, f.v.script, "setAttribute", (["src", ("/pj/js.php?codegroup=") + (f.v.name)])); },
	function (e,f) { e.mcall (3, f.v.head, "appendChild", ([f.v.script])); },
	function (e,f) { e.smcall (0, php_engine,"get_current_thread_id", ([])); },
/*10*/	function (e,f) {
		e.php_push_static_var_lvalue (1, dynloader,"thread_id");
		e.php_assign (2);
		e.php_builtin (0, "wait_for_completion", 0);
	},
null	];

;
	c.load_complete = cp.load_complete =  function (name)
	{
{
		php_engine.resume_thread  (dynloader.thread_id,"load-complete",null);;
		}
			}

;
	c.args__load_codegroup_mcall = c.pargs__load_codegroup_mcall =  ["name","obj","methodname","args"];
	c.inst__load_codegroup_mcall = c.pinst__load_codegroup_mcall =  [
/*0*/	function (e,f) { e.smcall (1, dynloader,"load_codegroup", ([f.v.name])); },
	function (e,f) {
		f.s[0] = f.v.args;
		f.s[1] = ([f.v.obj, f.v.methodname]);
		e.php_builtin (2, "call_user_func_array", 2);
	},
	function (e,f) { var t307 = f.s[0]; e.return_pop (t307); },
null	];

;
	c.args__load_codegroup_smcall = c.pargs__load_codegroup_smcall =  ["name","classname","methodname","args"];
	c.inst__load_codegroup_smcall = c.pinst__load_codegroup_smcall =  [
/*0*/	function (e,f) { e.smcall (1, dynloader,"load_codegroup", ([f.v.name])); },
	function (e,f) {
		f.s[0] = f.v.args;
		f.s[1] = ([f.v.classname, f.v.methodname]);
		e.php_builtin (2, "call_user_func_array", 2);
	},
	function (e,f) { var t308 = f.s[0]; e.return_pop (t308); },
null	];

;
};
dynloader.init_methods (dynloader);
rpcclass.setup_class (dynloader, "dynloader",0, (["listeners"]), ([2]));
function dbclass () { this.do_construct (arguments); }
dbclass.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__find_object = c.pargs__find_object =  ["cname","id"];
	c.inst__find_object = c.pinst__find_object =  [
/*0*/	function (e,f) {
		f.pc=2;
		e.smcall (2, rpcclass,"object_present", ([f.v.cname, ("dbclass:") + ("" + (f.v.cname) + ((":") + (f.v.id)))]));
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		var t185 = f.s[0]; 
		if (!(t185)) f.pc=1; else f.pc=3;
	},
	function (e,f) { e.smcall (2, rpcclass,"get_object_by_id", ([f.v.cname, ("dbclass:") + ("" + (f.v.cname) + ((":") + (f.v.id)))])); },
	function (e,f) { var t186 = f.s[0]; e.return_pop (t186); },
null	];

;
	c.pargs__render_calc_gobi =  [];
	c.pinst__render_calc_gobi =  [
/*0*/	function (e,f) { e.return_pop ("" + ((f.v["this"]).classname) + ((".dgobi('") + ("" + ((f.v["this"]).rowid) + ("')")))); },
null	];

;
	c.dgobi = cp.dgobi =  function (id)
	{
		return rpcclass.get_object_by_id (this.prototype.classname, "dbclass:"+this.prototype.classname+":"+id);
			}

;
};
dbclass.init_methods (dbclass);
rpcclass.setup_class (dbclass, "dbclass",0, (["rowid","listeners"]), ([0,2]));
function single_use_token () { this.do_construct (arguments); }
single_use_token.init_methods = function (c) {
	dbclass.init_methods(c);
	var cp = c.prototype;
};
single_use_token.init_methods (single_use_token);
rpcclass.setup_class (single_use_token, "single_use_token",0, (["tokenstr","timeout","data","owner","rowid","listeners"]), ([0,0,0,0,0,2]));
function aes () { this.do_construct (arguments); }
aes.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.get_key_complete = cp.get_key_complete =  function (res)
	{
{
		php_engine.resume_thread  (aes.thread_id,"sgk-complete",res);;
		}
			}

;
	c.args__get_key = c.pargs__get_key =  [];
	c.inst__get_key = c.pinst__get_key =  [
/*0*/	function (e,f) {
		e.php_push_static_var (0, aes,"current_key");
		var t311 = f.s[0]; 
		if ((t311) !== undefined) f.pc=1; else f.pc=2;
	},
	function (e,f) { f.pc=-1; },
	function (e,f) {
		f.v.cookie = (document).cookie;
		f.v.sessid = builtin__strstr (f.v.cookie,"PHPSESSID=");
		if (((f.v.sessid)) === ((false))) f.pc=3; else f.pc=4;
	},
	function (e,f) {
		f.s[0] = builtin__alert ("session cookie not found");
		f.pc=-1;
	},
	function (e,f) {
		f.v.sessid = builtin__substr (f.v.sessid,10);
		f.v.pos = builtin__strpos (f.v.sessid,";");
		if (((f.v.pos)) !== ((false))) f.pc=5; else f.pc=6;
	},
/*5*/	function (e,f) { f.v.sessid = builtin__substr (f.v.sessid,0,f.v.pos); },
	function (e,f) {
		f.v.url = ("https://secure.concordant.co.uk/relay/get-key2.php?targethost=") + ("" + ((encodeURIComponent ((window).location))) + (("&sessid=") + ((encodeURIComponent (f.v.sessid)))));
		e.mcall (3, document, "getElementsByTagName", (["head"]));
	},
	function (e,f) {
		var t319 = f.s[0]; f.v.heads = t319;
		f.v.head = (f.v.heads)[(0)];
		e.mcall (3, document, "createElement", (["script"]));
	},
	function (e,f) {
		var t322 = f.s[0]; f.v.script = t322;
		e.mcall (4, f.v.script, "setAttribute", (["type", "text/javascript"]));
	},
	function (e,f) { e.mcall (4, f.v.script, "setAttribute", (["src", f.v.url])); },
/*10*/	function (e,f) { e.mcall (3, f.v.head, "appendChild", ([f.v.script])); },
	function (e,f) { e.smcall (0, php_engine,"get_current_thread_id", ([])); },
	function (e,f) {
		e.php_push_static_var_lvalue (1, aes,"thread_id");
		e.php_assign (2);
	},
	function (e,f) { e.php_builtin (0, "wait_for_completion", 0); },
	function (e,f) {
		var t326 = f.s[0]; f.v.ev = t326;
		if ((((f.v.ev).action)) == (("sgk-complete"))) f.pc=15; else f.pc=13;
	},
/*15*/	function (e,f) {
		f.s[0] = builtin__debugout (("urlencoded key is ") + ((f.v.ev).parm));
		f.s[0] = (f.v.ev).parm;
		e.php_push_static_var_lvalue (1, aes,"current_key");
		e.php_assign (2);
	},
null	];

;
	c.args__encrypt = c.pargs__encrypt =  ["plaintext"];
	c.inst__encrypt = c.pinst__encrypt =  [
/*0*/	function (e,f) { e.smcall (0, aes,"get_key", ([])); },
	function (e,f) {
		e.php_push_static_var (1, aes,"current_key");
		var t328 = f.s[1]; e.mcall (5, AesCtr, "encrypt", ([f.v.plaintext, t328, 256]));
	},
	function (e,f) { var t329 = f.s[0]; e.return_pop (t329); },
null	];

;
	c.args__decrypt = c.pargs__decrypt =  ["ciphertext"];
	c.inst__decrypt = c.pinst__decrypt =  [
/*0*/	function (e,f) { e.smcall (0, aes,"get_key", ([])); },
	function (e,f) {
		e.php_push_static_var (1, aes,"current_key");
		var t330 = f.s[1]; e.mcall (5, AesCtr, "decrypt", ([f.v.ciphertext, t330, 256]));
	},
	function (e,f) { var t331 = f.s[0]; e.return_pop (t331); },
null	];

;
	c.args__encrypt_struct = c.pargs__encrypt_struct =  ["str"];
	c.inst__encrypt_struct = c.pinst__encrypt_struct =  [
/*0*/	function (e,f) {
		f.v.res = ({});
		f.v._k18 = e.enumkeys (f.v.str);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k18).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.s[0] = f.v.key = (f.v._k18).shift();
		f.s[1] = f.v.value = (f.v.str)[(f.v.key)];
		e.smcall (3, aes,"encrypt", ([f.v.value]));
	},
	function (e,f) {
		f.pc=1;
		var t337 = f.s[2]; f.v.res[f.v.key] = t337;
	},
null	];

;
	c.args__decrypt_struct = c.pargs__decrypt_struct =  ["str"];
	c.inst__decrypt_struct = c.pinst__decrypt_struct =  [
/*0*/	function (e,f) {
		f.v.res = ({});
		f.v._k20 = e.enumkeys (f.v.str);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k20).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.s[0] = f.v.key = (f.v._k20).shift();
		f.s[1] = f.v.value = (f.v.str)[(f.v.key)];
		e.smcall (3, aes,"decrypt", ([f.v.value]));
	},
	function (e,f) {
		f.pc=1;
		var t343 = f.s[2]; f.v.res[f.v.key] = t343;
	},
null	];

;
};
aes.init_methods (aes);
rpcclass.setup_class (aes, "aes",0, (["listeners"]), ([2]));
function site_config () { this.do_construct (arguments); }
site_config.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
};
site_config.init_methods (site_config);
rpcclass.setup_class (site_config, "site_config",0, (["listeners"]), ([2]));
function lib () { this.do_construct (arguments); }
lib.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__sleep = c.pargs__sleep =  ["n"];
	c.inst__sleep = c.pinst__sleep =  [
/*0*/	function (e,f) { e.smcall (0, php_engine,"get_current_thread_id", ([])); },
	function (e,f) {
		var t345 = f.s[0]; f.v.tid = t345;
		e.mcall (4, window, "setTimeout", ([("rpcclass.resume_thread (null, null, ") + ("" + (f.v.tid) + (", 'sleep_complete', null)")), f.v.n]));
	},
	function (e,f) {  },
	function (e,f) { e.php_builtin (0, "wait_for_input", 0); },
	function (e,f) {
		var t347 = f.s[0]; f.v.ev = t347;
		if ((((f.v.ev).action)) == (("sleep_complete"))) f.pc=-1; else f.pc=3;
	},
null	];

;
	c.args__page_version = c.pargs__page_version =  [];
	c.inst__page_version = c.pinst__page_version =  [
/*0*/	function (e,f) { e.return_pop ((window).page_version); },
null	];

;
	c.evaluate_javascript = cp.evaluate_javascript =  function (code)
	{
		return eval (code);
			}

;
	c.insertAtCaret = cp.insertAtCaret =  function (obj,text)
	{
		if(document.selection) {
			obj.focus();
			var orig = obj.value.replace(/\r\n/g, "\n");
			var range = document.selection.createRange();

			if(range.parentElement() != obj) {
				return false;
			}

			range.text = text;
			
			var actual = tmp = obj.value.replace(/\r\n/g, "\n");

			for(var diff = 0; diff < orig.length; diff++) {
				if(orig.charAt(diff) != actual.charAt(diff)) break;
			}

			for(var index = 0, start = 0; 
				tmp.match(text) 
					&& (tmp = tmp.replace(text, "")) 
					&& index <= diff; 
				index = start + text.length
			) {
				start = actual.indexOf(text, index);
			}
		} else if(obj.selectionStart) {
			var start = obj.selectionStart;
			var end   = obj.selectionEnd;

			obj.value = obj.value.substr(0, start) 
				+ text 
				+ obj.value.substr(end, obj.value.length);
		}
		
		if(start != null) {
			lib.setCaretTo(obj, start + text.length);
		} else {
			obj.value += text;
		}
			}

;
	c.setCaretTo = cp.setCaretTo =  function (obj,pos)
	{
		if(obj.createTextRange) {
			var range = obj.createTextRange();
			range.move('character', pos);
			range.select();
		} else if(obj.selectionStart) {
			obj.focus();
			obj.setSelectionRange(pos, pos);
		}
			}

;
	c.document_x_of = cp.document_x_of =  function (obj)
	{
		var res = 0;
		while (obj)
		{
			res += obj.offsetLeft;
			obj = obj.offsetParent;
			if (obj) res -= obj.scrollLeft;
		}
		return res;
			}

;
	c.block_x_of = cp.block_x_of =  function (obj)
	{
		var res = 0;
		while (obj)
		{
			if (obj.style.position == "absolute") break;
			res += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		return res;
			}

;
	c.document_y_of = cp.document_y_of =  function (obj)
	{
		var res = 0;
/*
		while (obj)
		{
			res += obj.offsetTop;
			obj = obj.offsetParent;
			if (obj)
			{
				if (obj.scrollTop) debugout ("tagName = "+obj.tagName);
				res -= obj.scrollTop;
			}
		}
*/
		var next = obj;
		while (obj)
		{
			if (obj == next)
			{
				res += obj.offsetTop;
				next = obj.offsetParent;
			}
			if (obj.scrollTop !== undefined)
				res -= obj.scrollTop;
			obj = obj.parentNode;

		}
		res += browser.scroll_top ();
		return res;
			}

;
	c.block_y_of = cp.block_y_of =  function (obj)
	{
		var res = 0;
		while (obj)
		{
			if (obj.style.position == "absolute") break;
			res += obj.offsetTop;
			obj = obj.offsetParent;
		}
		return res;
			}

;
	c.args__render_price = c.pargs__render_price =  ["price"];
	c.inst__render_price = c.pinst__render_price =  [
/*0*/	function (e,f) {
		f.v.sign = "";
		if (((f.v.price)) < ((0))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.v.sign = "-";
		f.v.price = parseInt((0),10) - parseInt((f.v.price),10);
	},
	function (e,f) {
		f.v.price = builtin__str_pad (f.v.price,3,"0",0);
		e.return_pop ("" + (f.v.sign) + (("£") + ("" + (builtin__substr (f.v.price,0,parseInt(((f.v.price).length),10) - parseInt((2),10))) + ((".") + (builtin__substr (f.v.price,parseInt(((f.v.price).length),10) - parseInt((2),10)))))));
	},
null	];

;
	c.args__render_price_simple = c.pargs__render_price_simple =  ["price"];
	c.inst__render_price_simple = c.pinst__render_price_simple =  [
/*0*/	function (e,f) {
		f.v.sign = "";
		if (((f.v.price)) < ((0))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.v.sign = "-";
		f.v.price = parseInt((0),10) - parseInt((f.v.price),10);
	},
	function (e,f) {
		f.v.price = builtin__str_pad (f.v.price,3,"0",0);
		e.return_pop ("" + (f.v.sign) + ("" + (builtin__substr (f.v.price,0,parseInt(((f.v.price).length),10) - parseInt((2),10))) + ((".") + (builtin__substr (f.v.price,parseInt(((f.v.price).length),10) - parseInt((2),10))))));
	},
null	];

;
	c.args__parse_price_simple = c.pargs__parse_price_simple =  ["str"];
	c.inst__parse_price_simple = c.pinst__parse_price_simple =  [
/*0*/	function (e,f) {
		f.v.str = builtin__trim (f.v.str);
		f.v.sign = 1;
		if (((builtin__substr (f.v.str,0,1))) == (("-"))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.v.sign = parseInt((0),10) - parseInt((1),10);
		f.v.str = builtin__substr (f.v.str,1);
	},
	function (e,f) {
		f.v.matches = ([]);
		if (builtin__preg_match ("/^([0-9]+)\\.([0-9]{2})$/",f.v.str,f.v.matches)) f.pc=3; else f.pc=4;
	},
	function (e,f) {
		f.v.amount = ((parseInt(((((f.v.matches)[(1)])) * ((100))),10) + parseInt(((f.v.matches)[(2)]),10))) * ((f.v.sign));
		e.return_pop (f.v.amount);
	},
	function (e,f) { if (builtin__preg_match ("/^([0-9]+)$/",f.v.str,f.v.matches)) f.pc=5; else f.pc=6; },
/*5*/	function (e,f) {
		f.v.amount = (((((f.v.matches)[(1)])) * ((100)))) * ((f.v.sign));
		e.return_pop (f.v.amount);
	},
	function (e,f) { e.return_pop (null); },
null	];

;
};
lib.init_methods (lib);
rpcclass.setup_class (lib, "lib",0, (["listeners"]), ([2]));
function miscfile () { this.do_construct (arguments); }
miscfile.init_methods = function (c) {
	dbclass.init_methods(c);
	var cp = c.prototype;
};
miscfile.init_methods (miscfile);
rpcclass.setup_class (miscfile, "miscfile",1, (["section","name","mimetype","rowid","listeners"]), ([0,0,0,0,2]));
function asyncnotify () { this.do_construct (arguments); }
asyncnotify.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.thread_starting = cp.thread_starting =  function ()
	{
		asyncnotify.thread_running++;
			}

;
	c.thread_stopping = cp.thread_stopping =  function ()
	{
		if (0 == (--asyncnotify.thread_running));
			asyncnotify.dispatch ();
			}

;
	c.post_request = cp.post_request =  function ()
	{
var args;var aj;{
		if (! asyncnotify.on_browser || asyncnotify.req != null || ! asyncnotify.needed)
		{return }
		;
		args = [];;
		args[args.length] = "asyncnotify";;
		args[args.length] = "poll";;
		args[args.length] = [];;
		aj = ajax.create  ("rpc_call_static_method",args,"asyncnotify.raw_completion",null);;
		aj.initiate  ();;
		asyncnotify.req = aj;;
		}
			}

;
	c.onunload = cp.onunload =  function ()
	{
		if (asyncnotify.req != null)
			asyncnotify.req.cancel();
			}

;
	c.initialise = cp.initialise =  function ()
	{
		asyncnotify.on_browser = true;
		asyncnotify.post_request();
		window.onunload = asyncnotify.onunload;
			}

;
	c.pargs__process_message =  [];
	c.pinst__process_message =  [
/*0*/	function (e,f) { if (!(((f.v["this"]).method) !== undefined)) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.s[0] = builtin__debugout (("Expected method to be defined in ") + (f.v["this"]));
		f.pc=-1;
	},
	function (e,f) {
		f.v.method = (f.v["this"]).method;
		e.mcall (3, (f.v["this"]).obj, f.v.method, ([(f.v["this"]).result]));
	},
null	];

;
	c.dispatch = cp.dispatch =  function ()
	{
		if (asyncnotify.msg_queue.length == 0) return;
		var obj = asyncnotify.msg_queue.shift();
		obj.call_self_using_engine ("process_message", ([]));
			}

;
	cp.completion =  function (msg)
	{
		this.result = msg;
		if (this.wait_for_idle)
		{
			asyncnotify.msg_queue.push (this);

			if (asyncnotify.thread_running == 0)
			{
				asyncnotify.dispatch();
			}
		}
		else
		{
			this.call_self_using_engine ("process_message", ([]));
		}

			}

;
	c.raw_completion = cp.raw_completion =  function (arg,cmd,res)
	{
		asyncnotify.req = null;
		asyncnotify.post_request();
		if (res == null) return;

		var ths = rpcclass.get_object_by_id ("asyncnotify", res["objid"]);

		var msg = res["msg"];
		ths.completion (msg);
			}

;
	c.pargs__establish_watch =  [];
	c.pinst__establish_watch =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "call_function_async", (["establish_watch", ([])])); },
	function (e,f) { var t364 = f.s[0]; e.return_pop (t364); },
null	];

;
	c.args__create_watch = c.pargs__create_watch =  ["key","obj","method","wait_for_idle"];
	c.inst__create_watch = c.pinst__create_watch =  [
/*0*/	function (e,f) {
		e.php_push_static_var (0, asyncnotify,"never_watch");
		var t365 = f.s[0]; if (t365) f.pc=1; else f.pc=2;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.v.asn = new asyncnotify;
		f.v.asn.key = f.v.key;
		f.v.asn.obj = f.v.obj;
		e.mcall (2, f.v.obj, "get_id", ([]));
	},
	function (e,f) {
		var t370 = f.s[0]; f.v.asn.tobjid = t370;
		f.v.asn.method = f.v.method;
		f.v.asn.wait_for_idle = f.v.wait_for_idle;
		e.mcall (2, f.v.asn, "establish_watch", ([]));
	},
	function (e,f) {
		f.s[0] = true;
		e.php_push_static_var_lvalue (1, asyncnotify,"needed");
		e.php_assign (2);
		e.smcall (0, asyncnotify,"post_request", ([]));
	},
/*5*/	function (e,f) { e.return_pop (f.v.asn); },
null	];

;
	c.args__notify =  ["key","msg"];
	c.inst__notify =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["asyncnotify", "notify", ([f.v.key, f.v.msg])])); },
	function (e,f) { var t374 = f.s[0]; e.return_pop (t374); },
null	];

;
	c.args__notify_ex =  ["key","msg","obj_list"];
	c.inst__notify_ex =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["asyncnotify", "notify_ex", ([f.v.key, f.v.msg, f.v.obj_list])])); },
	function (e,f) { var t375 = f.s[0]; e.return_pop (t375); },
null	];

;
	c.args__poll =  [];
	c.inst__poll =  [
/*0*/	function (e,f) { e.smcall (3, rpcclass,"call_static_function_async", (["asyncnotify", "poll", ([])])); },
	function (e,f) { var t376 = f.s[0]; e.return_pop (t376); },
null	];

;
};
asyncnotify.init_methods (asyncnotify);
rpcclass.setup_class (asyncnotify, "asyncnotify",0, (["key","method","wait_for_idle","tobjid","obj","listeners"]), ([0,0,0,0,0,2]));
function timer () { this.do_construct (arguments); }
timer.init_methods = function (c) {
	dbclass.init_methods(c);
	var cp = c.prototype;
};
timer.init_methods (timer);
rpcclass.setup_class (timer, "timer",0, (["classname","method","period","next","rowid","listeners"]), ([0,0,0,0,0,2]));
function dataitemdiv () { this.do_construct (arguments); }
dataitemdiv.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__create = c.pargs__create =  ["data","render_method","render_arg"];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.did = new dataitemdiv;
		f.v.did.data = f.v.data;
		f.v.did.render_method = f.v.render_method;
		f.v.did.render_arg = f.v.render_arg;
		e.mcall (5, f.v.data, "listen_msg", (["update_notification", f.v.did, "changed"]));
	},
	function (e,f) {
		f.s[0] = "\">";
		e.mcall (3, f.v.did, "get_id", ([]));
	},
	function (e,f) {
		var t381 = f.s[1]; var t382 = f.s[0]; 
		window.__outbuffer += ("<div id=\"did-") + ("" + (t381) + (t382));
		e.mcall (3, f.v.data, f.v.render_method, ([f.v.render_arg]));
	},
	function (e,f) {
		window.__outbuffer += "</div>";
		e.return_pop (f.v.did);
	},
null	];

;
	c.pargs__changed =  [];
	c.pinst__changed =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t383 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("did-") + (t383)]));
	},
	function (e,f) {
		var t385 = f.s[0]; f.v.el = t385;
		e.php_builtin (0, "ob_start", 0);
		f.v.method = (f.v["this"]).render_method;
		e.mcall (3, (f.v["this"]).data, f.v.method, ([(f.v["this"]).render_arg]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t388 = f.s[0]; f.v.el.innerHTML = t388;
	},
null	];

;
};
dataitemdiv.init_methods (dataitemdiv);
rpcclass.setup_class (dataitemdiv, "dataitemdiv",0, (["data","render_method","render_arg","listeners"]), ([0,0,0,2]));
function dragndrop () { this.do_construct (arguments); }
dragndrop.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.begin_from_xy = cp.begin_from_xy =  function (elementToDrag,x,y,onlyY,parent,release_method,move_method)
	{
		var deltaX = x - parseInt (elementToDrag.style.left);
		var deltaY = y - parseInt (elementToDrag.style.top);

		var old_movehandler;
		var old_uphandler;
		var old_onselectstart;

		function retfalse ()
		{
			return false;
		}

		if (document.addEventListener)
		{
			document.addEventListener ("mousemove", moveHandler, true);
			document.addEventListener ("mouseup", upHandler, true);
		}
		else if (document.attachEvent)
		{
			document.attachEvent ("onmousemove", moveHandler);
			document.attachEvent ("onmouseup", upHandler);
			old_onselectstart = document.onselectstart;
			document.onselectstart = retfalse;
		}
		else
		{
			old_movehandler = document.onmousemove;
			old_uphandler = document.onmouseup;
			document.onmousemove = moveHandler;
			document.onmouseup = upHandler;
		}


		function moveHandler (e)
		{
			if (!e) e = window.event;
			if (!onlyY)
				elementToDrag.style.left = (e.clientX - deltaX) + "px";
			elementToDrag.style.top = (e.clientY - deltaY) + "px";
			if (e.stopPropagation) e.stopPropagation();
			else e.cancelBubble = true;
			if (parent)
			{
				parent[move_method] (e);
	//			deltaX = event.clientX - parseInt (elementToDrag.style.left);
				deltaY = e.clientY - parseInt (elementToDrag.style.top);
			}
		}

		function upHandler (e)
		{
			if (!e) e = window.event;
			if (document.removeEventListener)
			{
				document.removeEventListener ("mouseup", upHandler, true);
				document.removeEventListener ("mousemove", moveHandler, true);
			}
			else if (document.detachEvent)
			{
				document.detachEvent ("onmouseup", upHandler);
				document.detachEvent ("onmousemove", moveHandler);
				document.onselectstart = old_onselectstart;
			}
			else
			{
				document.onmouseup = old_uphandler;
				document.onmousemove = old_movehandler;
			}
			if (e.stopPropagation) e.stopPropagation();
			else e.cancelBubble = true;

			if (parent)
			{
				parent[release_method] (e);
				parent = null;
			}
		}


			}

;
	c.begin_from_event = cp.begin_from_event =  function (elementToDrag,event,onlyY,parent,release_method,move_method)
	{
		if (!event) event = window.event;
		if (event.stopPropagation)
		{
			event.stopPropagation();
			event.preventDefault();
		}
		else event.cancelBubble = true;
		dragndrop.begin_from_xy (elementToDrag, event.clientX, event.clientY, onlyY, parent, release_method, move_method);
			}

;
};
dragndrop.init_methods (dragndrop);
rpcclass.setup_class (dragndrop, "dragndrop",0, (["listeners"]), ([2]));
function dragndrop2 () { this.do_construct (arguments); }
dragndrop2.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	cp.begin_xy =  function (x,y,elementToDrag)
	{
		this.el = elementToDrag;

		this.deltaX = x - parseInt (this.el.style.left);
		this.deltaY = y - parseInt (this.el.style.top);

		var me = this;

		this.move_fn = function (e) { me.moveHandler(e); };
		this.up_fn = function (e) { me.upHandler(e); };

		if (document.addEventListener)
		{
			document.addEventListener ("mousemove", this.move_fn, true);
			document.addEventListener ("mouseup", this.up_fn, true);
		}
		else if (document.attachEvent)
		{
			document.attachEvent ("onmousemove", this.move_fn);
			document.attachEvent ("onmouseup", this.up_fn);
			this.old_onselectstart = document.onselectstart;
			document.onselectstart = function () { return false; };
		}
		else
		{
			this.old_movehandler = document.onmousemove;
			this.old_uphandler = document.onmouseup;
			document.onmousemove = this.move_fn;
			document.onmouseup = this.up_fn;
		}
			}

;
	cp.begin =  function (event,elementToDrag)
	{
		if (!event) event = window.event;
		if (event.stopPropagation)
		{
			event.stopPropagation();
			event.preventDefault();
		}
		else event.cancelBubble = true;

		this.begin_xy (event.clientX, event.clientY, elementToDrag);
			}

;
	cp.moveHandler =  function (e)
	{
		if (!e) e = window.event;
		if (e.stopPropagation) e.stopPropagation();
		else e.cancelBubble = true;

		this.x = (e.clientX + browser.scroll_left()) - this.deltaX;
		this.y = (e.clientY + browser.scroll_top()) - this.deltaY;
		if (this.constrain_x !== undefined) this.x = this.constrain_x (x);
		if (this.constrain_y !== undefined) this.y = this.constrain_x (y);

		this.el.style.left = this.x+"px";
		this.el.style.top = this.y+"px";

		if (this.drag_move !== undefined) this.drag_move (this.x, this.y);
			}

;
	cp.upHandler =  function (e)
	{
		if (!e) e = window.event;
		if (document.removeEventListener)
		{
			document.removeEventListener ("mouseup", this.up_fn, true);
			document.removeEventListener ("mousemove", this.move_fn, true);
		}
		else if (document.detachEvent)
		{
			document.detachEvent ("onmouseup", this.up_fn);
			document.detachEvent ("onmousemove", this.move_fn);
			document.onselectstart = this.old_onselectstart;
		}
		else
		{
			document.onmouseup = this.old_uphandler;
			document.onmousemove = this.old_movehandler;
		}
		if (e.stopPropagation) e.stopPropagation();
		else e.cancelBubble = true;

		this.call_self_using_engine ("drag_release_helper", ([this.x, this.y]));
			}

;
	c.args__cloneNode = c.pargs__cloneNode =  ["el"];
	c.inst__cloneNode = c.pinst__cloneNode =  [
/*0*/	function (e,f) { e.mcall (3, f.v.el, "cloneNode", ([true])); },
	function (e,f) {
		var t390 = f.s[0]; f.v.nel = t390;
		(f.v.nel).style.position = "absolute";
		f.s[0] = "px";
		e.smcall (2, lib,"document_x_of", ([f.v.el]));
	},
	function (e,f) {
		var t392 = f.s[1]; var t393 = f.s[0]; 
		(f.v.nel).style.left = "" + (t392) + (t393);
		f.s[0] = "px";
		e.smcall (2, lib,"document_y_of", ([f.v.el]));
	},
	function (e,f) {
		var t395 = f.s[1]; var t396 = f.s[0]; 
		(f.v.nel).style.top = "" + (t395) + (t396);
		e.mcall (3, (document).documentElement, "appendChild", ([f.v.nel]));
	},
	function (e,f) { e.return_pop (f.v.nel); },
null	];

;
	cp.highlight =  function (el)
	{
{
		this.saved_style = el.style.border;;
		el.style.border = "solid blue 2px";;
		}
			}

;
	cp.unhighlight =  function (el)
	{
{
		el.style.border = this.saved_style;;
		}
			}

;
	cp.find_drop_target =  function (x,y)
	{
var d;var el;var el_left;var el_top;var el_right;var el_bottom;{
		for (d in this.drop_targets)
		{
		el = this.drop_targets[d];
		{
		el_left = lib.document_x_of  (el);;
		el_top = lib.document_y_of  (el);;
		el_right = el_left + el.clientWidth;;
		el_bottom = el_top + el.clientHeight;;
		if (el_left < x && el_right > x && el_top < y && el_bottom > y)
		{return (d) }
		;
		}
		}
		;
		return (null);
		}
			}

;
	cp.hover =  function (d)
	{
var del;{
		del = ((d === null) ? null : this.drop_targets[d]);;
		if (this.last_hover !== del)
		{{
		if (this.last_hover !== null)
		{{
		this.unhighlight  (this.last_hover);;
		this.last_hover = null;;
		}
		 }
		;
		if (del !== null)
		{{
		this.last_hover = del;;
		this.highlight  (this.last_hover);;
		}
		 }
		;
		}
		 }
		;
		}
			}

;
	cp.drag_move =  function (x,y)
	{
var d;{
		d = this.find_drop_target  (x,y);;
		this.hover  (d);;
		}
			}

;
	c.pargs__drag_release_helper =  ["x","y"];
	c.pinst__drag_release_helper =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "find_drop_target", ([f.v.x, f.v.y])); },
	function (e,f) {
		var t399 = f.s[0]; f.v.d = t399;
		e.mcall (3, f.v["this"], "hover", ([f.v.d]));
	},
	function (e,f) { e.mcall (4, f.v["this"], "drag_release", ([f.v.d, (f.v["this"]).drag_is_copy])); },
	function (e,f) { e.mcall (3, ((f.v["this"]).nel).parentNode, "removeChild", ([(f.v["this"]).nel])); },
	function (e,f) { if (!((f.v["this"]).drag_is_copy)) f.pc=5; else f.pc=6; },
/*5*/	function (e,f) { ((f.v["this"]).arm_el).style.display = ""; },
	function (e,f) { e.mcall (3, f.v["this"], "hover", ([null])); },
null	];

;
	c.pargs__fire =  [];
	c.pinst__fire =  [
/*0*/	function (e,f) {
		f.v["this"].dragtimer = null;
		e.mcall (5, f.v["this"], "disarm_drag", ([f.v.el, f.v.arg, f.v.ev]));
	},
	function (e,f) {
		f.v["this"].last_hover = null;
		e.smcall (1, dragndrop2,"cloneNode", ([(f.v["this"]).arm_el]));
	},
	function (e,f) {
		var t404 = f.s[0]; f.v["this"].nel = t404;
		if (!((f.v["this"]).drag_is_copy)) f.pc=3; else f.pc=4;
	},
	function (e,f) { ((f.v["this"]).arm_el).style.display = "none"; },
	function (e,f) { e.mcall (5, f.v["this"], "begin_xy", ([(f.v["this"]).arm_x, (f.v["this"]).arm_y, (f.v["this"]).nel])); },
null	];

;
	c.pargs__arm_helper =  ["el","is_copy","drop_targets"];
	c.pinst__arm_helper =  [
/*0*/	function (e,f) {
		e.php_push_static_var (0, rpcclass,"last_start_x");
		var t407 = f.s[0]; f.v["this"].arm_x = t407;
		e.php_push_static_var (0, rpcclass,"last_start_y");
		var t409 = f.s[0]; f.v["this"].arm_y = t409;
		f.v["this"].arm_el = f.v.el;
		f.v["this"].drag_is_copy = f.v.is_copy;
		f.v["this"].drop_targets = f.v.drop_targets;
		e.mcall (5, f.v["this"], "start_timeout_callback", ([300, "fire", null]));
	},
	function (e,f) {
		var t414 = f.s[0]; f.v["this"].dragtimer = t414;
		e.mcall (4, f.v["this"], "make_start_engine", (["disarm_drag", null]));
	},
	function (e,f) {
		var t416 = f.s[0]; f.v["this"].disarm_drag_thunk = t416;
		e.mcall (5, f.v["this"], "bind", ([f.v.el, "mouseup", (f.v["this"]).disarm_drag_thunk]));
	},
	function (e,f) { e.mcall (5, f.v["this"], "bind", ([f.v.el, "mouseout", (f.v["this"]).disarm_drag_thunk])); },
null	];

;
	c.pargs__disarm_drag =  ["el","arg","ev"];
	c.pinst__disarm_drag =  [
/*0*/	function (e,f) { e.mcall (5, f.v["this"], "unbind", ([(f.v["this"]).arm_el, "mouseup", (f.v["this"]).disarm_drag_thunk])); },
	function (e,f) { e.mcall (5, f.v["this"], "unbind", ([(f.v["this"]).arm_el, "mouseout", (f.v["this"]).disarm_drag_thunk])); },
	function (e,f) { if ((((f.v["this"]).dragtimer)) !== ((null))) f.pc=3; else f.pc=-1; },
	function (e,f) { e.mcall (3, f.v["this"], "stop_timeout", ([(f.v["this"]).dragtimer])); },
	function (e,f) { f.v["this"].dragtimer = null; },
null	];

;
};
dragndrop2.init_methods (dragndrop2);
rpcclass.setup_class (dragndrop2, "dragndrop2",0, (["el","deltaX","deltaY","old_movehandler","old_uphandler","old_onselectstart","move_fn","up_fn","x","y","dragtimer","arm_el","nel","drag_is_copy","disarm_drag_thunk","arm_x","arm_y","drop_targets","last_hover","saved_style","listeners"]), ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2]));
function divTableManager () { this.do_construct (arguments); }
divTableManager.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__initialise =  ["owner","ncols"];
	c.pinst__initialise =  [
/*0*/	function (e,f) {
		f.v["this"].owner = f.v.owner;
		f.v["this"].rows = ([]);
		f.v["this"].tid = builtin__make_uniq ();
		f.v["this"].ncols = f.v.ncols;
		f.v["this"].widths = ([]);
		f.v.n = ((98)) / ((f.v.ncols));
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=3;
		if (!(((f.v.i)) < ((f.v.ncols)))) f.pc=2;
	},
	function (e,f) {
		f.pc=-1;
		f.v["this"].ignore_background_class = false;
	},
	function (e,f) {
		f.pc=1;
		(f.v["this"]).widths[f.v.i] = "" + (f.v.n) + ("%");
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
null	];

;
	c.pargs__initialise2 =  ["owner","widths"];
	c.pinst__initialise2 =  [
/*0*/	function (e,f) {
		f.v["this"].owner = f.v.owner;
		f.v["this"].rows = ([]);
		f.v["this"].tid = builtin__make_uniq ();
		f.v["this"].ncols = builtin__count (f.v.widths);
		f.v["this"].widths = f.v.widths;
		f.v["this"].ignore_background_class = false;
	},
null	];

;
	c.pargs__no_background =  [];
	c.pinst__no_background =  [
/*0*/	function (e,f) { f.v["this"].ignore_background_class = true; },
null	];

;
	c.pargs__context_menu =  ["el","arg","ev"];
	c.pinst__context_menu =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([("table") + ("" + ((f.v["this"]).tid) + (("-row") + (f.v.arg)))])); },
	function (e,f) {
		var t436 = f.s[0]; f.v.row = t436;
		f.v.oldstyle = ((f.v.row).style).border;
		(f.v.row).style.border = "1px solid blue";
		e.smcall (1, popup,"set_default_event", ([f.v.ev]));
	},
	function (e,f) { e.mcall (3, (f.v["this"]).owner, "context_menu", ([f.v.arg])); },
	function (e,f) { (f.v.row).style.border = f.v.oldstyle; },
null	];

;
	c.pargs__on_row_click =  ["el","arg","ev"];
	c.pinst__on_row_click =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([("table") + ("" + ((f.v["this"]).tid) + (("-row") + (f.v.arg)))])); },
	function (e,f) {
		var t441 = f.s[0]; f.v.row = t441;
		f.v.oldstyle = ((f.v.row).style).border;
		(f.v.row).style.border = "1px solid blue";
		e.smcall (1, popup,"set_default_event", ([f.v.ev]));
	},
	function (e,f) { e.mcall (3, (f.v["this"]).owner, "on_row_click", ([f.v.arg])); },
	function (e,f) { (f.v.row).style.border = f.v.oldstyle; },
null	];

;
	c.pargs__render_row =  ["row","classname"];
	c.pinst__render_row =  [
/*0*/	function (e,f) { if ((f.v["this"]).ignore_background_class) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.v.classattr = "";
	},
	function (e,f) { f.v.classattr = ("class=\"") + ("" + (f.v.classname) + ("\"")); },
	function (e,f) { if (builtin__method_exists ((f.v["this"]).owner,"get_row_style")) f.pc=4; else f.pc=6; },
	function (e,f) { e.mcall (3, (f.v["this"]).owner, "get_row_style", ([f.v.row])); },
/*5*/	function (e,f) {
		f.pc=7;
		var t448 = f.s[0]; f.v.styleattr = t448;
	},
	function (e,f) { f.v.styleattr = ""; },
	function (e,f) {
		f.s[0] = ("\" ") + ("" + (f.v.classattr) + ((" ") + ("" + (f.v.styleattr) + (" style=\"clear:both; width:99%; float:left\""))));
		e.mcall (3, f.v.row, "get_id", ([]));
	},
	function (e,f) {
		var t450 = f.s[1]; var t451 = f.s[0]; 
		window.__outbuffer += ("<div id=\"table") + ("" + ((f.v["this"]).tid) + (("-row") + ("" + (t450) + (t451))));
		if (builtin__method_exists ((f.v["this"]).owner,"context_menu")) f.pc=9; else f.pc=12;
	},
	function (e,f) {
		f.s[0] = "\"";
		e.mcall (3, f.v.row, "get_id", ([]));
	},
/*10*/	function (e,f) { var t452 = f.s[1]; e.mcall (5, f.v["this"], "render_start", (["context_menu", t452])); },
	function (e,f) {
		var t453 = f.s[1]; var t454 = f.s[0]; 
		window.__outbuffer += (" oncontextmenu=\"") + ("" + (t453) + (t454));
	},
	function (e,f) { if (builtin__method_exists ((f.v["this"]).owner,"on_row_click")) f.pc=13; else f.pc=16; },
	function (e,f) {
		f.s[0] = "\"";
		e.mcall (3, f.v.row, "get_id", ([]));
	},
	function (e,f) { var t455 = f.s[1]; e.mcall (5, f.v["this"], "render_start", (["on_row_click", t455])); },
/*15*/	function (e,f) {
		var t456 = f.s[1]; var t457 = f.s[0]; 
		window.__outbuffer += (" onclick=\"") + ("" + (t456) + (t457));
	},
	function (e,f) {
		window.__outbuffer += ">";
		e.mcall (3, (f.v["this"]).owner, "get_row_fields", ([f.v.row]));
	},
	function (e,f) {
		var t459 = f.s[0]; f.v.fields = t459;
		f.v.n = ((99)) / (((f.v["this"]).ncols));
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=20;
		if (!(((f.v.i)) < (((f.v["this"]).ncols)))) f.pc=19;
	},
	function (e,f) {
		f.pc=-1;
		window.__outbuffer += "</div>\n";
	},
/*20*/	function (e,f) {
		f.v.text = (f.v.fields)[(f.v.i)];
		if (((f.v.text)) == ((""))) f.pc=21; else f.pc=22;
	},
	function (e,f) { f.v.text = "&nbsp;"; },
	function (e,f) {
		f.pc=18;
		window.__outbuffer += ("<div style=\"float:left; clear:none; width:") + ("" + (((f.v["this"]).widths)[(f.v.i)]) + (("\">") + ("" + (f.v.text) + ("</div>"))));
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
null	];

;
	c.pargs__render_table =  ["initial_rows"];
	c.pinst__render_table =  [
/*0*/	function (e,f) {
		f.v["this"].rows = f.v.initial_rows;
		window.__outbuffer += "<div style='width:99%; float:left'>";
		window.__outbuffer += ("<div id='") + ("" + ((f.v["this"]).tid) + ("' style='width:99%; float:left'>"));
		f.v.odd = true;
		f.v._k22 = e.enumkeys ((f.v["this"]).rows);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k22).length)) f.pc=2;
	},
	function (e,f) {
		window.__outbuffer += ("<div id=\"tab") + ("" + ((f.v["this"]).tid) + ("-end-marker\" style=\"clear:both\"></div>"));
		window.__outbuffer += "</div>";
		window.__outbuffer += "<div style=\"clear:both\">";
		if (builtin__method_exists ((f.v["this"]).owner,"new_name")) f.pc=8; else f.pc=13;
	},
	function (e,f) {
		f.v._i23 = (f.v._k22).shift();
		f.v.row = ((f.v["this"]).rows)[(f.v._i23)];
		if (f.v.odd) f.pc=4; else f.pc=5;
	},
	function (e,f) {
		f.pc=6;
		f.s[0] = "divTableOdd";
	},
/*5*/	function (e,f) { f.s[0] = "divTableEven"; },
	function (e,f) { var t470 = f.s[0]; e.mcall (4, f.v["this"], "render_row", ([f.v.row, t470])); },
	function (e,f) {
		f.pc=1;
		f.v.odd = !(f.v.odd);
	},
	function (e,f) {
		f.pc=12;
		f.s[0] = "";
		e.mcall (3, (f.v["this"]).owner, "new_name", ([]));
	},
	function (e,f) {
		f.s[0] = "</button>";
		e.mcall (3, (f.v["this"]).owner, "new_name", ([]));
	},
/*10*/	function (e,f) {
		var t472 = f.s[1]; var t473 = f.s[0]; 
		f.s[0] = ("\" >") + ("" + (t472) + (t473));
		e.mcall (5, f.v["this"], "render_start", (["add_new_clicked", false]));
	},
	function (e,f) {
		f.pc=13;
		var t474 = f.s[1]; var t475 = f.s[0]; 
		window.__outbuffer += ("<button onclick=\"") + ("" + (t474) + (t475));
	},
	function (e,f) {
		var t476 = f.s[1]; var t477 = f.s[0]; 
		if (((t476)) !== ((t477))) f.pc=9; else f.pc=13;
	},
	function (e,f) {
		window.__outbuffer += "</div>";
		window.__outbuffer += "</div>";
	},
null	];

;
	c.pargs__add_new_clicked =  ["buttonobj"];
	c.pinst__add_new_clicked =  [
/*0*/	function (e,f) { e.mcall (3, (f.v["this"]).owner, "insert_row", ([f.v.buttonobj])); },
null	];

;
	cp.recolour_rows =  function ()
	{
		if (this.ignore_background_class) return;
		var tobj = document.getElementById (this.tid);
		var odd = true;
		var endmarker = "tab"+this.tid+"-end-marker";
		for (i = 0; i < tobj.childNodes.length; i++)
		{
			var child = tobj.childNodes[i];
			if (child.nodeType == 1 && child.tagName == "DIV" && child.id != endmarker)
			{
				tobj.childNodes[i].className = odd ? "divTableOdd" : "divTableEven";
				odd = !odd;
			}
		}
			}

;
	c.pargs__append_row =  ["row"];
	c.pinst__append_row =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([(f.v["this"]).tid])); },
	function (e,f) {
		var t479 = f.s[0]; f.v.tobj = t479;
		f.v.count = 0;
		f.v.n = 0;
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=4;
		if (!(((f.v.i)) < ((((f.v.tobj).childNodes).length)))) f.pc=3;
	},
	function (e,f) {
		f.pc=10;
		e.mcall (3, document, "getElementById", ([("tab") + ("" + ((f.v["this"]).tid) + ("-end-marker"))]));
	},
	function (e,f) {
		f.v.child = ((f.v.tobj).childNodes)[(f.v.i)];
		if ((((f.v.child).nodeType)) == ((1))) f.pc=6; else f.pc=7;
	},
/*5*/	function (e,f) {
		f.pc=9;
		e.php_push_var_lvalue (0, "count");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=8;
		f.s[0] = (((f.v.child).tagName)) == (("DIV"));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t485 = f.s[0]; if (t485) f.pc=5; else f.pc=9; },
	function (e,f) {
		f.pc=2;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
/*10*/	function (e,f) {
		var t488 = f.s[0]; f.v.endobj = t488;
		e.mcall (3, document, "createElement", (["div"]));
	},
	function (e,f) {
		var t490 = f.s[0]; f.v.xdiv = t490;
		e.mcall (3, (f.v["this"]).owner, "get_row_fields", ([f.v.row]));
	},
	function (e,f) {
		var t492 = f.s[0]; f.v.f = t492;
		e.php_builtin (0, "ob_start", 0);
		if (((f.v.count)) % ((2))) f.pc=13; else f.pc=14;
	},
	function (e,f) {
		f.pc=15;
		f.s[0] = "divTableOdd";
	},
	function (e,f) { f.s[0] = "divTableEven"; },
/*15*/	function (e,f) { var t493 = f.s[0]; e.mcall (4, f.v["this"], "render_row", ([f.v.row, t493])); },
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t495 = f.s[0]; f.v.xdiv.innerHTML = t495;
		f.v.rowdiv = ((f.v.xdiv).childNodes)[(0)];
		e.mcall (4, f.v.tobj, "insertBefore", ([f.v.rowdiv, f.v.endobj]));
	},
null	];

;
	c.pargs__prepend_row =  ["row"];
	c.pinst__prepend_row =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([(f.v["this"]).tid])); },
	function (e,f) {
		var t498 = f.s[0]; f.v.tobj = t498;
		e.mcall (3, document, "getElementById", ([("tab") + ("" + ((f.v["this"]).tid) + ("-end-marker"))]));
	},
	function (e,f) {
		var t500 = f.s[0]; f.v.endobj = t500;
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=5;
		if (!(((f.v.i)) < ((((f.v.tobj).childNodes).length)))) f.pc=4;
	},
	function (e,f) {
		f.pc=11;
		e.mcall (3, document, "createElement", (["div"]));
	},
/*5*/	function (e,f) {
		f.v.child = ((f.v.tobj).childNodes)[(f.v.i)];
		if ((((f.v.child).nodeType)) == ((1))) f.pc=8; else f.pc=9;
	},
	function (e,f) {
		f.pc=4;
		f.v.endobj = f.v.child;
	},
	function (e,f) {
		f.pc=3;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=10;
		f.s[0] = (((f.v.child).tagName)) == (("DIV"));
	},
	function (e,f) { f.s[0] = false; },
/*10*/	function (e,f) { var t505 = f.s[0]; if (t505) f.pc=6; else f.pc=7; },
	function (e,f) {
		var t507 = f.s[0]; f.v.xdiv = t507;
		e.mcall (3, (f.v["this"]).owner, "get_row_fields", ([f.v.row]));
	},
	function (e,f) {
		var t509 = f.s[0]; f.v.f = t509;
		e.php_builtin (0, "ob_start", 0);
		e.mcall (4, f.v["this"], "render_row", ([f.v.row, ""]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t511 = f.s[0]; f.v.xdiv.innerHTML = t511;
		f.v.rowdiv = ((f.v.xdiv).childNodes)[(0)];
		e.mcall (4, f.v.tobj, "insertBefore", ([f.v.rowdiv, f.v.endobj]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "recolour_rows", ([])); },
null	];

;
	c.args__insert_before = c.pargs__insert_before =  ["row","before"];
	c.inst__insert_before = c.pinst__insert_before =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([(f.v["this"]).tid])); },
	function (e,f) {
		var t514 = f.s[0]; f.v.tobj = t514;
		f.v.cnt = 0;
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=4;
		if (!(((f.v.i)) < ((((f.v.tobj).childNodes).length)))) f.pc=3;
	},
	function (e,f) {
		f.pc=10;
		e.mcall (2, f.v.before, "get_id", ([]));
	},
	function (e,f) {
		f.v.child = ((f.v.tobj).childNodes)[(f.v.i)];
		if ((((f.v.child).nodeType)) == ((1))) f.pc=6; else f.pc=7;
	},
/*5*/	function (e,f) {
		f.pc=9;
		e.php_push_var_lvalue (0, "cnt");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=8;
		f.s[0] = (((f.v.child).tagName)) == (("DIV"));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t519 = f.s[0]; if (t519) f.pc=5; else f.pc=9; },
	function (e,f) {
		f.pc=2;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
/*10*/	function (e,f) {
		var t521 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("table") + ("" + ((f.v["this"]).tid) + (("-row") + (t521)))]));
	},
	function (e,f) {
		var t523 = f.s[0]; f.v.robj = t523;
		e.mcall (3, document, "createElement", (["div"]));
	},
	function (e,f) {
		var t525 = f.s[0]; f.v.xdiv = t525;
		e.mcall (3, (f.v["this"]).owner, "get_row_fields", ([f.v.row]));
	},
	function (e,f) {
		var t527 = f.s[0]; f.v.f = t527;
		e.php_builtin (0, "ob_start", 0);
		if (((f.v.cnt)) % ((2))) f.pc=14; else f.pc=15;
	},
	function (e,f) {
		f.pc=16;
		f.s[0] = "divTableOdd";
	},
/*15*/	function (e,f) { f.s[0] = "divTableEven"; },
	function (e,f) { var t528 = f.s[0]; e.mcall (4, f.v["this"], "render_row", ([f.v.row, t528])); },
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t530 = f.s[0]; f.v.xdiv.innerHTML = t530;
		f.v.rowdiv = ((f.v.xdiv).childNodes)[(0)];
		e.mcall (4, f.v.tobj, "insertBefore", ([f.v.rowdiv, f.v.robj]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "recolour_rows", ([])); },
null	];

;
	cp.remove_row =  function (row)
	{
		var robj = document.getElementById ("table"+this.tid+"-row"+row.get_id());
		robj.parentNode.removeChild (robj);
		this.recolour_rows ();
			}

;
	cp.get_rows =  function ()
	{
		var tobj = document.getElementById (this.tid);
		var endobj = document.getElementById ("tab"+this.tid+"-end-marker");

		var res = [];
		var i;
//		for (i = tobj.childNodes.length-1; i >= 0; i--)
		for (i = 0; i < tobj.childNodes.length; i++)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				var id = cobj.id;
				var matches = id.match (/\-row(.*)$/);
				res[res.length] = matches[1];
			}
		}

		return res;

			}

;
	c.pargs__rerender_row =  ["row"];
	c.pinst__rerender_row =  [
/*0*/	function (e,f) { e.mcall (2, f.v.row, "get_id", ([])); },
	function (e,f) {
		var t532 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("table") + ("" + ((f.v["this"]).tid) + (("-row") + (t532)))]));
	},
	function (e,f) {
		var t534 = f.s[0]; f.v.robj = t534;
		e.php_builtin (0, "ob_start", 0);
		e.mcall (4, f.v["this"], "render_row", ([f.v.row, ""]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t536 = f.s[0]; f.v.html = t536;
		e.mcall (3, document, "createElement", (["div"]));
	},
	function (e,f) {
		var t538 = f.s[0]; f.v.xdiv = t538;
		f.v.xdiv.innerHTML = f.v.html;
		f.v.rowdiv = ((f.v.xdiv).childNodes)[(0)];
		e.mcall (4, (f.v.robj).parentNode, "insertBefore", ([f.v.rowdiv, f.v.robj]));
	},
/*5*/	function (e,f) { e.mcall (3, (f.v.robj).parentNode, "removeChild", ([f.v.robj])); },
	function (e,f) { e.mcall (2, f.v["this"], "recolour_rows", ([])); },
null	];

;
	cp.nail_row =  function (obj)
	{
		obj.style.width = (obj.snapshot_w-0)+"px";
		obj.style.height = (obj.snapshot_h-0)+"px";
		obj.style.left = obj.snapshot_x+"px";
		obj.style.top = obj.snapshot_y+"px";
		obj.style.position = "absolute";
		obj.style.zIndex = popup.next_zindex()+10; // 999;
			}

;
	cp.snapshot_div =  function (obj)
	{
		obj.snapshot_x = lib.block_x_of (obj);
		obj.snapshot_y = lib.block_y_of (obj);
		obj.snapshot_w = obj.offsetWidth;
		obj.snapshot_h = obj.offsetHeight;
		obj.snapshot_z = obj.style.zIndex;
			}

;
	cp.snapshot_table =  function ()
	{
		var tobj = document.getElementById (this.tid);
		var endobj = document.getElementById ("tab"+this.tid+"-end-marker");
		this.snapshot_div (tobj);

//		this.x_adjust = lib.document_x_of (tobj) - tobj.snapshot_x;
		this.y_adjust = lib.document_y_of (tobj) - tobj.snapshot_y;

		var i;
		for (i = tobj.childNodes.length-1; i >= 0; i--)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				this.snapshot_div (cobj);
			}
		}

		tobj.style.width = (tobj.snapshot_w-2)+"px";
		tobj.style.height = (tobj.snapshot_h-2)+"px";

		for (i = tobj.childNodes.length-1; i >= 0; i--)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				this.nail_row (cobj);
			}
		}
			}

;
	cp.unsnapshot_table =  function ()
	{
		var tobj = document.getElementById (this.tid);
		var endobj = document.getElementById ("tab"+this.tid+"-end-marker");
		for (i = 0; i < tobj.childNodes.length; i++)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				cobj.style.left = "";
				cobj.style.top = "";
				cobj.style.width = "98%";
				cobj.style.height = "";
				cobj.style.position = "static";
				cobj.style.zIndex = cobj.snapshot_z;
			}
		}

		tobj.style.width = "100%";
		tobj.style.height = "";
		tobj.style.zIndex = tobj.snapshot_z;

			}

;
	c.pargs__reorder_animate =  [];
	c.pinst__reorder_animate =  [
/*0*/	function (e,f) {
		f.v["this"].reordering = true;
		f.s[0] = 20;
		f.s[1] = "', 'timer', 0)";
		e.mcall (4, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t542 = f.s[2]; var t543 = f.s[1]; 
		var t544 = f.s[0]; e.mcall (4, window, "setInterval", ([("rpcclass.call_method_by_name ('divTableManager', '") + ("" + (t542) + (t543)), t544]));
	},
	function (e,f) {
		var t546 = f.s[0]; f.v["this"].timerid = t546;
		e.smcall (0, php_engine,"get_current_thread_id", ([]));
	},
	function (e,f) {
		var t548 = f.s[0]; f.v["this"].thread_id = t548;
		e.php_builtin (0, "wait_for_completion", 0);
	},
	function (e,f) {
		f.v["this"].reordering = false;
		e.mcall (3, window, "clearInterval", ([(f.v["this"]).timerid]));
	},
null	];

;
	c.pargs__reorder_rows =  ["new_rows"];
	c.pinst__reorder_rows =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([(f.v["this"]).tid])); },
	function (e,f) {
		var t551 = f.s[0]; f.v.tobj = t551;
		e.mcall (3, document, "getElementById", ([("tab") + ("" + ((f.v["this"]).tid) + ("-end-marker"))]));
	},
	function (e,f) {
		var t553 = f.s[0]; f.v.endobj = t553;
		f.v.div_by_id = ({});
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=5;
		if (!(((f.v.i)) < ((((f.v.tobj).childNodes).length)))) f.pc=4;
	},
	function (e,f) {
		f.pc=13;
		f.v._k24 = e.enumkeys (f.v.new_rows);
	},
/*5*/	function (e,f) {
		f.v.cobj = ((f.v.tobj).childNodes)[(f.v.i)];
		if (((f.v.cobj)) != ((f.v.endobj))) f.pc=7; else f.pc=10;
	},
	function (e,f) {
		f.pc=12;
		f.v.matches = ([]);
		f.s[0] = builtin__preg_match ("/\\-row(.*)$/",(f.v.cobj).id,f.v.matches);
		f.v.id = (f.v.matches)[(1)];
		f.v.div_by_id[f.v.id] = f.v.cobj;
	},
	function (e,f) { if ((((f.v.cobj).nodeType)) == ((1))) f.pc=8; else f.pc=9; },
	function (e,f) {
		f.pc=11;
		f.s[0] = (((f.v.cobj).tagName)) == (("DIV"));
	},
	function (e,f) {
		f.pc=11;
		f.s[0] = false;
	},
/*10*/	function (e,f) { f.s[0] = false; },
	function (e,f) { var t561 = f.s[0]; if (t561) f.pc=6; else f.pc=12; },
	function (e,f) {
		f.pc=3;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=15;
		if (!((f.v._k24).length)) f.pc=14;
	},
	function (e,f) {
		f.pc=21;
		e.mcall (2, f.v["this"], "snapshot_table", ([]));
	},
/*15*/	function (e,f) {
		f.v._i25 = (f.v._k24).shift();
		f.v.row = (f.v.new_rows)[(f.v._i25)];
		e.mcall (2, f.v.row, "get_id", ([]));
	},
	function (e,f) {
		var t566 = f.s[0]; f.v.id = t566;
		if (!(((f.v.div_by_id)[(f.v.id)]) !== undefined)) f.pc=17; else f.pc=13;
	},
	function (e,f) { e.mcall (3, document, "createElement", (["div"])); },
	function (e,f) {
		var t568 = f.s[0]; f.v.xdiv = t568;
		e.php_builtin (0, "ob_start", 0);
		e.mcall (4, f.v["this"], "render_row", ([f.v.row, "divTableOdd"]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t570 = f.s[0]; f.v.xdiv.innerHTML = t570;
		f.v.rowdiv = ((f.v.xdiv).childNodes)[(0)];
		e.mcall (4, f.v.tobj, "insertBefore", ([f.v.rowdiv, f.v.endobj]));
	},
/*20*/	function (e,f) {
		f.pc=13;
		f.v.div_by_id[f.v.id] = f.v.rowdiv;
	},
	function (e,f) { f.v._k26 = e.enumkeys (f.v.div_by_id); },
	function (e,f) {
		f.pc=24;
		if (!((f.v._k26).length)) f.pc=23;
	},
	function (e,f) {
		f.pc=25;
		f.v._k28 = e.enumkeys (f.v.new_rows);
	},
	function (e,f) {
		f.pc=22;
		f.s[0] = f.v.id = (f.v._k26).shift();
		f.s[1] = f.v.cobj = (f.v.div_by_id)[(f.v.id)];
		e.mcall (5, (f.v.cobj).parentNode, "removeChild", ([f.v.cobj]));
	},
/*25*/	function (e,f) {
		f.pc=27;
		if (!((f.v._k28).length)) f.pc=26;
	},
	function (e,f) {
		f.pc=29;
		e.mcall (2, f.v["this"], "reorder_animate", ([]));
	},
	function (e,f) {
		f.v._i29 = (f.v._k28).shift();
		f.v.row = (f.v.new_rows)[(f.v._i29)];
		e.mcall (2, f.v.row, "get_id", ([]));
	},
	function (e,f) {
		f.pc=25;
		var t580 = f.s[0]; f.v.id = t580;
		f.v.rowdiv = (f.v.div_by_id)[(f.v.id)];
		e.mcall (4, f.v.tobj, "insertBefore", ([f.v.rowdiv, f.v.endobj]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "unsnapshot_table", ([])); },
/*30*/	function (e,f) { e.mcall (2, f.v["this"], "recolour_rows", ([])); },
null	];

;
	c.pargs__get_row_el =  ["row"];
	c.pinst__get_row_el =  [
/*0*/	function (e,f) { e.mcall (2, f.v.row, "get_id", ([])); },
	function (e,f) {
		var t582 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("table") + ("" + ((f.v["this"]).tid) + (("-row") + (t582)))]));
	},
	function (e,f) { var t583 = f.s[0]; e.return_pop (t583); },
null	];

;
	c.pargs__drag_group_complete =  [];
	c.pinst__drag_group_complete =  [
/*0*/	function (e,f) { e.mcall (3, ((f.v["this"]).drag_group_div).parentNode, "removeChild", ([(f.v["this"]).drag_group_div])); },
null	];

;
	cp.drag_group_stop =  function (ev)
	{
{
		this.owner.on_drag_group_stop  (ev.clientX,ev.clientY,this.drag_group_payload);;
		}
			}

;
	cp.drag_group_move =  function (ev)
	{
{
		this.owner.on_drag_group_move  (ev.clientX,ev.clientY);;
		}
			}

;
	c.pargs__drag_group_start =  ["rows","event"];
	c.pinst__drag_group_start =  [
/*0*/	function (e,f) { e.mcall (3, document, "createElement", (["div"])); },
	function (e,f) {
		var t585 = f.s[0]; f.v.div = t585;
		f.v["this"].drag_group_payload = f.v.rows;
		f.v["this"].drag_group_div = f.v.div;
		(f.v.div).style.position = "absolute";
		e.mcall (3, (document).body, "appendChild", ([f.v.div]));
	},
	function (e,f) {
		f.v.drows = ([]);
		f.v._k30 = e.enumkeys (f.v.rows);
	},
	function (e,f) {
		f.pc=5;
		if (!((f.v._k30).length)) f.pc=4;
	},
	function (e,f) {
		f.pc=15;
		(f.v.div).style.left = "" + (f.v.left) + ("px");
		(f.v.div).style.top = "" + (f.v.top) + ("px");
		f.s[0] = 20;
		e.smcall (1, popup,"next_zindex", ([]));
	},
/*5*/	function (e,f) {
		f.v._i31 = (f.v._k30).shift();
		f.v.row = (f.v.rows)[(f.v._i31)];
		e.mcall (3, f.v["this"], "get_row_el", ([f.v.row]));
	},
	function (e,f) {
		var t596 = f.s[0]; f.v.rowel = t596;
		e.smcall (1, lib,"document_x_of", ([f.v.rowel]));
	},
	function (e,f) {
		var t598 = f.s[0]; f.v.rowx = t598;
		e.smcall (1, lib,"document_y_of", ([f.v.rowel]));
	},
	function (e,f) {
		var t600 = f.s[0]; f.v.rowy = t600;
		e.mcall (3, f.v.rowel, "cloneNode", ([true]));
	},
	function (e,f) {
		var t602 = f.s[0]; f.v.dup = t602;
		f.v.drows[f.v.drows.length] = ({userobj:f.v.row, origel:f.v.rowel, rowel:f.v.dup, x:f.v.rowx, y:f.v.rowy});
		if (((builtin__count (f.v.drows))) == ((1))) f.pc=10; else f.pc=11;
	},
/*10*/	function (e,f) {
		f.pc=3;
		f.v.top = f.v.rowy;
		f.v.left = f.v.rowx;
	},
	function (e,f) { if (((f.v.top)) > ((f.v.rowy))) f.pc=12; else f.pc=13; },
	function (e,f) { f.v.top = f.v.rowy; },
	function (e,f) { if (((f.v.left)) > ((f.v.rowx))) f.pc=14; else f.pc=3; },
	function (e,f) {
		f.pc=3;
		f.v.left = f.v.rowx;
	},
/*15*/	function (e,f) {
		var t608 = f.s[1]; var t609 = f.s[0]; 
		(f.v.div).style.zIndex = parseInt((t608),10) + parseInt((t609),10);
		f.v._k32 = e.enumkeys (f.v.drows);
	},
	function (e,f) {
		f.pc=18;
		if (!((f.v._k32).length)) f.pc=17;
	},
	function (e,f) {
		f.pc=-1;
		e.smcall (6, dragndrop,"begin_from_event", ([f.v.div, f.v.event, false, f.v["this"], "drag_group_stop", "drag_group_move"]));
	},
	function (e,f) {
		f.v._i33 = (f.v._k32).shift();
		f.v.drow = (f.v.drows)[(f.v._i33)];
		f.v.rowel = (f.v.drow).rowel;
		f.v.origel = (f.v.drow).origel;
		f.v.rowx = (f.v.drow).x;
		f.v.rowy = (f.v.drow).y;
		e.mcall (3, f.v.div, "appendChild", ([f.v.rowel]));
	},
	function (e,f) {
		f.pc=16;
		(f.v.rowel).style.position = "absolute";
		(f.v.rowel).style.left = "" + (parseInt((f.v.rowx),10) - parseInt((f.v.left),10)) + ("px");
		(f.v.rowel).style.top = "" + (parseInt((f.v.rowy),10) - parseInt((f.v.top),10)) + ("px");
		(f.v.rowel).style.width = "" + ((f.v.origel).offsetWidth) + ("px");
		(f.v.rowel).style.height = "" + ((f.v.origel).offsetHeight) + ("px");
		e.smcall (2, browser,"set_alpha", ([f.v.rowel, 50]));
	},
null	];

;
	cp.drag_start =  function (event,row)
	{
		event.cancelBubble = true;

		var robj = document.getElementById ("table"+this.tid+"-row"+row.get_id());

		var width = robj.offsetWidth;
		var height = robj.offsetHeight;
		var x = lib.document_x_of (robj);
		var y = lib.document_y_of (robj);

		this.snapshot_table();

		robj.parentNode.removeChild (robj);

		robj.style.left = (x+20)+"px";
		robj.style.top = y+"px";
		robj.style.border = "black solid 1px";
		document.body.appendChild (robj);

		this.dragging_robj = robj;
		beginDrag (robj, event, true, this);

		this.timerid = window.setInterval ("rpcclass.call_method_by_name ('divTableManager', '"+this.get_id()+"', 'timer', 0)", 20);

			}

;
	cp.release_action =  function ()
	{
		window.clearInterval (this.timerid);

		var y = parseInt (this.dragging_robj.style.top) - this.y_adjust;
		var h = parseInt (this.dragging_robj.style.height);
		var midy = y + h/2;
		var tobj = document.getElementById (this.tid);
		var endobj = document.getElementById ("tab"+this.tid+"-end-marker");

		var i;
		var y = tobj.snapshot_y;
		var next = null;
		for (i = 0; i < tobj.childNodes.length; i++)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				if (next == null && y+cobj.snapshot_h >= midy)
				{
					next = cobj;
					break;
				}
				y += cobj.snapshot_h;
			}
		}

		this.dragging_robj.parentNode.removeChild (this.dragging_robj);
		tobj.insertBefore (this.dragging_robj, next);
		this.dragging_robj.style.border = "";

		this.unsnapshot_table ();

		this.recolour_rows();

		this.dragging_robj = null;

		var neworder = new Array;
		for (i = 0; i < tobj.childNodes.length; i++)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				var matches = cobj.id.match (/table(.*)\-row(.*)/);
				neworder[neworder.length] = matches[2];
			}
		}

		var args = [ neworder ];
		this.owner.call_self_using_engine ("reorder", args);

			}

;
	cp.move_action =  function ()
	{
		var y = parseInt (this.dragging_robj.style.top);
		var h = parseInt (this.dragging_robj.style.height);
		var top = browser.scroll_top(); // document.documentElement.scrollTop;
		var bottom = top + browser.window_height(); // document.documentElement.clientHeight;
		var end = browser.document_height(); // document.documentElement.scrollHeight;
		if (y < top+30 && top > 0)
		{
			window.scrollBy (0,-10);
			this.dragging_robj.style.top = (y-10)+"px";
		}
		if (y+h > bottom - 30 && bottom < end)
		{
			window.scrollBy (0,10);
			this.dragging_robj.style.top = (y+10)+"px";
		}
			}

;
	cp.timer =  function ()
	{
		var drag_y, drag_h;
		if (this.dragging_robj)
		{
			drag_h = parseInt (this.dragging_robj.style.height);
			drag_y = parseInt (this.dragging_robj.style.top) + drag_h / 2 - this.y_adjust;
		}

		var tobj = document.getElementById (this.tid);
		var endobj = document.getElementById ("tab"+this.tid+"-end-marker");

		var i;
		var y = tobj.snapshot_y;
		var included_gap = false;
		var settled = true;
		for (i = 0; i < tobj.childNodes.length; i++)
		{
			var cobj = tobj.childNodes[i];
			if (cobj != endobj && cobj.nodeType == 1 && cobj.tagName == "DIV")
			{
				if (this.dragging_robj && !included_gap && y+cobj.snapshot_h >= drag_y)
				{
					y += drag_h;
					included_gap = true;
				}

				if (cobj.snapshot_y > y)
				{
					if (cobj.snapshot_y > y+3)
						cobj.snapshot_y -= 3;
					else
						cobj.snapshot_y--;
					this.nail_row (cobj);
					settled = false;
				}
				else if (cobj.snapshot_y < y)
				{
					if (cobj.snapshot_y < y-3)
						cobj.snapshot_y += 3;
					else
						cobj.snapshot_y++;
					this.nail_row (cobj);
					settled = false;
				}
				else
				{
				}
				y += cobj.snapshot_h;
			}
		}
		if (settled && this.reordering)
		{
			php_engine.resume_thread (this.thread_id, "reorder-complete", null);
		}

			}

;
};
divTableManager.init_methods (divTableManager);
rpcclass.setup_class (divTableManager, "divTableManager",0, (["owner","rows","tid","ncols","widths","ignore_background_class","drag_timer","listeners"]), ([2,2,2,2,2,2,2,2]));
function form_element () { this.do_construct (arguments); }
form_element.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__init_helper =  [];
	c.pinst__init_helper =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.pargs__initialise =  ["form","fielddef","values"];
	c.pinst__initialise =  [
/*0*/	function (e,f) {
		f.v["this"].form = f.v.form;
		f.v["this"].fielddef = f.v.fielddef;
		f.v["this"].raw_value = "";
		f.v["this"].change_timer_handle = null;
		if (((f.v.values)) !== ((null))) f.pc=1; else f.pc=7;
	},
	function (e,f) { if (((f.v.fielddef).name) !== undefined) f.pc=2; else f.pc=7; },
	function (e,f) {
		f.v.fname = (f.v.fielddef).name;
		if (builtin__is_object (f.v.values)) f.pc=3; else f.pc=5;
	},
	function (e,f) { if (((f.v.values)[(f.v.fname)]) !== undefined) f.pc=4; else f.pc=7; },
	function (e,f) {
		f.pc=7;
		f.v["this"].raw_value = (f.v.values)[(f.v.fname)];
	},
/*5*/	function (e,f) { if (((f.v.values)[(f.v.fname)]) !== undefined) f.pc=6; else f.pc=7; },
	function (e,f) { f.v["this"].raw_value = (f.v.values)[(f.v.fname)]; },
	function (e,f) { e.mcall (2, f.v["this"], "init_helper", ([])); },
null	];

;
	c.pargs__change_timer =  [];
	c.pinst__change_timer =  [
/*0*/	function (e,f) {
		f.v["this"].change_timer_handle = null;
		e.mcall (2, f.v["this"], "check_for_possible_change", ([]));
	},
null	];

;
	cp.trigger_change_timer =  function ()
	{
{
		if (this.change_timer_handle === null)
		{{
		this.change_timer_handle = this.start_timeout_callback_sync  (300,"change_timer",null);;
		}
		 }
		;
		}
			}

;
	c.pargs__is_readonly =  [];
	c.pinst__is_readonly =  [
/*0*/	function (e,f) { if ((((f.v["this"]).fielddef).readonly) !== undefined) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.s[0] = ((((f.v["this"]).fielddef).readonly)) == (("1"));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t195 = f.s[0]; e.return_pop (t195); },
null	];

;
	c.pargs__is_required =  [];
	c.pinst__is_required =  [
/*0*/	function (e,f) { if ((((f.v["this"]).fielddef).required) !== undefined) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.s[0] = ((((f.v["this"]).fielddef).required)) == (("1"));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t196 = f.s[0]; e.return_pop (t196); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.pargs__render_button =  [];
	c.pinst__render_button =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) { e.return_pop (f.v.raw_value); },
null	];

;
	c.pargs__render_raw_value =  [];
	c.pinst__render_raw_value =  [
/*0*/	function (e,f) { e.mcall (3, f.v["this"], "render_value", ([(f.v["this"]).raw_value])); },
	function (e,f) { var t197 = f.s[0]; e.return_pop (t197); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { e.return_pop (f.v.value); },
null	];

;
	c.pargs__row_el =  [];
	c.pinst__row_el =  [
/*0*/	function (e,f) { e.return_pop (null); },
null	];

;
	c.pargs__is_enabled =  [];
	c.pinst__is_enabled =  [
/*0*/	function (e,f) { if (!((((f.v["this"]).fielddef).enabled) !== undefined)) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop (true); },
	function (e,f) { e.mcall (3, (f.v["this"]).form, "is_enabled", ([((f.v["this"]).fielddef).enabled])); },
	function (e,f) { var t198 = f.s[0]; e.return_pop (t198); },
null	];

;
	c.pargs__check_option_enable =  [];
	c.pinst__check_option_enable =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.pargs__check_enable =  [];
	c.pinst__check_enable =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "row_el", ([])); },
	function (e,f) {
		var t200 = f.s[0]; f.v.rowel = t200;
		if (((f.v.rowel)) !== ((null))) f.pc=2; else f.pc=6;
	},
	function (e,f) {
		f.pc=5;
		e.mcall (2, f.v["this"], "is_enabled", ([]));
	},
	function (e,f) {
		f.pc=6;
		(f.v.rowel).style.display = "";
	},
	function (e,f) {
		f.pc=6;
		(f.v.rowel).style.display = "none";
	},
/*5*/	function (e,f) { var t203 = f.s[0]; if (t203) f.pc=3; else f.pc=4; },
	function (e,f) { e.mcall (2, f.v["this"], "check_option_enable", ([])); },
null	];

;
	c.pargs__value_legal =  [];
	c.pinst__value_legal =  [
/*0*/	function (e,f) { e.return_pop (true); },
null	];

;
	c.args__create = c.pargs__create =  ["form","fielddef","values"];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.cname = ("form_element_") + ((f.v.fielddef).type);
		f.v.obj = eval ("new "+f.v.cname);
		e.mcall (5, f.v.obj, "initialise", ([f.v.form, f.v.fielddef, f.v.values]));
	},
	function (e,f) { e.return_pop (f.v.obj); },
null	];

;
};
form_element.init_methods (form_element);
rpcclass.setup_class (form_element, "form_element",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_hidden () { this.do_construct (arguments); }
form_element_hidden.init_methods = function (c) {
	form_element.init_methods(c);
	var cp = c.prototype;
};
form_element_hidden.init_methods (form_element_hidden);
rpcclass.setup_class (form_element_hidden, "form_element_hidden",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_condition () { this.do_construct (arguments); }
form_element_condition.init_methods = function (c) {
	form_element.init_methods(c);
	var cp = c.prototype;
	c.pargs__eval_condition =  ["condition"];
	c.pinst__eval_condition =  [
/*0*/	function (e,f) { e.smcall (1, form_condition,"parse", ([((f.v["this"]).fielddef).expr])); },
	function (e,f) {
		var t207 = f.s[0]; f.v.fc = t207;
		e.mcall (3, f.v.fc, "evaluate", ([(f.v["this"]).form]));
	},
	function (e,f) { var t208 = f.s[0]; e.return_pop (t208); },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) {
		f.pc=3;
		e.mcall (3, f.v["this"], "eval_condition", ([""]));
	},
	function (e,f) {
		f.pc=4;
		f.s[0] = "1";
	},
	function (e,f) {
		f.pc=4;
		f.s[0] = "0";
	},
	function (e,f) { var t209 = f.s[0]; if (t209) f.pc=1; else f.pc=2; },
	function (e,f) { var t210 = f.s[0]; e.return_pop (t210); },
null	];

;
};
form_element_condition.init_methods (form_element_condition);
rpcclass.setup_class (form_element_condition, "form_element_condition",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_condition_count () { this.do_construct (arguments); }
form_element_condition_count.init_methods = function (c) {
	form_element.init_methods(c);
	var cp = c.prototype;
	c.pargs__eval_condition_count =  [];
	c.pinst__eval_condition_count =  [
/*0*/	function (e,f) {
		f.v.cl = builtin__explode (",",((f.v["this"]).fielddef).expr);
		f.v.res = 0;
		f.v._k10 = e.enumkeys (f.v.cl);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k10).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.v._i11 = (f.v._k10).shift();
		f.v.c = (f.v.cl)[(f.v._i11)];
		e.smcall (1, form_condition,"parse", ([f.v.c]));
	},
	function (e,f) {
		f.pc=6;
		var t217 = f.s[0]; f.v.fc = t217;
		e.mcall (3, f.v.fc, "evaluate", ([(f.v["this"]).form]));
	},
/*5*/	function (e,f) {
		f.pc=1;
		e.php_push_var_lvalue (0, "res");
		e.php_postinc (1);
	},
	function (e,f) { var t219 = f.s[0]; if (t219) f.pc=5; else f.pc=1; },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) {
		f.pc=3;
		e.mcall (3, f.v["this"], "eval_condition", ([""]));
	},
	function (e,f) {
		f.pc=4;
		f.s[0] = "1";
	},
	function (e,f) {
		f.pc=4;
		f.s[0] = "0";
	},
	function (e,f) { var t220 = f.s[0]; if (t220) f.pc=1; else f.pc=2; },
	function (e,f) { var t221 = f.s[0]; e.return_pop (t221); },
null	];

;
};
form_element_condition_count.init_methods (form_element_condition_count);
rpcclass.setup_class (form_element_condition_count, "form_element_condition_count",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_line_base () { this.do_construct (arguments); }
form_element_line_base.init_methods = function (c) {
	form_element.init_methods(c);
	var cp = c.prototype;
	c.pargs__data_el_id =  [];
	c.pinst__data_el_id =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t222 = f.s[0]; 
		e.return_pop (("data-") + (t222));
	},
null	];

;
	c.pargs__data_el =  [];
	c.pinst__data_el =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "data_el_id", ([])); },
	function (e,f) { var t223 = f.s[0]; e.mcall (3, document, "getElementById", ([t223])); },
	function (e,f) { var t224 = f.s[0]; e.return_pop (t224); },
null	];

;
	c.pargs__label_el =  [];
	c.pinst__label_el =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t225 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("label-") + (t225)]));
	},
	function (e,f) { var t226 = f.s[0]; e.return_pop (t226); },
null	];

;
	c.pargs__row_el =  [];
	c.pinst__row_el =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t227 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("row-") + (t227)]));
	},
	function (e,f) { var t228 = f.s[0]; e.return_pop (t228); },
null	];

;
	c.pargs__set_value =  ["raw_value"];
	c.pinst__set_value =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "read_current_value", ([])); },
	function (e,f) {
		var t230 = f.s[0]; f.v.old = t230;
		e.mcall (3, f.v["this"], "render_value", ([f.v.raw_value]));
	},
	function (e,f) {
		var t232 = f.s[0]; f.v.text_val = t232;
		if (((f.v.old)) != ((f.v.text_val))) f.pc=3; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "parse_value", ([f.v.text_val])); },
	function (e,f) {
		var t234 = f.s[0]; f.v["this"].raw_value = t234;
		e.mcall (2, f.v["this"], "data_el", ([]));
	},
/*5*/	function (e,f) {
		var t236 = f.s[0]; f.v.el = t236;
		f.v.el.innerHTML = f.v.text_val;
		e.mcall (2, f.v["this"], "change_detected", ([]));
	},
null	];

;
	c.pargs__set_current_value =  ["raw_value"];
	c.pinst__set_current_value =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "read_current_value", ([])); },
	function (e,f) {
		var t239 = f.s[0]; f.v.old = t239;
		e.mcall (3, f.v["this"], "render_value", ([f.v.raw_value]));
	},
	function (e,f) {
		var t241 = f.s[0]; f.v.text_val = t241;
		if (((f.v.old)) != ((f.v.text_val))) f.pc=3; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "parse_value", ([f.v.text_val])); },
	function (e,f) {
		var t243 = f.s[0]; f.v["this"].raw_value = t243;
		e.mcall (2, f.v["this"], "data_el", ([]));
	},
/*5*/	function (e,f) {
		var t245 = f.s[0]; f.v.el = t245;
		f.v.el.value = f.v.text_val;
		e.mcall (2, f.v["this"], "change_detected", ([]));
	},
null	];

;
	c.pargs__value_legal =  [];
	c.pinst__value_legal =  [
/*0*/	function (e,f) {
		f.pc=2;
		e.mcall (2, f.v["this"], "is_enabled", ([]));
	},
	function (e,f) { e.return_pop (true); },
	function (e,f) {
		var t247 = f.s[0]; 
		if (!(t247)) f.pc=1; else f.pc=3;
	},
	function (e,f) { if ((((f.v["this"]).raw_value)) === ((null))) f.pc=4; else f.pc=5; },
	function (e,f) { e.return_pop (false); },
/*5*/	function (e,f) { if ((((f.v["this"]).raw_value)) != ((""))) f.pc=6; else f.pc=7; },
	function (e,f) { e.return_pop (true); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		var t248 = f.s[0]; 
		e.return_pop (!(t248));
	},
null	];

;
	c.pargs__rerender_label =  [];
	c.pinst__rerender_label =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "label_el", ([])); },
	function (e,f) {
		var t250 = f.s[0]; f.v.el = t250;
		e.php_builtin (0, "ob_start", 0);
		e.mcall (2, f.v["this"], "render_label", ([]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t252 = f.s[0]; f.v.el.innerHTML = t252;
	},
null	];

;
	c.pargs__change_detected =  [];
	c.pinst__change_detected =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "rerender_label", ([])); },
	function (e,f) { e.mcall (4, (f.v["this"]).form, "changed", ([((f.v["this"]).fielddef).name, (f.v["this"]).raw_value])); },
null	];

;
	c.pargs__current_value_is_raw =  [];
	c.pinst__current_value_is_raw =  [
/*0*/	function (e,f) { e.return_pop (false); },
null	];

;
	c.pargs__read_current_value =  [];
	c.pinst__read_current_value =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "data_el", ([])); },
	function (e,f) {
		var t254 = f.s[0]; f.v.el = t254;
		if (((f.v.el)) === ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) { e.return_pop ((f.v.el).value); },
null	];

;
	c.pargs__check_for_possible_change =  [];
	c.pinst__check_for_possible_change =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "read_current_value", ([])); },
	function (e,f) {
		var t256 = f.s[0]; f.v.current = t256;
		if (((f.v.current)) === ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) { f.pc=-1; },
	function (e,f) {
		f.pc=6;
		e.mcall (2, f.v["this"], "current_value_is_raw", ([]));
	},
	function (e,f) { e.mcall (3, f.v["this"], "parse_value", ([f.v.current])); },
/*5*/	function (e,f) {
		f.pc=7;
		var t258 = f.s[0]; f.v.current = t258;
	},
	function (e,f) {
		var t259 = f.s[0]; 
		if (!(t259)) f.pc=4; else f.pc=7;
	},
	function (e,f) { if (((f.v.current)) !== (((f.v["this"]).raw_value))) f.pc=8; else f.pc=-1; },
	function (e,f) {
		f.v["this"].raw_value = f.v.current;
		e.mcall (2, f.v["this"], "change_detected", ([]));
	},
null	];

;
	c.pargs__onchange_handler =  ["el","arg","ev"];
	c.pinst__onchange_handler =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "check_for_possible_change", ([])); },
null	];

;
	c.pargs__render_label =  [];
	c.pinst__render_label =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "value_legal", ([])); },
	function (e,f) {
		var t261 = f.s[0]; 
		f.v.red = !(t261);
		if (f.v.red) f.pc=2; else f.pc=3;
	},
	function (e,f) { window.__outbuffer += "<span style=\"color:red\">"; },
	function (e,f) { if (builtin__method_exists (f.v["this"],"custom_label")) f.pc=4; else f.pc=6; },
	function (e,f) { e.mcall (2, f.v["this"], "custom_label", ([])); },
/*5*/	function (e,f) {
		f.pc=8;
		var t263 = f.s[0]; window.__outbuffer += t263;
	},
	function (e,f) { if (((((f.v["this"]).fielddef).label)) != ((""))) f.pc=7; else f.pc=8; },
	function (e,f) { window.__outbuffer += "" + (((f.v["this"]).fielddef).label) + (":"); },
	function (e,f) { if (f.v.red) f.pc=9; else f.pc=-1; },
	function (e,f) { window.__outbuffer += "</span>"; },
null	];

;
	c.pargs__focus =  [];
	c.pinst__focus =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "data_el", ([])); },
	function (e,f) {
		var t265 = f.s[0]; f.v.el = t265;
		e.mcall (2, f.v.el, "focus", ([]));
	},
null	];

;
	c.pargs__render_line_element_helper =  ["prefix","tagname","attrs","body","onclick"];
	c.pinst__render_line_element_helper =  [
/*0*/	function (e,f) {
		f.s[0] = "\"";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		f.pc=3;
		var t266 = f.s[1]; var t267 = f.s[0]; 
		window.__outbuffer += ("<tr id=\"row-") + ("" + (t266) + (t267));
		e.mcall (2, f.v["this"], "is_enabled", ([]));
	},
	function (e,f) {
		f.pc=4;
		window.__outbuffer += " style=\"display:none\"";
	},
	function (e,f) {
		var t268 = f.s[0]; 
		if (!(t268)) f.pc=2; else f.pc=4;
	},
	function (e,f) {
		window.__outbuffer += ">";
		if (builtin__method_exists (f.v["this"],"one_column")) f.pc=5; else f.pc=8;
	},
/*5*/	function (e,f) {
		window.__outbuffer += "<td colspan=\"2\">";
		f.s[0] = "\" >";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t269 = f.s[1]; var t270 = f.s[0]; 
		window.__outbuffer += ("<div style=\"text-align:left\" id=\"label-") + ("" + (t269) + (t270));
		e.mcall (2, f.v["this"], "render_label", ([]));
	},
	function (e,f) {
		f.pc=11;
		window.__outbuffer += "</div>";
	},
	function (e,f) {
		f.s[0] = "\" >";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t271 = f.s[1]; var t272 = f.s[0]; 
		window.__outbuffer += ("<td style=\"text-align:right\" id=\"label-") + ("" + (t271) + (t272));
		e.mcall (2, f.v["this"], "render_label", ([]));
	},
/*10*/	function (e,f) { window.__outbuffer += "</td><td>"; },
	function (e,f) {
		window.__outbuffer += f.v.prefix;
		f.s[0] = ("\" name=\"") + ("" + (((f.v["this"]).fielddef).name) + ("\""));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t273 = f.s[1]; var t274 = f.s[0]; 
		window.__outbuffer += ("<") + ("" + (f.v.tagname) + ((" id=\"data-") + ("" + (t273) + (t274))));
		f.v._k12 = e.enumkeys (f.v.attrs);
	},
	function (e,f) {
		f.pc=15;
		if (!((f.v._k12).length)) f.pc=14;
	},
	function (e,f) {
		window.__outbuffer += " style=\"";
		if ((((f.v["this"]).fielddef).width) !== undefined) f.pc=19; else f.pc=22;
	},
/*15*/	function (e,f) {
		f.v.attr = (f.v._k12).shift();
		f.v.value = (f.v.attrs)[(f.v.attr)];
		if (((f.v.attr)) != (("style"))) f.pc=16; else f.pc=13;
	},
	function (e,f) {
		f.s[0] = "\"";
		e.smcall (2, form,"entities", ([f.v.value]));
	},
	function (e,f) {
		f.pc=13;
		var t278 = f.s[1]; var t279 = f.s[0]; 
		window.__outbuffer += (" ") + ("" + (f.v.attr) + (("=\"") + ("" + (t278) + (t279))));
	},
	function (e,f) {
		f.pc=24;
		window.__outbuffer += ("width:") + ("" + (((f.v["this"]).fielddef).width) + ("px;"));
	},
	function (e,f) { if (((((f.v["this"]).fielddef).width)) != ((""))) f.pc=20; else f.pc=21; },
/*20*/	function (e,f) {
		f.pc=23;
		f.s[0] = ((((f.v["this"]).fielddef).width)) != (("0"));
	},
	function (e,f) {
		f.pc=23;
		f.s[0] = false;
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t280 = f.s[0]; if (t280) f.pc=18; else f.pc=24; },
	function (e,f) { if ((((f.v["this"]).fielddef).height) !== undefined) f.pc=26; else f.pc=29; },
/*25*/	function (e,f) {
		f.pc=31;
		window.__outbuffer += ("height:") + ("" + (((f.v["this"]).fielddef).height) + ("px;"));
	},
	function (e,f) { if (((((f.v["this"]).fielddef).height)) != ((""))) f.pc=27; else f.pc=28; },
	function (e,f) {
		f.pc=30;
		f.s[0] = ((((f.v["this"]).fielddef).height)) != (("0"));
	},
	function (e,f) {
		f.pc=30;
		f.s[0] = false;
	},
	function (e,f) { f.s[0] = false; },
/*30*/	function (e,f) { var t281 = f.s[0]; if (t281) f.pc=25; else f.pc=31; },
	function (e,f) { if (((f.v.attrs).style) !== undefined) f.pc=32; else f.pc=33; },
	function (e,f) { window.__outbuffer += (f.v.attrs).style; },
	function (e,f) {
		window.__outbuffer += "\"";
		if (((f.v.body)) === ((null))) f.pc=34; else f.pc=35;
	},
	function (e,f) {
		f.pc=36;
		window.__outbuffer += "/>";
	},
/*35*/	function (e,f) {
		window.__outbuffer += ">";
		window.__outbuffer += f.v.body;
		window.__outbuffer += ("</") + ("" + (f.v.tagname) + (">"));
	},
	function (e,f) {
		window.__outbuffer += "</td>";
		if (((f.v.onclick)) !== ((null))) f.pc=37; else f.pc=38;
	},
	function (e,f) {
		window.__outbuffer += "<td>";
		window.__outbuffer += ("<a href=\"#\" onclick=\"") + ("" + (f.v.onclick) + ("\">change</a>"));
		window.__outbuffer += "</td>";
	},
	function (e,f) {
		window.__outbuffer += "</tr>";
		if ((((f.v["this"]).fielddef).focus) !== undefined) f.pc=39; else f.pc=-1;
	},
	function (e,f) { (f.v["this"]).form.focusfield = f.v["this"]; },
null	];

;
	c.pargs__edit_field =  ["el","args","ev"];
	c.pinst__edit_field =  [
/*0*/	function (e,f) {
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = (f.v["this"]).fielddef;
		f.v.fields[f.v.fields.length] = ({type:"ok"});
		f.v.fields[f.v.fields.length] = ({name:"cancel", type:"button", label:"Cancel", action:"cancel"});
		f.v.fname = ((f.v["this"]).fielddef).name;
		f.v.values = ({});
		f.v.values[f.v.fname] = (f.v["this"]).raw_value;
		e.smcall (3, form,"create", ([f.v["this"], f.v.fields, f.v.values]));
	},
	function (e,f) {
		var t291 = f.s[0]; f.v.xf = t291;
		e.mcall (3, f.v.xf, "focus", ([0]));
	},
	function (e,f) {
		f.v.xf.env = ((f.v["this"]).form).env;
		e.mcall (5, f.v.xf, "popup", ([0, 0, "Change"]));
	},
	function (e,f) {
		var t294 = f.s[0]; f.v.newvals = t294;
		if (((f.v.newvals)) !== ((null))) f.pc=4; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "set_value", ([(f.v.newvals)[(f.v.fname)]])); },
null	];

;
};
form_element_line_base.init_methods (form_element_line_base);
rpcclass.setup_class (form_element_line_base, "form_element_line_base",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_label () { this.do_construct (arguments); }
form_element_label.init_methods = function (c) {
	form_element_line_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__value_legal =  [];
	c.pinst__value_legal =  [
/*0*/	function (e,f) { e.return_pop (true); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.s[0] = null;
		e.mcall (3, f.v["this"], "render_raw_value", ([]));
	},
	function (e,f) { var t295 = f.s[1]; var t296 = f.s[0]; e.mcall (7, f.v["this"], "render_line_element_helper", (["", "span", ([]), t295, t296])); },
null	];

;
};
form_element_label.init_methods (form_element_label);
rpcclass.setup_class (form_element_label, "form_element_label",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_textarea () { this.do_construct (arguments); }
form_element_textarea.init_methods = function (c) {
	form_element_line_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__one_column =  [];
	c.pinst__one_column =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	cp.text_changed =  function (el,arg,ev)
	{
{
		this.trigger_change_timer  ();;
		return (true);
		}
			}

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "render_raw_value", ([])); },
	function (e,f) {
		var t298 = f.s[0]; f.v.value = t298;
		f.v.attrs = ([]);
		f.v.attrs.style = "margin-left:20px; border: solid 1px #c0c0c0; padding:3px;";
		if (((((f.v["this"]).form).form_mode)) == ((1))) f.pc=13; else f.pc=15;
	},
	function (e,f) { e.mcall (4, f.v["this"], "render_start_sync", (["text_changed", null])); },
	function (e,f) {
		var t302 = f.s[0]; f.v.attrs.onkeydown = t302;
		e.mcall (4, f.v["this"], "render_start_sync", (["text_changed", null]));
	},
	function (e,f) {
		f.pc=-1;
		var t304 = f.s[0]; f.v.attrs.onchange = t304;
		e.mcall (7, f.v["this"], "render_line_element_helper", (["", "textarea", f.v.attrs, builtin__htmlentities (f.v.value), null]));
	},
/*5*/	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((0))) f.pc=10; else f.pc=11; },
	function (e,f) {
		f.pc=-1;
		e.mcall (7, f.v["this"], "render_line_element_helper", (["", "div", f.v.attrs, builtin__str_replace ("\n","<br/>",builtin__htmlentities (f.v.value)), null]));
	},
	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((2))) f.pc=8; else f.pc=-1; },
	function (e,f) { e.mcall (4, f.v["this"], "render_start", (["edit_field", null])); },
	function (e,f) {
		f.pc=-1;
		var t305 = f.s[0]; e.mcall (7, f.v["this"], "render_line_element_helper", (["", "div", f.v.attrs, builtin__str_replace ("\n","<br/>",builtin__htmlentities (f.v.value)), t305]));
	},
/*10*/	function (e,f) {
		f.pc=12;
		f.s[0] = true;
	},
	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) { var t306 = f.s[0]; if (t306) f.pc=6; else f.pc=7; },
	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) {
		f.pc=16;
		var t307 = f.s[0]; f.s[0] = !(t307);
	},
/*15*/	function (e,f) { f.s[0] = false; },
	function (e,f) { var t308 = f.s[0]; if (t308) f.pc=2; else f.pc=5; },
null	];

;
};
form_element_textarea.init_methods (form_element_textarea);
rpcclass.setup_class (form_element_textarea, "form_element_textarea",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_text_base () { this.do_construct (arguments); }
form_element_text_base.init_methods = function (c) {
	form_element_line_base.init_methods(c);
	var cp = c.prototype;
	cp.text_changed =  function (el,arg,ev)
	{
{
		this.trigger_change_timer  ();;
		return (true);
		}
			}

;
	c.pargs__render_text_element_helper =  ["prefix","input_type"];
	c.pinst__render_text_element_helper =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "render_raw_value", ([])); },
	function (e,f) {
		var t310 = f.s[0]; f.v.value = t310;
		if (((((f.v["this"]).form).form_mode)) == ((1))) f.pc=13; else f.pc=15;
	},
	function (e,f) {
		f.v.attrs = ({type:f.v.input_type, value:f.v.value});
		e.mcall (4, f.v["this"], "render_start_sync", (["text_changed", null]));
	},
	function (e,f) {
		var t313 = f.s[0]; f.v.attrs.onkeydown = t313;
		e.mcall (4, f.v["this"], "render_start_sync", (["text_changed", null]));
	},
	function (e,f) {
		f.pc=-1;
		var t315 = f.s[0]; f.v.attrs.onchange = t315;
		e.mcall (7, f.v["this"], "render_line_element_helper", ([f.v.prefix, "input", f.v.attrs, null, null]));
	},
/*5*/	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((0))) f.pc=10; else f.pc=11; },
	function (e,f) {
		f.pc=-1;
		e.mcall (7, f.v["this"], "render_line_element_helper", ([f.v.prefix, "span", ([]), f.v.value, null]));
	},
	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((2))) f.pc=8; else f.pc=-1; },
	function (e,f) { e.mcall (4, f.v["this"], "render_start", (["edit_field", null])); },
	function (e,f) {
		f.pc=-1;
		var t316 = f.s[0]; e.mcall (7, f.v["this"], "render_line_element_helper", ([f.v.prefix, "span", ([]), f.v.value, t316]));
	},
/*10*/	function (e,f) {
		f.pc=12;
		f.s[0] = true;
	},
	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) { var t317 = f.s[0]; if (t317) f.pc=6; else f.pc=7; },
	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) {
		f.pc=16;
		var t318 = f.s[0]; f.s[0] = !(t318);
	},
/*15*/	function (e,f) { f.s[0] = false; },
	function (e,f) { var t319 = f.s[0]; if (t319) f.pc=2; else f.pc=5; },
null	];

;
	c.pargs__eval_condition =  ["condition"];
	c.pinst__eval_condition =  [
/*0*/	function (e,f) { if (((builtin__substr (f.v.condition,0,1))) == (("="))) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop (((builtin__substr (f.v.condition,1))) == (((f.v["this"]).raw_value))); },
	function (e,f) {
		f.s[0] = builtin__debugout (("form_element_text_base:eval_condition - don't know how to check ") + ("" + (f.v.condition) + ((" for ") + ((f.v["this"]).raw_value))));
		e.return_pop (false);
	},
null	];

;
};
form_element_text_base.init_methods (form_element_text_base);
rpcclass.setup_class (form_element_text_base, "form_element_text_base",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_integer () { this.do_construct (arguments); }
form_element_integer.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__init_helper =  [];
	c.pinst__init_helper =  [
/*0*/	function (e,f) { if ((((f.v["this"]).raw_value)) == ((""))) f.pc=1; else f.pc=-1; },
	function (e,f) { if ((((f.v["this"]).fielddef).definteger) !== undefined) f.pc=2; else f.pc=3; },
	function (e,f) {
		f.pc=-1;
		f.v["this"].raw_value = ("") + (((f.v["this"]).fielddef).definteger);
	},
	function (e,f) { f.v["this"].raw_value = "0"; },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "text"])); },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) { e.return_pop (f.v.raw_value); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { if (((f.v.value)) == ((""))) f.pc=2; else f.pc=4; },
	function (e,f) { e.return_pop (""); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		f.pc=5;
		var t322 = f.s[0]; f.s[0] = !(t322);
	},
	function (e,f) { f.s[0] = false; },
/*5*/	function (e,f) { var t323 = f.s[0]; if (t323) f.pc=1; else f.pc=6; },
	function (e,f) { if (!(builtin__preg_match ("/^\\-?\\d+$/",f.v.value))) f.pc=7; else f.pc=8; },
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.v.value = parseInt((0),10) + parseInt((f.v.value),10);
		if ((((f.v["this"]).fielddef).mininteger) !== undefined) f.pc=10; else f.pc=11;
	},
	function (e,f) { e.return_pop (null); },
/*10*/	function (e,f) {
		f.pc=12;
		f.s[0] = ((f.v.value)) < ((((f.v["this"]).fielddef).mininteger));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t325 = f.s[0]; if (t325) f.pc=9; else f.pc=13; },
	function (e,f) { if ((((f.v["this"]).fielddef).maxinteger) !== undefined) f.pc=15; else f.pc=16; },
	function (e,f) { e.return_pop (null); },
/*15*/	function (e,f) {
		f.pc=17;
		f.s[0] = ((f.v.value)) > ((((f.v["this"]).fielddef).maxinteger));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t326 = f.s[0]; if (t326) f.pc=14; else f.pc=18; },
	function (e,f) { e.return_pop (f.v.value); },
null	];

;
};
form_element_integer.init_methods (form_element_integer);
rpcclass.setup_class (form_element_integer, "form_element_integer",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_date () { this.do_construct (arguments); }
form_element_date.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__popup_date =  [];
	c.pinst__popup_date =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "read_current_value", ([])); },
	function (e,f) {
		var t328 = f.s[0]; f.v.current = t328;
		if (((f.v.current)) === ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) {
		f.pc=6;
		f.v.old = builtin__time ();
	},
	function (e,f) { e.mcall (3, f.v["this"], "parse_value", ([f.v.current])); },
	function (e,f) {
		var t331 = f.s[0]; f.v.old = t331;
		if (((f.v.old)) === ((null))) f.pc=5; else f.pc=6;
	},
/*5*/	function (e,f) { f.v.old = builtin__time (); },
	function (e,f) { e.smcall (2, popupdate,"run", ([((f.v["this"]).fielddef).label, f.v.old])); },
	function (e,f) {
		var t334 = f.s[0]; f.v.v = t334;
		if (((f.v.v)) !== ((null))) f.pc=8; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "set_current_value", ([f.v.v])); },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) { e.return_pop (builtin__date ("Y-m-d",f.v.raw_value)); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { if (((f.v.value)) == ((""))) f.pc=2; else f.pc=4; },
	function (e,f) { e.return_pop (""); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		f.pc=5;
		var t335 = f.s[0]; f.s[0] = !(t335);
	},
	function (e,f) { f.s[0] = false; },
/*5*/	function (e,f) { var t336 = f.s[0]; if (t336) f.pc=1; else f.pc=6; },
	function (e,f) {
		f.v.matches = ([]);
		if (builtin__preg_match ("/^(2\\d\\d\\d)\\-(\\d\\d?)\\-(\\d\\d?)$/",f.v.value,f.v.matches)) f.pc=7; else f.pc=8;
	},
	function (e,f) {
		f.s[0] = builtin__debugout (("Parsed it ") + (f.v.matches));
		e.return_pop (builtin__mktime (0,0,0,(f.v.matches)[(2)],(f.v.matches)[(3)],(f.v.matches)[(1)]));
	},
	function (e,f) { e.return_pop (null); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.s[0] = "text";
		f.s[1] = "\" src=\"/pj/graphics/calendar-small.png\" />";
		e.mcall (6, f.v["this"], "render_start", (["popup_date", null]));
	},
	function (e,f) {
		var t338 = f.s[2]; var t339 = f.s[1]; 
		var t340 = f.s[0]; e.mcall (4, f.v["this"], "render_text_element_helper", ([("<img onclick=\"") + ("" + (t338) + (t339)), t340]));
	},
null	];

;
};
form_element_date.init_methods (form_element_date);
rpcclass.setup_class (form_element_date, "form_element_date",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_time () { this.do_construct (arguments); }
form_element_time.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) { e.return_pop (builtin__date ("H:i",f.v.raw_value)); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { if (((f.v.value)) == ((""))) f.pc=2; else f.pc=4; },
	function (e,f) { e.return_pop (""); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		f.pc=5;
		var t341 = f.s[0]; f.s[0] = !(t341);
	},
	function (e,f) { f.s[0] = false; },
/*5*/	function (e,f) { var t342 = f.s[0]; if (t342) f.pc=1; else f.pc=6; },
	function (e,f) {
		f.v.matches = ([]);
		if (builtin__preg_match ("/^(\\d\\d?)\\:(\\d\\d)$/",f.v.value,f.v.matches)) f.pc=8; else f.pc=11;
	},
	function (e,f) {
		f.s[0] = builtin__debugout (("Parsed it ") + (f.v.matches));
		e.return_pop (builtin__mktime ((f.v.matches)[(1)],(f.v.matches)[(2)],0,1,1,2000));
	},
	function (e,f) { if ((((f.v.matches)[(1)])) < ((24))) f.pc=9; else f.pc=10; },
	function (e,f) {
		f.pc=12;
		f.s[0] = (((f.v.matches)[(2)])) < ((60));
	},
/*10*/	function (e,f) {
		f.pc=12;
		f.s[0] = false;
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t344 = f.s[0]; if (t344) f.pc=7; else f.pc=13; },
	function (e,f) { e.return_pop (null); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "text"])); },
null	];

;
};
form_element_time.init_methods (form_element_time);
rpcclass.setup_class (form_element_time, "form_element_time",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_datetime () { this.do_construct (arguments); }
form_element_datetime.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__popup_date =  [];
	c.pinst__popup_date =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "read_current_value", ([])); },
	function (e,f) {
		var t346 = f.s[0]; f.v.current = t346;
		if (((f.v.current)) === ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) {
		f.pc=6;
		f.v.old = builtin__time ();
	},
	function (e,f) { e.mcall (3, f.v["this"], "parse_value", ([f.v.current])); },
	function (e,f) {
		var t349 = f.s[0]; f.v.old = t349;
		if (((f.v.old)) === ((null))) f.pc=5; else f.pc=6;
	},
/*5*/	function (e,f) { f.v.old = builtin__time (); },
	function (e,f) { e.smcall (2, popupdate,"run", ([((f.v["this"]).fielddef).label, f.v.old])); },
	function (e,f) {
		var t352 = f.s[0]; f.v.v = t352;
		if (((f.v.v)) !== ((null))) f.pc=8; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "set_current_value", ([builtin__mktime (builtin__date ("H",f.v.old),builtin__date ("i",f.v.old),0,builtin__date ("m",f.v.v),builtin__date ("d",f.v.v),builtin__date ("Y",f.v.v))])); },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) { e.return_pop (builtin__date ("Y-m-d H:i",f.v.raw_value)); },
null	];

;
	c.pargs__parse_datetime =  ["value"];
	c.pinst__parse_datetime =  [
/*0*/	function (e,f) { if (((f.v.value)) == ((""))) f.pc=2; else f.pc=4; },
	function (e,f) { e.return_pop (""); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		f.pc=5;
		var t353 = f.s[0]; f.s[0] = !(t353);
	},
	function (e,f) { f.s[0] = false; },
/*5*/	function (e,f) { var t354 = f.s[0]; if (t354) f.pc=1; else f.pc=6; },
	function (e,f) {
		f.v.matches = ([]);
		if (builtin__preg_match ("/^(2\\d\\d\\d)\\-(\\d\\d?)\\-(\\d\\d?) (\\d\\d?)\\:(\\d\\d)$/",f.v.value,f.v.matches)) f.pc=8; else f.pc=11;
	},
	function (e,f) { e.return_pop (builtin__mktime ((f.v.matches)[(4)],(f.v.matches)[(5)],0,(f.v.matches)[(2)],(f.v.matches)[(3)],(f.v.matches)[(1)])); },
	function (e,f) { if ((((f.v.matches)[(4)])) < ((24))) f.pc=9; else f.pc=10; },
	function (e,f) {
		f.pc=12;
		f.s[0] = (((f.v.matches)[(5)])) < ((60));
	},
/*10*/	function (e,f) {
		f.pc=12;
		f.s[0] = false;
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t356 = f.s[0]; if (t356) f.pc=7; else f.pc=13; },
	function (e,f) { e.return_pop (null); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { e.mcall (3, f.v["this"], "parse_datetime", ([f.v.value])); },
	function (e,f) { var t357 = f.s[0]; e.return_pop (t357); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.s[0] = "text";
		f.s[1] = "\" src=\"/pj/graphics/calendar-small.png\" />";
		e.mcall (6, f.v["this"], "render_start", (["popup_date", null]));
	},
	function (e,f) {
		var t358 = f.s[2]; var t359 = f.s[1]; 
		var t360 = f.s[0]; e.mcall (4, f.v["this"], "render_text_element_helper", ([("<img onclick=\"") + ("" + (t358) + (t359)), t360]));
	},
null	];

;
};
form_element_datetime.init_methods (form_element_datetime);
rpcclass.setup_class (form_element_datetime, "form_element_datetime",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_price () { this.do_construct (arguments); }
form_element_price.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["&#163;", "text"])); },
null	];

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) { e.smcall (1, lib,"render_price_simple", ([f.v.raw_value])); },
	function (e,f) { var t361 = f.s[0]; e.return_pop (t361); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { if (((f.v.value)) == ((""))) f.pc=2; else f.pc=4; },
	function (e,f) { e.return_pop (""); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		f.pc=5;
		var t362 = f.s[0]; f.s[0] = !(t362);
	},
	function (e,f) { f.s[0] = false; },
/*5*/	function (e,f) { var t363 = f.s[0]; if (t363) f.pc=1; else f.pc=6; },
	function (e,f) { e.smcall (1, lib,"parse_price_simple", ([f.v.value])); },
	function (e,f) {
		var t365 = f.s[0]; f.v.n = t365;
		if (((f.v.n)) === ((null))) f.pc=8; else f.pc=9;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) { if ((((f.v["this"]).fielddef).minprice) !== undefined) f.pc=11; else f.pc=12; },
/*10*/	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.pc=13;
		f.s[0] = ((f.v.n)) < ((((f.v["this"]).fielddef).minprice));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t366 = f.s[0]; if (t366) f.pc=10; else f.pc=14; },
	function (e,f) { if ((((f.v["this"]).fielddef).maxprice) !== undefined) f.pc=16; else f.pc=17; },
/*15*/	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.pc=18;
		f.s[0] = ((f.v.n)) > ((((f.v["this"]).fielddef).maxprice));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t367 = f.s[0]; if (t367) f.pc=15; else f.pc=19; },
	function (e,f) { e.return_pop (f.v.n); },
null	];

;
};
form_element_price.init_methods (form_element_price);
rpcclass.setup_class (form_element_price, "form_element_price",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_email () { this.do_construct (arguments); }
form_element_email.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "text"])); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) { if (((f.v.value)) == ((""))) f.pc=2; else f.pc=4; },
	function (e,f) { e.return_pop (""); },
	function (e,f) { e.mcall (2, f.v["this"], "is_required", ([])); },
	function (e,f) {
		f.pc=5;
		var t368 = f.s[0]; f.s[0] = !(t368);
	},
	function (e,f) { f.s[0] = false; },
/*5*/	function (e,f) { var t369 = f.s[0]; if (t369) f.pc=1; else f.pc=6; },
	function (e,f) { if (!(builtin__preg_match ("/^[0-9a-zA-Z\\.\\+\\-_']+@[-0-9a-zA-Z\\.]+$/",f.v.value))) f.pc=7; else f.pc=8; },
	function (e,f) { e.return_pop (null); },
	function (e,f) { e.return_pop (f.v.value); },
null	];

;
};
form_element_email.init_methods (form_element_email);
rpcclass.setup_class (form_element_email, "form_element_email",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_text () { this.do_construct (arguments); }
form_element_text.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "text"])); },
null	];

;
};
form_element_text.init_methods (form_element_text);
rpcclass.setup_class (form_element_text, "form_element_text",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_postcode () { this.do_construct (arguments); }
form_element_postcode.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "text"])); },
null	];

;
};
form_element_postcode.init_methods (form_element_postcode);
rpcclass.setup_class (form_element_postcode, "form_element_postcode",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_dn () { this.do_construct (arguments); }
form_element_dn.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "text"])); },
null	];

;
};
form_element_dn.init_methods (form_element_dn);
rpcclass.setup_class (form_element_dn, "form_element_dn",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_password () { this.do_construct (arguments); }
form_element_password.init_methods = function (c) {
	form_element_text_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "render_text_element_helper", (["", "password"])); },
null	];

;
};
form_element_password.init_methods (form_element_password);
rpcclass.setup_class (form_element_password, "form_element_password",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_enum_base () { this.do_construct (arguments); }
form_element_enum_base.init_methods = function (c) {
	form_element_line_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__option_label =  ["opt"];
	c.pinst__option_label =  [
/*0*/	function (e,f) { e.return_pop ((f.v.opt).label); },
null	];

;
	cp.onkey =  function (el,arg,ev)
	{
{
		this.trigger_change_timer  ();;
		return (true);
		}
			}

;
	c.pargs__render_value =  ["raw_value"];
	c.pinst__render_value =  [
/*0*/	function (e,f) {
		f.v.label = "";
		f.v._k14 = e.enumkeys ((f.v["this"]).options);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k14).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (""); },
	function (e,f) {
		f.v._i15 = (f.v._k14).shift();
		f.v.opt = ((f.v["this"]).options)[(f.v._i15)];
		if ((((f.v.opt).name)) == ((f.v.raw_value))) f.pc=4; else f.pc=1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "option_label", ([f.v.opt])); },
/*5*/	function (e,f) { var t374 = f.s[0]; e.return_pop (t374); },
null	];

;
	c.pargs__parse_value =  ["value"];
	c.pinst__parse_value =  [
/*0*/	function (e,f) {
		f.v.label = "";
		f.v._k16 = e.enumkeys ((f.v["this"]).options);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k16).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (""); },
	function (e,f) {
		f.v._i17 = (f.v._k16).shift();
		f.v.opt = ((f.v["this"]).options)[(f.v._i17)];
		f.s[0] = "'";
		e.mcall (4, f.v["this"], "option_label", ([f.v.opt]));
	},
	function (e,f) {
		f.pc=6;
		var t379 = f.s[1]; var t380 = f.s[0]; 
		f.s[0] = builtin__debugout (("Checking '") + ("" + (f.v.value) + (("' against '") + ("" + (t379) + (t380)))));
		f.s[0] = f.v.value;
		e.mcall (4, f.v["this"], "option_label", ([f.v.opt]));
	},
/*5*/	function (e,f) { e.return_pop ((f.v.opt).name); },
	function (e,f) {
		var t381 = f.s[1]; var t382 = f.s[0]; 
		if (((t381)) == ((t382))) f.pc=5; else f.pc=1;
	},
null	];

;
	c.pargs__option_list =  [];
	c.pinst__option_list =  [
/*0*/	function (e,f) {
		f.v.live_opts = ([]);
		f.v.default_key = "";
		f.v._k18 = e.enumkeys ((f.v["this"]).options);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k18).length)) f.pc=2;
	},
	function (e,f) { if ((((f.v["this"]).raw_value)) == ((""))) f.pc=10; else f.pc=17; },
	function (e,f) {
		f.v._i19 = (f.v._k18).shift();
		f.v.opt = ((f.v["this"]).options)[(f.v._i19)];
		if (((f.v.opt).enabled) !== undefined) f.pc=4; else f.pc=5;
	},
	function (e,f) {
		f.pc=6;
		e.mcall (3, (f.v["this"]).form, "is_enabled", ([(f.v.opt).enabled]));
	},
/*5*/	function (e,f) { f.s[0] = true; },
	function (e,f) {
		var t389 = f.s[0]; f.v.opt.live = t389;
		if ((f.v.opt).live) f.pc=7; else f.pc=8;
	},
	function (e,f) {
		f.pc=1;
		f.v.live_opts[f.v.live_opts.length] = f.v.opt;
	},
	function (e,f) { if ((((f.v.opt).name)) == (((f.v["this"]).raw_value))) f.pc=9; else f.pc=1; },
	function (e,f) {
		f.pc=1;
		f.v["this"].raw_value = "";
	},
/*10*/	function (e,f) { if (((builtin__count (f.v.live_opts))) == ((1))) f.pc=11; else f.pc=12; },
	function (e,f) {
		f.pc=17;
		f.v["this"].raw_value = ((f.v.live_opts)[(0)]).name;
	},
	function (e,f) { if ((((f.v["this"]).fielddef).defoption) !== undefined) f.pc=13; else f.pc=17; },
	function (e,f) { f.v._k20 = e.enumkeys (f.v.live_opts); },
	function (e,f) { if (!((f.v._k20).length)) f.pc=17; },
/*15*/	function (e,f) {
		f.v._i21 = (f.v._k20).shift();
		f.v.opt = (f.v.live_opts)[(f.v._i21)];
		if ((((f.v.opt).name)) == ((((f.v["this"]).fielddef).defoption))) f.pc=16; else f.pc=14;
	},
	function (e,f) { f.v["this"].raw_value = (f.v.opt).name; },
	function (e,f) {
		f.v.options = "";
		if ((((f.v["this"]).raw_value)) == ((""))) f.pc=18; else f.pc=19;
	},
	function (e,f) { f.v.options = "" + (f.v.options) + ("<option value=\"\" selected=\"selected\"></option>"); },
	function (e,f) { f.v._k22 = e.enumkeys (f.v.live_opts); },
/*20*/	function (e,f) {
		f.pc=22;
		if (!((f.v._k22).length)) f.pc=21;
	},
	function (e,f) { e.return_pop (f.v.options); },
	function (e,f) {
		f.v._i23 = (f.v._k22).shift();
		f.v.opt = (f.v.live_opts)[(f.v._i23)];
		if ((((f.v.opt).name)) == (((f.v["this"]).raw_value))) f.pc=23; else f.pc=24;
	},
	function (e,f) {
		f.pc=25;
		f.s[0] = "selected=\"selected\"";
	},
	function (e,f) { f.s[0] = ""; },
/*25*/	function (e,f) {
		var t403 = f.s[0]; f.v.def = t403;
		f.s[0] = "</option>";
		e.mcall (4, f.v["this"], "option_label", ([f.v.opt]));
	},
	function (e,f) {
		f.pc=20;
		var t404 = f.s[1]; var t405 = f.s[0]; 
		f.v.options = "" + (f.v.options) + (("<option value=\"") + ("" + ((f.v.opt).name) + (("\" ") + ("" + (f.v.def) + ((">") + ("" + (t404) + (t405)))))));
	},
null	];

;
	c.pargs__eval_condition =  ["condition"];
	c.pinst__eval_condition =  [
/*0*/	function (e,f) { if (((builtin__substr (f.v.condition,0,1))) == (("="))) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop (((builtin__substr (f.v.condition,1))) == (((f.v["this"]).raw_value))); },
	function (e,f) {
		f.s[0] = builtin__debugout (("form_element_enum_base:eval_condition - don't know how to check ") + ("" + (f.v.condition) + ((" for ") + ((f.v["this"]).raw_value))));
		e.return_pop (false);
	},
null	];

;
	c.pargs__current_value_is_raw =  [];
	c.pinst__current_value_is_raw =  [
/*0*/	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((1))) f.pc=1; else f.pc=3; },
	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) {
		f.pc=4;
		var t407 = f.s[0]; f.s[0] = !(t407);
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t408 = f.s[0]; e.return_pop (t408); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((1))) f.pc=15; else f.pc=17; },
	function (e,f) { e.mcall (2, f.v["this"], "option_list", ([])); },
	function (e,f) {
		var t410 = f.s[0]; f.v.options = t410;
		f.v.attrs = ([]);
		e.mcall (4, f.v["this"], "render_start", (["onchange_handler", null]));
	},
	function (e,f) {
		var t413 = f.s[0]; f.v.attrs.onchange = t413;
		e.mcall (4, f.v["this"], "render_start_sync", (["onkey", null]));
	},
	function (e,f) {
		f.pc=-1;
		var t415 = f.s[0]; f.v.attrs.onkeypress = t415;
		e.mcall (7, f.v["this"], "render_line_element_helper", (["", "select", f.v.attrs, f.v.options, null]));
	},
/*5*/	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((0))) f.pc=12; else f.pc=13; },
	function (e,f) {
		f.s[0] = null;
		e.mcall (3, f.v["this"], "render_raw_value", ([]));
	},
	function (e,f) {
		f.pc=-1;
		var t416 = f.s[1]; var t417 = f.s[0]; e.mcall (7, f.v["this"], "render_line_element_helper", (["", "span", ([]), t416, t417]));
	},
	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((2))) f.pc=9; else f.pc=-1; },
	function (e,f) { e.mcall (4, f.v["this"], "render_start", (["edit_field", null])); },
/*10*/	function (e,f) { e.mcall (3, f.v["this"], "render_raw_value", ([])); },
	function (e,f) {
		f.pc=-1;
		var t418 = f.s[1]; var t419 = f.s[0]; e.mcall (7, f.v["this"], "render_line_element_helper", (["", "span", ([]), t418, t419]));
	},
	function (e,f) {
		f.pc=14;
		f.s[0] = true;
	},
	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) { var t420 = f.s[0]; if (t420) f.pc=6; else f.pc=8; },
/*15*/	function (e,f) { e.mcall (2, f.v["this"], "is_readonly", ([])); },
	function (e,f) {
		f.pc=18;
		var t421 = f.s[0]; f.s[0] = !(t421);
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t422 = f.s[0]; if (t422) f.pc=1; else f.pc=5; },
null	];

;
	c.pargs__check_option_enable =  [];
	c.pinst__check_option_enable =  [
/*0*/	function (e,f) { if (((((f.v["this"]).form).form_mode)) != ((1))) f.pc=1; else f.pc=2; },
	function (e,f) { f.pc=-1; },
	function (e,f) {
		f.v.reload = false;
		f.v._k24 = e.enumkeys ((f.v["this"]).options);
	},
	function (e,f) {
		f.pc=5;
		if (!((f.v._k24).length)) f.pc=4;
	},
	function (e,f) { if (f.v.reload) f.pc=9; else f.pc=-1; },
/*5*/	function (e,f) {
		f.v._i25 = (f.v._k24).shift();
		f.v.opt = ((f.v["this"]).options)[(f.v._i25)];
		if (((f.v.opt).enabled) !== undefined) f.pc=6; else f.pc=3;
	},
	function (e,f) {
		f.pc=8;
		e.mcall (3, (f.v["this"]).form, "is_enabled", ([(f.v.opt).enabled]));
	},
	function (e,f) {
		f.pc=4;
		f.v.reload = true;
	},
	function (e,f) {
		var t428 = f.s[0]; 
		if ((((f.v.opt).live)) != ((t428))) f.pc=7; else f.pc=3;
	},
	function (e,f) { e.mcall (2, f.v["this"], "data_el", ([])); },
/*10*/	function (e,f) {
		var t430 = f.s[0]; f.v.el = t430;
		e.mcall (2, f.v["this"], "option_list", ([]));
	},
	function (e,f) {
		var t432 = f.s[0]; f.v.el.innerHTML = t432;
		e.mcall (2, f.v["this"], "change_detected", ([]));
	},
null	];

;
	c.pargs__edit_field =  ["el","args","ev"];
	c.pinst__edit_field =  [
/*0*/	function (e,f) { e.smcall (0, menu,"create", ([])); },
	function (e,f) {
		var t434 = f.s[0]; f.v.menu = t434;
		f.v._k26 = e.enumkeys ((f.v["this"]).options);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k26).length)) f.pc=3;
	},
	function (e,f) {
		f.pc=5;
		e.smcall (1, popupmenu,"run", ([f.v.menu]));
	},
	function (e,f) {
		f.pc=2;
		f.v._i27 = (f.v._k26).shift();
		f.v.opt = ((f.v["this"]).options)[(f.v._i27)];
		e.mcall (4, f.v.menu, "add_item", ([(f.v.opt).name, (f.v.opt).label]));
	},
/*5*/	function (e,f) {
		var t439 = f.s[0]; f.v.choice = t439;
		if (((f.v.choice)) !== ((null))) f.pc=6; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, f.v["this"], "set_value", ([f.v.choice])); },
null	];

;
};
form_element_enum_base.init_methods (form_element_enum_base);
rpcclass.setup_class (form_element_enum_base, "form_element_enum_base",0, (["options","form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,0,2]));
function form_element_enum () { this.do_construct (arguments); }
form_element_enum.init_methods = function (c) {
	form_element_enum_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__init_helper =  [];
	c.pinst__init_helper =  [
/*0*/	function (e,f) { if (builtin__is_object (((f.v["this"]).fielddef).options)) f.pc=1; else f.pc=5; },
	function (e,f) {
		f.v.newopts = ([]);
		f.v._k28 = e.enumkeys (((f.v["this"]).fielddef).options);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k28).length)) f.pc=3;
	},
	function (e,f) {
		f.pc=-1;
		f.v["this"].options = f.v.newopts;
	},
	function (e,f) {
		f.pc=2;
		f.v.key = (f.v._k28).shift();
		f.v.value = (((f.v["this"]).fielddef).options)[(f.v.key)];
		f.v.value.name = f.v.key;
		f.v.newopts[f.v.newopts.length] = f.v.value;
	},
/*5*/	function (e,f) { f.v["this"].options = ((f.v["this"]).fielddef).options; },
null	];

;
};
form_element_enum.init_methods (form_element_enum);
rpcclass.setup_class (form_element_enum, "form_element_enum",0, (["options","form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,0,2]));
function form_element_yesno () { this.do_construct (arguments); }
form_element_yesno.init_methods = function (c) {
	form_element_enum_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__init_helper =  [];
	c.pinst__init_helper =  [
/*0*/	function (e,f) { f.v["this"].options = ([({name:"1", label:"Yes"}), ({name:"0", label:"No"})]); },
null	];

;
};
form_element_yesno.init_methods (form_element_yesno);
rpcclass.setup_class (form_element_yesno, "form_element_yesno",0, (["options","form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,0,2]));
function form_element_button () { this.do_construct (arguments); }
form_element_button.init_methods = function (c) {
	form_element.init_methods(c);
	var cp = c.prototype;
	c.pargs__clicked =  ["el","arg","ev"];
	c.pinst__clicked =  [
/*0*/	function (e,f) { if ((((f.v["this"]).fielddef).arg) !== undefined) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.s[0] = ((f.v["this"]).fielddef).arg;
	},
	function (e,f) { f.s[0] = null; },
	function (e,f) {
		var t450 = f.s[0]; f.v.arg = t450;
		e.mcall (4, (f.v["this"]).form, "clicked", ([((f.v["this"]).fielddef).action, f.v.arg]));
	},
null	];

;
	c.pargs__render_button =  [];
	c.pinst__render_button =  [
/*0*/	function (e,f) {
		f.s[0] = ("\" type=\"button\" style=\"width:60px\" value=\"") + ("" + (((f.v["this"]).fielddef).label) + ("\""));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t451 = f.s[1]; var t452 = f.s[0]; 
		window.__outbuffer += ("<input id=\"button-") + ("" + (t451) + (t452));
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_start", (["clicked", null]));
	},
	function (e,f) {
		f.pc=4;
		var t453 = f.s[1]; var t454 = f.s[0]; 
		window.__outbuffer += (" onclick=\"") + ("" + (t453) + (t454));
		e.mcall (2, f.v["this"], "is_enabled", ([]));
	},
	function (e,f) {
		f.pc=5;
		window.__outbuffer += " disabled=\"true\"";
	},
	function (e,f) {
		var t455 = f.s[0]; 
		if (!(t455)) f.pc=3; else f.pc=5;
	},
/*5*/	function (e,f) { window.__outbuffer += " />"; },
null	];

;
	c.pargs__check_enable =  [];
	c.pinst__check_enable =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t456 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("button-") + (t456)]));
	},
	function (e,f) {
		f.pc=5;
		var t458 = f.s[0]; f.v.el = t458;
		e.mcall (2, f.v["this"], "is_enabled", ([]));
	},
	function (e,f) {
		f.pc=6;
		f.s[0] = false;
	},
	function (e,f) {
		f.pc=6;
		f.s[0] = true;
	},
/*5*/	function (e,f) { var t459 = f.s[0]; if (t459) f.pc=3; else f.pc=4; },
	function (e,f) { var t461 = f.s[0]; f.v.el.disabled = t461; },
null	];

;
};
form_element_button.init_methods (form_element_button);
rpcclass.setup_class (form_element_button, "form_element_button",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_ok () { this.do_construct (arguments); }
form_element_ok.init_methods = function (c) {
	form_element.init_methods(c);
	var cp = c.prototype;
	c.pargs__render_button =  [];
	c.pinst__render_button =  [
/*0*/	function (e,f) {
		f.s[0] = "\" type=\"submit\" style=\"width:60px\" value=\"Ok\"";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		f.pc=3;
		var t462 = f.s[1]; var t463 = f.s[0]; 
		window.__outbuffer += ("<input id=\"button-") + ("" + (t462) + (t463));
		e.mcall (2, (f.v["this"]).form, "form_valid", ([]));
	},
	function (e,f) {
		f.pc=4;
		window.__outbuffer += "disabled=\"true\"";
	},
	function (e,f) {
		var t464 = f.s[0]; 
		if (!(t464)) f.pc=2; else f.pc=4;
	},
	function (e,f) { window.__outbuffer += " />"; },
null	];

;
	c.pargs__check_enable =  [];
	c.pinst__check_enable =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t465 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("button-") + (t465)]));
	},
	function (e,f) {
		f.pc=5;
		var t467 = f.s[0]; f.v.el = t467;
		e.mcall (2, (f.v["this"]).form, "form_valid", ([]));
	},
	function (e,f) {
		f.pc=6;
		f.s[0] = false;
	},
	function (e,f) {
		f.pc=6;
		f.s[0] = true;
	},
/*5*/	function (e,f) { var t468 = f.s[0]; if (t468) f.pc=3; else f.pc=4; },
	function (e,f) { var t470 = f.s[0]; f.v.el.disabled = t470; },
null	];

;
};
form_element_ok.init_methods (form_element_ok);
rpcclass.setup_class (form_element_ok, "form_element_ok",0, (["form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,2]));
function form_element_array_element () { this.do_construct (arguments); }
form_element_array_element.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
};
form_element_array_element.init_methods (form_element_array_element);
rpcclass.setup_class (form_element_array_element, "form_element_array_element",0, (["element","listeners"]), ([0,2]));
function form_element_array () { this.do_construct (arguments); }
form_element_array.init_methods = function (c) {
	form_element_line_base.init_methods(c);
	var cp = c.prototype;
	c.pargs__init_helper =  [];
	c.pinst__init_helper =  [
/*0*/	function (e,f) { if ((((f.v["this"]).raw_value)) === ((""))) f.pc=1; else f.pc=-1; },
	function (e,f) { f.v["this"].raw_value = ([]); },
null	];

;
	c.pargs__get_all_rows =  [];
	c.pinst__get_all_rows =  [
/*0*/	function (e,f) {
		f.v.res = ([]);
		e.mcall (2, (f.v["this"]).dtm, "get_rows", ([]));
	},
	function (e,f) {
		var t474 = f.s[0]; f.v.ids = t474;
		f.v._k30 = e.enumkeys (f.v.ids);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k30).length)) f.pc=3;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.v._i31 = (f.v._k30).shift();
		f.v.id = (f.v.ids)[(f.v._i31)];
		e.smcall (2, rpcclass,"get_object_by_id", (["form_element_array_element", f.v.id]));
	},
/*5*/	function (e,f) {
		f.pc=2;
		var t479 = f.s[0]; f.v.cf = t479;
		f.v.res[f.v.res.length] = (f.v.cf).element;
	},
null	];

;
	c.pargs__change_indication =  [];
	c.pinst__change_indication =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.pargs__changed =  [];
	c.pinst__changed =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_all_rows", ([])); },
	function (e,f) {
		var t482 = f.s[0]; f.v["this"].raw_value = t482;
		e.mcall (2, f.v["this"], "change_indication", ([]));
	},
null	];

;
	c.pargs__edit_element_link =  ["el","elobj","ev"];
	c.pinst__edit_element_link =  [
/*0*/	function (e,f) { e.mcall (3, f.v["this"], "edit_element", ([(f.v.elobj).element])); },
	function (e,f) {
		var t484 = f.s[0]; f.v.newval = t484;
		if (((f.v.newval)) !== ((null))) f.pc=2; else f.pc=-1;
	},
	function (e,f) {
		f.v.elobj.element = f.v.newval;
		e.mcall (3, (f.v["this"]).dtm, "rerender_row", ([f.v.elobj]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "changed", ([])); },
null	];

;
	c.pargs__get_elobj =  ["obj"];
	c.pinst__get_elobj =  [
/*0*/	function (e,f) { e.mcall (2, (f.v["this"]).dtm, "get_rows", ([])); },
	function (e,f) {
		var t487 = f.s[0]; f.v.ids = t487;
		f.v._k32 = e.enumkeys (f.v.ids);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k32).length)) f.pc=3;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.v._i33 = (f.v._k32).shift();
		f.v.id = (f.v.ids)[(f.v._i33)];
		e.smcall (2, rpcclass,"get_object_by_id", (["form_element_array_element", f.v.id]));
	},
/*5*/	function (e,f) {
		var t492 = f.s[0]; f.v.cf = t492;
		if ((((f.v.cf).element)) == ((f.v.obj))) f.pc=6; else f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.cf); },
null	];

;
	c.pargs__rerender_row =  ["obj"];
	c.pinst__rerender_row =  [
/*0*/	function (e,f) { e.mcall (3, f.v["this"], "get_elobj", ([f.v.obj])); },
	function (e,f) {
		var t494 = f.s[0]; f.v.elobj = t494;
		if (((f.v.elobj)) !== ((null))) f.pc=2; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, (f.v["this"]).dtm, "rerender_row", ([f.v.elobj])); },
null	];

;
	c.pargs__delete_element =  ["obj"];
	c.pinst__delete_element =  [
/*0*/	function (e,f) { e.mcall (3, f.v["this"], "get_elobj", ([f.v.obj])); },
	function (e,f) {
		var t496 = f.s[0]; f.v.elobj = t496;
		if (((f.v.elobj)) !== ((null))) f.pc=2; else f.pc=-1;
	},
	function (e,f) { e.mcall (3, (f.v["this"]).dtm, "remove_row", ([f.v.elobj])); },
	function (e,f) { e.mcall (2, f.v["this"], "changed", ([])); },
null	];

;
	c.pargs__delete_element_link =  ["el","elobj","ev"];
	c.pinst__delete_element_link =  [
/*0*/	function (e,f) {
		f.pc=3;
		e.smcall (1, popupokcancel,"run", (["Delete row?"]));
	},
	function (e,f) { e.mcall (3, (f.v["this"]).dtm, "remove_row", ([f.v.elobj])); },
	function (e,f) {
		f.pc=-1;
		e.mcall (2, f.v["this"], "changed", ([]));
	},
	function (e,f) { var t497 = f.s[0]; if (t497) f.pc=1; else f.pc=-1; },
null	];

;
	c.pargs__insert_row =  [];
	c.pinst__insert_row =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "create_element", ([])); },
	function (e,f) {
		var t499 = f.s[0]; f.v.data = t499;
		if (((f.v.data)) !== ((null))) f.pc=2; else f.pc=-1;
	},
	function (e,f) {
		f.v.elobj = new form_element_array_element;
		f.v.elobj.element = f.v.data;
		e.mcall (3, (f.v["this"]).dtm, "append_row", ([f.v.elobj]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "changed", ([])); },
null	];

;
	c.pargs__new_name =  [];
	c.pinst__new_name =  [
/*0*/	function (e,f) { if (builtin__method_exists (f.v["this"],"create_element")) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop ("Add new"); },
	function (e,f) { e.return_pop (""); },
null	];

;
	c.pargs__reorder =  ["neworder"];
	c.pinst__reorder =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "changed", ([])); },
null	];

;
	c.pargs__dragstart =  ["el","elobj","ev"];
	c.pinst__dragstart =  [
/*0*/	function (e,f) { e.mcall (4, (f.v["this"]).dtm, "drag_start", ([f.v.ev, f.v.elobj])); },
	function (e,f) { var t502 = f.s[0]; e.return_pop (t502); },
null	];

;
	c.pargs__can_delete_element =  [];
	c.pinst__can_delete_element =  [
/*0*/	function (e,f) { e.return_pop (true); },
null	];

;
	c.pargs__can_delete_this_element =  ["el"];
	c.pinst__can_delete_this_element =  [
/*0*/	function (e,f) { e.return_pop (true); },
null	];

;
	c.pargs__get_row_fields =  ["elobj"];
	c.pinst__get_row_fields =  [
/*0*/	function (e,f) {
		f.v.res = ([]);
		if (builtin__method_exists (f.v["this"],"drag_image")) f.pc=1; else f.pc=4;
	},
	function (e,f) { e.mcall (2, f.v["this"], "drag_image", ([])); },
	function (e,f) {
		var t505 = f.s[0]; f.v.img = t505;
		f.s[0] = ("\" src=\"") + ("" + (f.v.img) + ("\"/>"));
		e.mcall (5, f.v["this"], "render_start", (["dragstart", f.v.elobj]));
	},
	function (e,f) {
		var t506 = f.s[1]; var t507 = f.s[0]; 
		f.v.res[f.v.res.length] = ("<img ondragstart=\"return false\" onmousedown=\"") + ("" + (t506) + (t507));
	},
	function (e,f) { e.mcall (3, f.v["this"], "row_fields", ([(f.v.elobj).element])); },
/*5*/	function (e,f) {
		var t510 = f.s[0]; f.v.rfields = t510;
		f.v._k34 = e.enumkeys (f.v.rfields);
	},
	function (e,f) {
		f.pc=8;
		if (!((f.v._k34).length)) f.pc=7;
	},
	function (e,f) { if (builtin__method_exists (f.v["this"],"edit_element")) f.pc=9; else f.pc=11; },
	function (e,f) {
		f.pc=6;
		f.s[0] = f.v._i35 = (f.v._k34).shift();
		f.s[1] = f.v.rf = (f.v.rfields)[(f.v._i35)];
		f.v.res[f.v.res.length] = f.v.rf;
	},
	function (e,f) {
		f.s[0] = "\">edit</a>";
		e.mcall (5, f.v["this"], "render_start", (["edit_element_link", f.v.elobj]));
	},
/*10*/	function (e,f) {
		var t515 = f.s[1]; var t516 = f.s[0]; 
		f.v.res[f.v.res.length] = ("<a href=\"#\" onclick=\"") + ("" + (t515) + (t516));
	},
	function (e,f) {
		f.pc=17;
		e.mcall (2, f.v["this"], "can_delete_element", ([]));
	},
	function (e,f) {
		f.pc=16;
		e.mcall (3, f.v["this"], "can_delete_this_element", ([(f.v.elobj).element]));
	},
	function (e,f) {
		f.s[0] = "\">delete</a>";
		e.mcall (5, f.v["this"], "render_start", (["delete_element_link", f.v.elobj]));
	},
	function (e,f) {
		f.pc=18;
		var t518 = f.s[1]; var t519 = f.s[0]; 
		f.v.res[f.v.res.length] = ("<a href=\"#\" onclick=\"") + ("" + (t518) + (t519));
	},
/*15*/	function (e,f) {
		f.pc=18;
		f.v.res[f.v.res.length] = "";
	},
	function (e,f) { var t522 = f.s[0]; if (t522) f.pc=13; else f.pc=15; },
	function (e,f) { var t523 = f.s[0]; if (t523) f.pc=12; else f.pc=18; },
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.v.optobjs = ([]);
		f.v._k36 = e.enumkeys ((f.v["this"]).raw_value);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k36).length)) f.pc=2;
	},
	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((1))) f.pc=22; else f.pc=23; },
	function (e,f) {
		f.pc=1;
		f.v._i37 = (f.v._k36).shift();
		f.v.opt = ((f.v["this"]).raw_value)[(f.v._i37)];
		f.v.optobj = new form_element_array_element;
		f.v.optobj.element = f.v.opt;
		f.v.optobjs[f.v.optobjs.length] = f.v.optobj;
	},
	function (e,f) {
		f.v["this"].dtm = new divTableManager;
		e.mcall (2, f.v["this"], "table_widths", ([]));
	},
/*5*/	function (e,f) { var t532 = f.s[0]; e.mcall (4, (f.v["this"]).dtm, "initialise2", ([f.v["this"], t532])); },
	function (e,f) {
		e.php_builtin (0, "ob_start", 0);
		e.mcall (3, (f.v["this"]).dtm, "render_table", ([f.v.optobjs]));
	},
	function (e,f) {
		f.pc=-1;
		e.php_builtin (0, "ob_get_clean", 0);
		var t534 = f.s[0]; f.v.body = t534;
		e.mcall (7, f.v["this"], "render_line_element_helper", (["", "div", ([]), f.v.body, null]));
	},
	function (e,f) { if (((((f.v["this"]).form).form_mode)) == ((0))) f.pc=9; else f.pc=-1; },
	function (e,f) {
		e.php_builtin (0, "ob_start", 0);
		window.__outbuffer += "<table>";
		f.v._k38 = e.enumkeys (f.v.optobjs);
	},
/*10*/	function (e,f) {
		f.pc=12;
		if (!((f.v._k38).length)) f.pc=11;
	},
	function (e,f) {
		f.pc=-1;
		window.__outbuffer += "</table>";
		e.php_builtin (0, "ob_get_clean", 0);
		var t537 = f.s[0]; f.v.body = t537;
		e.mcall (7, f.v["this"], "render_line_element_helper", (["", "div", ([]), f.v.body, null]));
	},
	function (e,f) {
		f.v._i39 = (f.v._k38).shift();
		f.v.o = (f.v.optobjs)[(f.v._i39)];
		e.mcall (3, f.v["this"], "get_row_fields", ([f.v.o]));
	},
	function (e,f) {
		var t541 = f.s[0]; f.v.fields = t541;
		window.__outbuffer += "<tr>";
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=16;
		if (!(((f.v.i)) < ((parseInt((builtin__count (f.v.fields)),10) - parseInt((2),10))))) f.pc=15;
	},
/*15*/	function (e,f) {
		f.pc=10;
		window.__outbuffer += "</tr>";
	},
	function (e,f) { if (((f.v.i)) != ((0))) f.pc=18; else f.pc=19; },
	function (e,f) {
		f.pc=21;
		window.__outbuffer += ("<td>") + ("" + ((f.v.fields)[(f.v.i)]) + ("</td>"));
	},
	function (e,f) {
		f.pc=20;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = !(builtin__method_exists (f.v["this"],"drag_image")); },
/*20*/	function (e,f) { var t543 = f.s[0]; if (t543) f.pc=17; else f.pc=21; },
	function (e,f) {
		f.pc=14;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=24;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = ((((f.v["this"]).form).form_mode)) == ((2)); },
	function (e,f) { var t545 = f.s[0]; if (t545) f.pc=4; else f.pc=8; },
null	];

;
};
form_element_array.init_methods (form_element_array);
rpcclass.setup_class (form_element_array, "form_element_array",0, (["dtm","form","fielddef","raw_value","change_timer_handle","listeners"]), ([0,0,0,0,0,2]));
function form () { this.do_construct (arguments); }
form.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__create = c.pargs__create =  ["parent","fields","values"];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.res = new form;
		f.v.res.elements = ([]);
		f.v.res.parent = f.v.parent;
		f.v.res.tid = null;
		f.v.res.enforce_validity = true;
		f.v.res.focusfield = null;
		f.v.res.env = ({ignore_me:"1"});
		f.v.res.last_click_arg = null;
		f.v._k40 = e.enumkeys (f.v.fields);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k40).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.s[0] = f.v._i41 = (f.v._k40).shift();
		f.s[1] = f.v.fielddef = (f.v.fields)[(f.v._i41)];
		e.smcall (5, form_element,"create", ([f.v.res, f.v.fielddef, f.v.values]));
	},
	function (e,f) {
		f.pc=1;
		var t558 = f.s[2]; (f.v.res).elements[(f.v.res).elements.length] = t558;
	},
null	];

;
	c.pargs__set_env =  ["key","value"];
	c.pinst__set_env =  [
/*0*/	function (e,f) { (f.v["this"]).env[f.v.key] = f.v.value; },
null	];

;
	c.pargs__get_env =  ["key"];
	c.pinst__get_env =  [
/*0*/	function (e,f) { if (!((((f.v["this"]).env)[(f.v.key)]) !== undefined)) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop (null); },
	function (e,f) { e.return_pop (((f.v["this"]).env)[(f.v.key)]); },
null	];

;
	c.pargs__get_last_click_arg =  [];
	c.pinst__get_last_click_arg =  [
/*0*/	function (e,f) { e.return_pop ((f.v["this"]).last_click_arg); },
null	];

;
	c.pargs__focus =  ["index"];
	c.pinst__focus =  [
/*0*/	function (e,f) { f.v["this"].focusfield = ((f.v["this"]).elements)[(f.v.index)]; },
null	];

;
	c.pargs__can_be_invalid =  ["yesno"];
	c.pinst__can_be_invalid =  [
/*0*/	function (e,f) { f.v["this"].enforce_validity = !(f.v.yesno); },
null	];

;
	c.pargs__clicked =  ["action","arg"];
	c.pinst__clicked =  [
/*0*/	function (e,f) {
		f.v["this"].last_click_arg = f.v.arg;
		if ((((f.v["this"]).parent)) !== ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) {
		f.pc=5;
		e.mcall (3, (f.v["this"]).parent, "clicked", ([f.v.action]));
	},
	function (e,f) {
		f.pc=4;
		f.s[0] = builtin__method_exists ((f.v["this"]).parent,"clicked");
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t563 = f.s[0]; if (t563) f.pc=1; else f.pc=5; },
/*5*/	function (e,f) { if ((((f.v["this"]).tid)) !== ((null))) f.pc=6; else f.pc=-1; },
	function (e,f) { e.smcall (3, php_engine,"resume_thread", ([(f.v["this"]).tid, f.v.action, null])); },
null	];

;
	c.pargs__check_enable =  [];
	c.pinst__check_enable =  [
/*0*/	function (e,f) { f.v._k42 = e.enumkeys ((f.v["this"]).elements); },
	function (e,f) { if (!((f.v._k42).length)) f.pc=-1; },
	function (e,f) {
		f.pc=1;
		f.s[0] = f.v._i43 = (f.v._k42).shift();
		f.s[1] = f.v.el = ((f.v["this"]).elements)[(f.v._i43)];
		e.mcall (4, f.v.el, "check_enable", ([]));
	},
null	];

;
	c.pargs__changed =  ["fname","value"];
	c.pinst__changed =  [
/*0*/	function (e,f) { if ((((f.v["this"]).parent)) !== ((null))) f.pc=2; else f.pc=3; },
	function (e,f) {
		f.pc=5;
		e.mcall (4, (f.v["this"]).parent, "form_changed", ([f.v.fname, f.v.value]));
	},
	function (e,f) {
		f.pc=4;
		f.s[0] = builtin__method_exists ((f.v["this"]).parent,"form_changed");
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t567 = f.s[0]; if (t567) f.pc=1; else f.pc=5; },
/*5*/	function (e,f) { e.mcall (2, f.v["this"], "check_enable", ([])); },
null	];

;
	c.pargs__ok_clicked =  [];
	c.pinst__ok_clicked =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "clicked", (["OK", null])); },
null	];

;
	c.pargs__is_enabled =  ["expr"];
	c.pinst__is_enabled =  [
/*0*/	function (e,f) { e.smcall (1, form_condition,"parse", ([f.v.expr])); },
	function (e,f) {
		var t569 = f.s[0]; f.v.fe = t569;
		e.mcall (3, f.v.fe, "evaluate", ([f.v["this"]]));
	},
	function (e,f) {
		var t571 = f.s[0]; f.v.result = t571;
		e.return_pop (f.v.result);
	},
null	];

;
	c.pargs__render =  ["form_mode"];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.v["this"].form_mode = f.v.form_mode;
		if ((((f.v["this"]).form_mode)) == ((1))) f.pc=1; else f.pc=4;
	},
	function (e,f) {
		f.s[0] = "\">";
		e.mcall (5, f.v["this"], "render_start", (["ok_clicked", null]));
	},
	function (e,f) {
		var t573 = f.s[1]; var t574 = f.s[0]; 
		f.s[0] = ("-form\" onsubmit=\"") + ("" + (t573) + (t574));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t575 = f.s[1]; var t576 = f.s[0]; 
		window.__outbuffer += ("<form id=\"data-") + ("" + (t575) + (t576));
	},
	function (e,f) {
		window.__outbuffer += "<table>";
		f.v._k44 = e.enumkeys ((f.v["this"]).elements);
	},
/*5*/	function (e,f) {
		f.pc=7;
		if (!((f.v._k44).length)) f.pc=6;
	},
	function (e,f) {
		f.pc=8;
		window.__outbuffer += "<tr><td></td><td style=\"text-align:right\">";
		f.v._k46 = e.enumkeys ((f.v["this"]).elements);
	},
	function (e,f) {
		f.pc=5;
		f.v._i45 = (f.v._k44).shift();
		f.v.el = ((f.v["this"]).elements)[(f.v._i45)];
		e.mcall (2, f.v.el, "render", ([]));
	},
	function (e,f) {
		f.pc=10;
		if (!((f.v._k46).length)) f.pc=9;
	},
	function (e,f) {
		window.__outbuffer += "</td></tr>";
		window.__outbuffer += "</table>";
		if ((((f.v["this"]).form_mode)) == ((1))) f.pc=11; else f.pc=-1;
	},
/*10*/	function (e,f) {
		f.pc=8;
		f.s[0] = f.v._i47 = (f.v._k46).shift();
		f.s[1] = f.v.el = ((f.v["this"]).elements)[(f.v._i47)];
		e.mcall (4, f.v.el, "render_button", ([]));
	},
	function (e,f) { window.__outbuffer += "</form>"; },
null	];

;
	c.args__entities = c.pargs__entities =  ["str"];
	c.inst__entities = c.pinst__entities =  [
/*0*/	function (e,f) {
		f.v.str = ("") + (f.v.str);
		f.v.res = "";
		f.v.str = ("") + (f.v.str);
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=3;
		if (!(((f.v.i)) < (((f.v.str).length)))) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.v.ch = builtin__substr (f.v.str,f.v.i,1);
		if (!(builtin__preg_match ("/[A-Za-z0-9 ]/",f.v.ch))) f.pc=4; else f.pc=5;
	},
	function (e,f) {
		f.pc=6;
		f.v.res = "" + (f.v.res) + (("&#") + ("" + (builtin__ord (f.v.ch)) + (";")));
	},
/*5*/	function (e,f) { f.v.res = "" + (f.v.res) + (f.v.ch); },
	function (e,f) {
		f.pc=1;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
null	];

;
	c.pargs__initialise =  ["width","height","title"];
	c.pinst__initialise =  [
/*0*/	function (e,f) {
		f.v["this"].title = f.v.title;
		f.v["this"].width = f.v.width;
		f.v["this"].height = f.v.height;
		f.v["this"].pop = new popup;
		e.mcall (3, (f.v["this"]).pop, "initialise", ([f.v["this"]]));
	},
null	];

;
	c.pargs__open =  [];
	c.pinst__open =  [
/*0*/	function (e,f) {
		e.php_builtin (0, "ob_start", 0);
		window.__outbuffer += ("<h3>") + ("" + ((f.v["this"]).title) + ("</h3>"));
		e.mcall (3, f.v["this"], "render", ([1]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t596 = f.s[0]; f.v.html = t596;
		e.mcall (5, (f.v["this"]).pop, "open", ([(f.v["this"]).width, (f.v["this"]).height, f.v.html]));
	},
	function (e,f) { if ((((f.v["this"]).focusfield)) != ((null))) f.pc=3; else f.pc=-1; },
	function (e,f) { e.mcall (2, (f.v["this"]).focusfield, "focus", ([])); },
null	];

;
	c.pargs__close =  [];
	c.pinst__close =  [
/*0*/	function (e,f) { e.mcall (2, (f.v["this"]).pop, "close", ([])); },
null	];

;
	c.pargs__form_valid =  [];
	c.pinst__form_valid =  [
/*0*/	function (e,f) { if (!((f.v["this"]).enforce_validity)) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop (true); },
	function (e,f) { f.v._k48 = e.enumkeys ((f.v["this"]).elements); },
	function (e,f) {
		f.pc=5;
		if (!((f.v._k48).length)) f.pc=4;
	},
	function (e,f) { e.return_pop (true); },
/*5*/	function (e,f) {
		f.pc=7;
		f.v._i49 = (f.v._k48).shift();
		f.v.el = ((f.v["this"]).elements)[(f.v._i49)];
		e.mcall (2, f.v.el, "value_legal", ([]));
	},
	function (e,f) { e.return_pop (false); },
	function (e,f) {
		var t600 = f.s[0]; 
		if (!(t600)) f.pc=6; else f.pc=3;
	},
null	];

;
	c.pargs__get_element =  ["name"];
	c.pinst__get_element =  [
/*0*/	function (e,f) { f.v._k50 = e.enumkeys ((f.v["this"]).elements); },
	function (e,f) {
		f.pc=3;
		if (!((f.v._k50).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.s[0] = f.v._i51 = (f.v._k50).shift();
		f.s[1] = f.v.el = ((f.v["this"]).elements)[(f.v._i51)];
		if (((((f.v.el).fielddef).name)) == ((f.v.name))) f.pc=4; else f.pc=1;
	},
	function (e,f) { e.return_pop (f.v.el); },
null	];

;
	c.pargs__get_values =  [];
	c.pinst__get_values =  [
/*0*/	function (e,f) {
		f.v.res = ({});
		f.v._k52 = e.enumkeys ((f.v["this"]).elements);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k52).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.pc=5;
		f.v._i53 = (f.v._k52).shift();
		f.v.el = ((f.v["this"]).elements)[(f.v._i53)];
		e.mcall (2, f.v.el, "is_enabled", ([]));
	},
	function (e,f) {
		f.pc=1;
		f.v.res[((f.v.el).fielddef).name] = (f.v.el).raw_value;
	},
/*5*/	function (e,f) { var t609 = f.s[0]; if (t609) f.pc=4; else f.pc=1; },
null	];

;
	c.pargs__popup =  ["width","height","title"];
	c.pinst__popup =  [
/*0*/	function (e,f) { e.mcall (5, f.v["this"], "initialise", ([f.v.width, f.v.height, f.v.title])); },
	function (e,f) { e.mcall (2, f.v["this"], "open", ([])); },
	function (e,f) { e.smcall (0, php_engine,"get_current_thread_id", ([])); },
	function (e,f) {
		var t611 = f.s[0]; f.v["this"].tid = t611;
		f.v.res = null;
	},
	function (e,f) {
		f.pc=6;
		e.php_builtin (0, "wait_for_input", 0);
	},
/*5*/	function (e,f) {
		f.pc=13;
		e.mcall (2, f.v["this"], "close", ([]));
	},
	function (e,f) {
		var t614 = f.s[0]; f.v.ev = t614;
		if ((((f.v.ev).action)) == (("OK"))) f.pc=7; else f.pc=11;
	},
	function (e,f) {
		f.pc=10;
		e.mcall (2, f.v["this"], "form_valid", ([]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "get_values", ([])); },
	function (e,f) {
		f.pc=5;
		var t616 = f.s[0]; f.v.res = t616;
	},
/*10*/	function (e,f) { var t617 = f.s[0]; if (t617) f.pc=8; else f.pc=4; },
	function (e,f) { if ((((f.v.ev).action)) == (("cancel"))) f.pc=12; else f.pc=4; },
	function (e,f) { f.pc=5; },
	function (e,f) {
		f.v["this"].tid = null;
		e.return_pop (f.v.res);
	},
null	];

;
};
form.init_methods (form);
rpcclass.setup_class (form, "form",0, (["parent","elements","focusfield","pop","title","width","height","tid","enforce_validity","env","last_click_arg","form_mode","listeners"]), ([0,0,0,0,0,0,0,0,0,0,0,0,2]));
function form_condition () { this.do_construct (arguments); }
form_condition.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__advance =  [];
	c.pinst__advance =  [
/*0*/	function (e,f) {
		f.v["this"].ch = builtin__substr ((f.v["this"]).expr,(f.v["this"]).pos,1);
		f.s[0] = "pos";
		f.s[1] = f.v["this"];
		e.php_deref_lvalue (2);
		e.php_postinc (1);
	},
null	];

;
	c.pargs__next_token =  [];
	c.pinst__next_token =  [
/*0*/	function (e,f) { if ((((f.v["this"]).ch)) == ((""))) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.v["this"].tok = "";
		f.pc=-1;
	},
	function (e,f) {
		f.v.ops = "|&()!";
		if (builtin__strstr (f.v.ops,(f.v["this"]).ch)) f.pc=3; else f.pc=4;
	},
	function (e,f) {
		f.pc=-1;
		f.v["this"].tok = (f.v["this"]).ch;
		e.mcall (2, f.v["this"], "advance", ([]));
	},
	function (e,f) { f.v["this"].tok = ""; },
/*5*/	function (e,f) {
		f.v["this"].tok = "" + ((f.v["this"]).tok) + ((f.v["this"]).ch);
		e.mcall (2, f.v["this"], "advance", ([]));
	},
	function (e,f) { if ((((f.v["this"]).ch)) == ((""))) f.pc=7; else f.pc=8; },
	function (e,f) {
		f.pc=9;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = builtin__strstr (f.v.ops,(f.v["this"]).ch); },
	function (e,f) { var t626 = f.s[0]; if (t626) f.pc=-1; else f.pc=5; },
null	];

;
	c.pargs__parse_or =  [];
	c.pinst__parse_or =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "parse_and", ([])); },
	function (e,f) {
		var t628 = f.s[0]; f.v.left = t628;
		if ((((f.v["this"]).tok)) == (("|"))) f.pc=2; else f.pc=5;
	},
	function (e,f) { e.mcall (2, f.v["this"], "next_token", ([])); },
	function (e,f) { e.mcall (2, f.v["this"], "parse_or", ([])); },
	function (e,f) {
		var t630 = f.s[0]; f.v.right = t630;
		f.v.left = ({op:"|", args:([f.v.left, f.v.right])});
	},
/*5*/	function (e,f) { e.return_pop (f.v.left); },
null	];

;
	c.pargs__parse_and =  [];
	c.pinst__parse_and =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "parse_not", ([])); },
	function (e,f) {
		var t633 = f.s[0]; f.v.left = t633;
		if ((((f.v["this"]).tok)) == (("&"))) f.pc=2; else f.pc=5;
	},
	function (e,f) { e.mcall (2, f.v["this"], "next_token", ([])); },
	function (e,f) { e.mcall (2, f.v["this"], "parse_or", ([])); },
	function (e,f) {
		var t635 = f.s[0]; f.v.right = t635;
		f.v.left = ({op:"&", args:([f.v.left, f.v.right])});
	},
/*5*/	function (e,f) { e.return_pop (f.v.left); },
null	];

;
	c.pargs__parse_not =  [];
	c.pinst__parse_not =  [
/*0*/	function (e,f) { if ((((f.v["this"]).tok)) == (("!"))) f.pc=1; else f.pc=4; },
	function (e,f) { e.mcall (2, f.v["this"], "next_token", ([])); },
	function (e,f) { e.mcall (2, f.v["this"], "parse_not", ([])); },
	function (e,f) {
		var t637 = f.s[0]; 
		e.return_pop (({op:"!", args:([t637])}));
	},
	function (e,f) { e.mcall (2, f.v["this"], "parse_node", ([])); },
/*5*/	function (e,f) { var t638 = f.s[0]; e.return_pop (t638); },
null	];

;
	c.pargs__parse_node =  [];
	c.pinst__parse_node =  [
/*0*/	function (e,f) { if ((((f.v["this"]).tok)) == (("("))) f.pc=1; else f.pc=7; },
	function (e,f) { e.mcall (2, f.v["this"], "next_token", ([])); },
	function (e,f) { e.mcall (2, f.v["this"], "parse_or", ([])); },
	function (e,f) {
		var t640 = f.s[0]; f.v.content = t640;
		if ((((f.v["this"]).tok)) != ((")"))) f.pc=4; else f.pc=5;
	},
	function (e,f) {
		f.v["this"].error = true;
		e.return_pop (null);
	},
/*5*/	function (e,f) { e.mcall (2, f.v["this"], "next_token", ([])); },
	function (e,f) { e.return_pop (f.v.content); },
	function (e,f) {
		f.v.res = ({op:"node", text:(f.v["this"]).tok});
		e.mcall (2, f.v["this"], "next_token", ([]));
	},
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.pargs__dump =  ["indent","node"];
	c.pinst__dump =  [
/*0*/	function (e,f) {
		f.s[0] = builtin__debugout ("" + (builtin__str_pad ("",f.v.indent)) + ("" + ((f.v.node).op) + (": ")));
		if (((f.v.node).args) !== undefined) f.pc=1; else f.pc=4;
	},
	function (e,f) { f.v._k54 = e.enumkeys ((f.v.node).args); },
	function (e,f) { if (!((f.v._k54).length)) f.pc=-1; },
	function (e,f) {
		f.pc=2;
		f.s[0] = f.v._i55 = (f.v._k54).shift();
		f.s[1] = f.v.parm = ((f.v.node).args)[(f.v._i55)];
		e.mcall (6, f.v["this"], "dump", ([parseInt((f.v.indent),10) + parseInt((4),10), f.v.parm]));
	},
	function (e,f) { f.s[0] = builtin__debugout ("" + (builtin__str_pad ("",parseInt((f.v.indent),10) + parseInt((4),10))) + ((f.v.node).text)); },
null	];

;
	c.pargs__evaluate_node =  ["form","node"];
	c.pinst__evaluate_node =  [
/*0*/	function (e,f) { if ((((f.v.node).op)) == (("|"))) f.pc=1; else f.pc=7; },
	function (e,f) { f.v._k56 = e.enumkeys ((f.v.node).args); },
	function (e,f) {
		f.pc=4;
		if (!((f.v._k56).length)) f.pc=3;
	},
	function (e,f) { e.return_pop (false); },
	function (e,f) {
		f.pc=6;
		f.v._i57 = (f.v._k56).shift();
		f.v.parm = ((f.v.node).args)[(f.v._i57)];
		e.mcall (4, f.v["this"], "evaluate_node", ([f.v.form, f.v.parm]));
	},
/*5*/	function (e,f) { e.return_pop (true); },
	function (e,f) { var t649 = f.s[0]; if (t649) f.pc=5; else f.pc=2; },
	function (e,f) { if ((((f.v.node).op)) == (("&"))) f.pc=8; else f.pc=14; },
	function (e,f) { f.v._k58 = e.enumkeys ((f.v.node).args); },
	function (e,f) {
		f.pc=11;
		if (!((f.v._k58).length)) f.pc=10;
	},
/*10*/	function (e,f) { e.return_pop (true); },
	function (e,f) {
		f.pc=13;
		f.v._i59 = (f.v._k58).shift();
		f.v.parm = ((f.v.node).args)[(f.v._i59)];
		e.mcall (4, f.v["this"], "evaluate_node", ([f.v.form, f.v.parm]));
	},
	function (e,f) { e.return_pop (false); },
	function (e,f) {
		var t653 = f.s[0]; 
		if (!(t653)) f.pc=12; else f.pc=9;
	},
	function (e,f) { if ((((f.v.node).op)) == (("!"))) f.pc=15; else f.pc=17; },
/*15*/	function (e,f) { e.mcall (4, f.v["this"], "evaluate_node", ([f.v.form, ((f.v.node).args)[(0)]])); },
	function (e,f) {
		var t654 = f.s[0]; 
		e.return_pop (!(t654));
	},
	function (e,f) { if ((((f.v.node).op)) == (("node"))) f.pc=18; else f.pc=64; },
	function (e,f) {
		f.v.matches = ([]);
		if (builtin__preg_match ("/^([0-9a-zA-Z_]+)(.*)$/",(f.v.node).text,f.v.matches)) f.pc=19; else f.pc=63;
	},
	function (e,f) {
		f.v.key = (f.v.matches)[(1)];
		f.v.condition = (f.v.matches)[(2)];
		if (((f.v.key)) == (("1"))) f.pc=20; else f.pc=21;
	},
/*20*/	function (e,f) { e.return_pop (true); },
	function (e,f) { if (((f.v.key)) == (("0"))) f.pc=22; else f.pc=23; },
	function (e,f) { e.return_pop (false); },
	function (e,f) { if (((f.v.key)) == (("env"))) f.pc=24; else f.pc=27; },
	function (e,f) {
		f.v.condition = builtin__substr (f.v.condition,1);
		if (!((((f.v.form).env)[(f.v.condition)]) !== undefined)) f.pc=25; else f.pc=26;
	},
/*25*/	function (e,f) {
		f.s[0] = builtin__debugout (("Env ") + ("" + (f.v.condition) + (" is not set\n")));
		e.return_pop (false);
	},
	function (e,f) { e.return_pop (((f.v.form).env)[(f.v.condition)]); },
	function (e,f) { if (((f.v.key)) == (("form_valid"))) f.pc=28; else f.pc=30; },
	function (e,f) { e.mcall (2, f.v.form, "form_valid", ([])); },
	function (e,f) { var t659 = f.s[0]; e.return_pop (t659); },
/*30*/	function (e,f) { if (((f.v.key)) == (("parent"))) f.pc=31; else f.pc=33; },
	function (e,f) {
		f.v.condition = builtin__substr (f.v.condition,1);
		e.mcall (2, (f.v.form).parent, f.v.condition, ([]));
	},
	function (e,f) { var t661 = f.s[0]; e.return_pop (t661); },
	function (e,f) { if (((f.v.key)) == (("date"))) f.pc=34; else f.pc=57; },
	function (e,f) { if (((builtin__substr (f.v.condition,0,2))) == ((">="))) f.pc=35; else f.pc=36; },
/*35*/	function (e,f) {
		f.pc=45;
		f.v.comparison = ">=";
	},
	function (e,f) { if (((builtin__substr (f.v.condition,0,2))) == (("<="))) f.pc=37; else f.pc=38; },
	function (e,f) {
		f.pc=45;
		f.v.comparison = "<=";
	},
	function (e,f) { if (((builtin__substr (f.v.condition,0,1))) == ((">"))) f.pc=39; else f.pc=40; },
	function (e,f) {
		f.pc=45;
		f.v.comparison = ">";
	},
/*40*/	function (e,f) { if (((builtin__substr (f.v.condition,0,1))) == (("<"))) f.pc=41; else f.pc=42; },
	function (e,f) {
		f.pc=45;
		f.v.comparison = "<";
	},
	function (e,f) { if (((builtin__substr (f.v.condition,0,1))) == (("="))) f.pc=43; else f.pc=44; },
	function (e,f) {
		f.pc=45;
		f.v.comparison = "=";
	},
	function (e,f) {
		f.s[0] = builtin__debugout (("Comparison is not recognised in ") + (f.v.condition));
		e.return_pop (false);
	},
/*45*/	function (e,f) {
		f.v.matches = ([]);
		if (!(builtin__preg_match ("/(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/",builtin__substr (f.v.condition,(f.v.comparison).length),f.v.matches))) f.pc=46; else f.pc=47;
	},
	function (e,f) {
		f.s[0] = builtin__debugout (("Failed to parse date in ") + (f.v.condition));
		e.return_pop (false);
	},
	function (e,f) {
		f.v.t = builtin__mktime (0,0,0,(f.v.matches)[(2)],(f.v.matches)[(3)],(f.v.matches)[(1)]);
		f.v.today = builtin__mktime (0,0,0,builtin__date ("m"),builtin__date ("d"),builtin__date ("Y"));
		if (((f.v.comparison)) == ((">="))) f.pc=48; else f.pc=49;
	},
	function (e,f) {
		f.s[0] = f.v.t;
		f.s[1] = f.v.today;
		e.php_two_op (2, ">=");
		var t670 = f.s[0]; e.return_pop (t670);
	},
	function (e,f) { if (((f.v.comparison)) == (("<="))) f.pc=50; else f.pc=51; },
/*50*/	function (e,f) {
		f.s[0] = f.v.t;
		f.s[1] = f.v.today;
		e.php_two_op (2, "<=");
		var t671 = f.s[0]; e.return_pop (t671);
	},
	function (e,f) { if (((f.v.comparison)) == ((">"))) f.pc=52; else f.pc=53; },
	function (e,f) { e.return_pop (((f.v.today)) > ((f.v.t))); },
	function (e,f) { if (((f.v.comparison)) == (("<"))) f.pc=54; else f.pc=55; },
	function (e,f) { e.return_pop (((f.v.today)) < ((f.v.t))); },
/*55*/	function (e,f) { if (((f.v.comparison)) == (("="))) f.pc=56; else f.pc=57; },
	function (e,f) { e.return_pop (((f.v.today)) == ((f.v.t))); },
	function (e,f) { f.v._k60 = e.enumkeys ((f.v.form).elements); },
	function (e,f) {
		f.pc=60;
		if (!((f.v._k60).length)) f.pc=59;
	},
	function (e,f) {
		f.s[0] = builtin__debugout (("Unrecognised key ") + ("" + (f.v.key) + ((" for node ") + ((f.v.node).text))));
		e.return_pop (false);
	},
/*60*/	function (e,f) {
		f.v._i61 = (f.v._k60).shift();
		f.v.el = ((f.v.form).elements)[(f.v._i61)];
		if (((((f.v.el).fielddef).name)) == ((f.v.key))) f.pc=61; else f.pc=58;
	},
	function (e,f) { e.mcall (3, f.v.el, "eval_condition", ([f.v.condition])); },
	function (e,f) { var t675 = f.s[0]; e.return_pop (t675); },
	function (e,f) {
		f.s[0] = builtin__debugout (("Unparsable format for node ") + ((f.v.node).text));
		e.return_pop (false);
	},
	function (e,f) {
		f.s[0] = builtin__debugout (("Don't know how to evaluate ") + ((f.v.node).op));
		e.return_pop (false);
	},
null	];

;
	c.pargs__evaluate =  ["form"];
	c.pinst__evaluate =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "evaluate_node", ([f.v.form, (f.v["this"]).root])); },
	function (e,f) {
		var t677 = f.s[0]; f.v.res = t677;
		e.return_pop (f.v.res);
	},
null	];

;
	c.args__parse = c.pargs__parse =  ["expr"];
	c.inst__parse = c.pinst__parse =  [
/*0*/	function (e,f) {
		e.php_push_static_var (1, form_condition,"cache");
		var t678 = f.s[1]; 
		if (!(((t678)[(f.v.expr)]) !== undefined)) f.pc=1; else f.pc=5;
	},
	function (e,f) {
		f.v.fc = new form_condition;
		f.v.fc.expr = f.v.expr;
		f.v.fc.pos = 0;
		f.v.fc.error = false;
		e.mcall (2, f.v.fc, "advance", ([]));
	},
	function (e,f) { e.mcall (2, f.v.fc, "next_token", ([])); },
	function (e,f) { e.mcall (2, f.v.fc, "parse_or", ([])); },
	function (e,f) {
		var t684 = f.s[0]; f.v.fc.root = t684;
		e.php_push_static_var (2, form_condition,"cache");
		var t685 = f.s[2]; t685[f.v.expr] = f.v.fc;
	},
/*5*/	function (e,f) {
		e.php_push_static_var (1, form_condition,"cache");
		var t687 = f.s[1]; 
		e.return_pop ((t687)[(f.v.expr)]);
	},
null	];

;
};
form_condition.init_methods (form_condition);
rpcclass.setup_class (form_condition, "form_condition",0, (["expr","pos","root","error","tok","ch","listeners"]), ([0,0,0,0,0,0,2]));
function uploader () { this.do_construct (arguments); }
uploader.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__handle_pdf =  ["name","realname"];
	c.pinst__handle_pdf =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "call_function_async", (["handle_pdf", ([f.v.name, f.v.realname])])); },
	function (e,f) { var t1113 = f.s[0]; e.return_pop (t1113); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "call_function_async", (["render", ([])])); },
	function (e,f) { var t1114 = f.s[0]; e.return_pop (t1114); },
null	];

;
	c.pargs__pdf_upload =  ["msg"];
	c.pinst__pdf_upload =  [
/*0*/	function (e,f) { if ((f.v["this"]).can_accept_pdf) f.pc=1; else f.pc=-1; },
	function (e,f) {
		f.v.msg = builtin__explode ("|",f.v.msg);
		f.v.tmpname = (f.v.msg)[(0)];
		f.v.realname = (f.v.msg)[(1)];
		f.s[0] = builtin__debugout (("Handling incoming pdf at '") + ("" + (f.v.tmpname) + (("' called '") + ("" + (f.v.realname) + ("'")))));
		f.v.matches = ([]);
		if (builtin__preg_match ("/^(.*)\\.([^\\.]{1,4})$/",f.v.realname,f.v.matches)) f.pc=2; else f.pc=3;
	},
	function (e,f) {
		f.pc=4;
		f.v.realname = "" + ((f.v.matches)[(1)]) + (".pdf");
	},
	function (e,f) { f.v.realname = "" + (f.v.realname) + (".pdf"); },
	function (e,f) { e.mcall (4, f.v["this"], "handle_pdf", ([f.v.tmpname, f.v.realname])); },
/*5*/	function (e,f) { e.smcall (3, php_engine,"resume_thread", ([(f.v["this"]).thread_id, "pdf_arrived", f.v.msg])); },
null	];

;
	c.pargs__run =  [];
	c.pinst__run =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t1121 = f.s[0]; 
		f.v["this"].uploader_id = ("uploader_") + (t1121);
		f.v["this"].doc_count = 0;
		e.mcall (2, f.v["this"], "render", ([]));
	},
	function (e,f) {
		var t1124 = f.s[0]; 
		f.v.fields = ([({name:"uploader", type:"html", html:t1124})]);
		f.s[0] = false;
		f.s[1] = "pdf_upload";
		f.s[2] = f.v["this"];
		e.smcall (3, auth,"my_uid", ([]));
	},
	function (e,f) {
		var t1126 = f.s[3]; f.s[3] = ("pdf-upload:") + (t1126);
		e.php_static_method_call (4, asyncnotify,"create_watch", 4);
	},
	function (e,f) {
		f.v.pop = new popupform;
		e.mcall (6, f.v.pop, "initialise", ([230, 280, "Upload files", f.v.fields]));
	},
/*5*/	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) {
		f.pc=9;
		e.mcall (3, document, "getElementById", ([("count_") + ((f.v["this"]).uploader_id)]));
	},
	function (e,f) {
		f.pc=21;
		e.mcall (2, f.v.pop, "close_by_hiding", ([]));
	},
	function (e,f) {
		var t1132 = f.s[0]; f.v.el = t1132;
		f.v.el.innerHTML = (f.v["this"]).doc_count;
		e.smcall (0, php_engine,"get_current_thread_id", ([]));
	},
/*10*/	function (e,f) {
		var t1135 = f.s[0]; f.v["this"].thread_id = t1135;
		f.v["this"].can_accept_pdf = true;
		e.mcall (2, f.v.pop, "run", ([]));
	},
	function (e,f) {
		var t1138 = f.s[0]; f.v.event = t1138;
		f.v["this"].can_accept_pdf = false;
		f.v.action = (f.v.event).action;
		if (((f.v.action)) == (("OK"))) f.pc=12; else f.pc=13;
	},
	function (e,f) {
		f.pc=8;
		f.v.res = true;
	},
	function (e,f) { if (((f.v.action)) == (("cancel"))) f.pc=14; else f.pc=15; },
	function (e,f) {
		f.pc=8;
		f.v["this"].doc_count = 0;
	},
/*15*/	function (e,f) { if (((f.v.action)) == (("upload_complete"))) f.pc=16; else f.pc=18; },
	function (e,f) { e.mcall (2, f.v["this"], "get_file_info", ([])); },
	function (e,f) {
		var t1144 = f.s[0]; f.v.fi = t1144;
		f.v["this"].doc_count = builtin__count (f.v.fi);
	},
	function (e,f) { if (((f.v.action)) == (("pdf_arrived"))) f.pc=19; else f.pc=7; },
	function (e,f) { e.mcall (2, f.v["this"], "get_file_info", ([])); },
/*20*/	function (e,f) {
		f.pc=7;
		var t1147 = f.s[0]; f.v.fi = t1147;
		f.v["this"].doc_count = builtin__count (f.v.fi);
	},
	function (e,f) { e.return_pop ((((f.v["this"]).doc_count)) != ((0))); },
null	];

;
	c.pargs__get_file_info =  [];
	c.pinst__get_file_info =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "call_function_async", (["get_file_info", ([])])); },
	function (e,f) { var t1149 = f.s[0]; e.return_pop (t1149); },
null	];

;
	c.pargs__clear_files =  [];
	c.pinst__clear_files =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "call_function_async", (["clear_files", ([])])); },
	function (e,f) { var t1150 = f.s[0]; e.return_pop (t1150); },
null	];

;
	c.upload_completed = cp.upload_completed =  function ()
	{
{
		php_engine.resume  ("upload_complete");;
		}
			}

;
};
uploader.init_methods (uploader);
rpcclass.setup_class (uploader, "uploader",0, (["uploader_id","doc_count","listeners"]), ([0,0,2]));
function cover () { this.do_construct (arguments); }
cover.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	cp.close =  function ()
	{
		if (this.cover)
		{
			window.clearInterval (this.fader);
			document.body.removeChild (this.cover);
			this.cover = null;
			popup.zindex -= 20;
		}
			}

;
	cp.cover_clicked =  function (e)
	{
		if (!e) e = window.event;
		this.close();
		if (e) e.cancelBubble = true;
		return false;
			}

;
	cp.open =  function ()
	{
		if (popup.zindex == undefined) popup.zindex = 60;
		popup.zindex += 20;
		this.cover = document.createElement ("div");

		
		if (window.XMLHttpRequest)
		{
			this.cover.style.position = "fixed";
			this.cover.style.left = "0px";
			this.cover.style.top = "0px";
		}
		else
		{
			// MSIE 6
			this.cover.style.position = "absolute";
			this.cover.style.left = document.documentElement.scrollLeft+"px";
			this.cover.style.top = document.documentElement.scrollTop+"px";
		}

		// doing it in this rather strange order is to stop MSIE flickering when DIV is added but transparency hasn't caught up yet
		this.cover.style.width = "1px";
		this.cover.style.height = "1px";
		document.body.appendChild (this.cover);
		browser.set_alpha (this.cover, 1);

		this.cover.style.width = document.documentElement.scrollWidth+"px";
		this.cover.style.height = document.documentElement.clientHeight+"px";
		this.cover.style.zIndex = popup.zindex+100;
		this.cover.style.background = "white";

		var centre_x = browser.scroll_left() + browser.window_width()/2;
		var centre_y = browser.window_height()/2;

		if (!window.XMLHttpRequest)
		{
			// MSIE 6
			centre_y = browser.scroll_top() + browser.window_height()/2;
		}

		this.cover.innerHTML = "<img style=\"position:absolute; left:"+centre_x+"px; top:"+centre_y+"px\" src=\""+rootpath.map("/pj/graphics/spinner.gif")+"\"/>";

//		document.body.appendChild (this.cover);

		var cover_listener_code = "{ rpcclass.call_method_by_name ('popup', '"+this.get_id()+"', 'cover_clicked'); }";
		var cover_listener = new Function ("e", cover_listener_code);
		if (this.cover.addEventListener)
			this.cover.addEventListener ("click", cover_listener, false);
		else
			this.cover.attachEvent ("onclick", cover_listener);

		this.fade_level = 0;
		cover.current = this;
		this.fader = window.setInterval ("cover.fade()", 50);

			}

;
	cp.do_fade =  function ()
	{
var n;{
		n = this.fade_level;;
		if (this.cover !== null)
		{browser.set_alpha  (this.cover,n); }
		;
		this.fade_level = this.fade_level + 1;;
		}
			}

;
	c.fade = cp.fade =  function ()
	{
		cover.current.do_fade();
			}

;
};
cover.init_methods (cover);
rpcclass.setup_class (cover, "cover",0, (["listeners"]), ([2]));
function popup () { this.do_construct (arguments); }
popup.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	cp.initialise =  function ()
	{
		this.div = null;
		this.cover = null;
		this.disable_cover = false;
		this.x = popup.x;
		this.y = popup.y;
			}

;
	cp.close =  function ()
	{
		if (this.relocate_timer)
		{
			window.clearInterval (this.relocate_timer);
			this.relocate_timer = null;
		}

		if (this.div)
		{
			if (this.cover) document.body.removeChild (this.cover);

			document.body.removeChild (this.div);

			var i;
			for (i = 0; i < 5; i++)
				document.body.removeChild (this.shadow[i]);
			this.div = null;
			popup.leave_modal ();
		}
			}

;
	cp.close_by_hiding =  function ()
	{
		if (this.relocate_timer)
		{
			window.clearInterval (this.relocate_timer);
			this.relocate_timer = null;
		}
		if (this.div)
		{
			if (this.cover) document.body.removeChild (this.cover);

// workaround for IE not coping with radupload in a div which gets deleted
//			document.body.removeChild (this.div);
			this.div.style.display = "none";

			var i;
			for (i = 0; i < 5; i++)
				document.body.removeChild (this.shadow[i]);
			this.div = null;
			popup.leave_modal();
		}
			}

;
	cp.cover_clicked =  function (e)
	{
		if (!e) e = window.event;
		this.close();
		if (e) e.cancelBubble = true;
		return false;
			}

;
	c.next_zindex = cp.next_zindex =  function ()
	{
		if (popup.zindex == undefined) popup.zindex = 60;
		return popup.zindex + 20;
			}

;
	c.enter_modal = cp.enter_modal =  function ()
	{
		var res = popup.next_zindex ();
		popup.zindex += 20;
		return res;
			}

;
	c.leave_modal = cp.leave_modal =  function ()
	{
		popup.zindex -= 20;
			}

;
	cp.open =  function (width,height,html)
	{
		popup.enter_modal ();

		if (!this.disable_cover)
		{
			this.cover = document.createElement ("div");

			if (window.XMLHttpRequest)
			{
				this.cover.style.position = "fixed";
				this.cover.style.left = "0px";
				this.cover.style.top = "0px";

				if (document.all)
				{
					// MSIE 7 and 8
					this.cover.style.background = "white";
					browser.set_alpha (this.cover, 0);
				}
				else
				{
					this.cover.style.background = "transparent";
				}
			}
			else
			{
				// MSIE 6
				this.cover.style.position = "absolute";
				this.cover.style.left = browser.scroll_left()+"px";
				this.cover.style.top = browser.scroll_top()+"px";

				this.cover.style.background = "white";
				this.cover.style.filter = "alpha(opacity=0)";
			}

			this.cover.style.width = browser.window_width()+"px";
			this.cover.style.height = browser.window_height()+"px";
			this.cover.style.zIndex = ""+(popup.zindex-10); // "90";

			document.body.appendChild (this.cover);

			var cover_listener_code = "{ php_engine.resume_thread ("+php_engine.get_current_thread_id()+",'cover',null); }";
			var cover_listener = new Function ("e", cover_listener_code);
			if (this.cover.addEventListener)
			{
				this.cover.addEventListener ("click", cover_listener, false);
				this.cover.addEventListener ("contextmenu", cover_listener, false);
			}
			else
			{
				this.cover.attachEvent ("onclick", cover_listener);
				this.cover.attachEvent ("oncontextmenu", cover_listener);
			}
		}

		var margin = 50;
		if (this.y + height + margin > browser.scroll_top() + browser.window_height())
		{
			this.y = browser.scroll_top() + browser.window_height() - height - margin;
		}
		if (this.x + width + margin > browser.scroll_left() + browser.window_width())
		{
			this.x = browser.scroll_left() + browser.window_width() - width - margin;
		}
		if (this.y < margin) this.y = margin;

		this.div = document.createElement ("div");
		this.div.className = "popupdiv";

		if (width != 0)
		{
			this.div.style.width = width+"px";
			this.div.style.height = height+"px";
		}

		this.div.style.position = "absolute";
//		this.div.style.left = this.x+"px";
//		this.div.style.top = this.y+"px";
		this.div.style.left = "0px";
		this.div.style.top = "0px";
		this.div.style.zIndex = popup.zindex;

		this.div.innerHTML = html;

		document.body.appendChild (this.div);

		if (width == 0)
		{
			width = this.div.clientWidth-8;
			height = this.div.clientHeight-8;

			var width_clamped = false;
			var height_clamped = false;
			if (width > browser.window_width() - margin*2)
			{
				width = browser.window_width() - margin;
				width_clamped = true;
			}
			if (height > browser.window_height() - margin*2)
			{
				height = browser.window_height() - margin*2;
				height_clamped = true;
			}

			if (width_clamped || height_clamped)
			{
				var style = "overflow:auto;";
				if (width_clamped) style += " width:"+width+"px;";
				if (height_clamped) style += " height:"+height+"px;";
				this.div.innerHTML = "<div style=\""+style+"\">"+this.div.innerHTML+"</div>";
			}

			if (this.y + height + margin > browser.scroll_top() + browser.window_height())
			{
				this.y = browser.scroll_top() + browser.window_height() - height - margin;
			}
			if (this.x + width + margin > browser.scroll_left() + browser.window_width())
			{
				this.x = browser.scroll_left() + browser.window_width() - width - margin;
			}
			if (this.y < 0) this.y = 0;
		}

		this.div.style.left = this.x+"px";
		this.div.style.top = this.y+"px";

		this.w = width;
		this.h = height;

		this.shadow = new Array();
		var i;
		for (i = 0; i < 5; i++)
		{
			this.shadow[i] = document.createElement ("div");

			this.shadow[i].style.width = "1px";
			this.shadow[i].style.height = "1px";
			this.shadow[i].style.position = "absolute";
			this.shadow[i].style.left = (this.x+1+i)+"px";
			this.shadow[i].style.top = (this.y+1+i)+"px";
			this.shadow[i].style.zIndex = popup.zindex-i-1; // 99-i;
			this.shadow[i].style.background = "#000000";

			document.body.appendChild (this.shadow[i]);

			browser.set_alpha (this.shadow[i], 5);

			this.shadow[i].style.width = (width+11)+"px";
			this.shadow[i].style.height = (height+11)+"px";
		}

		var me = this;
		this.relocate_timer = window.setInterval (function () { me.relocate (); }, 100);
			}

;
	cp.relocate =  function ()
	{
var margin;var width;var height;var x;var y;var i;var sel;{
		margin = 50;;
		width = this.div.clientWidth - 8;;
		height = this.div.clientHeight - 8;;
		x = this.x;;
		y = this.y;;
		if (y + height + margin > browser.scroll_top  () + browser.window_height  ())
		{{
		y = browser.scroll_top  () + browser.window_height  () - height - margin;;
		}
		 }
		;
		if (x + width + margin > browser.scroll_left  () + browser.window_width  ())
		{{
		x = browser.scroll_left  () + browser.window_width  () - width - margin;;
		}
		 }
		;
		if (y < browser.scroll_top  () + margin)
		{y = browser.scroll_top  () + margin; }
		;
		if (x < browser.scroll_left  () + margin)
		{x = browser.scroll_left  () + margin; }
		;
		if (this.x == x && this.y == y && this.w == width && this.h == height)
		{return }
		;
		this.x = x;;
		this.y = y;;
		this.w = width;;
		this.h = height;;
		this.div.style.left = this.x + "px";;
		this.div.style.top = this.y + "px";;
		for (i = 0;i < 5;i++) {{
		sel = this.shadow[i];;
		sel.style.left = this.x + 1 + i + "px";;
		sel.style.top = this.y + 1 + i + "px";;
		sel.style.width = width + 11 + "px";;
		sel.style.height = height + 11 + "px";;
		}
		};
		}
			}

;
	c.pargs__set_content =  ["html"];
	c.pinst__set_content =  [
/*0*/	function (e,f) { (f.v["this"]).div.innerHTML = f.v.html; },
null	];

;
	c.pargs__get_x =  [];
	c.pinst__get_x =  [
/*0*/	function (e,f) { e.return_pop ((f.v["this"]).x); },
null	];

;
	c.pargs__get_y =  [];
	c.pinst__get_y =  [
/*0*/	function (e,f) { e.return_pop ((f.v["this"]).y); },
null	];

;
	cp.no_cover =  function ()
	{
		this.disable_cover = true;
			}

;
	cp.set_coordinates =  function (x,y)
	{
		this.x = x;
		this.y = y;
			}

;
	cp.set_element =  function (el)
	{
		this.x = lib.document_x_of(el);
		this.y = lib.document_y_of(el);
			}

;
	cp.set_event =  function (event)
	{
		this.x = event.clientX;
		this.y = event.clientY + browser.scroll_top();
			}

;
	cp.grab_keyboard =  function ()
	{
		var key_listener = new Function ("e", "{ if (!e) e = window.event; php_engine.resume_thread ("+php_engine.get_current_thread_id()+",'key',e.keyCode); }");

		if (this.div.addEventListener)
		{
			document.addEventListener ("keydown", key_listener, true);
		}
		else
		{
			this.div.attachEvent ("onkeydown", key_listener);
		}
		debugout ("onkeydown listener established\n");
			}

;
	c.set_default_coordinates = cp.set_default_coordinates =  function (x,y)
	{
		popup.x = x;
		popup.y = y;
			}

;
	c.set_default_element = cp.set_default_element =  function (el)
	{
		popup.x = lib.document_x_of(el);
		popup.y = lib.document_y_of(el);
			}

;
	c.set_default_event = cp.set_default_event =  function (event)
	{
		popup.x = event.clientX + browser.scroll_left();
		popup.y = event.clientY + browser.scroll_top();
			}

;
};
popup.init_methods (popup);
rpcclass.setup_class (popup, "popup",0, (["listeners"]), ([2]));
function popupform () { this.do_construct (arguments); }
popupform.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__cancel =  ["el","arg","event"];
	c.pinst__cancel =  [
/*0*/	function (e,f) { e.mcall (2, (f.v["this"]).pop, "close", ([])); },
null	];

;
	c.pargs__submit =  ["el","arg","event"];
	c.pinst__submit =  [
/*0*/	function (e,f) {
		f.v.results = ([]);
		f.v._k84 = e.enumkeys ((f.v["this"]).fields);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k84).length)) f.pc=2;
	},
	function (e,f) {
		f.pc=-1;
		e.mcall (2, (f.v["this"]).pop, "close", ([]));
	},
	function (e,f) {
		f.pc=1;
		f.v._i85 = (f.v._k84).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v._i85)];
		f.v.results[f.v.field] = ((f.v.el)[(f.v.field)]).value;
	},
null	];

;
	c.pargs__open_date =  ["el","i","ev"];
	c.pinst__open_date =  [
/*0*/	function (e,f) {
		f.v.field = ((f.v["this"]).fields)[(f.v.i)];
		f.s[0] = "-form";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1158 = f.s[1]; var t1159 = f.s[0]; 
		e.mcall (3, document, "getElementById", (["" + (t1158) + (t1159)]));
	},
	function (e,f) {
		var t1161 = f.s[0]; f.v.form = t1161;
		f.v.fname = "" + ((f.v.field).name) + ("-date");
		f.v.element = (f.v.form)[(f.v.fname)];
		f.v.value = (f.v.element).value;
		f.v.value = builtin__parse_mysql_datetime ("" + (f.v.value) + (" 00:00:00"));
		e.smcall (2, popupdate,"run", ([(f.v.field).label, f.v.value]));
	},
	function (e,f) {
		var t1167 = f.s[0]; f.v.value = t1167;
		f.v.element.value = builtin__date ("Y-m-d",f.v.value);
	},
null	];

;
	c.pargs__edit_query =  ["el","i","ev"];
	c.pinst__edit_query =  [
/*0*/	function (e,f) { f.v.field = ((f.v["this"]).fields)[(f.v.i)]; },
null	];

;
	c.pargs__insert_at_caret =  ["fname","text"];
	c.pinst__insert_at_caret =  [
/*0*/	function (e,f) {
		f.s[0] = "-form";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1170 = f.s[1]; var t1171 = f.s[0]; 
		e.mcall (3, document, "getElementById", (["" + (t1170) + (t1171)]));
	},
	function (e,f) {
		var t1173 = f.s[0]; f.v.form = t1173;
		f.v.element = (f.v.form)[(f.v.fname)];
		e.smcall (2, lib,"insertAtCaret", ([f.v.element, f.v.text]));
	},
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.s[0] = "\"><table>";
		e.smcall (3, popupform,"render_resume", (["OK", null]));
	},
	function (e,f) {
		var t1175 = f.s[1]; var t1176 = f.s[0]; 
		f.s[0] = ("-form\" onsubmit=\"") + ("" + (t1175) + (t1176));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1177 = f.s[1]; var t1178 = f.s[0]; 
		f.v["this"].html = ("<h3>") + ("" + ((f.v["this"]).title) + (("</h3><form id=\"") + ("" + (t1177) + (t1178))));
		f.v["this"].focusfield = null;
		f.v._k86 = e.enumkeys ((f.v["this"]).fields);
	},
	function (e,f) {
		f.pc=5;
		if (!((f.v._k86).length)) f.pc=4;
	},
	function (e,f) {
		f.pc=232;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td></td><td style=\"text-align:right\">");
		f.v._k94 = e.enumkeys ((f.v["this"]).fields);
	},
/*5*/	function (e,f) {
		f.v.i = (f.v._k86).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v.i)];
		f.s[0] = (":") + ((f.v.field).name);
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1186 = f.s[1]; var t1187 = f.s[0]; 
		f.v.fieldid = "" + (t1186) + (t1187);
		if (((f.v.field).value) !== undefined) f.pc=7; else f.pc=8;
	},
	function (e,f) {
		f.pc=9;
		f.v.value = (f.v.field).value;
	},
	function (e,f) { f.v.value = ""; },
	function (e,f) { if ((((f.v.field).type)) == (("label"))) f.pc=10; else f.pc=13; },
/*10*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=11; else f.pc=12;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.pc=230;
		f.v.evalue = builtin__htmlentities (f.v.value);
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td>") + ("" + (f.v.evalue) + ("</td></tr>")));
	},
	function (e,f) { if ((((f.v.field).type)) == (("text"))) f.pc=219; else f.pc=220; },
	function (e,f) { if (((f.v.value)) === ((null))) f.pc=15; else f.pc=16; },
/*15*/	function (e,f) { f.v.value = ""; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=17; else f.pc=18;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) { if ((((f.v.field).type)) == (("price"))) f.pc=19; else f.pc=21; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("&#163;");
		e.smcall (1, lib,"render_price_simple", ([f.v.value]));
	},
/*20*/	function (e,f) { var t1200 = f.s[0]; f.v.value = t1200; },
	function (e,f) {
		f.v.evalue = "";
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=24;
		if (!(((f.v.i)) < (((f.v.value).length)))) f.pc=23;
	},
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><input id=\"") + ("" + (f.v.fieldid) + ("\"")));
		if ((((f.v.field).type)) == (("password"))) f.pc=28; else f.pc=29;
	},
	function (e,f) {
		f.v.ch = builtin__substr (f.v.value,f.v.i,1);
		if (!(builtin__preg_match ("/[A-Za-z0-9 ]/",f.v.ch))) f.pc=25; else f.pc=26;
	},
/*25*/	function (e,f) {
		f.pc=27;
		f.v.evalue = "" + (f.v.evalue) + (("&#") + ("" + (builtin__ord (f.v.ch)) + (";")));
	},
	function (e,f) { f.v.evalue = "" + (f.v.evalue) + (f.v.ch); },
	function (e,f) {
		f.pc=22;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=30;
		f.v["this"].html = "" + ((f.v["this"]).html) + (" type=\"password\"");
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (" type=\"text\""); },
/*30*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ((" name=\"") + ("" + ((f.v.field).name) + (("\" value=\"") + ("" + (f.v.evalue) + ("\" style=\"")))));
		if (((f.v.field).width) !== undefined) f.pc=32; else f.pc=33;
	},
	function (e,f) {
		f.pc=35;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=34;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1212 = f.s[0]; if (t1212) f.pc=31; else f.pc=35; },
/*35*/	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=37; else f.pc=38; },
	function (e,f) {
		f.pc=40;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=39;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1214 = f.s[0]; if (t1214) f.pc=36; else f.pc=40; },
/*40*/	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\"");
		f.v["this"].html = "" + ((f.v["this"]).html) + (" /></td></tr>");
	},
	function (e,f) { if ((((f.v.field).type)) == (("date"))) f.pc=42; else f.pc=56; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=43; else f.pc=44;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.v.evalue = builtin__date ("Y-m-d",f.v.value);
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><input id=\"") + ("" + (f.v.fieldid) + (("\" type=\"text\" name=\"") + ("" + ((f.v.field).name) + (("-date\" value=\"") + ("" + (f.v.evalue) + ("\" style=\"")))))));
		if (((f.v.field).width) !== undefined) f.pc=46; else f.pc=47;
	},
/*45*/	function (e,f) {
		f.pc=49;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=48;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1222 = f.s[0]; if (t1222) f.pc=45; else f.pc=49; },
	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=51; else f.pc=52; },
/*50*/	function (e,f) {
		f.pc=54;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=53;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1224 = f.s[0]; if (t1224) f.pc=50; else f.pc=54; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\" />");
		f.s[0] = "\"><img style=\"border-style:none\" src=\"/pj/graphics/calendar-small.png\" alt=\"change\"/></a>";
		e.mcall (5, f.v["this"], "render_start", (["open_date", f.v.i]));
	},
/*55*/	function (e,f) {
		f.pc=230;
		var t1226 = f.s[1]; var t1227 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<a href=\"#\" onclick=\"") + ("" + (t1226) + (t1227)));
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td></tr>");
	},
	function (e,f) { if ((((f.v.field).type)) == (("time"))) f.pc=57; else f.pc=70; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=58; else f.pc=59;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.v.evalue = builtin__date ("H:i",f.v.value);
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><input id=\"") + ("" + (f.v.fieldid) + (("\" type=\"text\" name=\"") + ("" + ((f.v.field).name) + (("\" value=\"") + ("" + (f.v.evalue) + ("\" style=\"")))))));
		if (((f.v.field).width) !== undefined) f.pc=61; else f.pc=62;
	},
/*60*/	function (e,f) {
		f.pc=64;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=63;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1235 = f.s[0]; if (t1235) f.pc=60; else f.pc=64; },
	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=66; else f.pc=67; },
/*65*/	function (e,f) {
		f.pc=69;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=68;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1237 = f.s[0]; if (t1237) f.pc=65; else f.pc=69; },
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\" /></td></tr>");
	},
/*70*/	function (e,f) { if ((((f.v.field).type)) == (("datetime"))) f.pc=71; else f.pc=97; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=72; else f.pc=73;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td><td>");
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<input id=\"") + ("" + (f.v.fieldid) + (("\" type=\"text\" name=\"") + ("" + ((f.v.field).name) + (("-date\" value=\"") + ("" + (builtin__date ("Y-m-d",f.v.value)) + ("\" style=\"")))))));
		if (((f.v.field).width) !== undefined) f.pc=76; else f.pc=77;
	},
	function (e,f) {
		f.pc=79;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
/*75*/	function (e,f) {
		f.pc=79;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("width:70px;");
	},
	function (e,f) {
		f.pc=78;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1245 = f.s[0]; if (t1245) f.pc=74; else f.pc=75; },
	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=81; else f.pc=82; },
/*80*/	function (e,f) {
		f.pc=84;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=83;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1247 = f.s[0]; if (t1247) f.pc=80; else f.pc=84; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\" />");
		f.s[0] = "\"><img style=\"border-style:none\" src=\"/pj/graphics/calendar-small.png\" alt=\"change\"/></a>";
		e.mcall (5, f.v["this"], "render_start", (["open_date", f.v.i]));
	},
/*85*/	function (e,f) {
		var t1249 = f.s[1]; var t1250 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<a href=\"#\" onclick=\"") + ("" + (t1249) + (t1250)));
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<input type=\"text\" name=\"") + ("" + ((f.v.field).name) + (("-time\" value=\"") + ("" + (builtin__date ("H:i",f.v.value)) + ("\" style=\"")))));
		if (((f.v.field).width) !== undefined) f.pc=88; else f.pc=89;
	},
	function (e,f) {
		f.pc=91;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=91;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("width:35px;");
	},
	function (e,f) {
		f.pc=90;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
/*90*/	function (e,f) { var t1255 = f.s[0]; if (t1255) f.pc=86; else f.pc=87; },
	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=93; else f.pc=94; },
	function (e,f) {
		f.pc=96;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=95;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
/*95*/	function (e,f) { var t1257 = f.s[0]; if (t1257) f.pc=92; else f.pc=96; },
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\" />");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td></tr>");
	},
	function (e,f) { if ((((f.v.field).type)) == (("image"))) f.pc=98; else f.pc=111; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=99; else f.pc=100;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
/*100*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><img src=\"") + ("" + (f.v.value) + ("\" style=\"")));
		if (((f.v.field).width) !== undefined) f.pc=102; else f.pc=103;
	},
	function (e,f) {
		f.pc=105;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=104;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1264 = f.s[0]; if (t1264) f.pc=101; else f.pc=105; },
/*105*/	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=107; else f.pc=108; },
	function (e,f) {
		f.pc=110;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=109;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1266 = f.s[0]; if (t1266) f.pc=106; else f.pc=110; },
/*110*/	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\" /></td></tr>");
	},
	function (e,f) { if ((((f.v.field).type)) == (("textbox"))) f.pc=112; else f.pc=124; },
	function (e,f) {
		f.v.evalue = "";
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=115;
		if (!(((f.v.i)) < (((f.v.value).length)))) f.pc=114;
	},
	function (e,f) { if ((((f.v.field).label)) != ((""))) f.pc=122; else f.pc=123; },
/*115*/	function (e,f) {
		f.v.ch = builtin__substr (f.v.value,f.v.i,1);
		if (!(builtin__preg_match ("/[A-Za-z0-9 ]/",f.v.ch))) f.pc=116; else f.pc=120;
	},
	function (e,f) {
		f.v.c = builtin__ord (f.v.ch);
		if (((f.v.c)) == ((10))) f.pc=117; else f.pc=118;
	},
	function (e,f) {
		f.pc=121;
		f.v.evalue = "" + (f.v.evalue) + ("\r\n");
	},
	function (e,f) { if (((f.v.c)) == ((13))) f.pc=121; else f.pc=119; },
	function (e,f) {
		f.pc=121;
		f.v.evalue = "" + (f.v.evalue) + (("&#") + ("" + (builtin__ord (f.v.ch)) + (";")));
	},
/*120*/	function (e,f) { f.v.evalue = "" + (f.v.evalue) + (f.v.ch); },
	function (e,f) {
		f.pc=113;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (("<tr><td style=\"text-align:right\">") + ("" + ((f.v.field).label) + (":</td><td></td></tr>"))); },
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<tr><td colspan=\"2\"><textarea id=\"") + ("" + (f.v.fieldid) + (("\" name=\"") + ("" + ((f.v.field).name) + (("\" style=\"width:") + ("" + ((f.v.field).width) + (("px;height:") + ("" + ((f.v.field).height) + (("px;margin:15px;\">") + ("" + (f.v.evalue) + ("</textarea></td></tr>")))))))))));
	},
	function (e,f) { if ((((f.v.field).type)) == (("table"))) f.pc=125; else f.pc=139; },
/*125*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr>");
		if ((((f.v.field).label)) != ((""))) f.pc=126; else f.pc=127;
	},
	function (e,f) {
		f.pc=128;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<td style=\"text-align:right\">") + ("" + ((f.v.field).label) + (":</td>")));
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<td>");
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("<td colspan=\"2\">"); },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<div style=\"");
		if (((f.v.field).width) !== undefined) f.pc=129; else f.pc=130;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;"))); },
/*130*/	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=131; else f.pc=132; },
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;"))); },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("overflow:auto\">");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<table style=\"width:90%\">");
		f.v.odd = 1;
		f.v._k88 = e.enumkeys ((f.v.field).options);
	},
	function (e,f) {
		f.pc=135;
		if (!((f.v._k88).length)) f.pc=134;
	},
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</table>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</div>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</tr>");
	},
/*135*/	function (e,f) {
		f.v._i89 = (f.v._k88).shift();
		f.v.pagename = ((f.v.field).options)[(f.v._i89)];
		if (f.v.odd) f.pc=136; else f.pc=137;
	},
	function (e,f) {
		f.pc=138;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr class=\"comboodd\">");
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr class=\"comboeven\">"); },
	function (e,f) {
		f.pc=133;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("" + (f.v.pagename) + ("</tr>"));
		f.v.odd = !(f.v.odd);
	},
	function (e,f) { if ((((f.v.field).type)) == (("html"))) f.pc=140; else f.pc=146; },
/*140*/	function (e,f) { if (((f.v.field).label) !== undefined) f.pc=143; else f.pc=144; },
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":"));
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td>") + ("" + ((f.v.field).html) + ("</td></tr>")));
	},
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<tr><td colspan=\"2\">") + ("" + ((f.v.field).html) + ("</td></tr>")));
	},
	function (e,f) {
		f.pc=145;
		f.s[0] = (((f.v.field).label)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
/*145*/	function (e,f) { var t1303 = f.s[0]; if (t1303) f.pc=141; else f.pc=142; },
	function (e,f) { if ((((f.v.field).type)) == (("query_expr"))) f.pc=147; else f.pc=152; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=148; else f.pc=149;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.s[0] = "\">";
		e.mcall (5, f.v.value, "render_start", (["edit", 0]));
	},
/*150*/	function (e,f) {
		var t1306 = f.s[1]; var t1307 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><a href=\"#\" onclick=\"") + ("" + (t1306) + (t1307)));
		e.php_builtin (0, "ob_start", 0);
		e.smcall (3, dataitemdiv,"create", ([f.v.value, "render_text", false]));
	},
	function (e,f) {
		f.pc=230;
		e.php_builtin (0, "ob_get_clean", 0);
		var t1309 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + (t1309);
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</a></td></tr>");
	},
	function (e,f) { if ((((f.v.field).type)) == (("yesno"))) f.pc=153; else f.pc=173; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=154; else f.pc=155;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
/*155*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><select id=\"") + ("" + (f.v.fieldid) + (("\" name=\"") + ("" + ((f.v.field).name) + ("\" style=\"")))));
		if (((f.v.field).width) !== undefined) f.pc=157; else f.pc=158;
	},
	function (e,f) {
		f.pc=160;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=159;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1316 = f.s[0]; if (t1316) f.pc=156; else f.pc=160; },
/*160*/	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=162; else f.pc=163; },
	function (e,f) {
		f.pc=165;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=164;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1318 = f.s[0]; if (t1318) f.pc=161; else f.pc=165; },
/*165*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\"");
		if ((f.v["this"]).use_onchange) f.pc=166; else f.pc=168;
	},
	function (e,f) {
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_resume", (["form_changed", (f.v.field).name]));
	},
	function (e,f) {
		var t1320 = f.s[1]; var t1321 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + ((" onchange=\"") + ("" + (t1320) + (t1321)));
	},
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (">");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<option value=\"1\"");
		if (((f.v.value)) == ((1))) f.pc=169; else f.pc=170;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (" selected=\"selected\""); },
/*170*/	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (">yes</option>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<option value=\"0\"");
		if (((f.v.value)) == ((0))) f.pc=171; else f.pc=172;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (" selected=\"selected\""); },
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + (">no</option>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</select>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td></tr>");
	},
	function (e,f) { if ((((f.v.field).type)) == (("list"))) f.pc=174; else f.pc=195; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=175; else f.pc=176;
	},
/*175*/	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><select id=\"") + ("" + (f.v.fieldid) + (("\" name=\"") + ("" + ((f.v.field).name) + ("\" style=\"")))));
		if (((f.v.field).width) !== undefined) f.pc=178; else f.pc=179;
	},
	function (e,f) {
		f.pc=181;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
	function (e,f) {
		f.pc=180;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
/*180*/	function (e,f) { var t1336 = f.s[0]; if (t1336) f.pc=177; else f.pc=181; },
	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=183; else f.pc=184; },
	function (e,f) {
		f.pc=186;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
	function (e,f) {
		f.pc=185;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
/*185*/	function (e,f) { var t1338 = f.s[0]; if (t1338) f.pc=182; else f.pc=186; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\"");
		if ((f.v["this"]).use_onchange) f.pc=187; else f.pc=189;
	},
	function (e,f) {
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_resume", (["form_changed", (f.v.field).name]));
	},
	function (e,f) {
		var t1340 = f.s[1]; var t1341 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + ((" onchange=\"") + ("" + (t1340) + (t1341)));
	},
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (">");
		f.v._k90 = e.enumkeys ((f.v.field).options);
	},
/*190*/	function (e,f) {
		f.pc=192;
		if (!((f.v._k90).length)) f.pc=191;
	},
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</select>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td></tr>");
	},
	function (e,f) {
		f.v._i91 = (f.v._k90).shift();
		f.v.xvalue = ((f.v.field).options)[(f.v._i91)];
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<option value=\"") + ("" + (f.v.xvalue) + ("\"")));
		if (((f.v.value)) == ((f.v.xvalue))) f.pc=193; else f.pc=194;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (" selected=\"selected\""); },
	function (e,f) {
		f.pc=190;
		f.v["this"].html = "" + ((f.v["this"]).html) + ((">") + ("" + (f.v.xvalue) + ("</option>")));
	},
/*195*/	function (e,f) { if ((((f.v.field).type)) == (("enum"))) f.pc=196; else f.pc=217; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("<tr><td style=\"text-align:right\">");
		if ((((f.v.field).label)) != ((""))) f.pc=197; else f.pc=198;
	},
	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + ("" + ((f.v.field).label) + (":")); },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (("</td><td><select id=\"") + ("" + (f.v.fieldid) + (("\" name=\"") + ("" + ((f.v.field).name) + ("\" style=\"")))));
		if (((f.v.field).width) !== undefined) f.pc=200; else f.pc=201;
	},
	function (e,f) {
		f.pc=203;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("width:") + ("" + ((f.v.field).width) + ("px;")));
	},
/*200*/	function (e,f) {
		f.pc=202;
		f.s[0] = (((f.v.field).width)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1356 = f.s[0]; if (t1356) f.pc=199; else f.pc=203; },
	function (e,f) { if (((f.v.field).height) !== undefined) f.pc=205; else f.pc=206; },
	function (e,f) {
		f.pc=208;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("height:") + ("" + ((f.v.field).height) + ("px;")));
	},
/*205*/	function (e,f) {
		f.pc=207;
		f.s[0] = (((f.v.field).height)) != ((""));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1358 = f.s[0]; if (t1358) f.pc=204; else f.pc=208; },
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("\"");
		if ((f.v["this"]).use_onchange) f.pc=209; else f.pc=211;
	},
	function (e,f) {
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_resume", (["form_changed", (f.v.field).name]));
	},
/*210*/	function (e,f) {
		var t1360 = f.s[1]; var t1361 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + ((" onchange=\"") + ("" + (t1360) + (t1361)));
	},
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + (">");
		f.v._k92 = e.enumkeys ((f.v.field).options);
	},
	function (e,f) {
		f.pc=214;
		if (!((f.v._k92).length)) f.pc=213;
	},
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</select>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td></tr>");
	},
	function (e,f) {
		f.v.xkey = (f.v._k92).shift();
		f.v.xvalue = ((f.v.field).options)[(f.v.xkey)];
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<option value=\"") + ("" + (f.v.xkey) + ("\"")));
		if (((f.v.value)) == ((f.v.xkey))) f.pc=215; else f.pc=216;
	},
/*215*/	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (" selected=\"selected\""); },
	function (e,f) {
		f.pc=212;
		f.v["this"].html = "" + ((f.v["this"]).html) + ((">") + ("" + (f.v.xvalue) + ("</option>")));
	},
	function (e,f) { if ((((f.v.field).type)) == (("button"))) f.pc=230; else f.pc=218; },
	function (e,f) {
		f.pc=230;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("Don't know how to render a ") + ((f.v.field).type));
	},
	function (e,f) {
		f.pc=229;
		f.s[0] = true;
	},
/*220*/	function (e,f) { if ((((f.v.field).type)) == (("password"))) f.pc=221; else f.pc=222; },
	function (e,f) {
		f.pc=229;
		f.s[0] = true;
	},
	function (e,f) { if ((((f.v.field).type)) == (("postcode"))) f.pc=223; else f.pc=224; },
	function (e,f) {
		f.pc=229;
		f.s[0] = true;
	},
	function (e,f) { if ((((f.v.field).type)) == (("dn"))) f.pc=225; else f.pc=226; },
/*225*/	function (e,f) {
		f.pc=229;
		f.s[0] = true;
	},
	function (e,f) { if ((((f.v.field).type)) == (("integer"))) f.pc=227; else f.pc=228; },
	function (e,f) {
		f.pc=229;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v.field).type)) == (("price")); },
	function (e,f) { var t1373 = f.s[0]; if (t1373) f.pc=14; else f.pc=41; },
/*230*/	function (e,f) { if (((f.v.field).focus) !== undefined) f.pc=231; else f.pc=3; },
	function (e,f) {
		f.pc=3;
		f.v["this"].focusfield = f.v.fieldid;
	},
	function (e,f) {
		f.pc=234;
		if (!((f.v._k94).length)) f.pc=233;
	},
	function (e,f) { if ((f.v["this"]).use_ok) f.pc=237; else f.pc=241; },
	function (e,f) {
		f.v._i95 = (f.v._k94).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v._i95)];
		f.s[0] = (":") + ((f.v.field).name);
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
/*235*/	function (e,f) {
		var t1377 = f.s[1]; var t1378 = f.s[0]; 
		f.v.fieldid = "" + (t1377) + (t1378);
		if ((((f.v.field).type)) == (("button"))) f.pc=236; else f.pc=232;
	},
	function (e,f) {
		f.pc=232;
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<input id=\"") + ("" + (f.v.fieldid) + (("\" type=\"button\" name=\"") + ("" + ((f.v.field).name) + (("\" value=\"") + ("" + ((f.v.field).label) + (("\" onclick=\"") + ("" + ((f.v.field).action) + ("\"/>")))))))));
	},
	function (e,f) {
		f.s[0] = ":OK-button";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1381 = f.s[1]; var t1382 = f.s[0]; 
		f.v.fieldid = "" + (t1381) + (t1382);
		if ((((f.v["this"]).focusfield)) == ((null))) f.pc=239; else f.pc=240;
	},
	function (e,f) { f.v["this"].focusfield = f.v.fieldid; },
/*240*/	function (e,f) { f.v["this"].html = "" + ((f.v["this"]).html) + (("<input id=\"") + ("" + (f.v.fieldid) + ("\" type=\"submit\" style=\"width:60px\" value=\"Ok\">"))); },
	function (e,f) { if ((f.v["this"]).use_cancel) f.pc=242; else f.pc=247; },
	function (e,f) {
		f.s[0] = ":cancel-button";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1386 = f.s[1]; var t1387 = f.s[0]; 
		f.v.fieldid = "" + (t1386) + (t1387);
		if ((((f.v["this"]).focusfield)) == ((null))) f.pc=244; else f.pc=245;
	},
	function (e,f) { f.v["this"].focusfield = f.v.fieldid; },
/*245*/	function (e,f) {
		f.s[0] = "\">";
		e.smcall (3, popupform,"render_resume", (["cancel", null]));
	},
	function (e,f) {
		var t1390 = f.s[1]; var t1391 = f.s[0]; 
		f.v["this"].html = "" + ((f.v["this"]).html) + (("<input id=\"") + ("" + (f.v.fieldid) + (("\" type=\"button\" style=\"width:60px\" value=\"Cancel\" onclick=\"") + ("" + (t1390) + (t1391)))));
	},
	function (e,f) {
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</td></tr>");
		f.v["this"].html = "" + ((f.v["this"]).html) + ("</table></form>");
	},
null	];

;
	c.pargs__initialise =  ["width","height","title","fields"];
	c.pinst__initialise =  [
/*0*/	function (e,f) {
		f.v["this"].use_ok = true;
		f.v["this"].use_cancel = true;
		f.v["this"].use_onchange = false;
		f.v["this"].title = f.v.title;
		f.v["this"].fields = f.v.fields;
		e.mcall (2, f.v["this"], "render", ([]));
	},
	function (e,f) {
		f.v["this"].width = f.v.width;
		f.v["this"].height = f.v.height;
		f.v["this"].pop = new popup;
		e.mcall (3, (f.v["this"]).pop, "initialise", ([f.v["this"]]));
	},
null	];

;
	c.pargs__use_ok_cancel =  ["use_ok","use_cancel"];
	c.pinst__use_ok_cancel =  [
/*0*/	function (e,f) {
		f.v["this"].use_ok = f.v.use_ok;
		f.v["this"].use_cancel = f.v.use_cancel;
		e.mcall (2, f.v["this"], "render", ([]));
	},
null	];

;
	c.pargs__send_changes =  [];
	c.pinst__send_changes =  [
/*0*/	function (e,f) {
		f.v["this"].use_onchange = true;
		e.mcall (2, f.v["this"], "render", ([]));
	},
null	];

;
	c.pargs__set_element =  ["el"];
	c.pinst__set_element =  [
/*0*/	function (e,f) { e.mcall (3, (f.v["this"]).pop, "set_element", ([f.v.el])); },
null	];

;
	c.pargs__open =  [];
	c.pinst__open =  [
/*0*/	function (e,f) { e.mcall (5, (f.v["this"]).pop, "open", ([(f.v["this"]).width, (f.v["this"]).height, (f.v["this"]).html])); },
	function (e,f) { if ((f.v["this"]).focusfield) f.pc=2; else f.pc=-1; },
	function (e,f) {
		f.s[0] = "focus";
		e.mcall (4, document, "getElementById", ([(f.v["this"]).focusfield]));
	},
	function (e,f) { var t1406 = f.s[1]; var t1407 = f.s[0]; e.mcall (2, t1406, t1407, ([])); },
null	];

;
	c.pargs__set_content =  ["fields"];
	c.pinst__set_content =  [
/*0*/	function (e,f) {
		f.v["this"].fields = f.v.fields;
		e.mcall (2, f.v["this"], "render", ([]));
	},
	function (e,f) { e.mcall (3, (f.v["this"]).pop, "set_content", ([(f.v["this"]).html])); },
	function (e,f) { if ((f.v["this"]).focusfield) f.pc=3; else f.pc=-1; },
	function (e,f) {
		f.s[0] = "focus";
		e.mcall (4, document, "getElementById", ([(f.v["this"]).focusfield]));
	},
	function (e,f) { var t1409 = f.s[1]; var t1410 = f.s[0]; e.mcall (2, t1409, t1410, ([])); },
null	];

;
	c.pargs__get_form_fields =  [];
	c.pinst__get_form_fields =  [
/*0*/	function (e,f) {
		f.s[0] = "-form";
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1411 = f.s[1]; var t1412 = f.s[0]; 
		e.mcall (3, document, "getElementById", (["" + (t1411) + (t1412)]));
	},
	function (e,f) {
		var t1414 = f.s[0]; f.v.form = t1414;
		f.v.results = ({});
		f.v._k96 = e.enumkeys ((f.v["this"]).fields);
	},
	function (e,f) {
		f.pc=5;
		if (!((f.v._k96).length)) f.pc=4;
	},
	function (e,f) { e.return_pop (f.v.results); },
/*5*/	function (e,f) {
		f.v._i97 = (f.v._k96).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v._i97)];
		if (((f.v.field).name) !== undefined) f.pc=6; else f.pc=3;
	},
	function (e,f) {
		f.v.n = (f.v.field).name;
		if ((((f.v.field).type)) == (("datetime"))) f.pc=7; else f.pc=8;
	},
	function (e,f) {
		f.pc=3;
		f.v.value = ((f.v.form)[("" + (f.v.n) + ("-date"))]).value;
		f.v.value2 = ((f.v.form)[("" + (f.v.n) + ("-time"))]).value;
		f.v.value = builtin__parse_mysql_datetime ("" + (f.v.value) + ((" ") + ("" + (f.v.value2) + (":00"))));
		f.v.results[f.v.n] = f.v.value;
	},
	function (e,f) { if ((((f.v.field).type)) == (("date"))) f.pc=9; else f.pc=10; },
	function (e,f) {
		f.pc=3;
		f.v.value = ((f.v.form)[("" + (f.v.n) + ("-date"))]).value;
		f.v.value = builtin__parse_mysql_datetime ("" + (f.v.value) + (" 00:00:00"));
		f.v.results[f.v.n] = f.v.value;
	},
/*10*/	function (e,f) { if ((((f.v.field).type)) == (("price"))) f.pc=11; else f.pc=13; },
	function (e,f) { e.smcall (1, lib,"parse_price_simple", ([((f.v.form)[(f.v.n)]).value])); },
	function (e,f) {
		f.pc=3;
		var t1428 = f.s[0]; f.v.results[f.v.n] = t1428;
	},
	function (e,f) { if (((f.v.form)[(f.v.n)]) !== undefined) f.pc=14; else f.pc=20; },
	function (e,f) { if ((((f.v.form)[(f.v.n)]).value) !== undefined) f.pc=15; else f.pc=3; },
/*15*/	function (e,f) {
		f.v.value = ((f.v.form)[(f.v.n)]).value;
		if ((((f.v.field).type)) == (("textbox"))) f.pc=16; else f.pc=17;
	},
	function (e,f) {
		f.pc=19;
		f.v.value = builtin__preg_replace ("/([^\r])[\n]/","$1\r\n",f.v.value);
	},
	function (e,f) { if ((((f.v.field).type)) == (("time"))) f.pc=18; else f.pc=19; },
	function (e,f) { f.v.value = parseInt((builtin__parse_mysql_datetime (("2000-01-01 ") + (f.v.value))),10) - parseInt((builtin__mktime (0,0,0,1,1,2000)),10); },
	function (e,f) {
		f.pc=3;
		f.v.results[f.v.n] = f.v.value;
	},
/*20*/	function (e,f) {
		f.pc=3;
		f.v.results[f.v.n] = (f.v.field).value;
	},
null	];

;
	c.pargs__run =  [];
	c.pinst__run =  [
/*0*/	function (e,f) { e.php_builtin (0, "wait_for_input", 0); },
	function (e,f) { var t1434 = f.s[0]; e.return_pop (t1434); },
null	];

;
	c.pargs__close =  [];
	c.pinst__close =  [
/*0*/	function (e,f) { e.mcall (2, (f.v["this"]).pop, "close", ([])); },
null	];

;
	c.pargs__close_by_hiding =  [];
	c.pinst__close_by_hiding =  [
/*0*/	function (e,f) { e.mcall (2, (f.v["this"]).pop, "close_by_hiding", ([])); },
null	];

;
	c.args__quick = c.pargs__quick =  ["title","fields","use_ok","use_cancel"];
	c.inst__quick = c.pinst__quick =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		e.mcall (6, f.v.pop, "initialise", ([0, 0, f.v.title, f.v.fields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([f.v.use_ok, f.v.use_cancel])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) { f.v.res = null; },
	function (e,f) {
		f.pc=6;
		e.mcall (2, f.v.pop, "run", ([]));
	},
/*5*/	function (e,f) {
		f.pc=13;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		var t1438 = f.s[0]; f.v.event = t1438;
		f.v.action = (f.v.event).action;
		if (((f.v.action)) == (("cover"))) f.pc=8; else f.pc=9;
	},
	function (e,f) { if (((f.v.action)) == (("OK"))) f.pc=11; else f.pc=4; },
	function (e,f) {
		f.pc=10;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = ((f.v.action)) == (("cancel")); },
/*10*/	function (e,f) { var t1440 = f.s[0]; if (t1440) f.pc=5; else f.pc=7; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		f.pc=5;
		var t1442 = f.s[0]; f.v.res = t1442;
	},
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
};
popupform.init_methods (popupform);
rpcclass.setup_class (popupform, "popupform",0, (["pop","html","width","height","listeners"]), ([0,0,0,0,2]));
function popupdate () { this.do_construct (arguments); }
popupdate.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		f.v.month = builtin__date ("m",(f.v["this"]).curdate);
		f.v.year = builtin__date ("Y",(f.v["this"]).curdate);
		f.v.prevmonth = builtin__mktime (0,0,0,parseInt((f.v.month),10) - parseInt((1),10),1,f.v.year);
		f.v.nextmonth = builtin__mktime (0,0,0,parseInt((f.v.month),10) + parseInt((1),10),1,f.v.year);
		e.php_builtin (0, "ob_start", 0);
		window.__outbuffer += "\n<div style=\"text-align:center;width:205px;font-family:arial\">\n<a style=\"float:left;font-size:70%\" href=\"#\" onclick=\"";
		e.mcall (4, f.v["this"], "render_resume", (["move", f.v.prevmonth]));
	},
	function (e,f) {
		var t1447 = f.s[0]; window.__outbuffer += t1447;
		window.__outbuffer += "\">&lt;&lt;";
		window.__outbuffer += builtin__date ("M-y",f.v.prevmonth);
		window.__outbuffer += "</a>\n<a style=\"float:right;font-size:70%\" href=\"#\" onclick=\"";
		e.mcall (4, f.v["this"], "render_resume", (["move", f.v.nextmonth]));
	},
	function (e,f) {
		var t1448 = f.s[0]; window.__outbuffer += t1448;
		window.__outbuffer += "\">";
		window.__outbuffer += builtin__date ("M-y",f.v.nextmonth);
		window.__outbuffer += "&gt;&gt;</a>\n";
		window.__outbuffer += builtin__date ("F",(f.v["this"]).curdate);
		window.__outbuffer += "<br/>\n";
		window.__outbuffer += builtin__date ("Y",(f.v["this"]).curdate);
		window.__outbuffer += "\n</div>\n\n<table style=\"width:100%\">\n<tr>\n";
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=5;
		if (!(((f.v.i)) < ((7)))) f.pc=4;
	},
	function (e,f) {
		f.pc=6;
		window.__outbuffer += "</tr>";
		f.v.dim = builtin__cal_days_in_month (0,f.v.month,f.v.year);
		f.v.dow = builtin__date ("w",builtin__mktime (0,0,0,f.v.month,1,f.v.year));
		f.v.firstday = parseInt((1),10) - parseInt((f.v.dow),10);
		f.v.taildays = parseInt((7),10) - parseInt((((parseInt((f.v.dow),10) + parseInt((f.v.dim),10))) % ((7))),10);
		f.v.lastday = parseInt((f.v.dim),10) + parseInt((f.v.taildays),10);
		f.v.day = f.v.firstday;
	},
/*5*/	function (e,f) {
		f.pc=3;
		f.v.day = builtin__date ("D",builtin__mktime (0,0,0,1,parseInt((f.v.i),10) + parseInt((2),10),2000));
		window.__outbuffer += ("<th>") + ("" + (f.v.day) + ("</th>"));
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=8;
		f.s[0] = f.v.lastday;
		f.s[1] = f.v.day;
		e.php_two_op (2, "<=");
		var t1458 = f.s[0]; if (!(t1458)) f.pc=7;
	},
	function (e,f) { if (((f.v.dow)) != ((6))) f.pc=20; else f.pc=21; },
	function (e,f) {
		f.v.thisday = builtin__mktime (0,0,0,f.v.month,f.v.day,f.v.year);
		f.v.dow = builtin__date ("w",f.v.thisday);
		if (((f.v.dow)) == ((0))) f.pc=9; else f.pc=10;
	},
	function (e,f) { window.__outbuffer += "<tr>"; },
/*10*/	function (e,f) {
		f.v.style = "";
		f.v.boxstyle = "";
		if (((f.v.thisday)) == (((f.v["this"]).olddate))) f.pc=11; else f.pc=12;
	},
	function (e,f) { f.v.boxstyle = "" + (f.v.boxstyle) + ("background:#c0c0ff;"); },
	function (e,f) { if (((builtin__date ("m",f.v.thisday))) != ((builtin__date ("m",(f.v["this"]).curdate)))) f.pc=13; else f.pc=14; },
	function (e,f) { f.v.style = "" + (f.v.style) + ("color:#c0c0c0;"); },
	function (e,f) { if (((f.v.thisday)) == (((f.v["this"]).today))) f.pc=15; else f.pc=16; },
/*15*/	function (e,f) { f.v.style = "" + (f.v.style) + ("border: solid 1px red;"); },
	function (e,f) {
		f.v.boxstyle = "" + (f.v.boxstyle) + ("text-align:center;");
		f.v.style = "" + (f.v.style) + ("text-decoration:none;");
		window.__outbuffer += ("<td style=\"") + ("" + (f.v.boxstyle) + ("\">"));
		f.s[0] = ("\">") + ("" + (builtin__date ("j",f.v.thisday)) + ("</a>"));
		e.mcall (5, f.v["this"], "render_resume", (["pick_date", f.v.thisday]));
	},
	function (e,f) {
		var t1468 = f.s[1]; var t1469 = f.s[0]; 
		window.__outbuffer += ("<a class=\"calendarButtons\" style=\"") + ("" + (f.v.style) + (("\" href=\"#\" onclick=\"") + ("" + (t1468) + (t1469))));
		window.__outbuffer += "</td>";
		if (((f.v.dow)) == ((6))) f.pc=18; else f.pc=19;
	},
	function (e,f) { window.__outbuffer += "</tr>"; },
	function (e,f) {
		f.pc=6;
		e.php_push_var_lvalue (0, "day");
		e.php_postinc (1);
	},
/*20*/	function (e,f) { window.__outbuffer += "</tr>"; },
	function (e,f) {
		window.__outbuffer += "\n</table>\n";
		e.php_builtin (0, "ob_get_clean", 0);
		var t1471 = f.s[0]; e.return_pop (t1471);
	},
null	];

;
	c.pargs__fields =  [];
	c.pinst__fields =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "render", ([])); },
	function (e,f) {
		var t1472 = f.s[0]; 
		f.v.res = ([({name:"cal", type:"html", html:t1472})]);
		f.v.this_month = builtin__mktime (0,0,0,builtin__date ("m"),builtin__date ("d"),builtin__date ("Y"));
		if (((builtin__date ("Y-m"))) != ((builtin__date ("Y-m",(f.v["this"]).curdate)))) f.pc=2; else f.pc=4;
	},
	function (e,f) { e.mcall (4, f.v["this"], "render_resume", (["move", f.v.this_month])); },
	function (e,f) {
		var t1475 = f.s[0]; 
		f.v.res[f.v.res.length] = ({name:"today", type:"button", label:"This month", action:t1475});
	},
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.pargs__run_dialog =  [];
	c.pinst__run_dialog =  [
/*0*/	function (e,f) {
		f.v["this"].today = builtin__mktime (0,0,0,builtin__date ("m"),builtin__date ("d"),builtin__date ("Y"));
		f.v.pop = new popupform;
		e.mcall (2, f.v["this"], "fields", ([]));
	},
	function (e,f) { var t1479 = f.s[0]; e.mcall (6, f.v.pop, "initialise", ([220, 250, "" + ((f.v["this"]).title) + ("X"), t1479])); },
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([false, true])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) { f.v["this"].result = null; },
/*5*/	function (e,f) {
		f.pc=7;
		e.mcall (2, f.v["this"], "fields", ([]));
	},
	function (e,f) {
		f.pc=-1;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) { var t1481 = f.s[0]; e.mcall (3, f.v.pop, "set_content", ([t1481])); },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t1483 = f.s[0]; f.v.event = t1483;
		f.v.action = (f.v.event).action;
		if (((f.v.action)) == (("cover"))) f.pc=15; else f.pc=16;
	},
/*10*/	function (e,f) { f.pc=6; },
	function (e,f) { if (((f.v.action)) == (("move"))) f.pc=12; else f.pc=13; },
	function (e,f) {
		f.pc=5;
		f.v["this"].curdate = (f.v.event).parm;
	},
	function (e,f) { if (((f.v.action)) == (("pick_date"))) f.pc=14; else f.pc=5; },
	function (e,f) {
		f.pc=6;
		f.v["this"].result = (f.v.event).parm;
	},
/*15*/	function (e,f) {
		f.pc=17;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = ((f.v.action)) == (("cancel")); },
	function (e,f) { var t1487 = f.s[0]; if (t1487) f.pc=10; else f.pc=11; },
null	];

;
	c.args__run = c.pargs__run =  ["title","olddate"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) {
		f.v.pd = new popupdate;
		f.v.pd.title = f.v.title;
		f.v.pd.result = f.v.olddate;
		f.v.pd.olddate = f.v.olddate;
		f.v.pd.curdate = f.v.olddate;
		e.mcall (2, f.v.pd, "run_dialog", ([]));
	},
	function (e,f) { e.return_pop ((f.v.pd).result); },
null	];

;
};
popupdate.init_methods (popupdate);
rpcclass.setup_class (popupdate, "popupdate",0, (["olddate","curdate","title","listeners"]), ([0,0,0,2]));
function menu () { this.do_construct (arguments); }
menu.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__create = c.pargs__create =  [];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.x = new menu;
		f.v.x.list = ([]);
		e.return_pop (f.v.x);
	},
null	];

;
	c.pargs__add_item =  ["key","text"];
	c.pinst__add_item =  [
/*0*/	function (e,f) {
		f.v.item = ({});
		f.v.item.key = f.v.key;
		f.v.item.value = f.v.text;
		(f.v["this"]).list[(f.v["this"]).list.length] = f.v.item;
	},
null	];

;
	c.pargs__add_submenu =  ["text","submenu"];
	c.pinst__add_submenu =  [
/*0*/	function (e,f) {
		f.v.item = ({});
		f.v.item.value = f.v.text;
		f.v.item.submenu = f.v.submenu;
		(f.v["this"]).list[(f.v["this"]).list.length] = f.v.item;
	},
null	];

;
	c.compare_values = cp.compare_values =  function (row1,row2)
	{
{
		if (row1["value"] < row2["value"])
		{return (0 - 1) }
		;
		if (row1["value"] > row2["value"])
		{return (1) }
		;
		return (0);
		}
			}

;
	c.pargs__sort =  [];
	c.pinst__sort =  [
/*0*/	function (e,f) { f.s[0] = builtin__usort ((f.v["this"]).list,(["menu", "compare_values"])); },
null	];

;
	c.pargs__length =  [];
	c.pinst__length =  [
/*0*/	function (e,f) { e.return_pop (builtin__count ((f.v["this"]).list)); },
null	];

;
	c.pargs__item =  ["i"];
	c.pinst__item =  [
/*0*/	function (e,f) { e.return_pop (((f.v["this"]).list)[(f.v.i)]); },
null	];

;
	c.pargs__get =  ["value"];
	c.pinst__get =  [
/*0*/	function (e,f) { f.v._k62 = e.enumkeys ((f.v["this"]).list); },
	function (e,f) {
		f.pc=3;
		if (!((f.v._k62).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.v._i63 = (f.v._k62).shift();
		f.v.item = ((f.v["this"]).list)[(f.v._i63)];
		f.s[0] = builtin__debugout (("item['value'] = ") + ((f.v.item).value));
		if ((((f.v.item).value)) == ((f.v.value))) f.pc=4; else f.pc=1;
	},
	function (e,f) { if (((f.v.item).submenu) !== undefined) f.pc=5; else f.pc=6; },
/*5*/	function (e,f) { e.return_pop ((f.v.item).submenu); },
	function (e,f) { e.return_pop ((f.v.item).key); },
null	];

;
};
menu.init_methods (menu);
rpcclass.setup_class (menu, "menu",0, (["list","listeners"]), ([0,2]));
function popupmenu () { this.do_construct (arguments); }
popupmenu.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__open_menu = c.pargs__open_menu =  ["menuitems","depth","x","y","no_cover"];
	c.inst__open_menu = c.pinst__open_menu =  [
/*0*/	function (e,f) {
		f.v.columns = parseInt (parseInt((((builtin__count ((f.v.menuitems).list))) / ((30))),10) + parseInt((1),10),10);
		if (((builtin__count ((f.v.menuitems).list))) > ((30))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.pc=3;
		f.s[0] = 30;
	},
	function (e,f) { f.s[0] = builtin__count ((f.v.menuitems).list); },
	function (e,f) {
		var t703 = f.s[0]; f.v.rows = t703;
		f.v.popup = new popup;
		e.mcall (2, f.v.popup, "initialise", ([]));
	},
	function (e,f) { if (((f.v.x)) != ((parseInt((0),10) - parseInt((1),10)))) f.pc=6; else f.pc=7; },
/*5*/	function (e,f) {
		f.pc=9;
		e.mcall (4, f.v.popup, "set_coordinates", ([f.v.x, f.v.y]));
	},
	function (e,f) {
		f.pc=8;
		f.s[0] = ((f.v.y)) != ((parseInt((0),10) - parseInt((1),10)));
	},
	function (e,f) { f.s[0] = false; },
	function (e,f) { var t705 = f.s[0]; if (t705) f.pc=5; else f.pc=9; },
	function (e,f) { if (f.v.no_cover) f.pc=10; else f.pc=11; },
/*10*/	function (e,f) { e.mcall (2, f.v.popup, "no_cover", ([])); },
	function (e,f) {
		f.v.contents = "";
		f.v.divopen = false;
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=14;
		if (!(((f.v.i)) < ((builtin__count ((f.v.menuitems).list))))) f.pc=13;
	},
	function (e,f) { if (f.v.divopen) f.pc=26; else f.pc=27; },
	function (e,f) { if (((((f.v.i)) % ((30)))) == ((0))) f.pc=15; else f.pc=16; },
/*15*/	function (e,f) {
		f.v.contents = "" + (f.v.contents) + ("<div class=\"newpopupmenu\" style=\"float:left; clear:none; font-family:arial; font-size:11px\">");
		f.v.divopen = true;
	},
	function (e,f) { if (((((f.v.menuitems).list)[(f.v.i)]).submenu) !== undefined) f.pc=17; else f.pc=18; },
	function (e,f) {
		f.pc=19;
		f.v.contents = "" + (f.v.contents) + ("<div style=\"float:right; clear:none\">&gt;</div>");
	},
	function (e,f) { f.v.contents = "" + (f.v.contents) + ("<div style=\"float:right; clear:none\">&nbsp;</div>"); },
	function (e,f) {
		f.v.contents = "" + (f.v.contents) + (("<div id=\"popupmenuitem-") + ("" + (f.v.depth) + (("-") + ("" + (f.v.i) + ("\"")))));
		f.s[0] = "\"";
		e.smcall (3, popupmenu,"render_resume", (["select", ([f.v.depth, f.v.i])]));
	},
/*20*/	function (e,f) {
		var t714 = f.s[1]; var t715 = f.s[0]; 
		f.v.contents = "" + (f.v.contents) + ((" onclick=\"") + ("" + (t714) + (t715)));
		f.s[0] = "\"";
		e.smcall (3, popupmenu,"render_resume", (["down", ([f.v.depth, f.v.i])]));
	},
	function (e,f) {
		var t717 = f.s[1]; var t718 = f.s[0]; 
		f.v.contents = "" + (f.v.contents) + ((" onmousedown=\"") + ("" + (t717) + (t718)));
		f.s[0] = "\"";
		e.smcall (3, popupmenu,"render_resume", (["over", ([f.v.depth, f.v.i])]));
	},
	function (e,f) {
		var t720 = f.s[1]; var t721 = f.s[0]; 
		f.v.contents = "" + (f.v.contents) + ((" onmouseover=\"") + ("" + (t720) + (t721)));
		f.s[0] = "\"";
		e.smcall (3, popupmenu,"render_resume", (["out", ([f.v.depth, f.v.i])]));
	},
	function (e,f) {
		var t723 = f.s[1]; var t724 = f.s[0]; 
		f.v.contents = "" + (f.v.contents) + ((" onmouseout=\"") + ("" + (t723) + (t724)));
		f.v.contents = "" + (f.v.contents) + (" style=\"padding-top:2px;padding-bottom:2px\"");
		f.v.contents = "" + (f.v.contents) + ((">") + ((((f.v.menuitems).list)[(f.v.i)]).value));
		f.v.contents = "" + (f.v.contents) + ("</div>");
		if (((((f.v.i)) % ((30)))) == ((29))) f.pc=24; else f.pc=25;
	},
	function (e,f) {
		f.v.contents = "" + (f.v.contents) + ("</div>");
		f.v.divopen = false;
	},
/*25*/	function (e,f) {
		f.pc=12;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) { f.v.contents = "" + (f.v.contents) + ("</div>"); },
	function (e,f) {
		f.v.width = ((150)) * ((f.v.columns));
		f.v.height = parseInt((((15)) * ((f.v.rows))),10) + parseInt((5),10);
		if (f.v.depth) f.pc=28; else f.pc=35;
	},
	function (e,f) {
		f.pc=32;
		f.s[0] = 50;
		e.smcall (1, browser,"scroll_left", ([]));
	},
	function (e,f) {
		f.s[0] = 20;
		f.s[1] = 150;
		f.s[2] = f.v.width;
		e.mcall (5, f.v.popup, "get_x", ([]));
	},
/*30*/	function (e,f) {
		var t735 = f.s[3]; var t736 = f.s[2]; 
		var t737 = f.s[1]; 
		var t738 = f.s[0]; 
		f.v.new_x = parseInt((parseInt((parseInt((t735),10) - parseInt((t736),10)),10) - parseInt((t737),10)),10) - parseInt((t738),10);
		e.mcall (2, f.v.popup, "get_y", ([]));
	},
	function (e,f) {
		f.pc=35;
		var t740 = f.s[0]; e.mcall (4, f.v.popup, "set_coordinates", ([f.v.new_x, t740]));
	},
	function (e,f) {
		var t741 = f.s[1]; var t742 = f.s[0]; f.s[0] = parseInt((t741),10) - parseInt((t742),10);
		e.smcall (1, browser,"window_width", ([]));
	},
	function (e,f) {
		var t743 = f.s[1]; var t744 = f.s[0]; f.s[0] = parseInt((t743),10) + parseInt((t744),10);
		f.s[1] = f.v.width;
		e.mcall (4, f.v.popup, "get_x", ([]));
	},
	function (e,f) {
		var t745 = f.s[2]; var t746 = f.s[1]; 
		var t747 = f.s[0]; 
		if (((parseInt((t745),10) + parseInt((t746),10))) > ((t747))) f.pc=29; else f.pc=35;
	},
/*35*/	function (e,f) { e.mcall (5, f.v.popup, "open", ([0, 0, f.v.contents])); },
	function (e,f) {
		f.v.res = ({});
		f.v.res.menuitems = f.v.menuitems;
		f.v.res.popup = f.v.popup;
		f.v.res.width = f.v.width;
		f.v.res.height = f.v.height;
		f.s[0] = parseInt((f.v.width),10) + parseInt((10),10);
		e.mcall (3, f.v.popup, "get_x", ([]));
	},
	function (e,f) {
		var t753 = f.s[1]; var t754 = f.s[0]; 
		f.v.res.right = parseInt((t753),10) + parseInt((t754),10);
		e.mcall (2, f.v.popup, "get_y", ([]));
	},
	function (e,f) {
		var t757 = f.s[0]; f.v.res.top = t757;
		e.return_pop (f.v.res);
	},
null	];

;
	c.args__highlight = c.pargs__highlight =  ["depth","index"];
	c.inst__highlight = c.pinst__highlight =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([("popupmenuitem-") + ("" + (f.v.depth) + (("-") + (f.v.index)))])); },
	function (e,f) {
		var t759 = f.s[0]; f.v.el = t759;
		(f.v.el).style.color = "#fff";
		(f.v.el).style.background = "#4d5e99";
	},
null	];

;
	c.args__unhighlight = c.pargs__unhighlight =  ["depth","index"];
	c.inst__unhighlight = c.pinst__unhighlight =  [
/*0*/	function (e,f) { e.mcall (3, document, "getElementById", ([("popupmenuitem-") + ("" + (f.v.depth) + (("-") + (f.v.index)))])); },
	function (e,f) {
		var t763 = f.s[0]; f.v.el = t763;
		if (f.v.el) f.pc=2; else f.pc=-1;
	},
	function (e,f) {
		(f.v.el).style.color = "";
		(f.v.el).style.background = "";
	},
null	];

;
	c.args__create = c.pargs__create =  ["menuitems"];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.pm = new popupmenu;
		f.v.pm.menuitems = f.v.menuitems;
		e.smcall (2, popupmenu,"start_interval_timer", ([100, "menutimer"]));
	},
	function (e,f) {
		var t769 = f.s[0]; f.v.pm.it = t769;
		f.v.pm.popups = ([]);
		f.v.pm.depth = 0;
		f.v.pm.no_cover = false;
		f.v.pm.tid = null;
		e.return_pop (f.v.pm);
	},
null	];

;
	c.pargs__no_cover =  [];
	c.pinst__no_cover =  [
/*0*/	function (e,f) { f.v["this"].no_cover = true; },
null	];

;
	c.pargs__do_run =  [];
	c.pinst__do_run =  [
/*0*/	function (e,f) { e.smcall (0, php_engine,"get_current_thread_id", ([])); },
	function (e,f) {
		var t776 = f.s[0]; f.v["this"].tid = t776;
		e.smcall (5, popupmenu,"open_menu", ([(f.v["this"]).menuitems, 0, parseInt((0),10) - parseInt((1),10), parseInt((0),10) - parseInt((1),10), (f.v["this"]).no_cover]));
	},
	function (e,f) { var t778 = f.s[0]; (f.v["this"]).popups[0] = t778; },
	function (e,f) {
		f.pc=5;
		e.php_builtin (0, "wait_for_input", 0);
	},
	function (e,f) {
		f.v["this"].tid = null;
		e.return_pop (f.v.res);
	},
/*5*/	function (e,f) {
		var t781 = f.s[0]; f.v.ev = t781;
		f.v.cmd = (f.v.ev).action;
		f.v.val = (f.v.ev).parm;
		if (((f.v.cmd)) == (("down"))) f.pc=3; else f.pc=6;
	},
	function (e,f) { if (((f.v.cmd)) == (("over"))) f.pc=7; else f.pc=21; },
	function (e,f) {
		f.v.xdepth = (f.v.val)[(0)];
		f.v.xindex = (f.v.val)[(1)];
		f.v.i = f.v.xdepth;
	},
	function (e,f) {
		f.pc=10;
		if (!(((f.v.i)) < (((f.v["this"]).depth)))) f.pc=9;
	},
	function (e,f) {
		f.pc=12;
		e.smcall (2, popupmenu,"highlight", ([f.v.xdepth, f.v.xindex]));
	},
/*10*/	function (e,f) { e.smcall (2, popupmenu,"unhighlight", ([f.v.i, (((f.v["this"]).popups)[(f.v.i)]).active])); },
	function (e,f) {
		f.pc=8;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) { f.v.i = 0; },
	function (e,f) {
		f.pc=15;
		if (!(((f.v.i)) < ((f.v.xdepth)))) f.pc=14;
	},
	function (e,f) { if ((((((((f.v["this"]).popups)[(f.v.xdepth)]).menuitems).list)[(f.v.xindex)]).submenu) !== undefined) f.pc=18; else f.pc=19; },
/*15*/	function (e,f) { e.smcall (2, popupmenu,"highlight", ([f.v.i, (((f.v["this"]).popups)[(f.v.i)]).active])); },
	function (e,f) {
		f.pc=13;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) {
		f.pc=3;
		f.v.menutimer = 4;
		f.v.timeractivate_depth = f.v.xdepth;
		f.v.timeractivate_index = f.v.xindex;
	},
	function (e,f) {
		f.pc=20;
		f.s[0] = (((((f.v["this"]).popups)[(f.v.xdepth)]).active)) != ((f.v.xindex));
	},
	function (e,f) { f.s[0] = false; },
/*20*/	function (e,f) { var t793 = f.s[0]; if (t793) f.pc=17; else f.pc=3; },
	function (e,f) { if (((f.v.cmd)) == (("out"))) f.pc=22; else f.pc=28; },
	function (e,f) {
		f.v.xdepth = (f.v.val)[(0)];
		f.v.xindex = (f.v.val)[(1)];
		e.smcall (2, popupmenu,"unhighlight", ([f.v.xdepth, f.v.xindex]));
	},
	function (e,f) { f.v.i = 0; },
	function (e,f) {
		f.pc=26;
		if (!(((f.v.i)) < (((f.v["this"]).depth)))) f.pc=25;
	},
/*25*/	function (e,f) {
		f.pc=3;
		f.v.menutimer = 0;
	},
	function (e,f) { e.smcall (2, popupmenu,"highlight", ([f.v.i, (((f.v["this"]).popups)[(f.v.i)]).active])); },
	function (e,f) {
		f.pc=24;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) { if (((f.v.cmd)) == (("select"))) f.pc=29; else f.pc=38; },
	function (e,f) {
		f.v.xdepth = (f.v.val)[(0)];
		f.v.xindex = (f.v.val)[(1)];
	},
/*30*/	function (e,f) {
		f.pc=32;
		if (!(((f.v.xdepth)) < (((f.v["this"]).depth)))) f.pc=31;
	},
	function (e,f) { if ((((((((f.v["this"]).popups)[((f.v["this"]).depth)]).menuitems).list)[(f.v.xindex)]).submenu) !== undefined) f.pc=34; else f.pc=37; },
	function (e,f) { e.mcall (2, (((f.v["this"]).popups)[((f.v["this"]).depth)]).popup, "close", ([])); },
	function (e,f) {
		f.pc=30;
		f.s[0] = "depth";
		f.s[1] = f.v["this"];
		e.php_deref_lvalue (2);
		e.php_postdec (1);
	},
	function (e,f) {
		f.v.submenu = ((((((f.v["this"]).popups)[((f.v["this"]).depth)]).menuitems).list)[(f.v.xindex)]).submenu;
		((f.v["this"]).popups)[((f.v["this"]).depth)].active = f.v.xindex;
		e.smcall (2, popupmenu,"highlight", ([f.v.xdepth, f.v.xindex]));
	},
/*35*/	function (e,f) {
		f.v.x = (((f.v["this"]).popups)[((f.v["this"]).depth)]).right;
		f.v.y = parseInt(((((f.v["this"]).popups)[((f.v["this"]).depth)]).top),10) + parseInt((((f.v.xindex)) * ((15))),10);
		f.s[0] = "depth";
		f.s[1] = f.v["this"];
		e.php_deref_lvalue (2);
		e.php_postinc (1);
		e.smcall (5, popupmenu,"open_menu", ([f.v.submenu, (f.v["this"]).depth, f.v.x, f.v.y, true]));
	},
	function (e,f) {
		f.pc=3;
		var t808 = f.s[0]; (f.v["this"]).popups[(f.v["this"]).depth] = t808;
	},
	function (e,f) {
		f.pc=4;
		f.v.res = ((((((f.v["this"]).popups)[(f.v.xdepth)]).menuitems).list)[(f.v.xindex)]).key;
	},
	function (e,f) { if (((f.v.cmd)) == (("cover"))) f.pc=39; else f.pc=40; },
	function (e,f) {
		f.pc=4;
		f.v.res = null;
	},
/*40*/	function (e,f) { if (((f.v.cmd)) == (("menutimer"))) f.pc=41; else f.pc=3; },
	function (e,f) { if (f.v.menutimer) f.pc=42; else f.pc=3; },
	function (e,f) {
		e.php_push_var_lvalue (0, "menutimer");
		e.php_postdec (1);
		if (!(f.v.menutimer)) f.pc=43; else f.pc=3;
	},
	function (e,f) {
		f.v.xdepth = f.v.timeractivate_depth;
		f.v.xindex = f.v.timeractivate_index;
	},
	function (e,f) {
		f.pc=46;
		if (!(((f.v.xdepth)) < (((f.v["this"]).depth)))) f.pc=45;
	},
/*45*/	function (e,f) { if ((((((((f.v["this"]).popups)[((f.v["this"]).depth)]).menuitems).list)[(f.v.xindex)]).submenu) !== undefined) f.pc=48; else f.pc=3; },
	function (e,f) { e.mcall (2, (((f.v["this"]).popups)[((f.v["this"]).depth)]).popup, "close", ([])); },
	function (e,f) {
		f.pc=44;
		f.s[0] = "depth";
		f.s[1] = f.v["this"];
		e.php_deref_lvalue (2);
		e.php_postdec (1);
	},
	function (e,f) {
		f.v.submenu = ((((((f.v["this"]).popups)[((f.v["this"]).depth)]).menuitems).list)[(f.v.xindex)]).submenu;
		((f.v["this"]).popups)[((f.v["this"]).depth)].active = f.v.xindex;
		e.smcall (2, popupmenu,"highlight", ([f.v.xdepth, f.v.xindex]));
	},
	function (e,f) {
		f.v.x = (((f.v["this"]).popups)[((f.v["this"]).depth)]).right;
		f.v.y = parseInt(((((f.v["this"]).popups)[((f.v["this"]).depth)]).top),10) + parseInt((((f.v.xindex)) * ((15))),10);
		f.s[0] = "depth";
		f.s[1] = f.v["this"];
		e.php_deref_lvalue (2);
		e.php_postinc (1);
		e.smcall (5, popupmenu,"open_menu", ([f.v.submenu, (f.v["this"]).depth, f.v.x, f.v.y, true]));
	},
/*50*/	function (e,f) {
		f.pc=3;
		var t821 = f.s[0]; (f.v["this"]).popups[(f.v["this"]).depth] = t821;
	},
null	];

;
	c.pargs__close =  [];
	c.pinst__close =  [
/*0*/	function (e,f) {  },
	function (e,f) { e.mcall (2, (((f.v["this"]).popups)[((f.v["this"]).depth)]).popup, "close", ([])); },
	function (e,f) { if ((((f.v["this"]).depth)) == ((0))) f.pc=3; else f.pc=4; },
	function (e,f) {
		f.pc=-1;
		e.smcall (1, popupmenu,"stop_interval_timer", ([(f.v["this"]).it]));
	},
	function (e,f) {
		f.pc=1;
		f.s[0] = "depth";
		f.s[1] = f.v["this"];
		e.php_deref_lvalue (2);
		e.php_postdec (1);
	},
null	];

;
	c.pargs__destroy =  [];
	c.pinst__destroy =  [
/*0*/	function (e,f) { if ((((f.v["this"]).tid)) !== ((null))) f.pc=1; else f.pc=2; },
	function (e,f) { e.smcall (1, php_engine,"destroy_thread", ([(f.v["this"]).tid])); },
	function (e,f) { e.mcall (2, f.v["this"], "close", ([])); },
null	];

;
	c.args__run = c.pargs__run =  ["menuitems"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) { if (((builtin__count ((f.v.menuitems).list))) == ((0))) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop (null); },
	function (e,f) { e.smcall (1, popupmenu,"create", ([f.v.menuitems])); },
	function (e,f) {
		var t824 = f.s[0]; f.v.pm = t824;
		e.mcall (2, f.v.pm, "do_run", ([]));
	},
	function (e,f) {
		var t826 = f.s[0]; f.v.res = t826;
		e.mcall (2, f.v.pm, "close", ([]));
	},
/*5*/	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.args__quick = c.pargs__quick =  ["items"];
	c.inst__quick = c.pinst__quick =  [
/*0*/	function (e,f) { e.smcall (0, menu,"create", ([])); },
	function (e,f) {
		var t828 = f.s[0]; f.v.m = t828;
		f.v._k64 = e.enumkeys (f.v.items);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k64).length)) f.pc=3;
	},
	function (e,f) {
		f.pc=5;
		e.smcall (1, popupmenu,"run", ([f.v.m]));
	},
	function (e,f) {
		f.pc=2;
		f.s[0] = f.v._i65 = (f.v._k64).shift();
		f.s[1] = f.v.it = (f.v.items)[(f.v._i65)];
		e.mcall (6, f.v.m, "add_item", ([f.v.it, f.v.it]));
	},
/*5*/	function (e,f) { var t832 = f.s[0]; e.return_pop (t832); },
null	];

;
};
popupmenu.init_methods (popupmenu);
rpcclass.setup_class (popupmenu, "popupmenu",0, (["menuitems","popups","depth","it","tid","no_cover","listeners"]), ([0,0,0,0,0,0,2]));
function popupeditbox () { this.do_construct (arguments); }
popupeditbox.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__run_helper = c.pargs__run_helper =  ["width","height","title","old_value","fieldtype"];
	c.inst__run_helper = c.pinst__run_helper =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.field = ({type:f.v.fieldtype, name:"inbox", label:"", focus:true, value:f.v.old_value, width:"400"});
		if (((f.v.width)) == ((0))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		f.pc=3;
		f.v.field.width = "500";
	},
	function (e,f) { f.v.field.width = parseInt((f.v.width),10) - parseInt((20),10); },
	function (e,f) {
		f.v.fields = ([f.v.field]);
		e.mcall (6, f.v.pop, "initialise", ([f.v.width, f.v.height, f.v.title, f.v.fields]));
	},
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
/*5*/	function (e,f) { f.v.res = ""; },
	function (e,f) {
		f.pc=8;
		e.mcall (2, f.v.pop, "run", ([]));
	},
	function (e,f) {
		f.pc=18;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		var t1645 = f.s[0]; f.v.event = t1645;
		if ((((f.v.event).action)) == (("cancel"))) f.pc=9; else f.pc=10;
	},
	function (e,f) {
		f.pc=7;
		f.v.res = null;
	},
/*10*/	function (e,f) { if (builtin__is_array (f.v.action)) f.pc=11; else f.pc=13; },
	function (e,f) {
		f.v.reason = (f.v.action)[(0)];
		f.v.parm = (f.v.action)[(1)];
		if (((f.v.reason)) == (("select"))) f.pc=12; else f.pc=6;
	},
	function (e,f) {
		f.pc=7;
		f.v.res = (f.v.action)[(1)];
	},
	function (e,f) { if ((((f.v.event).action)) == (("OK"))) f.pc=14; else f.pc=16; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
/*15*/	function (e,f) {
		f.pc=7;
		var t1651 = f.s[0]; f.v.vals = t1651;
		f.v.res = (f.v.vals).inbox;
	},
	function (e,f) { if ((((f.v.event).action)) == (("cover"))) f.pc=17; else f.pc=6; },
	function (e,f) {
		f.pc=7;
		f.v.res = null;
	},
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.args__run = c.pargs__run =  ["width","height","title","old_value"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) { e.smcall (5, popupeditbox,"run_helper", ([f.v.width, f.v.height, f.v.title, f.v.old_value, "text"])); },
	function (e,f) { var t1654 = f.s[0]; e.return_pop (t1654); },
null	];

;
	c.args__runpw = c.pargs__runpw =  ["width","height","title","old_value"];
	c.inst__runpw = c.pinst__runpw =  [
/*0*/	function (e,f) { e.smcall (5, popupeditbox,"run_helper", ([f.v.width, f.v.height, f.v.title, f.v.old_value, "password"])); },
	function (e,f) { var t1655 = f.s[0]; e.return_pop (t1655); },
null	];

;
};
popupeditbox.init_methods (popupeditbox);
rpcclass.setup_class (popupeditbox, "popupeditbox",0, (["listeners"]), ([2]));
function popupcombobox () { this.do_construct (arguments); }
popupcombobox.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__run = c.pargs__run =  ["width","height","title","list","allow_manual","old_value"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		f.v.options = ([]);
		f.v._k102 = e.enumkeys (f.v.list);
	},
	function (e,f) {
		f.pc=3;
		if (!((f.v._k102).length)) f.pc=2;
	},
	function (e,f) {
		f.v.fields[f.v.fields.length] = ({type:"table", name:"pages", label:"", options:f.v.options});
		if (f.v.allow_manual) f.pc=5; else f.pc=6;
	},
	function (e,f) {
		f.s[0] = f.v._i103 = (f.v._k102).shift();
		f.s[1] = f.v.item = (f.v.list)[(f.v._i103)];
		f.s[2] = ("\">") + ("" + (f.v.item) + ("</a></td>"));
		e.smcall (5, popupcombobox,"render_resume", (["select", f.v.item]));
	},
	function (e,f) {
		f.pc=1;
		var t1663 = f.s[3]; var t1664 = f.s[2]; 
		f.v.options[f.v.options.length] = ("<td><a href=\"#\" onclick=\"") + ("" + (t1663) + (t1664));
	},
/*5*/	function (e,f) { f.v.fields[f.v.fields.length] = ({type:"text", name:"inbox", label:"", focus:true, value:f.v.old_value}); },
	function (e,f) { e.mcall (6, f.v.pop, "initialise", ([f.v.width, f.v.height, f.v.title, f.v.fields])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) { f.v.res = ""; },
	function (e,f) {
		f.pc=11;
		e.mcall (2, f.v.pop, "run", ([]));
	},
/*10*/	function (e,f) {
		f.pc=20;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		var t1669 = f.s[0]; f.v.event = t1669;
		f.v.action = (f.v.event).action;
		if (((f.v.action)) == (("cancel"))) f.pc=12; else f.pc=13;
	},
	function (e,f) {
		f.pc=10;
		f.v.res = null;
	},
	function (e,f) { if (((f.v.action)) == (("select"))) f.pc=14; else f.pc=15; },
	function (e,f) {
		f.pc=10;
		f.v.res = (f.v.event).parm;
	},
/*15*/	function (e,f) { if (((f.v.action)) == (("OK"))) f.pc=16; else f.pc=18; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		f.pc=10;
		var t1674 = f.s[0]; f.v.vals = t1674;
		f.v.res = (f.v.vals).inbox;
	},
	function (e,f) { if (((f.v.action)) == (("cover"))) f.pc=19; else f.pc=9; },
	function (e,f) {
		f.pc=10;
		f.v.res = null;
	},
/*20*/	function (e,f) { e.return_pop (f.v.res); },
null	];

;
};
popupcombobox.init_methods (popupcombobox);
rpcclass.setup_class (popupcombobox, "popupcombobox",0, (["listeners"]), ([2]));
function popupokcancel () { this.do_construct (arguments); }
popupokcancel.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__run = c.pargs__run =  ["title"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		e.mcall (6, f.v.pop, "initialise", ([0, 0, f.v.title, f.v.fields]));
	},
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t1680 = f.s[0]; f.v.res = t1680;
		if ((((f.v.res).action)) == (("OK"))) f.pc=6; else f.pc=7;
	},
/*5*/	function (e,f) {
		f.pc=9;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		f.pc=8;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v.res).action)) == (("cancel")); },
	function (e,f) { var t1681 = f.s[0]; if (t1681) f.pc=5; else f.pc=3; },
	function (e,f) { e.return_pop ((((f.v.res).action)) == (("OK"))); },
null	];

;
};
popupokcancel.init_methods (popupokcancel);
rpcclass.setup_class (popupokcancel, "popupokcancel",0, (["listeners"]), ([2]));
function popupok () { this.do_construct (arguments); }
popupok.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__run = c.pargs__run =  ["title"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		e.mcall (6, f.v.pop, "initialise", ([0, 0, f.v.title, f.v.fields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([true, false])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
/*5*/	function (e,f) {
		var t1685 = f.s[0]; f.v.res = t1685;
		if ((((f.v.res).action)) == (("OK"))) f.pc=7; else f.pc=8;
	},
	function (e,f) {
		f.pc=10;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		f.pc=9;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v.res).action)) == (("cover")); },
	function (e,f) { var t1686 = f.s[0]; if (t1686) f.pc=6; else f.pc=4; },
/*10*/	function (e,f) { e.return_pop ((((f.v.res).action)) == (("OK"))); },
null	];

;
};
popupok.init_methods (popupok);
rpcclass.setup_class (popupok, "popupok",0, (["listeners"]), ([2]));
function popupyesnocancel () { this.do_construct (arguments); }
popupyesnocancel.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__run = c.pargs__run =  ["title"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		e.smcall (2, popupyesnocancel,"render_resume", (["yes", 0]));
	},
	function (e,f) {
		var t1689 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"button", name:"yes", label:"Yes", action:t1689});
		e.smcall (2, popupyesnocancel,"render_resume", (["no", 0]));
	},
	function (e,f) {
		var t1691 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"button", name:"no", label:"No", action:t1691});
		e.mcall (6, f.v.pop, "initialise", ([0, 0, f.v.title, f.v.fields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([false, true])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
/*5*/	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t1694 = f.s[0]; f.v.res = t1694;
		if ((((f.v.res).action)) == (("yes"))) f.pc=9; else f.pc=10;
	},
	function (e,f) {
		f.pc=14;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		f.pc=13;
		f.s[0] = true;
	},
/*10*/	function (e,f) { if ((((f.v.res).action)) == (("no"))) f.pc=11; else f.pc=12; },
	function (e,f) {
		f.pc=13;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v.res).action)) == (("cancel")); },
	function (e,f) { var t1695 = f.s[0]; if (t1695) f.pc=8; else f.pc=6; },
	function (e,f) { e.return_pop ((f.v.res).action); },
null	];

;
};
popupyesnocancel.init_methods (popupyesnocancel);
rpcclass.setup_class (popupyesnocancel, "popupyesnocancel",0, (["listeners"]), ([2]));
function popupyesno () { this.do_construct (arguments); }
popupyesno.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.args__run = c.pargs__run =  ["title"];
	c.inst__run = c.pinst__run =  [
/*0*/	function (e,f) {
		f.v.pop = new popupform;
		f.v.fields = ([]);
		e.smcall (2, popupyesno,"render_resume", (["yes", 0]));
	},
	function (e,f) {
		var t1698 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"button", name:"yes", label:"Yes", action:t1698});
		e.smcall (2, popupyesno,"render_resume", (["no", 0]));
	},
	function (e,f) {
		var t1700 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"button", name:"no", label:"No", action:t1700});
		e.mcall (6, f.v.pop, "initialise", ([0, 0, f.v.title, f.v.fields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([false, false])); },
	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
/*5*/	function (e,f) {  },
	function (e,f) { e.mcall (2, f.v.pop, "run", ([])); },
	function (e,f) {
		var t1703 = f.s[0]; f.v.res = t1703;
		if ((((f.v.res).action)) == (("yes"))) f.pc=9; else f.pc=10;
	},
	function (e,f) {
		f.pc=12;
		e.mcall (2, f.v.pop, "close", ([]));
	},
	function (e,f) {
		f.pc=11;
		f.s[0] = true;
	},
/*10*/	function (e,f) { f.s[0] = (((f.v.res).action)) == (("no")); },
	function (e,f) { var t1704 = f.s[0]; if (t1704) f.pc=8; else f.pc=6; },
	function (e,f) { e.return_pop ((((f.v.res).action)) == (("yes"))); },
null	];

;
};
popupyesno.init_methods (popupyesno);
rpcclass.setup_class (popupyesno, "popupyesno",0, (["listeners"]), ([2]));
function popupobjeditor () { this.do_construct (arguments); }
popupobjeditor.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__do_fields =  ["mode"];
	c.pinst__do_fields =  [
/*0*/	function (e,f) { e.mcall (2, (f.v["this"]).pop, "get_form_fields", ([])); },
	function (e,f) {
		var t1706 = f.s[0]; f.v.values = t1706;
		f.v.changed = false;
		f.v._k104 = e.enumkeys ((f.v["this"]).fields);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k104).length)) f.pc=3;
	},
	function (e,f) { e.return_pop (f.v.changed); },
	function (e,f) {
		f.v._i105 = (f.v._k104).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v._i105)];
		f.v.fname = (f.v.field).name;
		if ((((f.v.field).type)) == (("query_expr"))) f.pc=5; else f.pc=7;
	},
/*5*/	function (e,f) { e.mcall (2, (f.v.field).value, "as_string", ([])); },
	function (e,f) {
		f.pc=8;
		var t1713 = f.s[0]; f.v.newval = t1713;
	},
	function (e,f) { f.v.newval = (f.v.values)[(f.v.fname)]; },
	function (e,f) { if (((f.v.mode)) == (("check_empty"))) f.pc=9; else f.pc=14; },
	function (e,f) { if ((((f.v.field).type)) == (("enum"))) f.pc=10; else f.pc=12; },
/*10*/	function (e,f) { if (((f.v.newval)) != (("0"))) f.pc=11; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.v.changed = true;
	},
	function (e,f) { if (((f.v.newval)) != ((""))) f.pc=13; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.v.changed = true;
	},
	function (e,f) { if (((f.v.mode)) == (("check_changed"))) f.pc=15; else f.pc=17; },
/*15*/	function (e,f) { if (((((f.v["this"]).obj)[(f.v.fname)])) != ((f.v.newval))) f.pc=16; else f.pc=2; },
	function (e,f) {
		f.pc=3;
		f.v.changed = true;
	},
	function (e,f) { if (((f.v.mode)) == (("save"))) f.pc=18; else f.pc=2; },
	function (e,f) { if (((((f.v["this"]).obj)[(f.v.fname)])) != ((f.v.newval))) f.pc=19; else f.pc=2; },
	function (e,f) {
		f.pc=2;
		f.v.changed = true;
		(f.v["this"]).obj[f.v.fname] = f.v.newval;
	},
null	];

;
	c.pargs__do_edit =  [];
	c.pinst__do_edit =  [
/*0*/	function (e,f) { f.v._k106 = e.enumkeys ((f.v["this"]).fields); },
	function (e,f) {
		f.pc=3;
		if (!((f.v._k106).length)) f.pc=2;
	},
	function (e,f) {
		f.pc=7;
		f.v["this"].pop = new popupform;
		e.mcall (6, (f.v["this"]).pop, "initialise", ([0, 0, (f.v["this"]).title, (f.v["this"]).fields]));
	},
	function (e,f) {
		f.v.key = (f.v._k106).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v.key)];
		f.v.fname = (f.v.field).name;
		f.v.val = ((f.v["this"]).obj)[(f.v.fname)];
		if ((((f.v.field).type)) == (("query_expr"))) f.pc=4; else f.pc=6;
	},
	function (e,f) {
		f.s[0] = ([f.v.val]);
		f.s[1] = (["query_expr", "create_from_string"]);
		e.php_builtin (2, "call_user_func_array", 2);
	},
/*5*/	function (e,f) {
		f.pc=1;
		var t1727 = f.s[0]; ((f.v["this"]).fields)[(f.v.key)].value = t1727;
	},
	function (e,f) {
		f.pc=1;
		((f.v["this"]).fields)[(f.v.key)].value = f.v.val;
	},
	function (e,f) { e.mcall (2, (f.v["this"]).pop, "open", ([])); },
	function (e,f) { f.v.res = false; },
	function (e,f) {
		f.pc=11;
		e.mcall (2, (f.v["this"]).pop, "run", ([]));
	},
/*10*/	function (e,f) {
		f.pc=21;
		e.mcall (2, (f.v["this"]).pop, "close", ([]));
	},
	function (e,f) {
		var t1731 = f.s[0]; f.v.event = t1731;
		if ((((f.v.event).action)) == (("OK"))) f.pc=12; else f.pc=14;
	},
	function (e,f) { e.mcall (3, f.v["this"], "do_fields", (["save"])); },
	function (e,f) {
		f.pc=10;
		f.v.res = true;
	},
	function (e,f) { if ((((f.v.event).action)) == (("cover"))) f.pc=15; else f.pc=19; },
/*15*/	function (e,f) { e.mcall (3, f.v["this"], "do_fields", (["check_changed"])); },
	function (e,f) {
		var t1734 = f.s[0]; f.v.changed = t1734;
		if (!(f.v.changed)) f.pc=10; else f.pc=17;
	},
	function (e,f) { e.smcall (1, popupokcancel,"run", (["Discard changes?"])); },
	function (e,f) { var t1735 = f.s[0]; if (t1735) f.pc=10; else f.pc=9; },
	function (e,f) { if ((((f.v.event).action)) == (("cancel"))) f.pc=20; else f.pc=9; },
/*20*/	function (e,f) { f.pc=10; },
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.pargs__do_create =  [];
	c.pinst__do_create =  [
/*0*/	function (e,f) { f.v._k108 = e.enumkeys ((f.v["this"]).fields); },
	function (e,f) {
		f.pc=3;
		if (!((f.v._k108).length)) f.pc=2;
	},
	function (e,f) {
		f.pc=7;
		f.v["this"].pop = new popupform;
		e.mcall (6, (f.v["this"]).pop, "initialise", ([0, 0, (f.v["this"]).title, (f.v["this"]).fields]));
	},
	function (e,f) {
		f.v.key = (f.v._k108).shift();
		f.v.field = ((f.v["this"]).fields)[(f.v.key)];
		f.v.fname = (f.v.field).name;
		if ((((f.v.field).type)) == (("query_expr"))) f.pc=4; else f.pc=6;
	},
	function (e,f) {
		f.s[0] = ([""]);
		f.s[1] = (["query_expr", "create_from_string"]);
		e.php_builtin (2, "call_user_func_array", 2);
	},
/*5*/	function (e,f) {
		f.pc=1;
		var t1742 = f.s[0]; ((f.v["this"]).fields)[(f.v.key)].value = t1742;
	},
	function (e,f) {
		f.pc=1;
		((f.v["this"]).fields)[(f.v.key)].value = "";
	},
	function (e,f) { e.mcall (2, (f.v["this"]).pop, "open", ([])); },
	function (e,f) { f.v.res = null; },
	function (e,f) {
		f.pc=11;
		e.mcall (2, (f.v["this"]).pop, "run", ([]));
	},
/*10*/	function (e,f) {
		f.pc=24;
		e.mcall (2, (f.v["this"]).pop, "close", ([]));
	},
	function (e,f) {
		var t1746 = f.s[0]; f.v.event = t1746;
		if ((((f.v.event).action)) == (("OK"))) f.pc=12; else f.pc=17;
	},
	function (e,f) { e.mcall (2, (f.v["this"]).pop, "get_form_fields", ([])); },
	function (e,f) {
		f.s[1] = "popupobjeditor_create";
		f.s[2] = (f.v["this"]).cname;
		e.php_static_method_call (3, popupobjeditor,"call_static_method", 3);
	},
	function (e,f) {
		var t1749 = f.s[0]; f.v["this"].obj = t1749;
		if ((((f.v["this"]).obj)) !== ((null))) f.pc=15; else f.pc=9;
	},
/*15*/	function (e,f) { e.mcall (3, f.v["this"], "do_fields", (["save"])); },
	function (e,f) {
		f.pc=10;
		f.v.res = (f.v["this"]).obj;
	},
	function (e,f) { if ((((f.v.event).action)) == (("cover"))) f.pc=18; else f.pc=22; },
	function (e,f) { e.mcall (3, f.v["this"], "do_fields", (["check_empty"])); },
	function (e,f) {
		var t1752 = f.s[0]; f.v.changed = t1752;
		if (!(f.v.changed)) f.pc=10; else f.pc=20;
	},
/*20*/	function (e,f) { e.smcall (1, popupokcancel,"run", (["Discard changes?"])); },
	function (e,f) { var t1753 = f.s[0]; if (t1753) f.pc=10; else f.pc=9; },
	function (e,f) { if ((((f.v.event).action)) == (("cancel"))) f.pc=23; else f.pc=9; },
	function (e,f) { f.pc=10; },
	function (e,f) { e.return_pop (f.v.res); },
null	];

;
	c.args__to_struct = c.pargs__to_struct =  ["obj"];
	c.inst__to_struct = c.pinst__to_struct =  [
/*0*/	function (e,f) { e.mcall (2, f.v.obj, "popupobjeditor_fields", ([])); },
	function (e,f) {
		var t1755 = f.s[0]; f.v.fields = t1755;
		f.v.res = ({});
		f.v._k110 = e.enumkeys (f.v.fields);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k110).length)) f.pc=3;
	},
	function (e,f) { e.return_pop (f.v.res); },
	function (e,f) {
		f.pc=2;
		f.v.key = (f.v._k110).shift();
		f.v.field = (f.v.fields)[(f.v.key)];
		f.v.fname = (f.v.field).name;
		f.v.res[f.v.fname] = (f.v.obj)[(f.v.fname)];
	},
null	];

;
	c.args__from_struct = c.pargs__from_struct =  ["obj","str"];
	c.inst__from_struct = c.pinst__from_struct =  [
/*0*/	function (e,f) { e.mcall (2, f.v.obj, "popupobjeditor_fields", ([])); },
	function (e,f) {
		var t1763 = f.s[0]; f.v.fields = t1763;
		f.v._k112 = e.enumkeys (f.v.fields);
	},
	function (e,f) { if (!((f.v._k112).length)) f.pc=-1; },
	function (e,f) {
		f.pc=2;
		f.v.key = (f.v._k112).shift();
		f.v.field = (f.v.fields)[(f.v.key)];
		f.v.fname = (f.v.field).name;
		f.v.obj[f.v.fname] = (f.v.str)[(f.v.fname)];
	},
null	];

;
	c.args__edit = c.pargs__edit =  ["obj","title"];
	c.inst__edit = c.pinst__edit =  [
/*0*/	function (e,f) {
		f.v.me = new popupobjeditor;
		f.v.me.obj = f.v.obj;
		f.v.me.title = f.v.title;
		e.mcall (2, f.v.obj, "popupobjeditor_fields", ([]));
	},
	function (e,f) {
		var t1773 = f.s[0]; f.v.me.fields = t1773;
		e.mcall (2, f.v.me, "do_edit", ([]));
	},
	function (e,f) { var t1774 = f.s[0]; e.return_pop (t1774); },
null	];

;
	c.args__create = c.pargs__create =  ["cname","title"];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.me = new popupobjeditor;
		f.v.me.cname = f.v.cname;
		f.v.me.title = f.v.title;
		e.smcall (3, popupobjeditor,"call_static_method", ([f.v.cname, "popupobjeditor_fields", null]));
	},
	function (e,f) {
		var t1779 = f.s[0]; f.v.me.fields = t1779;
		e.mcall (2, f.v.me, "do_create", ([]));
	},
	function (e,f) { var t1780 = f.s[0]; e.return_pop (t1780); },
null	];

;
};
popupobjeditor.init_methods (popupobjeditor);
rpcclass.setup_class (popupobjeditor, "popupobjeditor",0, (["cname","obj","title","fields","pop","listeners"]), ([0,0,0,0,0,2]));
function generic_tree_item () { this.do_construct (arguments); }
generic_tree_item.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	cp.item_context =  function ()
	{
{
		return (this.context);
		}
			}

;
	cp.get_tree =  function ()
	{
{
		return (this.tree);
		}
			}

;
	c.pargs__do_initialise_branch =  ["tree","parent","name","context"];
	c.pinst__do_initialise_branch =  [
/*0*/	function (e,f) {
		f.v["this"].tree = f.v.tree;
		f.v["this"].parent = f.v.parent;
		f.v["this"].is_leaf = false;
		f.v["this"].name = f.v.name;
		f.v["this"].children = ([]);
		f.v["this"].context = f.v.context;
	},
null	];

;
	c.pargs__do_initialise_leaf =  ["tree","parent","name","context"];
	c.pinst__do_initialise_leaf =  [
/*0*/	function (e,f) {
		f.v["this"].tree = f.v.tree;
		f.v["this"].parent = f.v.parent;
		f.v["this"].is_leaf = true;
		f.v["this"].name = f.v.name;
		f.v["this"].context = f.v.context;
	},
null	];

;
	c.pargs__remove =  [];
	c.pinst__remove =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "node_removed", ([])); },
	function (e,f) { e.mcall (3, (f.v["this"]).parent, "removeChild", ([f.v["this"]])); },
null	];

;
	c.pargs__rename =  ["newname"];
	c.pinst__rename =  [
/*0*/	function (e,f) {
		f.v["this"].name = f.v.newname;
		e.mcall (2, f.v["this"], "node_changed", ([]));
	},
null	];

;
	c.pargs__removeChild =  ["node"];
	c.pinst__removeChild =  [
/*0*/	function (e,f) {
		f.v.i = builtin__array_search (f.v.node,(f.v["this"]).children);
		if (((f.v.i)) === ((false))) f.pc=1; else f.pc=2;
	},
	function (e,f) { f.s[0] = builtin__alert ("Failed to find child in parent"); },
	function (e,f) { f.s[0] = builtin__array_splice ((f.v["this"]).children,f.v.i,1); },
null	];

;
	c.pargs__add_child =  ["newnode"];
	c.pinst__add_child =  [
/*0*/	function (e,f) { f.v.i = 0; },
	function (e,f) {
		f.pc=4;
		if (!(((f.v.i)) < ((builtin__count ((f.v["this"]).children))))) f.pc=2;
	},
	function (e,f) { if (((f.v.i)) == ((builtin__count ((f.v["this"]).children)))) f.pc=5; else f.pc=7; },
	function (e,f) {
		f.pc=1;
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) { if ((((((f.v["this"]).children)[(f.v.i)]).name)) > (((f.v.newnode).name))) f.pc=2; else f.pc=3; },
/*5*/	function (e,f) { e.mcall (3, f.v.newnode, "node_added", ([null])); },
	function (e,f) {
		f.pc=-1;
		(f.v["this"]).children[(f.v["this"]).children.length] = f.v.newnode;
	},
	function (e,f) { e.mcall (3, f.v.newnode, "node_added", ([((f.v["this"]).children)[(f.v.i)]])); },
	function (e,f) { f.s[0] = builtin__array_splice ((f.v["this"]).children,f.v.i,0,([f.v.newnode])); },
null	];

;
	cp.depth =  function ()
	{
var n;var p;{
		n = 0;;
		for (p = this;p.parent !== null;p = p.parent) {n++;};
		return (n);
		}
			}

;
};
generic_tree_item.init_methods (generic_tree_item);
rpcclass.setup_class (generic_tree_item, "generic_tree_item",0, (["parent","is_leaf","name","context","children","tree","listeners"]), ([0,0,0,0,0,0,2]));
function generic_tree () { this.do_construct (arguments); }
generic_tree.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__create_branch =  ["parent","name","obj"];
	c.pinst__create_branch =  [
/*0*/	function (e,f) {
		f.v.cname = (f.v["this"]).itemclass;
		f.v.it = eval ("new "+f.v.cname);
		e.mcall (6, f.v.it, "initialise_branch", ([f.v["this"], f.v.parent, f.v.name, f.v.obj]));
	},
	function (e,f) { e.return_pop (f.v.it); },
null	];

;
	c.pargs__create_leaf =  ["parent","name","obj"];
	c.pinst__create_leaf =  [
/*0*/	function (e,f) {
		f.v.cname = (f.v["this"]).itemclass;
		f.v.it = eval ("new "+f.v.cname);
		e.mcall (6, f.v.it, "initialise_leaf", ([f.v["this"], f.v.parent, f.v.name, f.v.obj]));
	},
	function (e,f) { e.return_pop (f.v.it); },
null	];

;
	c.pargs__add_fullname_item =  ["fullname","context"];
	c.pinst__add_fullname_item =  [
/*0*/	function (e,f) {
		f.v.fields = builtin__explode ("\\",f.v.fullname);
		f.v.path = "";
		f.v.pos = (f.v["this"]).root;
		f.v.n = builtin__count (f.v.fields);
		if (((f.v.context)) !== ((null))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		e.php_push_var_lvalue (0, "n");
		e.php_postdec (1);
	},
	function (e,f) { f.v.i = 0; },
	function (e,f) {
		f.pc=5;
		if (!(((f.v.i)) < ((f.v.n)))) f.pc=4;
	},
	function (e,f) { if (((f.v.context)) !== ((null))) f.pc=20; else f.pc=29; },
/*5*/	function (e,f) {
		f.v.field = (f.v.fields)[(f.v.i)];
		if (((f.v.path)) == ((""))) f.pc=6; else f.pc=7;
	},
	function (e,f) {
		f.pc=8;
		f.v.path = f.v.field;
	},
	function (e,f) { f.v.path = "" + (f.v.path) + (("\\") + (f.v.field)); },
	function (e,f) { f.v.j = 0; },
	function (e,f) {
		f.pc=11;
		if (!(((f.v.j)) < ((builtin__count ((f.v.pos).children))))) f.pc=10;
	},
/*10*/	function (e,f) { if (((f.v.j)) == ((builtin__count ((f.v.pos).children)))) f.pc=17; else f.pc=19; },
	function (e,f) { if ((((((f.v.pos).children)[(f.v.j)]).name)) == ((f.v.field))) f.pc=12; else f.pc=13; },
	function (e,f) { f.pc=10; },
	function (e,f) { if ((((((f.v.pos).children)[(f.v.j)]).name)) > ((f.v.field))) f.pc=14; else f.pc=16; },
	function (e,f) { e.mcall (5, f.v["this"], "create_branch", ([f.v.pos, f.v.field, null])); },
/*15*/	function (e,f) {
		f.pc=10;
		var t1812 = f.s[0]; f.v.child = t1812;
		f.s[0] = builtin__array_splice ((f.v.pos).children,f.v.j,0,([f.v.child]));
	},
	function (e,f) {
		f.pc=9;
		e.php_push_var_lvalue (0, "j");
		e.php_postinc (1);
	},
	function (e,f) { e.mcall (5, f.v["this"], "create_branch", ([f.v.pos, f.v.field, null])); },
	function (e,f) { var t1815 = f.s[0]; (f.v.pos).children[f.v.j] = t1815; },
	function (e,f) {
		f.pc=3;
		f.v.pos = ((f.v.pos).children)[(f.v.j)];
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
/*20*/	function (e,f) { f.v.j = 0; },
	function (e,f) {
		f.pc=23;
		if (!(((f.v.j)) < ((builtin__count ((f.v.pos).children))))) f.pc=22;
	},
	function (e,f) {
		f.pc=25;
		e.mcall (5, f.v["this"], "create_leaf", ([f.v.pos, (f.v.fields)[(f.v.i)], f.v.context]));
	},
	function (e,f) { if ((((((f.v.pos).children)[(f.v.j)]).name)) > (((f.v.fields)[(f.v.i)]))) f.pc=22; else f.pc=24; },
	function (e,f) {
		f.pc=21;
		e.php_push_var_lvalue (0, "j");
		e.php_postinc (1);
	},
/*25*/	function (e,f) {
		var t1821 = f.s[0]; f.v.newnode = t1821;
		if (((f.v.j)) == ((builtin__count ((f.v.pos).children)))) f.pc=26; else f.pc=27;
	},
	function (e,f) {
		f.pc=28;
		(f.v.pos).children[(f.v.pos).children.length] = f.v.newnode;
	},
	function (e,f) { f.s[0] = builtin__array_splice ((f.v.pos).children,f.v.j,0,([f.v.newnode])); },
	function (e,f) { e.return_pop (f.v.newnode); },
	function (e,f) { e.return_pop (null); },
null	];

;
	c.pargs__initialise =  ["itemclass","rootname","rootcontext"];
	c.pinst__initialise =  [
/*0*/	function (e,f) {
		f.v["this"].itemclass = f.v.itemclass;
		f.v["this"].root = eval ("new "+f.v.itemclass);
		e.mcall (5, (f.v["this"]).root, "initialise_root", ([f.v["this"], f.v.rootname, f.v.rootcontext]));
	},
null	];

;
};
generic_tree.init_methods (generic_tree);
rpcclass.setup_class (generic_tree, "generic_tree",0, (["root","itemclass","listeners"]), ([0,0,2]));
function tree_editor_item () { this.do_construct (arguments); }
tree_editor_item.init_methods = function (c) {
	generic_tree_item.init_methods(c);
	var cp = c.prototype;
	c.pargs__initialise_branch =  ["te","parent","name","context"];
	c.pinst__initialise_branch =  [
/*0*/	function (e,f) { e.mcall (6, f.v["this"], "do_initialise_branch", ([f.v.te, f.v.parent, f.v.name, f.v.context])); },
	function (e,f) { f.v["this"].is_open = false; },
null	];

;
	c.pargs__initialise_leaf =  ["te","parent","name","context"];
	c.pinst__initialise_leaf =  [
/*0*/	function (e,f) { e.mcall (6, f.v["this"], "do_initialise_leaf", ([f.v.te, f.v.parent, f.v.name, f.v.context])); },
null	];

;
	c.pargs__is_displayed =  [];
	c.pinst__is_displayed =  [
/*0*/	function (e,f) { f.v.p = (f.v["this"]).parent; },
	function (e,f) {
		f.pc=4;
		if (!(((f.v.p)) !== ((null)))) f.pc=2;
	},
	function (e,f) { e.return_pop (true); },
	function (e,f) { e.return_pop (false); },
	function (e,f) { if (!((f.v.p).is_open)) f.pc=3; else f.pc=5; },
/*5*/	function (e,f) {
		f.pc=1;
		f.v.p = (f.v.p).parent;
	},
null	];

;
	c.pargs__redisplay =  [];
	c.pinst__redisplay =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_el", ([])); },
	function (e,f) {
		f.pc=4;
		var t1829 = f.s[0]; f.v.el = t1829;
		e.mcall (2, f.v["this"], "is_displayed", ([]));
	},
	function (e,f) {
		f.pc=5;
		(f.v.el).style.display = "block";
	},
	function (e,f) {
		f.pc=5;
		(f.v.el).style.display = "none";
	},
	function (e,f) { var t1832 = f.s[0]; if (t1832) f.pc=2; else f.pc=3; },
/*5*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t1833 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("tree-node-label-") + (t1833)]));
	},
	function (e,f) {
		var t1835 = f.s[0]; f.v.el = t1835;
		if (((f.v["this"])) == ((((f.v["this"]).tree).current_item))) f.pc=8; else f.pc=9;
	},
	function (e,f) {
		f.pc=10;
		(f.v.el).style.background = "#4D5E99";
		(f.v.el).style.color = "white";
	},
	function (e,f) {
		(f.v.el).style.background = "";
		(f.v.el).style.color = "";
	},
/*10*/	function (e,f) { if (!((f.v["this"]).is_leaf)) f.pc=11; else f.pc=-1; },
	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t1840 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("tree-node-plus-") + (t1840)]));
	},
	function (e,f) {
		var t1842 = f.s[0]; f.v.el = t1842;
		if (((f.v.el)) !== ((null))) f.pc=14; else f.pc=16;
	},
	function (e,f) { e.mcall (2, f.v["this"], "plus_minus", ([])); },
/*15*/	function (e,f) { var t1844 = f.s[0]; f.v.el.innerHTML = t1844; },
	function (e,f) { f.v._k114 = e.enumkeys ((f.v["this"]).children); },
	function (e,f) { if (!((f.v._k114).length)) f.pc=-1; },
	function (e,f) {
		f.pc=17;
		f.s[0] = f.v._i115 = (f.v._k114).shift();
		f.s[1] = f.v.child = ((f.v["this"]).children)[(f.v._i115)];
		e.mcall (4, f.v.child, "redisplay", ([]));
	},
null	];

;
	c.pargs__pre_expand =  [];
	c.pinst__pre_expand =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.pargs__toggle_open =  ["el","arg","ev"];
	c.pinst__toggle_open =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "pre_expand", ([])); },
	function (e,f) {
		f.v["this"].is_open = !((f.v["this"]).is_open);
		e.mcall (2, f.v["this"], "redisplay", ([]));
	},
null	];

;
	c.pargs__open =  [];
	c.pinst__open =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "pre_expand", ([])); },
	function (e,f) {
		f.v["this"].is_open = true;
		f.s[0] = f.v["this"];
		f.s[1] = "open";
		e.mcall (4, f.v["this"], "get_tree", ([]));
	},
	function (e,f) { var t1850 = f.s[2]; var t1851 = f.s[1]; var t1852 = f.s[0]; e.mcall (3, t1850, t1851, ([t1852])); },
null	];

;
	c.pargs__click_open =  ["el","arg","ev"];
	c.pinst__click_open =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "open", ([])); },
null	];

;
	cp.get_el =  function ()
	{
{
		;
		return (document.getElementById  ("tree-node-" + this.get_id  ()));
		}
			}

;
	cp.find_element_under_cursor =  function (x,y)
	{
var el;var el_left;var el_top;var el_right;var el_bottom;var child;var res;{
		el = this.get_el  ();;
		el_left = lib.document_x_of  (el);;
		el_top = lib.document_y_of  (el);;
		el_right = el_left + el.clientWidth;;
		el_bottom = el_top + el.clientHeight;;
		if (el_left < x && el_right > x && el_top < y && el_bottom > y)
		{return (this) }
		;
		if (this.is_open)
		{{
		for (var _index in this.children)
		{
		child = this.children[_index];
		{
		res = child.find_element_under_cursor  (x,y);;
		if (res !== null)
		{return (res) }
		;
		}
		}
		;
		}
		 }
		;
		return (null);
		}
			}

;
	c.pargs__oncontextmenu =  ["el","arg","ev"];
	c.pinst__oncontextmenu =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "on_right_click", ([])); },
null	];

;
	c.pargs__render_to_el =  [];
	c.pinst__render_to_el =  [
/*0*/	function (e,f) { e.mcall (3, document, "createElement", (["div"])); },
	function (e,f) {
		var t1854 = f.s[0]; f.v.div = t1854;
		e.php_builtin (0, "ob_start", 0);
		e.mcall (2, f.v["this"], "render", ([]));
	},
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t1856 = f.s[0]; f.v.div.innerHTML = t1856;
		e.return_pop (((f.v.div).childNodes)[(0)]);
	},
null	];

;
	c.pargs__node_added =  ["refnode"];
	c.pinst__node_added =  [
/*0*/	function (e,f) {
		f.s[0] = builtin__debugout (("Node ") + ("" + ((f.v["this"]).name) + ((" added under node ") + (((f.v["this"]).parent).name))));
		e.mcall (2, f.v["this"], "render_to_el", ([]));
	},
	function (e,f) {
		var t1858 = f.s[0]; f.v.el = t1858;
		if (((f.v.refnode)) === ((null))) f.pc=2; else f.pc=10;
	},
	function (e,f) { f.v.refnode = (f.v["this"]).parent; },
	function (e,f) { if ((f.v.refnode).is_leaf) f.pc=6; else f.pc=7; },
	function (e,f) {
		f.pc=9;
		e.mcall (2, f.v.refnode, "get_el", ([]));
	},
/*5*/	function (e,f) {
		f.pc=3;
		f.v.refnode = ((f.v.refnode).children)[(parseInt((builtin__count ((f.v.refnode).children)),10) - parseInt((1),10))];
	},
	function (e,f) {
		f.pc=8;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = ((builtin__count ((f.v.refnode).children))) == ((0)); },
	function (e,f) { var t1861 = f.s[0]; if (t1861) f.pc=4; else f.pc=5; },
	function (e,f) {
		f.pc=12;
		var t1863 = f.s[0]; f.v.refel = t1863;
		f.v.refel = (f.v.refel).nextSibling;
	},
/*10*/	function (e,f) { e.mcall (2, f.v.refnode, "get_el", ([])); },
	function (e,f) { var t1866 = f.s[0]; f.v.refel = t1866; },
	function (e,f) { e.mcall (4, (f.v.refel).parentNode, "insertBefore", ([f.v.el, f.v.refel])); },
null	];

;
	c.pargs__node_removed =  [];
	c.pinst__node_removed =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_el", ([])); },
	function (e,f) {
		var t1868 = f.s[0]; f.v.el = t1868;
		e.mcall (3, (f.v.el).parentNode, "removeChild", ([f.v.el]));
	},
null	];

;
	c.pargs__node_changed =  [];
	c.pinst__node_changed =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_el", ([])); },
	function (e,f) {
		var t1870 = f.s[0]; f.v.el = t1870;
		e.mcall (2, f.v["this"], "render_to_el", ([]));
	},
	function (e,f) {
		var t1872 = f.s[0]; f.v.newel = t1872;
		e.mcall (4, (f.v.el).parentNode, "insertBefore", ([f.v.newel, f.v.el]));
	},
	function (e,f) { e.mcall (3, (f.v.el).parentNode, "removeChild", ([f.v.el])); },
null	];

;
	c.pargs__plus_minus =  [];
	c.pinst__plus_minus =  [
/*0*/	function (e,f) { if ((f.v["this"]).is_open) f.pc=1; else f.pc=2; },
	function (e,f) { e.return_pop ("(<span style=\"font-family:courier,monospace\">-</span>)"); },
	function (e,f) { e.return_pop ("(<span style=\"font-family:courier,monospace\">+</span>)"); },
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "depth", ([])); },
	function (e,f) {
		var t1874 = f.s[0]; f.v.depth = t1874;
		f.s[0] = ";border:solid 1px transparent;\">";
		if ((((f.v["this"]).parent)) == ((null))) f.pc=4; else f.pc=5;
	},
	function (e,f) {
		f.pc=7;
		f.s[1] = "block";
	},
	function (e,f) {
		f.pc=7;
		f.s[1] = "none";
	},
	function (e,f) {
		f.pc=6;
		f.s[1] = true;
	},
/*5*/	function (e,f) { f.s[1] = ((f.v["this"]).parent).is_open; },
	function (e,f) { var t1875 = f.s[1]; if (t1875) f.pc=2; else f.pc=3; },
	function (e,f) {
		var t1876 = f.s[1]; var t1877 = f.s[0]; 
		f.s[0] = ("\" style=\"margin-left:") + ("" + (((f.v.depth)) * ((30))) + (("px;display:") + ("" + (t1876) + (t1877))));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1878 = f.s[1]; var t1879 = f.s[0]; 
		window.__outbuffer += ("<div id=\"tree-node-") + ("" + (t1878) + (t1879));
		if ((f.v["this"]).is_leaf) f.pc=9; else f.pc=10;
	},
	function (e,f) {
		f.pc=14;
		window.__outbuffer += "&nbsp;&nbsp;&nbsp;&nbsp;";
	},
/*10*/	function (e,f) {
		f.s[0] = "</a>";
		e.mcall (3, f.v["this"], "plus_minus", ([]));
	},
	function (e,f) {
		var t1880 = f.s[1]; var t1881 = f.s[0]; 
		f.s[0] = ("\">") + ("" + (t1880) + (t1881));
		e.mcall (5, f.v["this"], "render_start", (["toggle_open", null]));
	},
	function (e,f) {
		var t1882 = f.s[1]; var t1883 = f.s[0]; 
		f.s[0] = ("\" onclick=\"") + ("" + (t1882) + (t1883));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t1884 = f.s[1]; var t1885 = f.s[0]; 
		window.__outbuffer += ("<a href=\"#\" id=\"tree-node-plus-") + ("" + (t1884) + (t1885));
	},
	function (e,f) {
		f.s[0] = "\" />";
		e.mcall (5, f.v["this"], "render_start", (["oncontextmenu", null]));
	},
/*15*/	function (e,f) {
		var t1886 = f.s[1]; var t1887 = f.s[0]; 
		f.s[0] = ("\" alt=\"\" oncontextmenu=\"") + ("" + (t1886) + (t1887));
		e.mcall (3, f.v["this"], "icon", ([]));
	},
	function (e,f) {
		var t1888 = f.s[1]; var t1889 = f.s[0]; 
		window.__outbuffer += ("<img src=\"") + ("" + (t1888) + (t1889));
		if ((f.v["this"]).is_open) f.pc=19; else f.pc=20;
	},
	function (e,f) {
		f.pc=22;
		f.s[0] = "background:#4D5E99;color:white";
	},
	function (e,f) {
		f.pc=22;
		f.s[0] = "";
	},
	function (e,f) {
		f.pc=21;
		f.s[0] = (f.v["this"]).is_leaf;
	},
/*20*/	function (e,f) { f.s[0] = false; },
	function (e,f) { var t1890 = f.s[0]; if (t1890) f.pc=17; else f.pc=18; },
	function (e,f) {
		var t1892 = f.s[0]; f.v.style = t1892;
		f.s[0] = ("\" style=\"") + ("" + (f.v.style) + (("\">") + ("" + ((f.v["this"]).name) + ("</a>"))));
		e.mcall (5, f.v["this"], "render_start", (["oncontextmenu", null]));
	},
	function (e,f) {
		var t1893 = f.s[1]; var t1894 = f.s[0]; 
		f.s[0] = ("\" oncontextmenu=\"") + ("" + (t1893) + (t1894));
		e.mcall (5, f.v["this"], "render_start", (["click_open", null]));
	},
	function (e,f) {
		var t1895 = f.s[1]; var t1896 = f.s[0]; 
		f.s[0] = ("\" href=\"#\" onclick=\"") + ("" + (t1895) + (t1896));
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
/*25*/	function (e,f) {
		var t1897 = f.s[1]; var t1898 = f.s[0]; 
		window.__outbuffer += ("&nbsp;<a id=\"tree-node-label-") + ("" + (t1897) + (t1898));
		window.__outbuffer += "</div>";
		if (!((f.v["this"]).is_leaf)) f.pc=26; else f.pc=-1;
	},
	function (e,f) { f.v._k116 = e.enumkeys ((f.v["this"]).children); },
	function (e,f) { if (!((f.v._k116).length)) f.pc=-1; },
	function (e,f) {
		f.pc=27;
		f.v._i117 = (f.v._k116).shift();
		f.v.child = ((f.v["this"]).children)[(f.v._i117)];
		e.mcall (3, f.v.child, "render", ([parseInt((f.v.depth),10) + parseInt((1),10)]));
	},
null	];

;
};
tree_editor_item.init_methods (tree_editor_item);
rpcclass.setup_class (tree_editor_item, "tree_editor_item",0, (["is_open","parent","is_leaf","name","context","children","tree","listeners"]), ([0,0,0,0,0,0,0,2]));
function tree_editor () { this.do_construct (arguments); }
tree_editor.init_methods = function (c) {
	generic_tree.init_methods(c);
	var cp = c.prototype;
	c.pargs__close =  [];
	c.pinst__close =  [
/*0*/	function (e,f) { if ((((f.v["this"]).current_item)) === ((null))) f.pc=1; else f.pc=2; },
	function (e,f) { f.pc=-1; },
	function (e,f) { e.mcall (2, (f.v["this"]).current_item, "close_document", ([])); },
	function (e,f) {
		f.s[0] = "";
		f.s[1] = "innerHTML";
		e.mcall (4, f.v["this"], "docpane", ([]));
	},
	function (e,f) {
		e.php_deref_lvalue (3);
		e.php_assign (2);
		f.v.it = (f.v["this"]).current_item;
		f.v["this"].current_item = null;
		e.mcall (2, f.v.it, "redisplay", ([]));
	},
null	];

;
	c.pargs__rerender_doc =  [];
	c.pinst__rerender_doc =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "docpane", ([])); },
	function (e,f) {
		var t1909 = f.s[0]; f.v.docpane = t1909;
		e.php_builtin (0, "ob_start", 0);
		if ((((f.v["this"]).doc)) !== ((null))) f.pc=2; else f.pc=3;
	},
	function (e,f) { e.mcall (2, (f.v["this"]).doc, "render_editor", ([])); },
	function (e,f) {
		e.php_builtin (0, "ob_get_clean", 0);
		var t1911 = f.s[0]; f.v.docpane.innerHTML = t1911;
	},
null	];

;
	c.pargs__open =  ["item"];
	c.pinst__open =  [
/*0*/	function (e,f) { e.mcall (2, f.v.item, "open_document", ([])); },
	function (e,f) {
		var t1913 = f.s[0]; f.v.doc = t1913;
		if (((f.v.doc)) !== ((null))) f.pc=2; else f.pc=4;
	},
	function (e,f) { e.mcall (2, f.v["this"], "close", ([])); },
	function (e,f) {
		f.v["this"].current_item = f.v.item;
		f.v["this"].doc = f.v.doc;
		e.mcall (2, f.v["this"], "rerender_doc", ([]));
	},
	function (e,f) { e.mcall (2, f.v.item, "redisplay", ([])); },
null	];

;
	c.pargs__docpane =  [];
	c.pinst__docpane =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "get_id", ([])); },
	function (e,f) {
		var t1916 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("tree-docpane-") + (t1916)]));
	},
	function (e,f) { var t1917 = f.s[0]; e.return_pop (t1917); },
null	];

;
	cp.drag_move =  function (x,y)
	{
var node;var el;{
		;
		x += browser.scroll_left  ();;
		y += browser.scroll_top  ();;
		node = this.root.find_element_under_cursor  (x,y);;
		if (node !== this.current_hover)
		{{
		if (this.current_hover !== null)
		{{
		el = document.getElementById  ("tree-node-" + this.current_hover.get_id  ());;
		el.style.borderColor = "transparent";;
		this.current_hover = null;;
		}
		 }
		;
		if (node !== null && node != this.current_item)
		{{
		if (node.can_drop  ())
		{{
		el = document.getElementById  ("tree-node-" + node.get_id  ());;
		el.style.borderColor = "blue";;
		this.current_hover = node;;
		}
		 }
		;
		}
		 }
		;
		}
		 }
		;
		}
			}

;
	c.pargs__drag_stop =  ["payload","is_copy"];
	c.pinst__drag_stop =  [
/*0*/	function (e,f) { if ((((f.v["this"]).current_hover)) === ((null))) f.pc=2; else f.pc=3; },
	function (e,f) { e.return_pop (false); },
	function (e,f) {
		f.pc=4;
		f.s[0] = true;
	},
	function (e,f) { f.s[0] = (((f.v["this"]).current_hover)) === (((f.v["this"]).current_item)); },
	function (e,f) { var t1918 = f.s[0]; if (t1918) f.pc=1; else f.pc=5; },
/*5*/	function (e,f) { e.mcall (5, f.v["this"], "handle_drag_and_drop", ([f.v.payload, (f.v["this"]).current_hover, f.v.is_copy])); },
	function (e,f) { e.mcall (2, (f.v["this"]).current_hover, "get_id", ([])); },
	function (e,f) {
		var t1919 = f.s[0]; 
		e.mcall (3, document, "getElementById", ([("tree-node-") + (t1919)]));
	},
	function (e,f) {
		var t1921 = f.s[0]; f.v.el = t1921;
		(f.v.el).style.borderColor = "transparent";
		e.return_pop (true);
	},
null	];

;
};
tree_editor.init_methods (tree_editor);
rpcclass.setup_class (tree_editor, "tree_editor",0, (["current_hover","current_item","doc","root","itemclass","listeners"]), ([0,0,0,0,0,2]));
function popupmenutree () { this.do_construct (arguments); }
popupmenutree.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__tree_as_menu =  ["tree"];
	c.pinst__tree_as_menu =  [
/*0*/	function (e,f) { e.smcall (0, menu,"create", ([])); },
	function (e,f) {
		var t1924 = f.s[0]; f.v.menu = t1924;
		f.v._k118 = e.enumkeys ((f.v.tree).children);
	},
	function (e,f) {
		f.pc=4;
		if (!((f.v._k118).length)) f.pc=3;
	},
	function (e,f) { if ((f.v["this"]).admin) f.pc=8; else f.pc=10; },
	function (e,f) {
		f.v.i = (f.v._k118).shift();
		f.v.item = ((f.v.tree).children)[(f.v.i)];
		if ((((f.v.item).type)) == (("leaf"))) f.pc=5; else f.pc=6;
	},
/*5*/	function (e,f) {
		f.pc=2;
		e.mcall (4, f.v.menu, "add_item", ([(f.v.item).value, (f.v.item).name]));
	},
	function (e,f) { e.mcall (3, f.v["this"], "tree_as_menu", ([f.v.item])); },
	function (e,f) {
		f.pc=2;
		var t1929 = f.s[0]; f.v.sub = t1929;
		e.mcall (4, f.v.menu, "add_submenu", ([(f.v.item).name, f.v.sub]));
	},
	function (e,f) { e.mcall (4, f.v.menu, "add_item", ([("newc:") + ((f.v.tree).path), "New submenu..."])); },
	function (e,f) { e.mcall (4, f.v.menu, "add_item", ([("newg:") + ((f.v.tree).path), "New group here..."])); },
/*10*/	function (e,f) { e.return_pop (f.v.menu); },
null	];

;
	c.pargs__add_item_to_tree =  ["menuname","group"];
	c.pinst__add_item_to_tree =  [
/*0*/	function (e,f) {
		f.v.fields = builtin__explode ("\\",f.v.menuname);
		f.v.path = "";
		f.v.pos = (f.v["this"]).tree;
		f.v.n = builtin__count (f.v.fields);
		if (((f.v.group)) !== ((null))) f.pc=1; else f.pc=2;
	},
	function (e,f) {
		e.php_push_var_lvalue (0, "n");
		e.php_postdec (1);
	},
	function (e,f) { f.v.i = 0; },
	function (e,f) {
		f.pc=5;
		if (!(((f.v.i)) < ((f.v.n)))) f.pc=4;
	},
	function (e,f) { if (((f.v.group)) !== ((null))) f.pc=16; else f.pc=-1; },
/*5*/	function (e,f) {
		f.v.field = (f.v.fields)[(f.v.i)];
		if (((f.v.path)) == ((""))) f.pc=6; else f.pc=7;
	},
	function (e,f) {
		f.pc=8;
		f.v.path = f.v.field;
	},
	function (e,f) { f.v.path = "" + (f.v.path) + (("\\") + (f.v.field)); },
	function (e,f) { f.v.j = 0; },
	function (e,f) {
		f.pc=11;
		if (!(((f.v.j)) < ((builtin__count ((f.v.pos).children))))) f.pc=10;
	},
/*10*/	function (e,f) { if (((f.v.j)) == ((builtin__count ((f.v.pos).children)))) f.pc=14; else f.pc=15; },
	function (e,f) { if ((((((f.v.pos).children)[(f.v.j)]).name)) == ((f.v.field))) f.pc=12; else f.pc=13; },
	function (e,f) { f.pc=10; },
	function (e,f) {
		f.pc=9;
		e.php_push_var_lvalue (0, "j");
		e.php_postinc (1);
	},
	function (e,f) { (f.v.pos).children[f.v.j] = ({type:"branch", name:f.v.field, path:f.v.path, children:([])}); },
/*15*/	function (e,f) {
		f.pc=3;
		f.v.pos = ((f.v.pos).children)[(f.v.j)];
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
	function (e,f) { (f.v.pos).children[(f.v.pos).children.length] = ({type:"leaf", name:(f.v.fields)[(f.v.i)], value:f.v.group}); },
null	];

;
	c.pargs__initialise_tree =  [];
	c.pinst__initialise_tree =  [
/*0*/	function (e,f) { f.v["this"].tree = ({type:"branch", name:"", path:"", children:([])}); },
null	];

;
	c.pargs__select =  [];
	c.pinst__select =  [
/*0*/	function (e,f) { e.mcall (2, f.v["this"], "create_tree", ([])); },
	function (e,f) {  },
	function (e,f) {
		f.pc=4;
		e.mcall (3, f.v["this"], "tree_as_menu", ([(f.v["this"]).tree]));
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		var t1947 = f.s[0]; f.v.menu = t1947;
		e.smcall (1, popupmenu,"run", ([f.v.menu]));
	},
/*5*/	function (e,f) {
		var t1949 = f.s[0]; f.v.value = t1949;
		if (((f.v.value)) == ((null))) f.pc=3; else f.pc=6;
	},
	function (e,f) {
		f.v.matches = ([]);
		if (builtin__preg_match ("/^newc\\:(.*)$/",f.v.value,f.v.matches)) f.pc=7; else f.pc=13;
	},
	function (e,f) {
		f.v.path = (f.v.matches)[(1)];
		e.smcall (6, popupcombobox,"run", ([0, 0, ("Create new submenu in ") + (f.v.path), ([]), true, ""]));
	},
	function (e,f) {
		var t1953 = f.s[0]; f.v.name = t1953;
		if (((f.v.name)) === ((null))) f.pc=3; else f.pc=9;
	},
	function (e,f) { if (((f.v.path)) == ((""))) f.pc=10; else f.pc=11; },
/*10*/	function (e,f) {
		f.pc=12;
		f.v.path = f.v.name;
	},
	function (e,f) { f.v.path = "" + (f.v.path) + (("\\") + (f.v.name)); },
	function (e,f) {
		f.pc=2;
		e.mcall (4, f.v["this"], "add_item_to_tree", ([f.v.path, null]));
	},
	function (e,f) { if (builtin__preg_match ("/^newg\\:(.*)$/",f.v.value,f.v.matches)) f.pc=14; else f.pc=21; },
	function (e,f) {
		f.v.path = (f.v.matches)[(1)];
		e.smcall (6, popupcombobox,"run", ([0, 0, ("Create new group in ") + (f.v.path), ([]), true, ""]));
	},
/*15*/	function (e,f) {
		var t1958 = f.s[0]; f.v.name = t1958;
		if (((f.v.name)) === ((null))) f.pc=3; else f.pc=16;
	},
	function (e,f) { if (((f.v.path)) == ((""))) f.pc=17; else f.pc=18; },
	function (e,f) {
		f.pc=19;
		f.v.path = f.v.name;
	},
	function (e,f) { f.v.path = "" + (f.v.path) + (("\\") + (f.v.name)); },
	function (e,f) { e.mcall (3, f.v["this"], "create_new", ([f.v.path])); },
/*20*/	function (e,f) { var t1961 = f.s[0]; e.return_pop (t1961); },
	function (e,f) { e.return_pop (f.v.value); },
null	];

;
};
popupmenutree.init_methods (popupmenutree);
rpcclass.setup_class (popupmenutree, "popupmenutree",0, (["tree","admin","listeners"]), ([0,0,2]));
function menubar () { this.do_construct (arguments); }
menubar.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__run_menu =  ["n"];
	c.pinst__run_menu =  [
/*0*/	function (e,f) {
		f.v["this"].active_menu = f.v.n;
		e.mcall (3, f.v["this"], "get_menu_id", ([f.v.n]));
	},
	function (e,f) { var t1963 = f.s[0]; e.mcall (3, document, "getElementById", ([t1963])); },
	function (e,f) {
		var t1965 = f.s[0]; f.v.el = t1965;
		(f.v.el).style.background = "#316ac5";
		(f.v.el).style.color = "white";
		f.s[0] = (f.v.el).clientHeight;
		e.smcall (2, lib,"document_y_of", ([f.v.el]));
	},
	function (e,f) {
		var t1968 = f.s[1]; var t1969 = f.s[0]; f.s[0] = parseInt((t1968),10) + parseInt((t1969),10);
		e.smcall (2, lib,"document_x_of", ([f.v.el]));
	},
	function (e,f) { e.php_static_method_call (2, popup,"set_default_coordinates", 2); },
/*5*/	function (e,f) { e.mcall (2, f.v["this"], "get_menubar_id", ([])); },
	function (e,f) { var t1972 = f.s[0]; e.mcall (3, document, "getElementById", ([t1972])); },
	function (e,f) {
		var t1974 = f.s[0]; f.v.bar = t1974;
		f.s[0] = 1;
		e.smcall (1, popup,"next_zindex", ([]));
	},
	function (e,f) {
		var t1975 = f.s[1]; var t1976 = f.s[0]; 
		(f.v.bar).style.zIndex = parseInt((t1975),10) + parseInt((t1976),10);
		f.s[0] = "px";
		e.smcall (2, lib,"block_x_of", ([f.v.bar]));
	},
	function (e,f) {
		var t1978 = f.s[1]; var t1979 = f.s[0]; 
		(f.v.bar).style.left = "" + (t1978) + (t1979);
		f.s[0] = "px";
		e.smcall (2, lib,"block_y_of", ([f.v.bar]));
	},
/*10*/	function (e,f) {
		var t1981 = f.s[1]; var t1982 = f.s[0]; 
		(f.v.bar).style.top = "" + (t1981) + (t1982);
		(f.v.bar).style.width = "" + ((f.v.bar).offsetWidth) + ("px");
		(f.v.bar).style.height = "" + ((f.v.bar).offsetHeight) + ("px");
		(f.v.bar).style.position = "absolute";
		e.smcall (1, popupmenu,"create", ([(((f.v["this"]).items)[(f.v.n)]).menu]));
	},
	function (e,f) {
		var t1988 = f.s[0]; f.v["this"].pm = t1988;
		e.mcall (2, (f.v["this"]).pm, "do_run", ([]));
	},
	function (e,f) {
		var t1990 = f.s[0]; f.v.choice = t1990;
		e.mcall (2, f.v["this"], "deactivate", ([]));
	},
	function (e,f) { if (((f.v.choice)) !== ((null))) f.pc=14; else f.pc=-1; },
	function (e,f) {
		f.v.fn = (f.v.choice)[(0)];
		f.v.arg = (f.v.choice)[(1)];
		e.mcall (5, (f.v["this"]).owner, f.v.fn, ([f.v.el, f.v.arg, null]));
	},
null	];

;
	c.pargs__deactivate =  [];
	c.pinst__deactivate =  [
/*0*/	function (e,f) { if ((((f.v["this"]).active_menu)) !== ((null))) f.pc=1; else f.pc=-1; },
	function (e,f) { e.mcall (2, f.v["this"], "get_menubar_id", ([])); },
	function (e,f) { var t1993 = f.s[0]; e.mcall (3, document, "getElementById", ([t1993])); },
	function (e,f) {
		var t1995 = f.s[0]; f.v.bar = t1995;
		(f.v.bar).style.zIndex = "";
		(f.v.bar).style.left = "";
		(f.v.bar).style.top = "";
		(f.v.bar).style.width = "";
		(f.v.bar).style.height = "";
		(f.v.bar).style.position = "";
		e.mcall (3, f.v["this"], "get_menu_id", ([(f.v["this"]).active_menu]));
	},
	function (e,f) { var t2002 = f.s[0]; e.mcall (3, document, "getElementById", ([t2002])); },
/*5*/	function (e,f) {
		var t2004 = f.s[0]; f.v.el = t2004;
		(f.v.el).style.background = "";
		(f.v.el).style.color = "";
		e.mcall (2, (f.v["this"]).pm, "destroy", ([]));
	},
	function (e,f) {
		f.v["this"].pm = null;
		f.v["this"].active_menu = null;
	},
null	];

;
	c.pargs__onmouseover =  ["el","arg","ev"];
	c.pinst__onmouseover =  [
/*0*/	function (e,f) { if ((((f.v["this"]).active_menu)) === ((null))) f.pc=1; else f.pc=2; },
	function (e,f) {
		f.pc=-1;
		(f.v.el).style.background = "#316ac5";
		(f.v.el).style.color = "white";
	},
	function (e,f) { e.mcall (2, f.v["this"], "deactivate", ([])); },
	function (e,f) { e.mcall (3, f.v["this"], "run_menu", ([f.v.arg])); },
null	];

;
	c.pargs__onmouseout =  ["el","arg","ev"];
	c.pinst__onmouseout =  [
/*0*/	function (e,f) { if ((((f.v["this"]).active_menu)) === ((null))) f.pc=1; else f.pc=-1; },
	function (e,f) {
		(f.v.el).style.background = "";
		(f.v.el).style.color = "";
	},
null	];

;
	c.pargs__onclick =  ["el","arg","ev"];
	c.pinst__onclick =  [
/*0*/	function (e,f) {
		f.v.item = ((f.v["this"]).items)[(f.v.arg)];
		e.mcall (2, f.v["this"], "deactivate", ([]));
	},
	function (e,f) { e.mcall (3, f.v["this"], "run_menu", ([f.v.arg])); },
null	];

;
	c.pargs__onmousedown =  ["el","arg","ev"];
	c.pinst__onmousedown =  [
/*0*/	function (e,f) { /* This is a NOP */ },
null	];

;
	c.args__create = c.pargs__create =  ["owner"];
	c.inst__create = c.pinst__create =  [
/*0*/	function (e,f) {
		f.v.res = new menubar;
		f.v.res.owner = f.v.owner;
		f.v.res.items = ([]);
		f.v.res.active_menu = null;
		e.return_pop (f.v.res);
	},
null	];

;
	c.pargs__add_item =  ["name","menu"];
	c.pinst__add_item =  [
/*0*/	function (e,f) { (f.v["this"]).items[(f.v["this"]).items.length] = ({name:f.v.name, menu:f.v.menu}); },
null	];

;
	c.pargs__get =  ["name"];
	c.pinst__get =  [
/*0*/	function (e,f) { f.v._k120 = e.enumkeys ((f.v["this"]).items); },
	function (e,f) {
		f.pc=3;
		if (!((f.v._k120).length)) f.pc=2;
	},
	function (e,f) { e.return_pop (null); },
	function (e,f) {
		f.s[0] = f.v._i121 = (f.v._k120).shift();
		f.s[1] = f.v.item = ((f.v["this"]).items)[(f.v._i121)];
		if ((((f.v.item).name)) == ((f.v.name))) f.pc=4; else f.pc=1;
	},
	function (e,f) { e.return_pop ((f.v.item).menu); },
null	];

;
	c.pargs__get_menu_id =  ["i"];
	c.pinst__get_menu_id =  [
/*0*/	function (e,f) {
		f.s[0] = ("-") + (f.v.i);
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t2022 = f.s[1]; var t2023 = f.s[0]; 
		e.return_pop (("menu-item-") + ("" + (t2022) + (t2023)));
	},
null	];

;
	c.pargs__get_menubar_id =  [];
	c.pinst__get_menubar_id =  [
/*0*/	function (e,f) {
		f.s[0] = ("-") + (f.v.i);
		e.mcall (3, f.v["this"], "get_id", ([]));
	},
	function (e,f) {
		var t2024 = f.s[1]; var t2025 = f.s[0]; 
		e.return_pop (("menu-item-") + ("" + (t2024) + (t2025)));
	},
null	];

;
	c.pargs__render =  [];
	c.pinst__render =  [
/*0*/	function (e,f) {
		window.__outbuffer += "<div class=\"pjmenubar\" contentEditable=\"false\" >";
		f.s[0] = "\" style=\"float:left\" >";
		e.mcall (3, f.v["this"], "get_menubar_id", ([]));
	},
	function (e,f) {
		var t2026 = f.s[1]; var t2027 = f.s[0]; 
		window.__outbuffer += ("<div id=\"") + ("" + (t2026) + (t2027));
		f.v.i = 0;
	},
	function (e,f) {
		f.pc=4;
		if (!(((f.v.i)) < ((builtin__count ((f.v["this"]).items))))) f.pc=3;
	},
	function (e,f) {
		f.pc=-1;
		window.__outbuffer += "<div style=\"clear:both\"></div>";
		window.__outbuffer += "</div>";
		window.__outbuffer += "</div>";
	},
	function (e,f) {
		window.__outbuffer += "<div class=\"pjmenubarheader\"";
		f.s[0] = "\"";
		e.mcall (4, f.v["this"], "get_menu_id", ([f.v.i]));
	},
/*5*/	function (e,f) {
		var t2029 = f.s[1]; var t2030 = f.s[0]; 
		window.__outbuffer += (" id=\"") + ("" + (t2029) + (t2030));
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_start", (["onmouseover", f.v.i]));
	},
	function (e,f) {
		var t2031 = f.s[1]; var t2032 = f.s[0]; 
		window.__outbuffer += (" onmouseover=\"") + ("" + (t2031) + (t2032));
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_start", (["onmouseout", f.v.i]));
	},
	function (e,f) {
		var t2033 = f.s[1]; var t2034 = f.s[0]; 
		window.__outbuffer += (" onmouseout=\"") + ("" + (t2033) + (t2034));
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_start", (["onclick", f.v.i]));
	},
	function (e,f) {
		var t2035 = f.s[1]; var t2036 = f.s[0]; 
		window.__outbuffer += (" onclick=\"") + ("" + (t2035) + (t2036));
		f.s[0] = "\"";
		e.mcall (5, f.v["this"], "render_start", (["onmousedown", f.v.i]));
	},
	function (e,f) {
		f.pc=2;
		var t2037 = f.s[1]; var t2038 = f.s[0]; 
		window.__outbuffer += (" onmousedown=\"") + ("" + (t2037) + (t2038));
		window.__outbuffer += (">") + ("" + ((((f.v["this"]).items)[(f.v.i)]).name) + ("</div>"));
		e.php_push_var_lvalue (0, "i");
		e.php_postinc (1);
	},
null	];

;
};
menubar.init_methods (menubar);
rpcclass.setup_class (menubar, "menubar",0, (["owner","items","active_menu","listeners"]), ([0,0,0,2]));
function tabmanager () { this.do_construct (arguments); }
tabmanager.init_methods = function (c) {
	rpcclass.init_methods(c);
	var cp = c.prototype;
	c.pargs__can_import =  [];
	c.pinst__can_import =  [
/*0*/	function (e,f) { e.return_pop (false); },
null	];

;
	c.pargs__rating_field =  [];
	c.pinst__rating_field =  [
/*0*/	function (e,f) { e.return_pop (null); },
null	];

;
	c.pargs__initialise =  ["tabclass","list_fields","search_fields"];
	c.pinst__initialise =  [
/*0*/	function (e,f) {
		f.v["this"].tabclass = f.v.tabclass;
		f.v["this"].list_fields = f.v.list_fields;
		f.v["this"].search_fields = f.v.search_fields;
	},
null	];

;
	c.pargs__run_search =  ["terms"];
	c.pinst__run_search =  [
/*0*/	function (e,f) { e.mcall (4, f.v["this"], "call_function_async", (["run_search", ([f.v.terms])])); },
	function (e,f) { var t2043 = f.s[0]; e.return_pop (t2043); },
null	];

;
	c.pargs__choose =  ["title","include_select","include_create","namehint"];
	c.pinst__choose =  [
/*0*/	function (e,f) {
		f.v.fields = ([]);
		f.v.fields[f.v.fields.length] = ({type:"text", name:"inbox", label:"", focus:true, value:f.v.namehint});
		if (f.v.include_create) f.pc=1; else f.pc=3;
	},
	function (e,f) { e.smcall (2, tabmanager,"render_resume", (["create", 0])); },
	function (e,f) {
		var t2046 = f.s[0]; 
		f.v.fields[f.v.fields.length] = ({type:"button", name:"create", label:"Create New", action:t2046});
	},
	function (e,f) {  },
	function (e,f) {
		f.v.re_search = false;
		f.v.pop = new popupform;
		e.mcall (6, f.v.pop, "initialise", ([0, 0, f.v.title, f.v.fields]));
	},
/*5*/	function (e,f) { e.mcall (2, f.v.pop, "open", ([])); },
	function (e,f) {  },
	function (e,f) {
		f.pc=9;
		e.mcall (2, f.v.pop, "run", ([]));
	},
	function (e,f) { if (!(f.v.re_search)) f.pc=93; else f.pc=4; },
	function (e,f) {
		var t2051 = f.s[0]; f.v.event = t2051;
		f.v.action = (f.v.event).action;
		f.v.rowid = 0;
		if (((f.v.action)) == (("cancel"))) f.pc=90; else f.pc=91;
	},
/*10*/	function (e,f) { e.mcall (2, f.v.pop, "close", ([])); },
	function (e,f) { f.pc=8; },
	function (e,f) { if (((f.v.action)) == (("OK"))) f.pc=13; else f.pc=76; },
	function (e,f) { e.mcall (2, f.v.pop, "get_form_fields", ([])); },
	function (e,f) {
		var t2055 = f.s[0]; f.v.vals = t2055;
		f.v.terms = (f.v.vals).inbox;
		e.mcall (2, f.v.pop, "close", ([]));
	},
/*15*/	function (e,f) { e.mcall (3, f.v["this"], "run_search", ([f.v.terms])); },
	function (e,f) {
		var t2058 = f.s[0]; f.v.res = t2058;
		if (((builtin__count (f.v.res))) == ((1))) f.pc=73; else f.pc=74;
	},
	function (e,f) {
		f.pc=8;
		f.v.item = (f.v.res)[(0)];
		f.v.rowid = (f.v.item).rowid;
	},
	function (e,f) {
		f.v.srfields = ([]);
		if (((builtin__count (f.v.res))) == ((0))) f.pc=19; else f.pc=20;
	},
	function (e,f) {
		f.pc=39;
		f.v.srfields[f.v.srfields.length] = ({name:"stuff", label:"", type:"label", value:"Nothing found"});
	},
/*20*/	function (e,f) {
		f.v.options = ([]);
		f.v._k122 = e.enumkeys (f.v.res);
	},
	function (e,f) {
		f.pc=23;
		if (!((f.v._k122).length)) f.pc=22;
	},
	function (e,f) {
		f.pc=39;
		f.v.srfields[f.v.srfields.length] = ({name:"table", label:"", type:"table", options:f.v.options});
	},
	function (e,f) {
		f.pc=28;
		f.v.i = (f.v._k122).shift();
		f.v.item = (f.v.res)[(f.v.i)];
		f.v.html = "";
		f.v.colour = "";
		f.s[0] = null;
		e.mcall (3, f.v["this"], "rating_field", ([]));
	},
	function (e,f) { e.mcall (2, f.v["this"], "rating_field", ([])); },
/*25*/	function (e,f) {
		var t2071 = f.s[0]; f.v.field = t2071;
		e.mcall (2, f.v["this"], "rating_field", ([]));
	},
	function (e,f) {
		var t2072 = f.s[0]; 
		e.mcall (3, f.v["this"], "rating_colour", ([(f.v.item)[(t2072)]]));
	},
	function (e,f) {
		f.pc=29;
		var t2074 = f.s[0]; f.v.colour = t2074;
	},
	function (e,f) {
		var t2075 = f.s[1]; var t2076 = f.s[0]; 
		if (((t2075)) != ((t2076))) f.pc=24; else f.pc=29;
	},
	function (e,f) { f.v._k124 = e.enumkeys ((f.v["this"]).list_fields); },
/*30*/	function (e,f) {
		f.pc=32;
		if (!((f.v._k124).length)) f.pc=31;
	},
	function (e,f) {
		f.pc=35;
		f.s[0] = "\">open</a></td>";
		e.smcall (3, tabmanager,"render_resume", (["open", f.v.i]));
	},
	function (e,f) {
		f.v._i125 = (f.v._k124).shift();
		f.v.fname = ((f.v["this"]).list_fields)[(f.v._i125)];
		f.v.html = "" + (f.v.html) + ("<td");
		if (((f.v.colour)) != ((""))) f.pc=33; else f.pc=34;
	},
	function (e,f) { f.v.html = "" + (f.v.html) + ((" style=\"color:") + ("" + (f.v.colour) + ("\""))); },
	function (e,f) {
		f.pc=30;
		f.v.html = "" + (f.v.html) + ((">") + ("" + ((f.v.item)[(f.v.fname)]) + ("</td>")));
	},
/*35*/	function (e,f) {
		var t2083 = f.s[1]; var t2084 = f.s[0]; 
		f.v.html = "" + (f.v.html) + (("<td><a href=\"#\" onclick=\"") + ("" + (t2083) + (t2084)));
		if (f.v.include_select) f.pc=36; else f.pc=38;
	},
	function (e,f) {
		f.s[0] = "\">select</a></td>";
		e.smcall (3, tabmanager,"render_resume", (["select", f.v.i]));
	},
	function (e,f) {
		var t2086 = f.s[1]; var t2087 = f.s[0]; 
		f.v.html = "" + (f.v.html) + (("<td><a href=\"#\" onclick=\"") + ("" + (t2086) + (t2087)));
	},
	function (e,f) {
		f.pc=21;
		f.v.options[f.v.options.length] = f.v.html;
	},
	function (e,f) { if (f.v.include_create) f.pc=40; else f.pc=43; },
/*40*/	function (e,f) { e.smcall (2, tabmanager,"render_resume", (["create", 0])); },
	function (e,f) {
		var t2090 = f.s[0]; 
		f.v.srfields[f.v.srfields.length] = ({type:"button", name:"create", label:"Create New", action:t2090});
		e.smcall (2, tabmanager,"render_resume", (["re_search", 0]));
	},
	function (e,f) {
		var t2092 = f.s[0]; 
		f.v.srfields[f.v.srfields.length] = ({type:"button", name:"create", label:"Search again", action:t2092});
	},
	function (e,f) {
		f.v.pop = new popupform;
		e.mcall (6, f.v.pop, "initialise", ([0, 0, "Search results", f.v.srfields]));
	},
	function (e,f) { e.mcall (4, f.v.pop, "use_ok_cancel", ([false, true])); },

