Removed var duplication, cached cookies.length

Always good to save a couple of bytes where possible, multiple vars may not be stripped during minify so lets do it now

Calculate length before the forLoop is initiated, can be faster in extreme cases or when you need max performance - see http://jsperf.com/angular-foreach-vs-native-for-loop/29