
	var BrowserDetect = {
		init: function () {
			this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
			this.version = this.searchVersion(navigator.userAgent)
				|| this.searchVersion(navigator.appVersion)
				|| "an unknown version";
			this.OS = this.searchString(this.dataOS) || "an unknown OS";
		},
		searchString: function (data) {
			for (var i=0;i<data.length;i++)	{
				var dataString = data[i].string;
				var dataProp = data[i].prop;
				this.versionSearchString = data[i].versionSearch || data[i].identity;
				if (dataString) {
					if (dataString.indexOf(data[i].subString) != -1)
						return data[i].identity;
				}
				else if (dataProp)
					return data[i].identity;
			}
		},
		searchVersion: function (dataString) {
			var index = dataString.indexOf(this.versionSearchString);
			if (index == -1) return;
			return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
		},
		dataBrowser: [
			{ 	string: navigator.userAgent,
				subString: "OmniWeb",
				versionSearch: "OmniWeb/",
				identity: "OmniWeb"
			},
			{
				string: navigator.vendor,
				subString: "Apple",
				identity: "Safari"
			},
			{
				prop: window.opera,
				identity: "Opera"
			},
			{
				string: navigator.vendor,
				subString: "iCab",
				identity: "iCab"
			},
			{
				string: navigator.vendor,
				subString: "KDE",
				identity: "Konqueror"
			},
			{
				string: navigator.userAgent,
				subString: "Firefox",
				identity: "Firefox"
			},
			{
				string: navigator.vendor,
				subString: "Camino",
				identity: "Camino"
			},
			{		// for newer Netscapes (6+)
				string: navigator.userAgent,
				subString: "Netscape",
				identity: "Netscape"
			},
			{
				string: navigator.userAgent,
				subString: "MSIE",
				identity: "Explorer",
				versionSearch: "MSIE"
			},
			{
				string: navigator.userAgent,
				subString: "Gecko",
				identity: "Mozilla",
				versionSearch: "rv"
			},
			{ 		// for older Netscapes (4-)
				string: navigator.userAgent,
				subString: "Mozilla",
				identity: "Netscape",
				versionSearch: "Mozilla"
			}
		],
		dataOS : [
			{
				string: navigator.platform,
				subString: "Win",
				identity: "Windows"
			},
			{
				string: navigator.platform,
				subString: "Mac",
				identity: "Mac"
			},
			{
				string: navigator.platform,
				subString: "Linux",
				identity: "Linux"
			}
		]

	};
	BrowserDetect.init();

	if (BrowserDetect.browser == 'Firefox')
	{
		//alert(BrowserDetect.browser + ' is not currently supported.  Please try again in a few days or use Internet Explorer.');
	}
	

    function currentDate()
    {
        date = new Date();
        
        months = new Array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
        
        month = date.getMonth();
        day = date.getDate();
        year = date.getFullYear();
        
        hours = date.getHours();
        minutes = date.getMinutes();
        seconds = date.getSeconds();
        
        if (hours < 13)
        {
            ampm = 'AM';
        }
        else
        {
            ampm = 'PM';
        }
        
        return months[month] + ' ' + day + ', ' + year + ' ' + hours + ':' + minutes + ':' + seconds + ' ' + ampm;
    }
    
    
    function CheckFormOnLoad()
    {
        if (!formSubmittedOK)
        {
            var txtPostcode = document.getElementById('ctl00$pageContent$txtPostcode');
            if (txtPostcode == null) txtPostcode = document.getElementById('ctl00_pageContent_txtPostcode');
            
            if (txtPostcode.value != '')
            {
                ToggleRecordLocationType(0);
            }

            var txtLatDeg = document.getElementById('ctl00$pageContent$txtLatDeg');
            if (txtLatDeg == null) txtLatDeg = document.getElementById('ctl00_pageContent_txtLatDeg');
            var txtLatMin = document.getElementById('ctl00$pageContent$txtLatMin');
            if (txtLatMin == null) txtLatMin = document.getElementById('ctl00_pageContent_txtLatMin');
            var txtLatSec = document.getElementById('ctl00$pageContent$txtLatSec');
            if (txtLatSec == null) txtLatSec = document.getElementById('ctl00_pageContent_txtLatSec');

            var txtLongDeg = document.getElementById('ctl00$pageContent$txtLongDeg');
            if (txtLongDeg == null) txtLongDeg = document.getElementById('ctl00_pageContent_txtLongDeg');
            var txtLongMin = document.getElementById('ctl00$pageContent$txtLongMin');
            if (txtLongMin == null) txtLatMin = document.getElementById('ctl00_pageContent_txtLongMin');
            var txtLongSec = document.getElementById('ctl00$pageContent$txtLongSec');
            if (txtLongSec == null) txtLongSec = document.getElementById('ctl00_pageContent_txtLongSec');
            
            if (txtLatDeg.value != '' && txtLatMin.value != '' && txtLatSec.value != '' &&
                txtLongDeg.value != '' && txtLongMin.value != '' && txtLongSec.value != '')
            {
                ToggleRecordLocationType(1);
            }

            var txtDecLatitude = document.getElementById('ctl00$pageContent$txtDecLatitude');
            if (txtDecLatitude == null) txtDecLatitude = document.getElementById('ctl00_pageContent_txtDecLatitude');
            var txtDecLongitude = document.getElementById('ctl00$pageContent$txtDecLongitude');
            if (txtDecLongitude == null) txtDecLongitude = document.getElementById('ctl00_pageContent_txtDecLongitude');
            
            if (txtDecLatitude.value != '' && txtDecLongitude.value != '')
            {
                ToggleRecordLocationType(2);
            }
        }
    }


    function ToggleRecordLocationType(index)
    {
        //var txtPostcode = document.getElementById('ctl00$pageContent$txtPostcode');
        //if (txtPostcode == null) txtPostcode = document.getElementById('ctl00_pageContent_txtPostcode');
        //txtPostcode.value = '';

        var rowPostcodeArea = document.getElementById('rowPostcodeArea');
        var rowLatitude = document.getElementById('rowLatitude');
        var rowLongitude = document.getElementById('rowLongitude');
        var rowDecLatitude = document.getElementById('rowDecLatitude');
        var rowDecLongitude = document.getElementById('rowDecLongitude');
        
        switch (index)
        {
            case 0:
                rowPostcodeArea.style.display = '';
                rowLatitude.style.display = 'none';
                rowLongitude.style.display = 'none';
                rowDecLatitude.style.display = 'none';
                rowDecLongitude.style.display = 'none';
                break;

            case 1:
                rowPostcodeArea.style.display = 'none';
                rowLatitude.style.display = '';
                rowLongitude.style.display = '';
                rowDecLatitude.style.display = 'none';
                rowDecLongitude.style.display = 'none';
                break;

            case 2:
                rowPostcodeArea.style.display = 'none';
                rowLatitude.style.display = 'none';
                rowLongitude.style.display = 'none';
                rowDecLatitude.style.display = '';
                rowDecLongitude.style.display = '';
                break;
                
            case 3:
                rowPostcodeArea.style.display = 'none';
                rowLatitude.style.display = 'none';
                rowLongitude.style.display = 'none';
                rowDecLatitude.style.display = '';
                rowDecLongitude.style.display = '';
                var url = 'googlemap.aspx';
                //var title = 'UKAI Google Maps';
                var title = '';
                var arguments = 'width=800,height=600,resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=yes';
                //var arguments = '';
                var googlewindow = window.open(url,title,arguments);
                if (window.focus) googlewindow.focus();
                break;
        }
    }


    function UpdateLatLongFromGoogle(latlong)
    {
        var txtDecLatitude = document.getElementById('ctl00$pageContent$txtDecLatitude');
        if (txtDecLatitude == null) txtDecLatitude = document.getElementById('ctl00_pageContent_txtDecLatitude');
        var txtDecLongitude = document.getElementById('ctl00$pageContent$txtDecLongitude');
        if (txtDecLongitude == null) txtDecLongitude = document.getElementById('ctl00_pageContent_txtDecLongitude');
        
        txtDecLatitude.value = latlong.split(', ')[0];
        txtDecLongitude.value = latlong.split(', ')[1];
    }
    

    function ToggleStreetLights()
    {
        var ddlStreetLights = document.getElementById('ctl00$pageContent$ddlStreetLights');
        if (ddlStreetLights == null) ddlStreetLights = document.getElementById('ctl00_pageContent_ddlStreetLights');
        var txtStreetLights = document.getElementById('ctl00$pageContent$txtStreetLights');
        if (txtStreetLights == null) txtStreetLights = document.getElementById('ctl00_pageContent_txtStreetLights');
        var rowStreetLights = document.getElementById('rowStreetLights');
        var rowStreetLightType = document.getElementById('rowStreetLightType');
       
        switch (ddlStreetLights.value)
        {
            case '0':
			    rowStreetLights.style.display = 'none';
				rowStreetLightType.style.display = 'none';
                txtStreetLights.value = '';
                break;

            case '1':
	            rowStreetLights.style.display = '';
		        rowStreetLightType.style.display = '';
                txtStreetLights.focus();
                break;
        }
    }


    function ToggleSecurityLights()
    {
        var ddlSecurityLights = document.getElementById('ctl00$pageContent$ddlSecurityLights');
        if (ddlSecurityLights == null) ddlSecurityLights = document.getElementById('ctl00_pageContent_ddlSecurityLights');
        var txtSecurityLights = document.getElementById('ctl00$pageContent$txtSecurityLights');
        if (txtSecurityLights == null) txtSecurityLights = document.getElementById('ctl00_pageContent_txtSecurityLights');
        var rowSecurityLights = document.getElementById('rowSecurityLights');
        var rowSecurityLightPositioning = document.getElementById('rowSecurityLightPositioning');
        
        switch (ddlSecurityLights.value)
        {
            case '0':
                rowSecurityLights.style.display = 'none';
                rowSecurityLightPositioning.style.display = 'none';
                txtSecurityLights.value = '';
                break;

            case '1':
				rowSecurityLights.style.display = '';
				rowSecurityLightPositioning.style.display = '';
                txtSecurityLights.focus();
                break;
        }
    }
    
    
    function ToggleLocationType()
    {
        var ddlLocationType = document.getElementById('ctl00$pageContent$ddlLocationType');
        if (ddlLocationType == null) ddlLocationType = document.getElementById('ctl00_pageContent_ddlLocationType');
        
        var ddlFacilitiesElectric = document.getElementById('ctl00$pageContent$ddlFacilitiesElectric');
        if (ddlFacilitiesElectric == null) ddlFacilitiesElectric = document.getElementById('ctl00_pageContent_ddlFacilitiesElectric');
        
        var rowFacilitiesTitle = document.getElementById('rowFacilitiesTitle');
        var rowFacilitiesName = document.getElementById('rowFacilitiesName');
        var rowFacilitiesPub = document.getElementById('rowFacilitiesPub');
        var rowFacilitiesRestaurant = document.getElementById('rowFacilitiesRestaurant');
        var rowFacilitiesShowers = document.getElementById('rowFacilitiesShowers');
        var rowFacilitiesToilets = document.getElementById('rowFacilitiesToilets');
        var rowFacilitiesHolidayHomes = document.getElementById('rowFacilitiesHolidayHomes');
        var rowFacilitiesHardStanding = document.getElementById('rowFacilitiesHardStanding');
        var rowFacilitiesGrassPitches = document.getElementById('rowFacilitiesGrassPitches');
        var rowFacilitiesElectric = document.getElementById('rowFacilitiesElectric');
        var rowFacilitiesWater = document.getElementById('rowFacilitiesWater');
        var rowFacilitiesSewerage = document.getElementById('rowFacilitiesSewerage');
        
        switch (ddlLocationType.value)
        {
            default:
                rowFacilitiesTitle.style.display = 'none';
                rowFacilitiesName.style.display = 'none';
                rowFacilitiesPub.style.display = 'none';
                rowFacilitiesRestaurant.style.display = 'none';
                rowFacilitiesShowers.style.display = 'none';
                rowFacilitiesToilets.style.display = 'none';
                rowFacilitiesHolidayHomes.style.display = 'none';
                rowFacilitiesHardStanding.style.display = 'none';
                rowFacilitiesGrassPitches.style.display = 'none';
                rowFacilitiesElectric.style.display = 'none';
                rowFacilitiesWater.style.display = 'none';
                rowFacilitiesSewerage.style.display = 'none';
                break;
                
            case '3':
                ddlFacilitiesElectric.selectedIndex = 1;
                rowFacilitiesTitle.style.display = '';
                rowFacilitiesName.style.display = '';
                rowFacilitiesPub.style.display = '';
                rowFacilitiesRestaurant.style.display = '';
                rowFacilitiesShowers.style.display = '';
                rowFacilitiesToilets.style.display = '';
                rowFacilitiesHolidayHomes.style.display = '';
                rowFacilitiesHardStanding.style.display = '';
                rowFacilitiesGrassPitches.style.display = '';
                rowFacilitiesElectric.style.display = '';
                rowFacilitiesWater.style.display = '';
                rowFacilitiesSewerage.style.display = '';
                break;
                
            case '4':
                ddlFacilitiesElectric.selectedIndex = 0;
                rowFacilitiesTitle.style.display = '';
                rowFacilitiesName.style.display = '';
                rowFacilitiesPub.style.display = '';
                rowFacilitiesRestaurant.style.display = '';
                rowFacilitiesShowers.style.display = '';
                rowFacilitiesToilets.style.display = '';
                rowFacilitiesHolidayHomes.style.display = '';
                rowFacilitiesHardStanding.style.display = '';
                rowFacilitiesGrassPitches.style.display = '';
                rowFacilitiesElectric.style.display = '';
                rowFacilitiesWater.style.display = '';
                rowFacilitiesSewerage.style.display = '';
                break;
                
            case '5':
                ddlFacilitiesElectric.selectedIndex = 1;
                rowFacilitiesTitle.style.display = '';
                rowFacilitiesName.style.display = '';
                rowFacilitiesPub.style.display = '';
                rowFacilitiesRestaurant.style.display = '';
                rowFacilitiesShowers.style.display = '';
                rowFacilitiesToilets.style.display = '';
                rowFacilitiesHolidayHomes.style.display = '';
                rowFacilitiesHardStanding.style.display = '';
                rowFacilitiesGrassPitches.style.display = '';
                rowFacilitiesElectric.style.display = '';
                rowFacilitiesWater.style.display = '';
                rowFacilitiesSewerage.style.display = '';
                break;
                
            case '6':
                ddlFacilitiesElectric.selectedIndex = 0;
                rowFacilitiesTitle.style.display = '';
                rowFacilitiesName.style.display = '';
                rowFacilitiesPub.style.display = '';
                rowFacilitiesRestaurant.style.display = '';
                rowFacilitiesShowers.style.display = '';
                rowFacilitiesToilets.style.display = '';
                rowFacilitiesHolidayHomes.style.display = '';
                rowFacilitiesHardStanding.style.display = '';
                rowFacilitiesGrassPitches.style.display = '';
                rowFacilitiesElectric.style.display = '';
                rowFacilitiesWater.style.display = '';
                rowFacilitiesSewerage.style.display = '';
                break;
        }
    }
    
    
    function ToggleSkyQuality(index)
    {
        var rowStars = document.getElementById('rowStars');
        var rowMagnitude = document.getElementById('rowMagnitude');
        
        switch (index)
        {
            case 0:
                rowStars.style.display = '';
                rowMagnitude.style.display = 'none';
                break;

            case 1:
                rowStars.style.display = 'none';
                rowMagnitude.style.display = '';
                break;
        }
    }
	
	
	function NumberOfStarsHelp()
	{
        var url = 'numberofstarshelp.aspx';
        var title = '';
        var arguments = 'width=800,height=600,resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=yes';
        var helpwindow = window.open(url,title,arguments);
        if (window.focus) helpwindow.focus();
	}
	
	
	function MagnitudeHelp()
	{
        var url = 'magnitudehelp.aspx';
        var title = '';
        var arguments = 'width=800,height=600,resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=yes';
        var helpwindow = window.open(url,title,arguments);
        if (window.focus) helpwindow.focus();
	}
	
	
	function DatePickerTest()
	{
	    alert('Date Picker Test');
	}

	
	function DatePicker(datePicker,btnID,txtID,offset)
	{
	    //alert('DatePicker');
		var pnlDatePicker = document.getElementById(datePicker);
		if (pnlDatePicker == null) pnlDatePicker = document.getElementById(datePicker.replace('$','_'));
		if (pnlDatePicker.style.display == 'inline' || pnlDatePicker.style.display == '')
		{
    	    //alert('Switch DatePicker Off');
		    pnlDatePicker.style.display = 'none';
		}
		else
		{
    	    //alert('Switch DatePicker On');
	        var datePickerX = 0;
	        var datePickerY = 0;

            //alert('Get DatePicker Button');
		    var btnDatePicker = document.getElementById(btnID);
			if (btnDatePicker == null) btnDatePicker = document.getElementById(btnID.replace('$','_'));
		    
            //alert('Get DatePicker TextBox');
		    var txtDateControl = document.getElementById(txtID);
			if (txtDateControl == null) txtDateControl = document.getElementById(txtID.replace('$','_'));
		    //var txtDate = txtDateControl.value;

            //alert('Get DatePicker Location');
		    datePickerX = btnDatePicker.offsetLeft;
		    datePickerY = btnDatePicker.offsetTop;
    		
		    var parent = btnDatePicker;
		    while (parent.offsetParent) 
		    {
			    parent = parent.offsetParent;
			    datePickerX += parent.offsetLeft;
			    datePickerY += parent.offsetTop ;
		    }

		    if (offset == 'bottomright')
		    {
			    datePickerX += 28;
			    //datePickerY += 2;
			    datePickerY -= 38;
		    }
		    else if (offset == 'topright')
		    {
			    datePickerY -= 181 - 25;
		    }
		    else if (offset == 'topleft')
		    {
			    datePickerX -= 247 - 25;
			    //datePickerY -= 181 - 25;
			    datePickerY -= 181 - 75;
		    }
    				
            //alert('Set DatePicker TextBox');
		    DateTextBox = txtID;

            //alert('Set DatePicker Location');
		    pnlDatePicker.style.left = datePickerX + 'px';
		    pnlDatePicker.style.top = datePickerY + 'px';
            //alert('Display DatePicker');
		    pnlDatePicker.style.display = '';
		}
	}
	
	function CloseDatePicker(datePicker)
	{
		var pnlDatePicker = document.getElementById(datePicker);
		if (btnDatePicker == null) btnDatePicker = document.getElementById(datePicker.replace('$','_'));
		pnlDatePicker.style.display = 'none';
	}


	function ValidateForm()
	{
		var formOK = true;
		
		// Observation Date & Time
		var lblDate = document.getElementById('ctl00$pageContent$lblDate');
		if (lblDate == null) lblDate = document.getElementById('ctl00_pageContent_lblDate');

		var txtDate = document.getElementById('ctl00$pageContent$txtDate');
		if (txtDate == null) txtDate = document.getElementById('ctl00_pageContent_txtDate');
		
		var lblTime = document.getElementById('ctl00$pageContent$lblTime');
		if (lblTime == null) lblTime = document.getElementById('ctl00_pageContent_lblTime');

		var ddlHours = document.getElementById('ctl00$pageContent$ddlHours');
		if (ddlHours == null) ddlHours = document.getElementById('ctl00_pageContent_ddlHours');
		
		var ddlMinutes = document.getElementById('ctl00$pageContent$ddlMinutes');
		if (ddlMinutes == null) ddlMinutes = document.getElementById('ctl00_pageContent_ddlMinutes');
		
		if (txtDate.value == null || txtDate.value == '')
		{
			lblDate.style.color = '#ff0000';
			lblDate.style.fontWeight = 'bold';
			txtDate.style.background = '#ffc0c0';
			formOK = false;
		}
		else
		{
			lblDate.style.color = '#ffffff';
			lblDate.style.fontWeight = 'normal';
			txtDate.style.background = '#ffffff';
		}
		
		if ((ddlHours.options[ddlHours.selectedIndex].value == null || ddlHours.options[ddlHours.selectedIndex].value == '') || (ddlMinutes.options[ddlMinutes.selectedIndex].value == null || ddlMinutes.options[ddlMinutes.selectedIndex].value == ''))
		{
			lblTime.style.color = '#ff0000';
			lblTime.style.fontWeight = 'bold';
			if (ddlHours.options[ddlHours.selectedIndex].value == null || ddlHours.options[ddlHours.selectedIndex].value == '')
			{
				ddlHours.style.background = '#ffc0c0';
			}
			else
			{
				ddlHours.style.background = '#ffffff';
			}
			if (ddlMinutes.options[ddlMinutes.selectedIndex].value == null || ddlMinutes.options[ddlMinutes.selectedIndex].value == '')
			{
				ddlMinutes.style.background = '#ffc0c0';
			}
			else
			{
				ddlMinutes.style.background = '#ffffff';
			}
			formOK = false;
		}
		else
		{
			lblTime.style.color = '#ffffff';
			lblTime.style.fontWeight = 'normal';
			ddlHours.style.background = '#ffffff';
			ddlMinutes.style.background = '#ffffff';
		}
		
		// Observation Location
		var rblLocationType0 = document.getElementById('ctl00$pageContent$rblLocationType$0');
		if (rblLocationType0 == null) rblLocationType0 = document.getElementById('ctl00_pageContent_rblLocationType_0');
		var rblLocationType1 = document.getElementById('ctl00$pageContent$rblLocationType$1');
		if (rblLocationType1 == null) rblLocationType1 = document.getElementById('ctl00_pageContent_rblLocationType_1');
		var rblLocationType2 = document.getElementById('ctl00$pageContent$rblLocationType$2');
		if (rblLocationType2 == null) rblLocationType2 = document.getElementById('ctl00_pageContent_rblLocationType_2');
		var rblLocationType3 = document.getElementById('ctl00$pageContent$rblLocationType$3');
		if (rblLocationType3 == null) rblLocationType3 = document.getElementById('ctl00_pageContent_rblLocationType_3');
		
		if (rblLocationType0.checked)
		{
			var lblPostcode = document.getElementById('ctl00$pageContent$lblPostcodeArea');
			if (lblPostcode == null) lblPostcode = document.getElementById('ctl00_pageContent_lblPostcodeArea');

			var txtPostcode = document.getElementById('ctl00$pageContent$txtPostcode');
			if (txtPostcode == null) txtPostcode = document.getElementById('ctl00_pageContent_txtPostcode');

			if (txtPostcode.value == null || txtPostcode.value == '')
			{
				lblPostcode.style.color = '#ff0000';
				lblPostcode.style.fontWeight = 'bold';
				txtPostcode.style.background = '#ffc0c0';
				formOK = false;
			}
			else
			{
				lblPostcode.style.color = '#ffffff';
				lblPostcode.style.fontWeight = 'normal';
				txtPostcode.style.background = '#ffffff';
			}
		}
		
		if (rblLocationType1.checked)
		{
			var lblLatitude = document.getElementById('ctl00$pageContent$lblLatitude');
			if (lblLatitude == null) lblLatitude = document.getElementById('ctl00_pageContent_lblLatitude');
			
			var txtLatDeg = document.getElementById('ctl00$pageContent$txtLatDeg');
			if (txtLatDeg == null) txtLatDeg = document.getElementById('ctl00_pageContent_txtLatDeg');
			
			var txtLatMin = document.getElementById('ctl00$pageContent$txtLatMin');
			if (txtLatMin == null) txtLatMin = document.getElementById('ctl00_pageContent_txtLatMin');
			
			var txtLatSec = document.getElementById('ctl00$pageContent$txtLatSec');
			if (txtLatSec == null) txtLatSec = document.getElementById('ctl00_pageContent_txtLatSec');
			
			var ddlLatDir = document.getElementById('ctl00$pageContent$ddlLatDir');
			if (ddlLatDir == null) ddlLatDir = document.getElementById('ctl00_pageContent_ddlLatDir');

			if ((txtLatDeg.value == null || txtLatDeg.value == '') || (txtLatMin.value == null || txtLatMin.value == '')
			 || (txtLatSec.value == null || txtLatSec.value == '') || (ddlLatDir.options[ddlLatDir.selectedIndex].value == null || ddlLatDir.options[ddlLatDir.selectedIndex].value == ''))
			{
				lblLatitude.style.color = '#ff0000';
				lblLatitude.style.fontWeight = 'bold';
				if (txtLatDeg.value == null || txtLatDeg.value == '') txtLatDeg.style.background = '#ffc0c0';
				if (txtLatMin.value == null || txtLatMin.value == '') txtLatMin.style.background = '#ffc0c0';
				if (txtLatSec.value == null || txtLatSec.value == '') txtLatSec.style.background = '#ffc0c0';
				if (ddlLatDir.options[ddlLatDir.selectedIndex].value == null || ddlLatDir.options[ddlLatDir.selectedIndex].value == '') ddlLatDir.style.background = '#ffc0c0';
				formOK = false;
			}
			else
			{
				lblLatitude.style.color = '#ffffff';
				lblLatitude.style.fontWeight = 'normal';
				txtLatDeg.style.background = '#ffffff';
				txtLatMin.style.background = '#ffffff';
				txtLatSec.style.background = '#ffffff';
				ddlLatDir.style.background = '#ffffff';
			}
			
			var lblLongitude = document.getElementById('ctl00$pageContent$lblLongitude');
			if (lblLongitude == null) lblLongitude = document.getElementById('ctl00_pageContent_lblLongitude');
			
			var txtLongDeg = document.getElementById('ctl00$pageContent$txtLongDeg');
			if (txtLongDeg == null) txtLongDeg = document.getElementById('ctl00_pageContent_txtLongDeg');
			
			var txtLongMin = document.getElementById('ctl00$pageContent$txtLongMin');
			if (txtLongMin == null) txtLongMin = document.getElementById('ctl00_pageContent_txtLongMin');
			
			var txtLongSec = document.getElementById('ctl00$pageContent$txtLongSec');
			if (txtLongSec == null) txtLongSec = document.getElementById('ctl00_pageContent_txtLongSec');
			
			var ddlLongDir = document.getElementById('ctl00$pageContent$ddlLongDir');
			if (ddlLongDir == null) ddlLongDir = document.getElementById('ctl00_pageContent_ddlLongDir');

			if ((txtLongDeg.value == null || txtLongDeg.value == '') || (txtLongMin.value == null || txtLongMin.value == '')
			 || (txtLongSec.value == null || txtLongSec.value == '') || (ddlLongDir.options[ddlLongDir.selectedIndex].value == null || ddlLongDir.options[ddlLongDir.selectedIndex].value == ''))
			{
				lblLongitude.style.color = '#ff0000';
				lblLongitude.style.fontWeight = 'bold';
				if (txtLongDeg.value == null || txtLongDeg.value == '') txtLongDeg.style.background = '#ffc0c0';
				if (txtLongMin.value == null || txtLongMin.value == '') txtLongMin.style.background = '#ffc0c0';
				if (txtLongSec.value == null || txtLongSec.value == '') txtLongSec.style.background = '#ffc0c0';
				if (ddlLongDir.options[ddlLongDir.selectedIndex].value == null || ddlLongDir.options[ddlLongDir.selectedIndex].value == '') ddlLongDir.style.background = '#ffc0c0';
				formOK = false;
			}
			else
			{
				lblLongitude.style.color = '#ffffff';
				lblLongitude.style.fontWeight = 'normal';
				txtLongDeg.style.background = '#ffffff';
				txtLongMin.style.background = '#ffffff';
				txtLongSec.style.background = '#ffffff';
				ddlLongDir.style.background = '#ffffff';
			}
		}
		
		if (rblLocationType2.checked || rblLocationType3.checked)
		{
			var lblDecLatitude = document.getElementById('ctl00$pageContent$lblDecLatitude');
			if (lblDecLatitude == null) lblDecLatitude = document.getElementById('ctl00_pageContent_lblDecLatitude');
			
			var txtDecLatitude = document.getElementById('ctl00$pageContent$txtDecLatitude');
			if (txtDecLatitude == null) txtDecLatitude = document.getElementById('ctl00_pageContent_txtDecLatitude');

			if (txtDecLatitude.value == null || txtDecLatitude.value == '')
			{
				lblDecLatitude.style.color = '#ff0000';
				lblDecLatitude.style.fontWeight = 'bold';
				txtDecLatitude.style.background = '#ffc0c0';
				formOK = false;
			}
			else
			{
				lblDecLatitude.style.color = '#ffffff';
				lblDecLatitude.style.fontWeight = 'normal';
				txtDecLatitude.style.background = '#ffffff';
			}
			
			var lblDecLongitude = document.getElementById('ctl00$pageContent$lblDecLongitude');
			if (lblDecLongitude == null) lblDecLongitude = document.getElementById('ctl00_pageContent_lblDecLongitude');
			
			var txtDecLongitude = document.getElementById('ctl00$pageContent$txtDecLongitude');
			if (txtDecLongitude == null) txtDecLongitude = document.getElementById('ctl00_pageContent_txtDecLongitude');

			if (txtDecLongitude.value == null || txtDecLongitude.value == '')
			{
				lblDecLongitude.style.color = '#ff0000';
				lblDecLongitude.style.fontWeight = 'bold';
				txtDecLongitude.style.background = '#ffc0c0';
				formOK = false;
			}
			else
			{
				lblDecLongitude.style.color = '#ffffff';
				lblDecLongitude.style.fontWeight = 'normal';
				txtDecLongitude.style.background = '#ffffff';
			}
		}
		
		
		// Street Lights
		var ddlStreetLights = document.getElementById('ctl00$pageContent$ddlStreetLights');
		if (ddlStreetLights == null) ddlStreetLights = document.getElementById('ctl00_pageContent_ddlStreetLights');
		
		var txtStreetLights = document.getElementById('ctl00$pageContent$txtStreetLights');
		if (txtStreetLights == null) txtStreetLights = document.getElementById('ctl00_pageContent_txtStreetLights');
		
		var ddlStreetLightType = document.getElementById('ctl00$pageContent$ddlStreetLightType');
		if (ddlStreetLightType == null) ddlStreetLightType = document.getElementById('ctl00_pageContent_ddlStreetLightType');
		
		// Security Lights
		var ddlSecurityLights = document.getElementById('ctl00$pageContent$ddlSecurityLights');
		if (ddlSecurityLights == null) ddlSecurityLights = document.getElementById('ctl00_pageContent_ddlSecurityLights');
		
		var txtSecurityLights = document.getElementById('ctl00$pageContent$txtSecurityLights');
		if (txtSecurityLights == null) txtSecurityLights = document.getElementById('ctl00_pageContent_txtSecurityLights');
		
		var rblSecurityLightPositioning = document.getElementById('ctl00$pageContent$rblSecurityLightPositioning');
		if (rblSecurityLightPositioning == null) rblSecurityLightPositioning = document.getElementById('ctl00_pageContent_rblSecurityLightPositioning');
		
		// Location
		var lblLocationType = document.getElementById('ctl00$pageContent$lblLocationType');
		if (lblLocationType == null) lblLocationType = document.getElementById('ctl00_pageContent_lblLocationType');
		
		var ddlLocationType = document.getElementById('ctl00$pageContent$ddlLocationType');
		if (ddlLocationType == null) ddlLocationType = document.getElementById('ctl00_pageContent_ddlLocationType');
		
		if (ddlLocationType.options[ddlLocationType.selectedIndex].value == null || ddlLocationType.options[ddlLocationType.selectedIndex].value == '')
		{
			lblLocationType.style.color = '#ff0000';
			lblLocationType.style.fontWeight = 'bold';
		    ddlLocationType.style.background = '#ffc0c0';
		    formOK = false;
		}
		else
		{
			lblLocationType.style.color = '#ffffff';
			lblLocationType.style.fontWeight = 'normal';
		    ddlLocationType.style.background = '#ffffff';
		}
		
		var ddlFacilitiesPub = document.getElementById('ctl00$pageContent$ddlFacilitiesPub');
		if (ddlFacilitiesPub == null) ddlFacilitiesPub = document.getElementById('ctl00_pageContent_ddlFacilitiesPub');
		
		var ddlFacilitiesRestaurant = document.getElementById('ctl00$pageContent$ddlFacilitiesRestaurant');
		if (ddlFacilitiesRestaurant == null) ddlFacilitiesRestaurant = document.getElementById('ctl00_pageContent_ddlFacilitiesRestaurant');
		
		var ddlFacilitiesShowers = document.getElementById('ctl00$pageContent$ddlFacilitiesShowers');
		if (ddlFacilitiesShowers == null) ddlFacilitiesShowers = document.getElementById('ctl00_pageContent_ddlFacilitiesShowers');
		
		var ddlFacilitiesToilets = document.getElementById('ctl00$pageContent$ddlFacilitiesToilets');
		if (ddlFacilitiesToilets == null) ddlFacilitiesToilets = document.getElementById('ctl00_pageContent_ddlFacilitiesToilets');
		
		var ddlFacilitiesHolidayHomes = document.getElementById('ctl00$pageContent$ddlFacilitiesHolidayHomes');
		if (ddlFacilitiesHolidayHomes == null) ddlFacilitiesHolidayHomes = document.getElementById('ctl00_pageContent_ddlFacilitiesHolidayHomes');
		
		var ddlFacilitiesHardStanding = document.getElementById('ctl00$pageContent$ddlFacilitiesHardStanding');
		if (ddlFacilitiesHardStanding == null) ddlFacilitiesHardStanding = document.getElementById('ctl00_pageContent_ddlFacilitiesHardStanding');
		
		var ddlFacilitiesGrassPitches = document.getElementById('ctl00$pageContent$ddlFacilitiesGrassPitches');
		if (ddlFacilitiesGrassPitches == null) ddlFacilitiesGrassPitches = document.getElementById('ctl00_pageContent_ddlFacilitiesGrassPitches');
		
		var ddlFacilitiesElectric = document.getElementById('ctl00$pageContent$ddlFacilitiesElectric');
		if (ddlFacilitiesElectric == null) ddlFacilitiesElectric = document.getElementById('ctl00_pageContent_ddlFacilitiesElectric');
		
		var ddlFacilitiesWater = document.getElementById('ctl00$pageContent$ddlFacilitiesWater');
		if (ddlFacilitiesWater == null) ddlFacilitiesWater = document.getElementById('ctl00_pageContent_ddlFacilitiesWater');
		
		var ddlFacilitiesSewerage = document.getElementById('ctl00$pageContent$ddlFacilitiesSewerage');
		if (ddlFacilitiesSewerage == null) ddlFacilitiesSewerage = document.getElementById('ctl00_pageContent_ddlFacilitiesSewerage');
		
		var txtLocComments = document.getElementById('ctl00$pageContent$txtLocComments');
		if (txtLocComments == null) txtLocComments = document.getElementById('ctl00_pageContent_txtLocComments');
		
		// Sky Quality
		//var rblSkyQuality = document.getElementById('ctl00$pageContent$rblSkyQuality');
		//if (rblSkyQuality == null) rblSkyQuality = document.getElementById('ctl00_pageContent_rblSkyQuality');
		var rblSkyQuality0 = document.getElementById('ctl00$pageContent$rblSkyQuality$0');
		if (rblSkyQuality0 == null) rblSkyQuality0 = document.getElementById('ctl00_pageContent_rblSkyQuality_0');
		var rblSkyQuality1 = document.getElementById('ctl00$pageContent$rblSkyQuality$1');
		if (rblSkyQuality1 == null) rblSkyQuality1 = document.getElementById('ctl00_pageContent_rblSkyQuality_1');

        if (rblSkyQuality0.checked)
        {
		    var lblStars = document.getElementById('ctl00$pageContent$lblStars');
		    if (lblStars == null) lblStars = document.getElementById('ctl00_pageContent_lblStars');

		    var txtStars = document.getElementById('ctl00$pageContent$txtStars');
		    if (txtStars == null) txtStars = document.getElementById('ctl00_pageContent_txtStars');

            if (txtStars.value == null || txtStars.value == '')
            {
				lblStars.style.color = '#ff0000';
				lblStars.style.fontWeight = 'bold';
				txtStars.style.background = '#ffc0c0';
    		    formOK = false;
			}
			else
            {
				lblStars.style.color = '#ffffff';
				lblStars.style.fontWeight = 'normal';
				txtStars.style.background = '#ffffff';
			}
		}
		
        if (rblSkyQuality1.checked)
        {
		    var lblMagnitude = document.getElementById('ctl00$pageContent$lblMagnitude');
		    if (lblMagnitude == null) lblMagnitude = document.getElementById('ctl00_pageContent_lblMagnitude');

		    var ddlMagnitude = document.getElementById('ctl00$pageContent$ddlMagnitude');
		    if (ddlMagnitude == null) ddlMagnitude = document.getElementById('ctl00_pageContent_ddlMagnitude');

			if (ddlMagnitude.options[ddlMagnitude.selectedIndex].value == null || ddlMagnitude.options[ddlMagnitude.selectedIndex].value == '')
			{
				lblMagnitude.style.color = '#ff0000';
				lblMagnitude.style.fontWeight = 'bold';
			    ddlMagnitude.style.background = '#ffc0c0';
    		    formOK = false;
			}
			else
			{
				lblMagnitude.style.color = '#ffffff';
				lblMagnitude.style.fontWeight = 'normal';
			    ddlMagnitude.style.background = '#ffffff';
			}
		}
		
		var rblCloudCover = document.getElementById('ctl00$pageContent$rblCloudCover');
		if (rblCloudCover == null) rblCloudCover = document.getElementById('ctl00_pageContent_rblCloudCover');
		
		var rblSkyglow = document.getElementById('ctl00$pageContent$rblSkyglow');
		if (rblSkyglow == null) rblSkyglow = document.getElementById('ctl00_pageContent_rblSkyglow');
		
		var txtSkyComments = document.getElementById('ctl00$pageContent$txtSkyComments');
		if (txtSkyComments == null) txtSkyComments = document.getElementById('ctl00_pageContent_txtSkyComments');
		
		if (formOK) 
		{
			SubmitForm();
		}
		else
		{
			alert('There are required fields missing.  Please check the form and resubmit.');
			//return false;
		}
	}
	
	
	function SubmitForm()
	{
		//document.Form1.submit();
		document.aspnetForm.submit();
	}
	
	
	
