﻿
function setFormValues(qs){
    if(qs.params.k !== undefined && qs.params.k !== null){
        $('input[@name=keywords]').val(URLDecode(qs.params.k));
    }
    if(qs.params.r !== undefined && qs.params.r !== null){
        $('select[@name=type_resource] option').each(function(){
            if(qs.params.r === this.value){
                this.selected = true;
            }
        });
    }
    if(qs.params.i !== undefined && qs.params.i !== null){
        $('select[@name=type_industry] option').each(function(){
            if(qs.params.i === this.value){
                this.selected = true;
            }
        });
    }
    if(qs.params.a !== undefined && qs.params.a !== null){
        $('select[@name=type_application] option').each(function(){
            if(qs.params.a === this.value){
                this.selected = true;
            }
        });
    }
    if(qs.params.t !== undefined && qs.params.t !== null){
        $('select[@name=type_topic] option').each(function(){
            if(qs.params.t === this.value){
                this.selected = true;
            }
        });
    }
}

$(document).ready(function(){
    if(window.location.search.length > 0){
        var qs = $.parseURI(window.location);
        
        if(qs !== null){
            setFormValues(qs);
            $('#postme').submit();
        } 
    }
});


