﻿
function zoomToFeature(theLayer, theRef) {
    if (true) {
        var siteURL = "http://gis.durham.gov.uk/website/interMAP";

        //Set the URL to zoom to a postcode.
        var theURL = siteURL + "?QUERYLAYER=" + theLayer + "&GISQUERY=" + escape(theRef);

        //get screen resolution
        var screenWidth = screen.width
        var screenHeight = screen.height

        //check resolution of user machine is OK for GIS
        if (screenWidth < 640 || screenHeight < 480) {
            alert("To use the Interactive Mapping Service, your screen resolution should be set to 640 x 480 or greater")
        }
        else {
            //set sizes for the GIS window, depending upon users screen resolution
            var windowWidth = screenWidth * 0.98
            var windowHeight = screenHeight * 0.90

            //open the GIS in a window
            myWin = open(theURL, "displaywindow", "width=" + windowWidth + ",height=" + windowHeight + ",top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no")
        }
    }
}