//Javascript to get the viewport size (width and height)
function viewportSize() {
   var vWidth;
   var vHeight;
   //For standards compliant browsers (mozilla/netscape/opera/IE7)
   // use window.innerWidth and window.innerHeight
   if (typeof window.innerWidth != 'undefined') {
      vWidth = window.innerWidth, vHeight = window.innerHeight
   }
   // IE6 in standards compliant mode 
   //(i.e. with a valid doctype as the first line in the document)
   else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth !=
      'undefined' && document.documentElement.clientWidth != 0) {
      vWidth = document.documentElement.clientWidth,
      vHeight = document.documentElement.clientHeight
   } else { //older versions of IE
      vWidth = document.getElementsByTagName('body')[0].clientWidth,
      vHeight = document.getElementsByTagName('body')[0].clientHeight
   }
   //document.write(viewportwidth+'x'+viewportheight);
   return [vWidth, vHeight];
}