This is an alright tutorial for showing.
When doing this you tell javascript to fetch the clients screen size and store the information as a varible which can then be past on to PHP or used on the same page.
http://www.javascripter.net/faq/screensi.htm