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://kcnpt.jobseu.recruitadvantage.com/job/job_search_result.cfm';

    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 ) : '';
    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://kcnpt.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;
  },



  CatItems: ["Todas|0" , "Administrativo / Financeiro|10174" , "Banca / Seguros|10175" , "Call Center|10176" , "Comercial|10177" , "Engenharias/ Técnicos Especializados|10178" , "Hotelaria/ Restauração/ Turismo|10179" , "Indústria|10180" , "Logística / Distribuição|10181" , "Outros|10182"],

  LocItems: ["Todas|0" , "Aveiro|2500" , "Beja|2501" , "Braga|2502" , "Bragança|2503" , "Castelo Branco|2504" , "Coimbra|2505" , "Évora|2506" , "Faro|2507" , "Guarda|2508" , "Leiria|2509" , "Lisboa|2510" , "Portalegre|2511" , "Porto|2512" , "Santarém|2513" , "Setúbal|2514" , "Viana do Castelo|2515" , "Vila Real|2516" , "Viseu|2517" , "Outra|2518"],

  DivisionItems: ["Todos|0" , "part-time|1" , "tempo inteiro|2"]
};


<!--
//Server:WWb02
-->
