refined media query script to handle mixed width and height media queries