The XP bit is easy. They need 1000 x their current level to advance to the next level. So at first level (with 0 xp) you need 1000 xp to advance to second level. At the start of second level (1000 xp) you need 2000 more xp to advance to third level (and thus must have 3000 xp to reach third level). Just add up the thousands to reach the desired level. So if you want to have enough xp to be 12th level you need:
(1+2+3+4+5+6+7+8+9+10+11)*1000 xp, or 66,000 xp. To reach 13th level they would need 12000 more xp, or 78,000 xp.
Now, the CR/EL is a bit more complicated. I can't recall the equation right now, but I think the party is supposed to go through about 13 or 14 encounters (on average) per level to level up. So, to use the above example, a "typical" or "average" encounter for a group of four "typical" PCs at 12th level working towards 13th level would grant about 890 xp (per individual PC). Make it an even 900 xp per encounter and it works out to 13.3333 encounters rather than 13.5 encounters. Either way works, but the second gives a nice round number.
Now, as for how xp increases / decreases as one moves up or down from the suggested CR level, I do not know. I do recall that eight levels higher or lower than the suggested CR gain no xp as it is presumed that either the encounter was too easy or that success was only due to luck. (I'd still give some ad hoc xp anyway in the latter instance, however.) Also, the increase or decrease of monster HD, whether or not the monster has class levels (and whether the class levels are particularly useful or not - less useful ones granting only half a CR increase as I recall), and how many PCs more or less than 4 also impact CR. Then there is the fact that a PC receives differing xp differently if they differ in level from their compatriots. If someone can give a hint as to how xp differs based on +/- 1, 2, ..., 7 levels from the suggested CR then you would have all you need.
Does this help any?