First of all, you should always consult a lawyer for advice on the legal language in any sales contract you enter into. Generally speaking - whether you will lose any funds depends on the specifics of the sales contract, the finance addendum or any other additional contract language.
In most sales contracts where the buyer is getting a loan, there is a finance addendum that says that your earnest money is protected if you have made a good faith effort to obtain the financing that you said you were attempting to get and you don't qualify within a given time period. You may still be responsible for any loan application fees, appraisals, inspections, etc. that took place while you were attempting to get financing.
Your earnest money may be in jeopardy if you changed the type of financing you were trying to get without disclosing that to the seller or if you intentionally do something to sabotage your financing. Also, most finance addendums protect the earnest money only if you don't qualify - not if you just don't care for the loan terms.
Every state is different with regard to what is customary - it will all boil down to what specifically is stated in your contract and how each party has fulfilled their obligations and stipulations. Ask your real estate agent to go over the specific terms of your contract with you, then take the time to read your contract and consult a lawyer!
If you do it within the time frame and loan condition was part of deal you should be ok.
King of Craigslist