def urljoin(refurl, objurl):
    """
    >>> urljoin('http://www.homeinns.com/hotel', 'http://www.homeinns.com/beijing')
    'http://www.homeinns.com/beijing'
    >>> urljoin('http://www.homeinns.com/hotel', '/beijing')
    'http://www.homeinns.com/beijing'
    >>> urljoin('http://www.homeinns.com/hotel', 'beijing')
    'http://www.homeinns.com/beijing'
    """
    if objurl.strip() in ('', '#'):
        return ''
    elif objurl.startswith('http'):
        return objurl
    elif objurl.startswith('/'):
        refurl = refurl.replace('//', '{$$}')
        return ''.join([refurl[:refurl.index('/')].replace('{$$}', '//'), objurl])
    else:
        return '/'.join([refurl[:refurl.rindex('/')], objurl])