function urlencode(str) {
    if (str != '') {
        str = escape(str);
        str = str.replace(/%20/g, '-');
        str = str.replace('+', '-');
        str = str.replace('*', '-');
        str = str.replace('/', '-');
        str = str.replace('@', '-');
        return str;
    }
}

function actionSearch (dkeywords, scat, scatname, skeywordsid, formid) {
    var skeywords = jQuery(skeywordsid).val();
    
    if  (skeywords == dkeywords) skeywords = '-';
    
    if (skeywords != dkeywords && skeywords != "") {
        var newAction = '/search/cat/' + scat + '/' + urlencode(scatname) + '/' + urlencode(skeywords);
        
        jQuery(formid).attr('action', newAction);
        jQuery(formid).submit();
    }
}

function categorySearch (cat_select) {
    var catid = cat_select.options[cat_select.selectedIndex].value;
    var catname = cat_select.options[cat_select.selectedIndex].innerHTML;
    location.href = '/cat/' + catid + '/' + urlencode(catname) + '/';
}