
function changeType()
{                        
    pSortType = getObject('sorttype');
    if(pSortType[pSortType.selectedIndex].text == 'по градове')
    {
        getObject('selectsortdirections').style.display = 'none';
        getObject('selectsorttowns').style.display = 'block'; 
    } 
    else
    {
        getObject('selectsortdirections').style.display = 'block';
        getObject('selectsorttowns').style.display = 'none';
    }
}
function SubmitSortForm(strUrl)
{
    pSortType = getObject('sorttype');
    if(pSortType[pSortType.selectedIndex].text == 'по градове')
    {
        // getObject('selectsortdirections').innerHTML = ''; 
        strUrl = strUrl.replace(/((\/town\/|\/date\/|\/title\/|\/page_)(.+))?\.html$/i, '');  
        pSortTown = getObject('sorttown');
        strUrl = strUrl + '/' + pSortType[pSortType.selectedIndex].value + '/' + pSortTown[pSortTown.selectedIndex].value + '.html';
        GetLocation(strUrl);
    } 
    else
    {
        // getObject('selectsorttowns').innerHTML = '';
        strUrl = strUrl.replace(/((\/town\/|\/date\/|\/title\/|\/page_)(.+))?\.html$/i, '');
        pSortDirection = getObject('sortdirection');
        strUrl = strUrl + '/' + pSortType[pSortType.selectedIndex].value + '/' + pSortDirection[pSortDirection.selectedIndex].value + '.html';
        GetLocation(strUrl);
    }     
    getObject('sortform').innerHTML = '';
}

/**
 * GetLocation 
 *
 */
function GetLocation(strUrl)
{
    if (window.location.replace)
    {
        window.location.replace(strUrl);
    }
    else
    {
        window.location = strUrl;
    }
}
                    