function multisearchmoto()
{
    this.set = function()
    {
        $( 'multisearchPrice' ).style.display = '';
        $( 'multisearchArea' ).style.display = 'none';
        $( 'multisearchWithPhotoField' ).style.display = '';
        $( 'multisearchWithPhotoText' ).style.display = '';
        $( 'multisearchExclusiveField' ).style.display = 'none';
        $( 'multisearchExclusiveText' ).style.display = 'none';
        
        var ul = multisearch.clean( $( 'multisearch-nav' ) );
        var i = 0;
        while( element = ul.childNodes[i] )
        {
            if( element.attributes["onclick"].value == 'multisearch.moto.set();' )
            {
                element.className = 'selected';
            }    
            else
            {
                element.className = '';
            }
            i++;
        }

        while( $( 'multisearchdynamic' ).hasChildNodes() ) 
        { 
            $( 'multisearchdynamic' ).removeChild( $( 'multisearchdynamic' ).lastChild ); 
        }

        this.loadType();
    }
    
    this.loadType = function()
    {           
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
            td1.style.width = '28.57%'; 
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Rodzaj oferty:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.moto.setCategory( 1, 1 );' );    
            select.appendChild( option );
                    
        var list = multisearch.clean( $( 'subcategory-1' ) );
        
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                
                elementchild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                        select.appendChild( option );
                            
                    if( element.getAttribute( 'id' ) )
                    {
                        option.setAttribute( 'onclick', 'multisearch.moto.loadCategories( '+id[1]+' );' );
                    }
                    else
                    {
                        option.setAttribute( 'onclick', 'multisearch.moto.setCategory( '+id[1]+', 1 );' );    
                    }
                }
                
                i++;
            } 
            
            this.setCategory( 1, 1 );
    }
    
    this.loadCategories = function( catid )
    {           
            this.setCategory( catid, 1 );
        
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
            td1.style.width = '28.57%'; 
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Kategoria:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.moto.setCategory( '+catid+', 2 );' );    
            select.appendChild( option );
            
        var list = multisearch.clean( $( 'subcategory-'+catid ) ); 
            var i = 0;
                while( element = list.childNodes[i] )
                {        
                    element = multisearch.clean( element );
                    elementchild = multisearch.clean( element.firstChild );  
                    
                    if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                    {
                        var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                         
                            if( element.getAttribute( 'id' ) )
                            {
                                var optgroup = document.createElement( 'optgroup' );
                                    select.appendChild( optgroup );
                                    optgroup.setAttribute( 'label', elementchild.firstChild.firstChild.data );
                                    
                                var sublist = multisearch.clean( $( 'subcategory-'+element.getAttribute( 'id' ).replace( 'category-', '' ) ) );
                                var j = 0;
                                    while( subelement = sublist.childNodes[j] )
                                    {
                                        subelement = multisearch.clean( subelement );
                                        subelementchild = multisearch.clean( subelement.firstChild ); 
                                        
                                        if( ( subelement.nodeName == 'DIV' ) && ( subelementchild.firstChild.nodeName == 'A' ) )
                                        {
                                            var subid = subelementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                                            var option = document.createElement( 'option' );
                                                option.setAttribute( 'value', subid[1] );
                                                option.appendChild( document.createTextNode( subelementchild.firstChild.firstChild.data ) );
                                                optgroup.appendChild( option );
                                            
                                                if( subelement.getAttribute( 'id' ) )
                                                {
                                                    option.setAttribute( 'onclick', 'multisearch.moto.loadBrand( '+subid[1]+' )' );    
                                                }
                                                else
                                                {
                                                    option.setAttribute( 'onclick', 'multisearch.moto.setCategory( '+subid[1]+', 2 );' );    
                                                }
                                        }
                                        
                                        j++;
                                    }
                            }           
                            else
                            {
                                var option = document.createElement( 'option' );
                                    option.setAttribute( 'value', id[1] );
                                    option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                                    option.setAttribute( 'onclick', 'multisearch.moto.setCategory( '+id[1]+', 2 );' );    
                                    select.appendChild( option );
                            }
                    }
                
                    i++;
                } 
    }
    
    this.loadBrand = function( catid )
    {          
            this.setCategory( catid, 2 ); 
        
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
            td1.style.width = '28.57%'; 
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Marka:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.moto.setCategory( '+catid+', 3 );' );    
            select.appendChild( option );
                    
        var list = multisearch.clean( $( 'subcategory-'+catid ) );
        
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                
                elementchild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                        select.appendChild( option );
                    
                    option.setAttribute( 'onclick', 'multisearch.moto.loadModel( '+id[1]+', 3 );' ); 
                }
                
                i++;
            } 
    }
    
    this.loadModel = function( catid )
    {
        this.setCategory( catid, 3 );
    
        // stworzenie pola z modelem
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.setAttribute( 'for', 'multisearchmodel' );
            label.appendChild( document.createTextNode( 'Model:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var input = document.createElement( 'input' );
            input.setAttribute( 'name', 'model' );
            input.setAttribute( 'id', 'multisearchmodel' );
            td2.appendChild( input );
            $( 'multisearchdynamic' ).appendChild( tr );  
    }
    
    this.setCategory = function( id, lv )
    {
        while( element = $( 'multisearchdynamic' ).childNodes[lv] )
        {
            $( 'multisearchdynamic' ).removeChild( element );
        }
        // wstawienie ID kategorii 
        $( 'multisearchCategoryId' ).value = id; 
    }
}

function multisearchwork()
{
    this.set = function()
    {
        $( 'multisearchPrice' ).style.display = 'none';
        $( 'multisearchArea' ).style.display = 'none';
        $( 'multisearchWithPhotoField' ).style.display = 'none';
        $( 'multisearchWithPhotoText' ).style.display = 'none';
        $( 'multisearchExclusiveField' ).style.display = 'none';
        $( 'multisearchExclusiveText' ).style.display = 'none';
    
        var ul = multisearch.clean( $( 'multisearch-nav' ) );
        var i = 0;
        while( element = ul.childNodes[i] )
        {
            if( element.attributes["onclick"].value == 'multisearch.work.set();' )
            {
                element.className = 'selected';
            }    
            else
            {
                element.className = '';
            }
            i++;
        }
    
        while( $( 'multisearchdynamic' ).hasChildNodes() ) 
        { 
            $( 'multisearchdynamic' ).removeChild( $( 'multisearchdynamic' ).lastChild ); 
        }
        
        this.loadType();
    }
    
    this.loadType = function()
    {            
        this.setCategory( 2, 1 ); 
        
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            td1.style.width = '28.57%';
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Rodzaj oferty:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.work.setCategory( 2, 1 );' );    
            select.appendChild( option );
                    
        var list = multisearch.clean( $( 'subcategory-2' ) );
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementchild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                        select.appendChild( option );
                    
                    if( elementchild.firstChild.firstChild.data.toLowerCase() == 'oferty pracy' || 
                        elementchild.firstChild.firstChild.data.toLowerCase() == 'oferty cv' )
                    {
                        option.setAttribute( 'onclick', 'multisearch.work.loadBranch( '+id[1]+' );' );
                    }
                    else
                    {
                        option.setAttribute( 'onclick', 'multisearch.work.setCategory( '+id[1]+', 1 );' );
                    }
                }
                
                i++;
            } 
    }
    
    this.loadBranch = function( catId )
    {
            this.setCategory( catId, 1 ); 
            
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            td1.style.width = '28.57%';
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Branża:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            select.setAttribute( 'name', 'job_section' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr ); 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );   
            select.appendChild( option );
            
        /* branże */
        var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '1' );
            option.appendChild( document.createTextNode( 'Administracja biurowa' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '2' );
            option.appendChild( document.createTextNode( 'Administracja publiczna' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '3' );
            option.appendChild( document.createTextNode( 'Agencje zatrudnienia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '4' );
            option.appendChild( document.createTextNode( 'Architektura' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '5' );
            option.appendChild( document.createTextNode( 'Biura projektowe / Wdrażanie' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '6' );
            option.appendChild( document.createTextNode( 'BHP / Audyty' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '7' );
            option.appendChild( document.createTextNode( 'Budownictwo' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '8' );
            option.appendChild( document.createTextNode( 'Call Center / Obsługa klienta' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '9' );
            option.appendChild( document.createTextNode( 'Chałupnictwo' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '10' );
            option.appendChild( document.createTextNode( 'Doradztwo / Konsulting / HR' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '11' );
            option.appendChild( document.createTextNode( 'Działalność badawczo - rozwojowa' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '12' );
            option.appendChild( document.createTextNode( 'Edukacja / Kształcenie' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '13' );
            option.appendChild( document.createTextNode( 'Energetyka / Elektronika' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '14' );
            option.appendChild( document.createTextNode( 'Finanse / Bankowość' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '15' );
            option.appendChild( document.createTextNode( 'Gastronomia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '16' );
            option.appendChild( document.createTextNode( 'Gospodarstwa domowe' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '17' );
            option.appendChild( document.createTextNode( 'Grafika / DTP / Fotografia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '18' );
            option.appendChild( document.createTextNode( 'Handel / Sprzedaż' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '19' );
            option.appendChild( document.createTextNode( 'Hotelarstwo' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '20' );
            option.appendChild( document.createTextNode( 'Informatyka / Internet' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '21' );
            option.appendChild( document.createTextNode( 'Inżynieria / Technologia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '22' );
            option.appendChild( document.createTextNode( 'Księgowość / Kadry' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '23' );
            option.appendChild( document.createTextNode( 'Logistyka / Zaopatrzenie' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '24' );
            option.appendChild( document.createTextNode( 'Marketing / Reklama / Promocja / PR' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '25' );
            option.appendChild( document.createTextNode( 'Medycyna / farmacja / Służba zdrowia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '26' );
            option.appendChild( document.createTextNode( 'Motoryzacja' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '27' );
            option.appendChild( document.createTextNode( 'Nieruchomości' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '28' );
            option.appendChild( document.createTextNode( 'Ochrona środowiska' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '29' );
            option.appendChild( document.createTextNode( 'Opieka nad domem, dziećmi i osobami starszymi' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '30' );
            option.appendChild( document.createTextNode( 'Ochrona' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '31' );
            option.appendChild( document.createTextNode( 'Prawo' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '32' );
            option.appendChild( document.createTextNode( 'Produkcja / Praca fizyczna' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '33' );
            option.appendChild( document.createTextNode( 'Rolnictwo / Ogrodnictwo' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '34' );
            option.appendChild( document.createTextNode( 'Rozrywka / Media / Kultura' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '35' );
            option.appendChild( document.createTextNode( 'Telekomunikacja' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '36' );
            option.appendChild( document.createTextNode( 'Tłumaczenia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '37' );
            option.appendChild( document.createTextNode( 'Transport / Logistyka' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '38' );
            option.appendChild( document.createTextNode( 'Turystyka / Sport / Rekreacja' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '39' );
            option.appendChild( document.createTextNode( 'Ubezpieczenia' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '40' );
            option.appendChild( document.createTextNode( 'Uroda' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '41' );
            option.appendChild( document.createTextNode( 'Wydawnictwa' ) );
            select.appendChild( option );
var option = document.createElement( 'option' );
            option.setAttribute( 'value' , '42' );
            option.appendChild( document.createTextNode( 'Zarządzanie / Organizacja' ) );
            select.appendChild( option ); 
        /* end */ 
    }
    
    this.setCategory = function( id, lv )
    {
        while( element = $( 'multisearchdynamic' ).childNodes[lv] )
        {
            $( 'multisearchdynamic' ).removeChild( element );
        }
        // wstawienie ID kategorii 
        $( 'multisearchCategoryId' ).value = id; 
    }
}

function multisearchrealestate()
{
    this.set = function()
    {
        $( 'multisearchPrice' ).style.display = '';
        $( 'multisearchArea' ).style.display = '';
        $( 'multisearchWithPhotoField' ).style.display = '';
        $( 'multisearchWithPhotoText' ).style.display = '';
        $( 'multisearchExclusiveField' ).style.display = '';
        $( 'multisearchExclusiveText' ).style.display = '';
        
        var ul = multisearch.clean( $( 'multisearch-nav' ) );
        var i = 0;
        while( element = ul.childNodes[i] )
        {
            if( element.attributes["onclick"].value == 'multisearch.realestate.set();' )
            {
                element.className = 'selected';
            }    
            else
            {
                element.className = '';
            }
            i++;
        }
    
        while( $( 'multisearchdynamic' ).hasChildNodes() ) 
        { 
            $( 'multisearchdynamic' ).removeChild( $( 'multisearchdynamic' ).lastChild ); 
        }
        
        this.loadType();
    }
    
    this.loadType = function()
    {            
            this.setCategory( 3, 0 );
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            td1.style.width = '100px';
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Rodzaj oferty:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.realestate.setCategory( 3, 1 );' );    
            select.appendChild( option );
                    
        var list = multisearch.clean( $( 'subcategory-3' ) );
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementchild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                        select.appendChild( option );
                            
                    if( element.getAttribute( 'id' ) )
                    {
                        option.setAttribute( 'onclick', 'multisearch.realestate.loadMarket( '+id[1]+' );' );
                    }
                    else
                    {
                        option.setAttribute( 'onclick', 'multisearch.realestate.setCategory( '+id[1]+', 1 );' );    
                    }
                }
                
                i++;
            } 
    }
    
    this.loadMarket = function( catid )
    {
        this.setCategory( catid, 1 );

        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            //td1.style.width = '120px';
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Rynek:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            //td2.colSpan = '3';
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.realestate.setCategory( '+catid+', 2 );' );
            select.appendChild( option );
                    
        var list = multisearch.clean( $( 'subcategory-'+catid ) );
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementchild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                        select.appendChild( option );       
                    
                    if( element.getAttribute( 'id' ) )
                    {
                        option.setAttribute( 'onclick', 'multisearch.realestate.loadRealestate( '+id[1]+' );' );
                    }
                    else
                    {
                        option.setAttribute( 'onclick', 'multisearch.realestate.setCategory( '+id[1]+', 1 );' );    
                    }
                }
                
                i++;
            }        
    }
    
    this.loadRealestate = function( catid )
    {
        this.setCategory( catid, 2 ); 
  
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                //td1.style.width = '120px';
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                //label.style.width = '120px';
                label.appendChild( document.createTextNode( 'Typ nieruchomości:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                //td2.colSpan = '3';
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );
                
                select.onchange = function() { multisearch.iefix( this ) };
                
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                option.setAttribute( 'onclick', 'multisearch.realestate.setCategory( '+catid+', 2 );' );
                select.appendChild( option );
                
            var list = multisearch.clean( $( 'subcategory-'+catid ) );
            var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementchild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementchild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementchild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementchild.firstChild.firstChild.data ) );
                        select.appendChild( option );       
                    
                        option.setAttribute( 'onclick', 'multisearch.realestate.setCategory( '+id[1]+', 3 );' );    
                }
                
                i++;
            }
    }
    
    this.setCategory = function( id, lv )
    {
        while( element = $( 'multisearchdynamic' ).childNodes[lv] )
        {
            $( 'multisearchdynamic' ).removeChild( element );
        }
        // wstawienie ID kategorii 
        $( 'multisearchCategoryId' ).value = id; 
    }
}

function multisearchconstruction()
{
    this.set = function()
    {
        $( 'multisearchPrice' ).style.display = '';
        $( 'multisearchArea' ).style.display = 'none';
        $( 'multisearchWithPhotoField' ).style.display = '';
        $( 'multisearchWithPhotoText' ).style.display = '';
        $( 'multisearchExclusiveField' ).style.display = 'none';
        $( 'multisearchExclusiveText' ).style.display = 'none';
        
        var ul = multisearch.clean( $( 'multisearch-nav' ) );
        var i = 0;
        while( element = ul.childNodes[i] )
        {
            if( element.attributes["onclick"].value == 'multisearch.construction.set();' )
            {
                element.className = 'selected';
            }    
            else
            {
                element.className = '';
            }
            i++;
        }
    
        while( $( 'multisearchdynamic' ).hasChildNodes() ) 
        { 
            $( 'multisearchdynamic' ).removeChild( $( 'multisearchdynamic' ).lastChild ); 
        }
        
        this.loadType();
    }
    
    this.loadType = function()
    {          
            this.setCategory( 4, 0 );
              
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
            td1.style.width = '28.57%';
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Rodzaj oferty:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.construction.setCategory( 4, 1 );' );
            select.appendChild( option );
              
        var list = $( 'subcategory-4' );     
        if( !list )
        {
            return false;
        }
        var list = multisearch.clean( list );
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementChild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementChild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementChild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementChild.firstChild.firstChild.data ) );
                        select.appendChild( option );

                    if( ( elementChild.firstChild.firstChild.data.toLowerCase() == 'maszyny budowlane' ) ||
                        ( elementChild.firstChild.firstChild.data.toLowerCase() == 'inne maszyny i urządzenia' ) )
                    {
                        option.setAttribute( 'onclick', 'multisearch.construction.loadStatus( '+id[1]+' );' );
                    }
                    else if( elementChild.firstChild.firstChild.data.toLowerCase() == 'dom i ogród' )
                    {
                        option.setAttribute( 'onclick', 'multisearch.construction.loadCategory( '+id[1]+' );' );
                    }
                    else
                    {
                        option.setAttribute( 'onclick', 'multisearch.construction.setCategory( '+id[1]+', 1 );' );    
                    } 
                }
                
                i++;
            }
    }
    
    this.loadStatus = function( catid )
    {
        this.setCategory( catid, 1 );
        // stworzenie pola z stanem
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.setAttribute( 'for', 'multisearchstatus' );
            label.appendChild( document.createTextNode( 'Stan:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            select.setAttribute( 'name', 'thing_state' );
            select.setAttribute( 'id', 'multisearchstatus' );
            td2.appendChild( select );
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            select.appendChild( option );
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '1' );
            option.appendChild( document.createTextNode( 'Nowy' ) );
            select.appendChild( option );
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '2' );
            option.appendChild( document.createTextNode( 'Używany' ) );
            select.appendChild( option );
            
            $( 'multisearchdynamic' ).appendChild( tr );
    }
    
    this.loadCategory = function( catid )
    {
            this.setCategory( catid, 1 );
            
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            tr.appendChild( td1 );
            td1.style.width = '28.57%';
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Kategoria:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.construction.setCategory( '+catid+', 1 );' );
            select.appendChild( option );
    
        var list = multisearch.clean( $( 'subcategory-'+catid ) );
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementChild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementChild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementChild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementChild.firstChild.firstChild.data ) );
                        select.appendChild( option );

                        option.setAttribute( 'onclick', 'multisearch.construction.setCategory( '+id[1]+', 2 );' ); 
                }
                
                i++;
            }    
    }
    
    this.setCategory = function( id, lv )
    {
        while( element = $( 'multisearchdynamic' ).childNodes[lv] )
        {
            $( 'multisearchdynamic' ).removeChild( element );
        }
        // wstawienie ID kategorii 
        $( 'multisearchCategoryId' ).value = id; 
    }
}

function multisearchtourism()
{
    this.set = function()
    {
        $( 'multisearchPrice' ).style.display = '';
        $( 'multisearchArea' ).style.display = 'none';
        $( 'multisearchWithPhotoField' ).style.display = '';
        $( 'multisearchWithPhotoText' ).style.display = '';
        $( 'multisearchExclusiveField' ).style.display = 'none';
        $( 'multisearchExclusiveText' ).style.display = 'none';
        
        var ul = multisearch.clean( $( 'multisearch-nav' ) );
        var i = 0;
        while( element = ul.childNodes[i] )
        {
            if( element.attributes["onclick"].value == 'multisearch.tourism.set();' )
            {
                element.className = 'selected';
            }    
            else
            {
                element.className = '';
            }
            i++;
        }
    
        while( $( 'multisearchdynamic' ).hasChildNodes() ) 
        { 
            $( 'multisearchdynamic' ).removeChild( $( 'multisearchdynamic' ).lastChild ); 
        }
        
        this.loadCategory();
    }
    
    this.loadCategory = function()
    {    
            this.setCategory( 5, 0 );
                 
        var tr = document.createElement( 'tr' );
        var td1 = document.createElement( 'td' );
            td1.style.width = '28.57%';
            tr.appendChild( td1 );
        var label = document.createElement( 'label' );
            label.appendChild( document.createTextNode( 'Kategoria:' ) );
            td1.appendChild( label );
        var td2 = document.createElement( 'td' );
            tr.appendChild( td2 );
        var select = document.createElement( 'select' );
            select.setAttribute( 'id', 'multisearchCategory' );
            td2.appendChild( select );
            $( 'multisearchdynamic' ).appendChild( tr );
            
            select.onchange = function() { multisearch.iefix( this ) }; 
            
        var option = document.createElement( 'option' );
            option.setAttribute( 'value', '' );
            option.appendChild( document.createTextNode( '-- wybierz --' ) );
            option.setAttribute( 'onclick', 'multisearch.tourism.setCategory( 5, 8 );' );
            select.appendChild( option );
                    
        var list = $( 'subcategory-5' );
        if( !list )
        {
            return false;
        }
        var list = multisearch.clean( list );
        var i = 0;
            while( element = list.childNodes[i] )
            {    
                element = multisearch.clean( element );
                elementChild = multisearch.clean( element.firstChild );
                
                if( ( element.nodeName == 'DIV' ) && ( elementChild.firstChild.nodeName == 'A' ) )
                {
                    var id = elementChild.firstChild.getAttribute( 'href' ).split( '/' ).reverse();
                    var option = document.createElement( 'option' );
                        option.setAttribute( 'value', id[1] );
                        option.appendChild( document.createTextNode( elementChild.firstChild.firstChild.data ) );
                        select.appendChild( option );
                            
                        option.setAttribute( 'onclick', 'multisearch.tourism.setCategory( '+id[1]+', 1 );' );    
                }
                
                i++;
            } 
    }
    
    this.loadWhere = function()
    {
        var select = $( 'multisearchCategory' );
        
        if( !select )
        {
            return false;
        }      
        
        var text = select.options[select.selectedIndex].firstChild.data;
        
        if( ( text == 'imprezy dla firm' ) || ( text == 'wycieczki' ) || ( text == 'kolonie, obozy, zimowiska' ) )
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.setAttribute( 'for', 'multisearchkeyword' );
                label.appendChild( document.createTextNode( 'Miejsce:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'tourism_place' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );  
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '1' );
                option.appendChild( document.createTextNode( 'Morze' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '2' );
                option.appendChild( document.createTextNode( 'Jeziora' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '3' );
                option.appendChild( document.createTextNode( 'Góry' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '4' );
                option.appendChild( document.createTextNode( 'Pozostałe' ) );
                select.appendChild( option );
        }
    }
    
    this.loadTour = function()
    {
        var select = $( 'multisearchCategory' );
        
        if( !select )
        {
            return false;
        }
        
        var text = select.options[select.selectedIndex].firstChild.data;
        if( text == 'wycieczki' )
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.setAttribute( 'for', 'multisearchkeyword' );
                label.appendChild( document.createTextNode( 'Typ:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'tourism_category1' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );   
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '1' );
                option.appendChild( document.createTextNode( 'Letnie' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '2' );
                option.appendChild( document.createTextNode( 'Zimowe' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '3' );
                option.appendChild( document.createTextNode( 'Objazdowe' ) );
                select.appendChild( option );
        }
    }
    
    this.loadColonies = function()
    {
        var select = $( 'multisearchCategory' );
        
        if( !select )
        {
            return false;
        }
        
        var text = select.options[select.selectedIndex].firstChild.data;
        if( text == 'kolonie, obozy, zimowiska' )
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.setAttribute( 'for', 'multisearchkeyword' );
                label.appendChild( document.createTextNode( 'Rodzaj:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'tourism_category2' );
                //select.setAttribute( 'onchange', 'multisearch.tourism.loadColoniesDetail( this );' );
                
                select.onclick = function() { multisearch.tourism.loadColoniesDetail( this ); };
                
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option );   
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '1' );
                option.appendChild( document.createTextNode( 'Edukacyjne' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '9' );
                option.appendChild( document.createTextNode( 'Sportowe' ) );
                select.appendChild( option );
        }
    }
    
    this.loadColoniesDetail = function( select )
    {           
        while( element = $( 'multisearchdynamic' ).childNodes[3] )
        {
            $( 'multisearchdynamic' ).removeChild( element );
        }
        
        if( !select )
        {
            return false;
        }
        
        if( select.selectedIndex == 0 )
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.appendChild( document.createTextNode( 'Zakres:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'tourism_category2' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option );  
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '2' );
                option.appendChild( document.createTextNode( 'Językowe' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '15' );
                option.appendChild( document.createTextNode( 'Naukowo-badawcze' ) );
                select.appendChild( option );    
        }
        else
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.appendChild( document.createTextNode( 'Zakres:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'tourism_category2' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );   
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '4' );
                option.appendChild( document.createTextNode( 'Koszykówka' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '5' );
                option.appendChild( document.createTextNode( 'Narciarstwo' ) );
                select.appendChild( option ); 
                var option = document.createElement( 'option' );
                option.setAttribute( 'value', '6' );
                option.appendChild( document.createTextNode( 'Piłkarskie' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '7' );
                option.appendChild( document.createTextNode( 'Pływanie' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '8' );
                option.appendChild( document.createTextNode( 'Rowerowe' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '11' );
                option.appendChild( document.createTextNode( 'Taniec' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '12' );
                option.appendChild( document.createTextNode( 'Tenis' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '13' );
                option.appendChild( document.createTextNode( 'Wspinaczka' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '14' );
                option.appendChild( document.createTextNode( 'Żeglarstwo' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '3' );
                option.appendChild( document.createTextNode( 'Jeździectwo' ) );
                select.appendChild( option ); 
        }
    }
    
    this.loadTransType = function()
    {
        var select = $( 'multisearchCategory' );
        
        if( !select )
        {
            return false;
        }
        
        var text = select.options[select.selectedIndex].firstChild.data;
        if( text == 'transport' )
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.setAttribute( 'for', 'multisearchkeyword' );
                label.appendChild( document.createTextNode( 'Rodzaj:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'tourism_access' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );   
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '1' );
                option.appendChild( document.createTextNode( 'Lądowy' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '4' );
                option.appendChild( document.createTextNode( 'Wodny' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '3' );
                option.appendChild( document.createTextNode( 'Powietrzny' ) );
                select.appendChild( option );

        }
    }
    
    this.loadTouristEquipment = function()
    {
        var select = $( 'multisearchCategory' );
        
        if( !select )
        {
            return false;
        }
        
        var text = select.options[select.selectedIndex].firstChild.data;
        if( text == 'sprzęt turystyczny' )
        {
            var tr = document.createElement( 'tr' );
            var td1 = document.createElement( 'td' );
                tr.appendChild( td1 );
            var label = document.createElement( 'label' );
                label.setAttribute( 'for', 'multisearchkeyword' );
                label.appendChild( document.createTextNode( 'Jaki:' ) );
                td1.appendChild( label );
            var td2 = document.createElement( 'td' );
                tr.appendChild( td2 );
            var select = document.createElement( 'select' );
                select.setAttribute( 'name', 'category' );
                td2.appendChild( select );
                $( 'multisearchdynamic' ).appendChild( tr );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '' );
                option.appendChild( document.createTextNode( '-- wybierz --' ) );
                select.appendChild( option );   
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '206' );
                option.appendChild( document.createTextNode( 'Odzież' ) );
                select.appendChild( option ); 
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '207' );
                option.appendChild( document.createTextNode( 'Obuwie' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '208' );
                option.appendChild( document.createTextNode( 'Plecaki' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '209' );
                option.appendChild( document.createTextNode( 'Śpiwory' ) );
                select.appendChild( option );
            var option = document.createElement( 'option' );
                option.setAttribute( 'value', '210' );
                option.appendChild( document.createTextNode( 'Namioty' ) );
                select.appendChild( option );

        }
    }
    
    this.setCategory = function( id, lv )
    {
        while( element = $( 'multisearchdynamic' ).childNodes[lv] )
        {
            $( 'multisearchdynamic' ).removeChild( element );
        }
        // wstawienie ID kategorii 
        $( 'multisearchCategoryId' ).value = id; 
        
        this.loadWhere();
        this.loadTour();
        this.loadColonies();
        this.loadTransType();
        this.loadTouristEquipment();
    }
}

function multisearch()
{
    this.moto         = new multisearchmoto();
    this.work         = new multisearchwork();
    this.realestate   = new multisearchrealestate();
    this.construction = new multisearchconstruction();
    this.tourism      = new multisearchtourism();
    
    this.clean = function( element )
    {
        var i = 0;
        if ( element )
        {
        while( element.childNodes[i] )
        {
            if( element.childNodes[i].nodeName == '#text' )
            {
                element.removeChild( element.childNodes[i] );
            }
            else
            {
                i++;
            }
        }
        }
        
        return element;
    }
    
    this.iefix = function( select )
    {       
        if( navigator.userAgent.search(/msie/i) == -1 ) return false; 
                    
        var onclick = select.options[select.selectedIndex].getAttribute( 'onclick' );
                    
        eval( onclick );
    }
    
    this.country = function( option )
    {
        if( option.value == 67 )
        {
            $( 'multisearchProvincesLabel' ).style.display = '';
            $( 'multisearchProvincesField' ).style.display = '';
        }
        else
        {
            $( 'multisearchProvincesLabel' ).style.display = 'none';
            $( 'multisearchProvincesField' ).style.display = 'none'; 
            
            $( 'multisearchProvincesField' ).selectedIndex = 0;
        }
    }
}

var multisearch = new multisearch();

window.addEvent( 'domready', function()
{
    multisearch.moto.set(); 
} );