var JSEARCH = {  
  requiredAttrParams: ["btn_type" , "btn_lbl" , "kw_lbl" , "cat_lbl" , "loc_lbl" , "div_lbl" ],

  create: function( SO , id , parentid ) {
    DROP.setElementDisplay(parentid, "none");
    var loadfn = function() {
      if (DROP.hasRequiredAttrParams(SO)) {
        JSEARCH.init( SO, id , parentid );
      }
      DROP.setElementDisplay(parentid, "block");
    };
    DROP.addLoadEvent(loadfn);
  },

  init: function( SO , id , parentid ){

    if( !document.getElementById || !document.getElementsByTagName ) return;
    var objTarget = document.getElementById( id );
    var objParent = document.getElementById( parentid );
    if (typeof objTarget.innerHTML == "undefined" || typeof objParent.innerHTML == "undefined") return;

    var strOutPut = '';
    objTarget.innerHTML = '';

    strOutPut += '<form action="" method="post">\n';

    strOutPut += '<span class="wrapper"><label for="' + id + '_keywords">' + SO.kw_lbl + '</label><input type="text" id="' + id + '_keywords" class="txt" maxlength="30" /></span>';

    strOutPut += '<span class="wrapper"><label for="' + id + '_category" class="hide">' + SO.cat_lbl + '</label><select id="' + id + '_category">';
    strOutPut += '<option value="">' + SO.cat_lbl + '</option>';
    strOptions = '';
    for( x=0 ; x<JSEARCH.CatItems.length ; x++ ){
      strOptions += JSEARCH.addOption( JSEARCH.CatItems[x].split('|')[1] , JSEARCH.CatItems[x].split('|')[0] , '' );
    } 
    strOutPut += strOptions;
    strOutPut += '</select></span>';

    strOutPut += '<span class="wrapper"><label for="' + id + '_location" class="hide">' + SO.loc_lbl + '</label><select id="' + id + '_location">';
    strOutPut += '<option value="">' + SO.loc_lbl + '</option>';
    strOptions = '';
    for( x=0 ; x<JSEARCH.LocItems.length ; x++ ){
      strOptions += JSEARCH.addOption( JSEARCH.LocItems[x].split('|')[1] , JSEARCH.LocItems[x].split('|')[0] , '' );
    } 
    strOutPut += strOptions;
    strOutPut += '</select></span>';

    strOutPut += '<span class="wrapper"><label for="' + id + '_division" class="hide">' + SO.loc_lbl + '</label><select id="' + id + '_division">';
    strOutPut += '<option value="">' + SO.div_lbl + '</option>';
    strOptions = '';
    for( x=0 ; x<JSEARCH.DivisionItems.length ; x++ ){
      strOptions += JSEARCH.addOption( JSEARCH.DivisionItems[x].split('|')[1] , JSEARCH.DivisionItems[x].split('|')[0] , '' );
    } 
    strOutPut += strOptions;
    strOutPut += '</select></span>';

    strOutPut += '<a href="#" title="' + SO.btn_lbl + '" class="btn btn' + SO.btn_type + '" id="' + id + '_btn" target="_blank"><span>' + SO.btn_lbl + '</span></a>\n';
    strOutPut += '</form>\n';

    objTarget.innerHTML = strOutPut;

    objButton = document.getElementById( id + '_btn' );
    if( objButton ){
      addEvent( objButton , 'click' , JSEARCH.processClick , false );
    }

    addclass( objTarget , 'selector' );
    objParent.style.overflow = 'visible';
    objParent.style.overflow = '';
  },

  addOption: function( strval , strtext , id ){
    strIdAttrib = id != '' ? ' id="' + id + '"' : '';
    strTemp = '<option value="' + strval + '"' + strIdAttrib + '>' + strtext + '</option>\n';
    return strTemp;
  },

  processClick: function(e){
    var curNode = window.event ? window.event.srcElement: e ? e.target : null;
    if( curNode == null ) return;

    divBase = ascendDOM( curNode , 'div' );
    if( divBase.nodeName.toLowerCase() != 'div' || !divBase.id ) return;

    strSelected = 'http://kcnru.jobseu.recruitadvantage.com/job/job_search_result.cfm?cLang=Russian';

    objKw = document.getElementById( divBase.id + '_keywords' );
    objCat = document.getElementById( divBase.id + '_category' );
    objLoc = document.getElementById( divBase.id + '_location' );
    objDivision = document.getElementById( divBase.id + '_division' );

//    strKw = objKw ? escape( objKw.value ) : '';
    strKw = objKw ? JSEARCH.encode(objKw.value) : '';
    strCat = objCat ? objCat.options[objCat.selectedIndex].value : '';
    strLoc = objLoc ? objLoc.options[objLoc.selectedIndex].value : '';
    strDivision = objDivision ? objDivision.options[objDivision.selectedIndex].value : '';

    if( strKw == '' && strCat == '' && strLoc == '' && strDivision == '' ){
      curNode.href = 'http://kcnru.jobseu.recruitadvantage.com/job/job_search.cfm';
    }
    else {
                         { if (strCat == '' ){ (strCat = '0' );}
                         if (strLoc == '') { (strLoc = '0');}
                         if  (strDivision == '') {(strDivision = '0' );}}
                        curNode.href = strSelected + '&frm_loc_id=' + strLoc + '&frm_ind_id=' + strCat + '&frm_job_type_id=' + strDivision + '&frm_keyword=' + strKw;

         }

    return true;
  },

// ==========================================================================
// JavaScript Tool for URL Encoding/Decoding
// Copyright (C) 2006 Netzreport (netzreport.googlepages.com)
//
// Website: http://netzreport.googlepages.com/online_tool_for_url_en_decoding.html
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
//
// The GNU General Public License is also available from:
// http://www.gnu.org/copyleft/gpl.html
//
// A local copy of the GNU General Public License is available here:
// http://netzreport.googlepages.com/gpl.txt
// ==========================================================================
//
// --------------------------------------------------------------------------
// 2006-12-18: Changed character encoding. Now, one can choose between URL
//             encoding/decoding strings that are character encoded as ASCII
//             or UTF-8.
// 2006-11-19: First release
// --------------------------------------------------------------------------

// This function returns a percent sign followed by two hexadecimal digits.
// Input is a decimal value not greater than 255.
  gethex: function(decimal) {
     return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);
  },
  encode: function(inStr){
      // According to RFC 3986, only characters from a set of reserved and a set
      // of unreserved characters are allowed in a URL:
      var unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~";
      var reserved = "!*'();:@&=+$,/?%#[]";
      var allowed = unreserved + reserved;
      var hexchars = "0123456789ABCDEFabcdef";
      // This function returns a percent sign followed by two hexadecimal digits.
      // Input is a decimal value not greater than 255.
      function gethex(decimal) {
        return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);
       }

  // Some variables:
  var decoded = inStr;
  var encoded = "";
  // ---------------- If UTF-8 character encoding was chosen: ----------------
    for (var i = 0; i < decoded.length; i++ ) {
      var ch = decoded.charAt(i);
      // Check if character is an unreserved character:
      if (unreserved.indexOf(ch) != -1) {
        encoded = encoded + ch;
      } else {

        // The position in the Unicode table tells us how many bytes are needed.
        // Note that if we talk about first, second, etc. in the following, we are
        // counting from left to right:
        //
        //   Position in   |  Bytes needed   | Binary representation
        //  Unicode table  |   for UTF-8     |       of UTF-8
        // ----------------------------------------------------------
        //     0 -     127 |    1 byte       | 0XXX.XXXX
        //   128 -    2047 |    2 bytes      | 110X.XXXX 10XX.XXXX
        //  2048 -   65535 |    3 bytes      | 1110.XXXX 10XX.XXXX 10XX.XXXX
        // 65536 - 2097151 |    4 bytes      | 1111.0XXX 10XX.XXXX 10XX.XXXX 10XX.XXXX

        var charcode = decoded.charCodeAt(i);

        // Position 0 - 127 is equal to percent-encoding with an ASCII character encoding:
        if (charcode < 128) {
          encoded = encoded + gethex(charcode);
        }

        // Position 128 - 2047: two bytes for UTF-8 character encoding.
        if (charcode > 127 && charcode < 2048) {
          // First UTF byte: Mask the first five bits of charcode with binary 110X.XXXX:
          encoded = encoded + gethex((charcode >> 6) | 0xC0);
          // Second UTF byte: Get last six bits of charcode and mask them with binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 2048 - 65535: three bytes for UTF-8 character encoding.
        if (charcode > 2047 && charcode < 65536) {
          // First UTF byte: Mask the first four bits of charcode with binary 1110.XXXX:
          encoded = encoded + gethex((charcode >> 12) | 0xE0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 65536 - : four bytes for UTF-8 character encoding.
        if (charcode > 65535) {
          // First UTF byte: Mask the first three bits of charcode with binary 1111.0XXX:
          encoded = encoded + gethex((charcode >> 18) | 0xF0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 12) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Fourth UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

      }

    }  // end of for ...

    // Write result:
    return encoded;
  },


  CatItems: ["&#1042;&#1089;&#1077;|0" , "&#1056;&#1072;&#1073;&#1086;&#1090;&#1072; &#1074; Kelly|3767" , "&#1040;&#1074;&#1090;&#1086;&#1090;&#1088;&#1072;&#1085;&#1089;&#1087;&#1086;&#1088;&#1090;|5844" , "&#1040;&#1076;&#1084;&#1080;&#1085;&#1080;&#1089;&#1090;&#1088;&#1072;&#1090;&#1080;&#1074;&#1085;&#1099;&#1077; &#1074;&#1072;&#1082;&#1072;&#1085;&#1089;&#1080;&#1080;|3760" , "&#1041;&#1072;&#1085;&#1082;&#1080;|3761" , "&#1041;&#1091;&#1093;&#1075;&#1072;&#1083;&#1090;&#1077;&#1088;&#1080;&#1103;|5838" , "&#1048;&#1085;&#1074;&#1077;&#1089;&#1090;&#1080;&#1094;&#1080;&#1080;|5841" , "&#1048;&#1085;&#1078;&#1080;&#1085;&#1080;&#1088;&#1080;&#1085;&#1075;|3764" , "&#1048;&#1085;&#1092;&#1086;&#1088;&#1084;&#1072;&#1094;&#1080;&#1086;&#1085;&#1085;&#1099;&#1077; &#1090;&#1077;&#1093;&#1085;&#1086;&#1083;&#1086;&#1075;&#1080;&#1080;|3766" , "&#1051;&#1086;&#1075;&#1080;&#1089;&#1090;&#1080;&#1082;&#1072;|3769" , "&#1052;&#1072;&#1088;&#1082;&#1077;&#1090;&#1080;&#1085;&#1075;/&#1056;&#1077;&#1082;&#1083;&#1072;&#1084;&#1072;/PR|3770" , "&#1052;&#1077;&#1076;&#1080;&#1094;&#1080;&#1085;&#1072;/&#1060;&#1072;&#1088;&#1084;&#1072;&#1094;&#1077;&#1074;&#1090;&#1080;&#1082;&#1072;|5842" , "&#1052;&#1077;&#1088;&#1095;&#1077;&#1085;&#1076;&#1072;&#1081;&#1079;&#1080;&#1085;&#1075;|5843" , "&#1052;&#1086;&#1088;&#1089;&#1082;&#1086;&#1081; &#1090;&#1088;&#1072;&#1085;&#1089;&#1087;&#1086;&#1088;&#1090;|5845" , "&#1055;&#1088;&#1072;&#1074;&#1086;|3768" , "&#1055;&#1088;&#1086;&#1076;&#1072;&#1078;&#1080;|3771" , "&#1055;&#1088;&#1086;&#1080;&#1079;&#1074;&#1086;&#1076;&#1089;&#1090;&#1074;&#1086;/&#1055;&#1088;&#1086;&#1084;&#1099;&#1096;&#1083;&#1077;&#1085;&#1085;&#1086;&#1089;&#1090;&#1100;|4557" , "&#1057;&#1090;&#1088;&#1086;&#1080;&#1090;&#1077;&#1083;&#1100;&#1089;&#1090;&#1074;&#1086;/&#1053;&#1077;&#1076;&#1074;&#1080;&#1078;&#1080;&#1084;&#1086;&#1089;&#1090;&#1100;|5839" , "&#1059;&#1087;&#1088;&#1072;&#1074;&#1083;&#1077;&#1085;&#1080;&#1077; &#1087;&#1077;&#1088;&#1089;&#1086;&#1085;&#1072;&#1083;&#1086;&#1084;|3765" , "&#1060;&#1080;&#1085;&#1072;&#1085;&#1089;&#1099;|5840" , "&#1042;&#1088;&#1077;&#1084;&#1077;&#1085;&#1085;&#1072;&#1103; &#1088;&#1072;&#1073;&#1086;&#1090;&#1072;|5847" , "&#1057;&#1090;&#1091;&#1076;&#1077;&#1085;&#1090;&#1099;/&#1053;&#1072;&#1095;&#1072;&#1083;&#1086; &#1082;&#1072;&#1088;&#1100;&#1077;&#1088;&#1099;|5846" , "Call-&#1094;&#1077;&#1085;&#1090;&#1088;&#1099;|3762" , "&#1044;&#1088;&#1091;&#1075;&#1086;&#1077;|3763"],

  LocItems: ["&#1042;&#1089;&#1077;|0" , "&#1041;&#1072;&#1088;&#1085;&#1072;&#1091;&#1083;|2231", "&#1059;&#1092;&#1072;|2232", "&#1042;&#1083;&#1072;&#1076;&#1080;&#1074;&#1086;&#1089;&#1090;&#1086;&#1082;|2233", "&#1050;&#1072;&#1083;&#1091;&#1075;&#1072;|2234", "&#1050;&#1072;&#1079;&#1072;&#1085;&#1100;|2257" ,"&#1050;&#1080;&#1077;&#1074;|2309", "&#1050;&#1088;&#1072;&#1089;&#1085;&#1086;&#1103;&#1088;&#1089;&#1082;|2235", "&#1052;&#1086;&#1089;&#1082;&#1074;&#1072;|1318" , "&#1057;&#1072;&#1085;&#1082;&#1090; &#1055;&#1077;&#1090;&#1077;&#1088;&#1073;&#1091;&#1088;&#1075;|1322" , "&#1045;&#1082;&#1072;&#1090;&#1077;&#1088;&#1080;&#1085;&#1073;&#1091;&#1088;&#1075;|1317" , "&#1051;&#1080;&#1087;&#1077;&#1094;&#1082;|2125" , "&#1053;&#1086;&#1074;&#1075;&#1086;&#1088;&#1086;&#1076; &#1042;.|1316" , "&#1053;&#1086;&#1074;&#1075;&#1086;&#1088;&#1086;&#1076; &#1053;.|2126" , "&#1053;&#1086;&#1074;&#1086;&#1089;&#1080;&#1073;&#1080;&#1088;&#1089;&#1082;|1319" , "&#1055;&#1077;&#1088;&#1084;&#1100;|2127" , "&#1056;&#1086;&#1089;&#1090;&#1086;&#1074; &#1085;&#1072; &#1044;&#1086;&#1085;&#1091;|2128" , "&#1057;&#1072;&#1084;&#1072;&#1088;&#1072;|1321" , "&#1058;&#1102;&#1084;&#1077;&#1085;&#1100;|2129" , "&#1044;&#1088;&#1091;&#1075;&#1086;&#1081; &#1075;&#1086;&#1088;&#1086;&#1076;|2130" ,"&#1052;&#1077;&#1078;&#1076;&#1091;&#1085;&#1072;&#1088;&#1086;&#1076;&#1085;&#1099;&#1077;|-1"],

  DivisionItems: ["&#1042;&#1089;&#1077;|0" , "&#1042;&#1088;&#1077;&#1084;&#1077;&#1085;&#1085;&#1072;&#1103;|15" , "&#1055;&#1086;&#1089;&#1090;&#1086;&#1103;&#1085;&#1085;&#1072;&#1103;|2" , "&#1063;&#1072;&#1089;&#1090;&#1080;&#1095;&#1085;&#1072;&#1103;|4"]

};


<!--
//Server:WWb02
-->
