window.onload = function()  {
                                getCMS();
                                loadGoogleMap();
                                setTimeout('loadSiteTitle()', 1000);
                            }

function loadSiteTitle()
{
    if (navigator.appName == "Microsoft Internet Explorer")
    {
        sitetitle.filters[0].apply();
        sitetitle.src = "images/sitetitle_2.gif";
        sitetitle.filters[0].play();
    }
    else
    {
        sitetitle.src = "images/sitetitle_2.gif";
    }
}

function fShowLargerImage(imageIDIn)
{
  var screenURL = "images/" + imageIDIn + ".html";
  window.open(screenURL, '_blank', 'menubar=no, toolbar=no, height=608, width=912');
}

function loadGoogleMap()
{
    if (document.getElementById("oldCollegeMap") != null) /* We only want to do this on a page that has a map */
    {
        var myOptions =
            {
                zoom: 15,
                center: new google.maps.LatLng(54.139, -1.523),
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
        var map = new google.maps.Map(
                    document.getElementById("oldCollegeMap"),
                    myOptions);
        map.setTilt(45);
        var infowindow = new google.maps.InfoWindow(
            {
                content: "<div class='smalltext'><font size=2pt><b>15 The Old College</b><br />Wilkinson Court<br />Ripon<br />HG4 2TW</font></div>",
                position: new google.maps.LatLng(54.1413, -1.5273)
            });
        infowindow.open(map);
    }
}

function getCMS()
{
    /* We only want to do this on a page that has  Content Management elements */
    if (document.getElementById("cmsTitleContainer") != null) 
    {

        var XMLHttp;
        if (navigator.appName == "Microsoft Internet Explorer") {
            XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else {
            XMLHttp = new XMLHttpRequest();
        }
        XMLHttp.open("GET", "cgi-bin/getcms.pl", true);
        XMLHttp.onreadystatechange = function() {
            if (XMLHttp.readyState == 4) /* All the data has been received */
            {
                var text = XMLHttp.responseText;
                var titleContentSplit = text.split("=");
                if (titleContentSplit.length > 0) {
                    if (titleContentSplit[0].length == 0) {
                        document.getElementById('cmsTitleContainer').display = 'none';
                    }
                    else {
                        document.getElementById('cmsTitle').innerHTML = titleContentSplit[0];
                    }
                }
                if (titleContentSplit.length > 1) {
                    if (titleContentSplit[1].length == 0) {
                        document.getElementById('cmsContentContainer').display = 'none';
                    }
                    else {
                        var formattedContent = new String();
                        var contentSplit = titleContentSplit[1].split("|");
                        for (x in contentSplit) {
                            formattedContent = formattedContent + "<p>" + contentSplit[x] + "</p>";
                        }
                        document.getElementById('cmsContent').innerHTML = formattedContent;
                    }
                }
            }
        }
        XMLHttp.send(null);
    }
}

/*
window.onload=loadGoogleMap;
window.onunload=unLoadGoogleMap;

var map = null;
var marker = null;
var geocoder = null;

function loadGoogleMap()
{
    if (document.getElementById("oldCollegeMap") != null)
    {
        if (GBrowserIsCompatible())
        {
            map = new GMap2(document.getElementById("oldCollegeMap"));
            map.setMapType(G_HYBRID_MAP);
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            map.setCenter(new GLatLng(54.139, -1.52), 15);
            marker = new GMarker(new GLatLng(54.1413, -1.5273, true));
            map.addOverlay(marker);
            marker.openInfoWindowHtml("<div class='smalltext'><font size=2pt><b>15 The Old College</b><br />Wilkinson Court<br />Ripon<br />HG4 2TW</font></div>");
            geocoder = new GClientGeocoder();
        }
    }
}
function unLoadGoogleMap()
{
    if (document.getElementById("oldCollegeMap") != null)
    {
        GUnload();
    }
}
*/

