Mage::getStoreConfig('web/secure/use_in_frontend')

Use Mage::getStoreConfig('web/secure/use_in_frontend') when creating
urls, instead of assuming “secure” urls are in use on the frontend