Added conditional width

In early versions of jQuery the $(window).width() could return a 0 value.
This tries every combination of width detection to get a proper width value.
See:
http://bugs.jquery.com/ticket/12618