This function cleans up a URL, like "http://www.webanddata.com/login.aspx?url=http://mailflick.com/Home/Tools/tool?id=123" to "www.webanddata.com".
I created this for my MailFlick browser extensions so I can block malware or any harmful sites to other users.