Well, look. The easiest way to explain this is that when (όταν) refers to time, while if (αν) refers to possibility. They are two different words.
I will go out, if my father allows it. - Θα βγω έξω, αν μου το επιτρέψει ο πατέρας μου.
I will go out, when my father allows it/allows me to. - Θα βγω έξω όταν μου το επιτρέψει ο πατέρας μου.
I hope this is clear enough. ^.^