
var map, mapMgr;
var properties;
var minSlider, maxSlider, minRentalSlider, maxRentalSlider;
var boardIcon;
var nurseryIcon, primarySchoolIcon, secondarySchoolIcon, gymnasieumIcon, cinemaIcon, swimmingPoolIcon, supermarketIcon, officeIcon;
var overgroundIcon, firstCapitalConnectIcon;
var addGoogleEarth = false;
/*
function setSliderValues(minValue, maxValue, sales)
{
	var minPosition = getSliderPositionFromValue(minValue, sales);
	var maxPosition = getSliderPositionFromValue(maxValue, sales);
	alert("In setSliderValues");
	alert(minPosition);
	alert(maxPosition);
	if(sales == true)
	{
		setMinSliderValue(minPosition);
		setMaxSliderValue(maxPosition);
	} 
	else 
	{
		setMinRentalSliderValue(minPosition);
		setMaxRentalSliderValue(maxPosition);
	}
}
*/

function getSliderPositionFromValue(value, sales)
{
	if(sales == true)
	{
		// Convert sales value to position
		if(value <= 1000000)
		{
			value /= 100000;
		} else {
			value -= 1000000;
			value /= 1000000;
			value += 10;	// NB: 10.0 is the "millionValue", e.g. the figure expected at that stage for a value of £1,000,000
		}
		value *= sliderStepSize;
	} else {
		// Convert rentals value to position
		//return ((value * sliderRentalStepSize) / 25);
		value *= sliderRentalStepSize;
		value /= 25;
	}
	return value;
}

//var sliderWidth = 155, sliderStepSize = 11, lockToSteps = false;
var sliderWidth = 140, sliderStepSize = 10, lockToSteps = false, sliderRentalWidth = 160, sliderRentalStepSize = 2, lockRentalToSteps = true;
var startMinSliderPosition = 0, startMinRentalSliderPosition = 0, startMaxSliderPosition = sliderWidth, startMaxRentalSliderPosition = sliderRentalWidth;
var switchToListView = false;
function init()
{
	// NB: TODO: Get this checking for saved search values for starting slider positions (which will then be overruled by current values if present)

	// NB: Trying to allow slider values to be held when coming "Back" to the page, but the values appear to be lost :(
	//alert($('minSliderValue').value);
	//alert($('maxSliderValue').value);
	//alert($('propSale').checked);
	//alert($('currentViewMode').value);
	if($('currentViewMode').value == 'ListView')
		switchToListView = true;
	if($('minSliderValue').value != '' && $('maxSliderValue').value != '')
	{
		//window.setTimeout("setSliderValues(" + $('minSliderValue').value + ", " + $('maxSliderValue').value + ", " + $('propSale').checked.toString() + ");", 500);
		if($('propSale').checked == true)
		{
			startMinSliderPosition = getSliderPositionFromValue(parseInt($('minSliderValue').value), true);
			startMaxSliderPosition = getSliderPositionFromValue(parseInt($('maxSliderValue').value), true);
		} else {
			startMinRentalSliderPosition = getSliderPositionFromValue(parseInt($('minSliderValue').value), false);
			startMaxRentalSliderPosition = getSliderPositionFromValue(parseInt($('maxSliderValue').value), false);
		}
	}
	/*
	alert(startMinSliderPosition);
	alert(startMaxSliderPosition);
	alert(startMinRentalSliderPosition);
	alert(startMaxRentalSliderPosition);
	*/
	
	officeIcon = new GIcon();
	officeIcon.image = "images/gMarkers/hboffice.png";
	////icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	officeIcon.iconSize = new GSize(22, 22);
	////icon.shadowSize = new GSize(22, 20);
	//officeIcon.iconAnchor = new GPoint(12, 24);
	officeIcon.iconAnchor = new GPoint(12, 34);
	officeIcon.infoWindowAnchor = new GPoint(12, 12);

	/*
	var iconstar = new GIcon();
	iconstar.image = "http://www.facefeeder.com/images/starpin.png";
	//icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	iconstar.iconSize = new GSize(24, 24);
	//icon.shadowSize = new GSize(22, 20);
	iconstar.iconAnchor = new GPoint(12, 24);
	iconstar.infoWindowAnchor = new GPoint(12, 12);
	*/
	
	boardIcon = new GIcon();
	boardIcon.image = "images/gMarkers/board2.png";

	boardIcon.iconSize = new GSize(29, 29);
	//boardIcon.shadowSize = new GSize(37, 34);
	boardIcon.iconAnchor = new GPoint(10, 34);
	boardIcon.infoWindowAnchor = new GPoint(12, 12);
	
	nurseryIcon = new GIcon();
	nurseryIcon.image = "images/gMarkers/nurseryIcon.png";
	nurseryIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";

	nurseryIcon.iconSize = new GSize(25, 25);
	nurseryIcon.iconAnchor = new GPoint(10, 34);
	nurseryIcon.shadowSize = new GSize(25, 25);
	nurseryIcon.infoWindowAnchor = new GPoint(12, 12);
	
	primarySchoolIcon = new GIcon();
	primarySchoolIcon.image = "images/gMarkers/primarySchoolIcon.png";
	primarySchoolIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";

	primarySchoolIcon.iconSize = new GSize(15, 15);
	primarySchoolIcon.iconAnchor = new GPoint(10, 34);
	primarySchoolIcon.infoWindowAnchor = new GPoint(12, 12);
	primarySchoolIcon.shadowSize = new GSize(25, 25);
	
	secondarySchoolIcon = new GIcon();
	secondarySchoolIcon.image = "images/gMarkers/secondarySchoolIcon.png";
	secondarySchoolIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	
	secondarySchoolIcon.iconSize = new GSize(21, 24);
	secondarySchoolIcon.iconAnchor = new GPoint(10, 34);
	secondarySchoolIcon.infoWindowAnchor = new GPoint(12, 12);
	secondarySchoolIcon.shadowSize = new GSize(25, 25);
	
	gymnasieumIcon = new GIcon();
	gymnasieumIcon.image = "images/gMarkers/gymnasieumIcon.png";
	gymnasieumIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	
	gymnasieumIcon.iconSize = new GSize(22, 10);
	gymnasieumIcon.iconAnchor = new GPoint(10, 34);
	gymnasieumIcon.infoWindowAnchor = new GPoint(12, 12);
	gymnasieumIcon.shadowSize = new GSize(25, 25);
	
	cinemaIcon = new GIcon();
	cinemaIcon.image = "images/gMarkers/cinemaIcon.png";
	cinemaIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	
	cinemaIcon.iconSize = new GSize(18, 17);
	cinemaIcon.iconAnchor = new GPoint(10, 34);
	cinemaIcon.infoWindowAnchor = new GPoint(12, 12);
	cinemaIcon.shadowSize = new GSize(25, 25);
	
	swimmingPoolIcon = new GIcon();
	swimmingPoolIcon.image = "images/gMarkers/swimmingPoolIcon.png";
	swimmingPoolIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	
	swimmingPoolIcon.iconSize = new GSize(20, 16);
	swimmingPoolIcon.iconAnchor = new GPoint(10, 34);
	swimmingPoolIcon.infoWindowAnchor = new GPoint(12, 12);
	swimmingPoolIcon.shadowSize = new GSize(25, 25);
	
	supermarketIcon = new GIcon();
	supermarketIcon.image = "images/gMarkers/supermarketIcon.png";
	supermarketIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	
	supermarketIcon.iconSize = new GSize(15, 18);
	supermarketIcon.iconAnchor = new GPoint(10, 34);
	supermarketIcon.infoWindowAnchor = new GPoint(12, 12);
	supermarketIcon.shadowSize = new GSize(25, 25);
	
	tubeIcon = new GIcon();
	tubeIcon.image = "images/gMarkers/tube.png";

	
	tubeIcon.iconSize = new GSize(24, 21);
	tubeIcon.iconAnchor = new GPoint(8, 8);
	tubeIcon.infoWindowAnchor = new GPoint(12, 12);

    // New amenity types (OVERGROUND and First Capital Connect) added 06 March 2008 - JB
    overgroundIcon = new GIcon();
    overgroundIcon.image = "images/gMarkers/over.png";
    overgroundIcon.iconSize = new GSize(24,21);
    overgroundIcon.iconAnchor = new GPoint(8, 8);
    overgroundIcon.infoWindowAnchor = new GPoint(12, 12);
    
    firstCapitalConnectIcon = new GIcon();
    firstCapitalConnectIcon.image = "images/gMarkers/first2.png";
    firstCapitalConnectIcon.iconSize = new GSize(24, 21);
    firstCapitalConnectIcon.iconAnchor = new GPoint(8, 8);
    firstCapitalConnectIcon.infoWindowAnchor = new GPoint(12, 12);

	map = new GMap2(document.getElementById("map"));

	var zoomLevel = 13;
	map.setCenter(new GLatLng(51.548744, -0.132087), zoomLevel);
	
	if(useBlackAndWhiteMap == true)
	{
		map.removeMapType(G_NORMAL_MAP);
		map.addMapType(G_BLACK_AND_WHITE_TYPE);
		//map.addMapType(G_BLACK_AND_WHITE_SATELLITE);
		//map.addMapType(G_BLACK_AND_WHITE_HYBRID);
	
		//map.setMapType(G_SATELLITE_TYPE);
		//alert(G_HYBRID_MAP.getTileLayers().length.toString());
		map.setMapType(G_BLACK_AND_WHITE_TYPE);
	} else {
		map.setMapType(G_NORMAL_MAP);
    }

    if (addGoogleEarth == true) {
        map.addMapType(G_SATELLITE_3D_MAP);
    }
	
	// Create map manager (to handle overlapping station markers);
	mapMgr = new MarkerManager(map);    // NB: This is the open-source version referenced from here: <script src="http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js">
	//mapMgr = new GMarkerManager(map, {minZoom:0, maxZoom:17});

	showHotblackOffices();
	showTubeStations();
	showOvergroundStations();
	showFirstCapitalConnectStations();
	showCombinedStations();

	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	//map.addOverlay(new GTrafficOverlay());
	
	properties = new PropertyCollection(map);
	addPropertyMarkers();
	createAmenities();
	
	createSliders();
	
	//alert("NB: checkbox script disabled for breaking radio buttons and onclick event handling!");
	replaceChecks();
	
	/*
	//chgRB('searchForm');
	//useCustomChecksAndRadios();
	createRadioReplacement('propSale');
	createRadioReplacement('propRent');
	*/
	replaceRentAndSaleRadios();
	
	//document.getElementById('includeUnderOffer').checked = false;
	
	if($('propSale').checked == true)
	{
		$('minSliderValue').value = convertSliderValue(minSlider.getValue()).toString();
		$('maxSliderValue').value = convertSliderValue(maxSlider.getValue()).toString();
	} else {
		$('minSliderValue').value = convertRentalSliderValue(minRentalSlider.getValue()).toString();
		$('maxSliderValue').value = convertRentalSliderValue(maxRentalSlider.getValue()).toString();
	}
	
	/*
	search();
	//setSearchDelay();
	//*/
	
	updateRadioDisplay('propSale');
	updateRadioDisplay('propRent');

	// NB: Fix to ensure display catches up with settings:-
	window.setTimeout("updateSaleRentalDisplay(); search();", 400);
	/* window.setTimeout("updateSaleRentalDisplay();", 200);
	window.setTimeout("search();", 5000); */
	
	if(switchToListView == true)
		window.setTimeout("showPropertyThumbs(); showListView();", 550);
    else
        window.setTimeout("showPropertyThumbs();", 550);
		
	$('formAction').value = '';

	//*
	search();
	//setSearchDelay();
	//*/	
}

function showPropertyThumbs()
{
    var propertyThumbs = document.getElementsByName("PropertyThumb");
    for(var i = 0; i < propertyThumbs.length; i++)
    {
        if(propertyThumbs[i].style.display == 'none')
        {
            propertyThumbs[i].src = propertyThumbs[i].getAttribute("srcToLoad");
            propertyThumbs[i].style.display = '';
        }
    }
}

var hotblackOffices = [], showingHotblackOffices = false, createdHotblackOffices = false;
function showHotblackOffices()
{
	if(createdHotblackOffices == false)
	{
		//hotblackOffices[0] = createCustomMarker(new GLatLng(51.53720, -0.10252), "<div ID=\"googleBubble\">Islington Office<br>314 Upper Street<br>London<br>N1 2XQ</div>" , officeIcon)
		hotblackOffices[0] = createCustomMarker(new GLatLng(51.53761715986149, -0.10271251201629638), "<div ID=\"googleBubble\">Islington Office<br>314 Upper Street<br>London<br>N1 2XQ</div>" , officeIcon)
		//hotblackOffices[1] = createCustomMarker(new GLatLng(51.55297, -0.098200), "<div ID=\"googleBubble\">Highbury Office<br>2 Highbury Park<br>London<br>N5 2AB</div>" , officeIcon)
		hotblackOffices[1] = createCustomMarker(new GLatLng(51.55320508821869, -0.09829223155975342), "<div ID=\"googleBubble\">Highbury Office<br>2 Highbury Park<br>London<br>N5 2AB</div>" , officeIcon)
		//hotblackOffices[2] = createCustomMarker(new GLatLng(51.53687, -0.1452), "<div ID=\"googleBubble\">Camden Office<br>67 Parkway<br>London<br>NW1 7pp</div>" , officeIcon)
		hotblackOffices[2] = createCustomMarker(new GLatLng(51.53749537118164, -0.14516383409500122), "<div ID=\"googleBubble\">Camden Office<br>67 Parkway<br>London<br>NW1 7pp</div>" , officeIcon)
		createdHotblackOffices = true;
	}
	if(showingHotblackOffices == false)
	{
		map.addOverlay(hotblackOffices[0]);
		map.addOverlay(hotblackOffices[1]);
		map.addOverlay(hotblackOffices[2]);	
		showingHotblackOffices = true;
	}
}

function hideHotblackOffices()
{
	if(showingHotblackOffices == true)
	{
		for(var i = 0; i < 3; i++)
			map.removeOverlay(hotblackOffices[i]);
		showingHotblackOffices = false;
	}
}

var combinedStations = [], showingCombinedStations = false, createdCombinedStations = false;
function showCombinedStations()
{
    if(createdCombinedStations == false)
    {
        // NB: Use Underground icon
        // Highbury & Islington
        combinedStations[0] = createCustomMarker(new GLatLng(51.54620160643689, -0.10462760925292969), "<div ID=\"googleBubble\">Highbury & Islington<br/>(Tube &amp; Rail)</div>", tubeIcon);
        // Old Street
        combinedStations[1] = createCustomMarker(new GLatLng(51.52556684350165, -0.08793354034423828), "<div ID=\"googleBubble\">Old Street<br/>(Tube &amp Rail)</div>", tubeIcon);
        // Kings Cross
        combinedStations[2] = createCustomMarker(new GLatLng(51.53031927385486, -0.1242828369140625), "<div ID=\"googleBubble\">Kings Cross<br/>(Tube &amp; Rail)</div>", tubeIcon);
        // Finsbury Park
        combinedStations[3] = createCustomMarker(new GLatLng(51.56434605756756, -0.10724544525146484), "<div ID=\"googleBubble\">Finsbury Park<br/>(Tube &amp; Rail)</div>", tubeIcon);
        // Moorgate
        combinedStations[4] = createCustomMarker(new GLatLng(51.51833044921744, -0.08939266204833984), "<div ID=\"googleBubble\">Moorgate<br/>(First Capital Connect)</div>", tubeIcon);
    }
    if(showingCombinedStations == false)
    {
        for(var i = 0; i < combinedStations.length; i++)
        {
            mapMgr.addMarker(combinedStations[i], 0, 14);
        }
        showingCombinedStations = true;
    }
}

function hideCombinedStations()
{
	if(showingCombinedStations == true)
	{
		for(var i = 0; i < combinedStations.length; i++)
		{
		    mapMgr.removeMarker(combinedStations[i]);
		}
		showingCombinedStations = false;
	}
}

var overgroundStations = [], showingOvergroundStations = false, createdOvergroundStations = false;
function showOvergroundStations()
{
    if(createdOvergroundStations == false)
    {
        //Canonbury                             51.548763614805566 / -0.09196758270263672
        overgroundStations[0] = createCustomMarker(new GLatLng(51.548763614805566, -0.09196758270263672), "<div ID=\"googleBubble\">Canonbury<br/>(Overground Station)</div>", overgroundIcon);
        //Dalston                               51.54801637726744  / -0.07578849792480469
        overgroundStations[1] = createCustomMarker(new GLatLng(51.54801637726744, -0.07578849792480469), "<div ID=\"googleBubble\">Dalston<br/>(Overground Station)</div>", overgroundIcon);
        //Highbury & Islington                  51.54620160643689  / -0.10462760925292969
        overgroundStations[2] = createCustomMarker(new GLatLng(51.54620160643689, -0.10462760925292969), "<div ID=\"googleBubble\">Highbury & Islington<br/>(Overground Station)</div>", overgroundIcon);
        //Caledonian & Barnsbury Road           51.54347931446777  / -0.11449813842773437
        overgroundStations[3] = createCustomMarker(new GLatLng(51.54347931446777, -0.11449813842773437), "<div ID=\"googleBubble\">Caledonian & Barnsbury Road<br/>(Overground Station)</div>", overgroundIcon);
        //Camden Road                           51.54182450838865  / -0.13887405395507812
        overgroundStations[4] = createCustomMarker(new GLatLng(51.54182450838865, -0.13887405395507812), "<div ID=\"googleBubble\">Camden Road<br/>(Overground Station)</div>", overgroundIcon);
        //Kentish Town West                     51.547028937410865 / -0.1467275619506836
        overgroundStations[5] = createCustomMarker(new GLatLng(51.547028937410865, -0.1467275619506836), "<div ID=\"googleBubble\">Kentish Town West<br/>(Overground Station)</div>", overgroundIcon);
        //Gospel Oak                            51.555221370691314 / -0.15110492706298828
        overgroundStations[6] = createCustomMarker(new GLatLng(51.555221370691314, -0.15110492706298828), "<div ID=\"googleBubble\">Gospel Oak<br/>(Overground Station)</div>", overgroundIcon);
        //Hampstead Heath                       51.555168004564784 / -0.16561031341552734
        overgroundStations[7] = createCustomMarker(new GLatLng(51.555168004564784, -0.16561031341552734), "<div ID=\"googleBubble\">Hampstead Heath<br/>(Overground Station)</div>", overgroundIcon);
        //Upper Holloway                        51.56375914450247  / -0.12947559356689453
        overgroundStations[8] = createCustomMarker(new GLatLng(51.56375914450247, -0.12947559356689453), "<div ID=\"googleBubble\">Upper Holloway<br/>(Overground Station)</div>", overgroundIcon);
    }
	if(showingOvergroundStations == false)
	{
		for(var i = 0;i < overgroundStations.length; i++)
		{
		    // Add normal markers to map, and overlapping markers to marker manager
		    if(i == 2)  // e.g. Highbury & Islington
		    {
		        mapMgr.addMarker(overgroundStations[i], 15, 17);
		    } else {
    			map.addOverlay(overgroundStations[i]);
            }
		}
		showingOvergroundStations = true;
	}
}

function hideOvergroundStations()
{
	if(showingOvergroundStations == true)
	{
		for(var i = 0; i < overgroundStations.length; i++)
		{
		    if(i == 2) // e.g. Highbury & Islington
		    {
		        mapMgr.removeMarker(overgroundStations[i]);
		    } else {
			    map.removeOverlay(overgroundStations[i]);
			}
		}
		showingOvergroundStations = false;
	}
}

var firstCapitalConnectionStations = [], showingFirstCapitalConnectionStations = false, createdFirstCapitalConnectStations = false;
function showFirstCapitalConnectStations()
{
    if(createdFirstCapitalConnectStations == false)
    {
        //Finsbury Park                         51.56434605756756 / -0.10724544525146484
        firstCapitalConnectionStations[0] = createCustomMarker(new GLatLng(51.56434605756756, -0.10724544525146484), "<div ID=\"googleBubble\">Finsbury Park<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
        //Kings Cross                           51.53031927385486 / -0.1242828369140625
        firstCapitalConnectionStations[1] = createCustomMarker(new GLatLng(51.53031927385486, -0.1242828369140625), "<div ID=\"googleBubble\">Kings Cross<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
        //Drayton Park                          51.55289988630948 / -0.10514259338378906
        firstCapitalConnectionStations[2] = createCustomMarker(new GLatLng(51.55289988630948, -0.10514259338378906), "<div ID=\"googleBubble\">Drayton Park<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
        //Highbury & Islington                  51.54588134524687 / -0.1043701171875                          
        firstCapitalConnectionStations[3] = createCustomMarker(new GLatLng(51.54588134524687, -0.1043701171875), "<div ID=\"googleBubble\">Highbury & Islington<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
        //Essex Road                            51.54057001851906 / -0.09643077850341797
        firstCapitalConnectionStations[4] = createCustomMarker(new GLatLng(51.54057001851906, -0.09643077850341797), "<div ID=\"googleBubble\">Essex Road<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
        //Old Street                            51.52556684350165 / -0.08793354034423828
        firstCapitalConnectionStations[5] = createCustomMarker(new GLatLng(51.52556684350165, -0.08793354034423828), "<div ID=\"googleBubble\">Old Street<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
        //Moorgate                              51.51833044921744 / -0.08939266204833984
        firstCapitalConnectionStations[6] = createCustomMarker(new GLatLng(51.51833044921744, -0.08939266204833984), "<div ID=\"googleBubble\">Moorgate<br/>(First Capital Connect)</div>", firstCapitalConnectIcon);
    }
	if(showingFirstCapitalConnectionStations == false)
	{
		for(var i = 0;i < firstCapitalConnectionStations.length; i++)
		{
		    // NB: Use MarkerManager for overlapping stations
		    switch(i) {
		        case 0:
		        case 1:
		        case 3:
		        case 5:
		        case 6:
		            mapMgr.addMarker(firstCapitalConnectionStations[i], 15, 17);
		            break;
		        default:
			        map.addOverlay(firstCapitalConnectionStations[i]);
			        break;
			}
		}
		showingFirstCapitalConnectionStations = true;
	}
}

function hideFirstCapitalConnectStations()
{
	if(showingFirstCapitalConnectionStations == true)
	{
		for(var i = 0;i < firstCapitalConnectionStations.length; i++)
		{
		    // NB: Use MarkerManager for overlapping stations
		    switch(i) {
		        case 0:
		        case 1:
		        case 3:
		        case 5:
		        case 6:
		            mapMgr.removeMarker(firstCapitalConnectionStations[i]);
		            break;
		        default:
			        map.removeOverlay(firstCapitalConnectionStations[i]);
			        break;
			}
		}
		showingFirstCapitalConnectionStations = false;
	}
}

var tubeStations = [], showingTubeStations = false, createdTubeStations = false;
function showTubeStations()
{
	if(createdTubeStations == false)
	{
	    // Angel (Northern Line)
		tubeStations[0] = createCustomMarker(new GLatLng(51.53248173242774, -0.10580778121948242), "<div ID=\"googleBubble\">Angel<br>(Northern line)</div>" , tubeIcon);
		// Highbury & Islington (Victoria Line & British Rail)
		tubeStations[1] = createCustomMarker(new GLatLng(51.546228294767644, -0.10381221771240234), "<div ID=\"googleBubble\">Highbury & Islington<br>(Victoria lines and British Rail)</div>" , tubeIcon);
		// Camden Town (Northern Line)
		tubeStations[2] = createCustomMarker(new GLatLng(51.53940891729288, -0.14272570610046387), "<div ID=\"googleBubble\">Camden Town<br>(Northern line)</div>" , tubeIcon);
		// Mornington Cresent (Northern Line)
		tubeStations[3] = createCustomMarker(new GLatLng(51.53420361671604, -0.13883113861083984), "<div ID=\"googleBubble\">Mornington Crescent<br>(Northern line)</div>" , tubeIcon);
		// Chalk Farm (Northern Line)
		tubeStations[4] = createCustomMarker(new GLatLng(51.54407983405021, -0.153733491897583), "<div ID=\"googleBubble\">Chalk Farm<br>(Northern line)</div>" , tubeIcon);
		// Euston (Northern & Victoria Lines)
		tubeStations[5] = createCustomMarker(new GLatLng(51.52859056797073 , -0.13315558433532715), "<div ID=\"googleBubble\">Euston<br>(Northern/Victoria lines) </div>" , tubeIcon);
		// Kentish Town (Northern Line)
		tubeStations[6] = createCustomMarker(new GLatLng(51.550298081984835, -0.14034390449523926), "<div ID=\"googleBubble\">Kentish Town<br>(Northern line)</div>" , tubeIcon);
		// Belsize Park (Northern Line)
		tubeStations[7] = createCustomMarker(new GLatLng(51.550424840002705, -0.16423702239990234), "<div ID=\"googleBubble\">Belsize Park<br>(Northern line)</div>" , tubeIcon);
		// Tuffnell Park (Northern Line)
		tubeStations[8] = createCustomMarker(new GLatLng(51.556662232440004, -0.13792991638183594), "<div ID=\"googleBubble\">Tuffnell Park<br>(Northern line)</div>" , tubeIcon);
		// Holloway Road (Piccadilly Line)
		tubeStations[9] = createCustomMarker(new GLatLng(51.55274645069637, -0.11292099952697754), "<div ID=\"googleBubble\">Holloway Road<br>(Piccadilly line)</div>" , tubeIcon);
		// Caledonian Road (Piccadilly Line)
		tubeStations[10] = createCustomMarker(new GLatLng(51.5484100128574, -0.1183176040649414), "<div ID=\"googleBubble\">Caledonian Road<br>(Piccadilly line)</div>" , tubeIcon);
		// Archway (Northern Line)
		tubeStations[11] = createCustomMarker(new GLatLng(51.565419822089524, -0.13510823249816894), "<div ID=\"googleBubble\">Archway<br>(Northern line)</div>" , tubeIcon);
		// Arsenal (Piccadilly Line)
		tubeStations[12] = createCustomMarker(new GLatLng(51.55849659685885 , -0.10576486587524414), "<div ID=\"googleBubble\">Arsenal<br>(Piccadilly line)</div>" , tubeIcon);
		// Finsbury Park (Victoria/Piccadilly lines and British Rail)
		tubeStations[13] = createCustomMarker(new GLatLng(51.56439941292512, -0.10638713836669922), "<div ID=\"googleBubble\">Finsbury Park<br>(Victoria/Piccadilly lines and British Rail)</div>" , tubeIcon);
		// Manor House (Piccadilly Line)
		tubeStations[14] = createCustomMarker(new GLatLng(51.570648226081325, -0.09589433670043945), "<div ID=\"googleBubble\">Manor House<br>(Piccadilly line)</div>" , tubeIcon);
		// Bethnal Green (Central Line)
		tubeStations[15] = createCustomMarker(new GLatLng(51.52702866914609, -0.05515694618225098), "<div ID=\"googleBubble\">Bethnal Green<br>(Central line) </div>" , tubeIcon);	
		// Old Street (Northern/Northern City lines)
		tubeStations[16] = createCustomMarker(new GLatLng(51.52560689414461, -0.08742928504943847), "<div ID=\"googleBubble\">Old Street<br>(Northern/Northern City lines)</div>" , tubeIcon);
		// Kings Cross/St Pancras (Victoria/Piccadilly/Northern/Hammersmith & City/Circle/Metropolitan lines and British Rail)
		tubeStations[17] = createCustomMarker(new GLatLng(51.530386017939676, -0.12372493743896484), "<div ID=\"googleBubble\">Kings Cross/St Pancras<br>(Victoria/Piccadilly/Northern/Hammersmith & City/Circle/Metropolitan lines and British Rail) </div>" , tubeIcon);
		// Farringdon (Tube Station)
		tubeStations[18] = createCustomMarker(new GLatLng(51.52044007035645, -0.1049494743347168), "<div ID=\"googleBubble\">Farringdon<br>(Tube station) </div>" , tubeIcon);
		// Barbican (Tube Station)
		tubeStations[19] = createCustomMarker(new GLatLng(51.52013965559167, -0.09757876396179199), "<div ID=\"googleBubble\">Barbican <br>(Tube station) </div>" , tubeIcon);
		// Moorgate (Tube Station)
		tubeStations[20] = createCustomMarker(new GLatLng(51.51836383005963, -0.08888840675354004), "<div ID=\"googleBubble\">Moorgate<br>(Tube station) </div>" , tubeIcon);
		// Liverpool Street (Tube Station)
		tubeStations[21] = createCustomMarker(new GLatLng(51.517349041524156, -0.08284807205200195), "<div ID=\"googleBubble\">Liverpool St<br>(Tube station) </div>" , tubeIcon);
		// Chancery Lane (Tube Station)
		tubeStations[22] = createCustomMarker(new GLatLng(51.518116811248134, -0.11177301406860351), "<div ID=\"googleBubble\">Chancery Lane<br>(Tube station) </div>" , tubeIcon);
		// Holborn (Tube Station)
		tubeStations[23] = createCustomMarker(new GLatLng(51.51743583353309, -0.12001276016235351), "<div ID=\"googleBubble\">Holborn <br>(Tube station) </div>" , tubeIcon);
		// Russel Square (Tube Station)
		tubeStations[24] = createCustomMarker(new GLatLng(51.52291007217969, -0.12432575225830078), "<div ID=\"googleBubble\">Russell Sq<br>(Tube station) </div>" , tubeIcon);
	}	
	if(showingTubeStations == false)
	{
		for(var i = 0;i < tubeStations.length; i++)
		{
		    // Use MarkerManager for overlapping stations
		    switch(i) {
		        case 1:
		        case 13:
		        case 16:
		        case 17:
		        case 20:
		            mapMgr.addMarker(tubeStations[i], 15, 17);
		            break;
		        default:
        			map.addOverlay(tubeStations[i]);
        			break;
            }
		}
		showingTubeStations = true;
	}
}

function hideTubeStations()
{
	if(showingTubeStations == true)
	{
		for(var i = 0;i < tubeStations.length; i++)
		{
		    // Use MarkerManager for overlapping stations
		    switch(i) {
		        case 1:
		        case 13:
		        case 16:
		        case 17:
		        case 20:
		            mapMgr.removeMarker(tubeStations[i]);
		            break;
		        default:
			        map.removeOverlay(tubeStations[i]);
			        break;
		    }
		}
		showingTubeStations = false;
	}
}

function replaceRentAndSaleRadios() {
	$('propRent').style.display = 'none';
	$('propRent_radioReplacement').style.display = '';
	$('propSale').style.display = 'none';
	$('propSale_radioReplacement').style.display = '';
}

function clickRadioReplacement(radioId)
{
	$(radioId).checked = true;
	$(radioId).click();
	
	updateRadioDisplay('propSale');
	updateRadioDisplay('propRent');

	/* Moved into updateSaleRentalDisplay:-				
	if($('propSale').checked == true)
		$('pnlPropertyType').style.display = '';
	else
		$('pnlPropertyType').style.display = 'none';
	//*/
}

function updateSaleRentalDisplay()
{
	if($('propSale').checked == true)
	{
		// Set to sales display
		$('pnlPropertyType').style.display = '';
		$('rentalSliders').className = 'hidden';
		$('saleSliders').className = '';
		setMinSliderValue(minSlider.getValue());
		setMaxSliderValue(maxSlider.getValue());
		$('salesAllPropertiesPDFLink').className = '';
		$('salesFilteredPropertiesPDFLink').className = '';
		$('rentalsAllPropertiesPDFLink').className = 'doNotDisplay';
		$('rentalsFilteredPropertiesPDFLink').className = 'doNotDisplay';
		$('underOfferControl').className = '';
	} else {
		// Set to rental display
		$('pnlPropertyType').style.display = 'none';
		$('rentalSliders').className = '';
		$('saleSliders').className = 'hidden';
		setMinRentalSliderValue(minRentalSlider.getValue());
		setMaxRentalSliderValue(maxRentalSlider.getValue());
		$('salesAllPropertiesPDFLink').className = 'doNotDisplay';
		$('salesFilteredPropertiesPDFLink').className = 'doNotDisplay';
		$('rentalsAllPropertiesPDFLink').className = '';
		$('rentalsFilteredPropertiesPDFLink').className = '';
		//$('underOfferControl').className = 'hidden';
		// NB: Under Offer is now available for Rental properties too
		$('underOfferControl').className = '';
	}
}

function updateRadioDisplay(radioId)
{
	if($(radioId).checked == true)
		$(radioId + '_radioReplacement').className = 'radioSelected';
	else
		$(radioId + '_radioReplacement').className = 'radioDeselected';
}

function createSliders()
{
	/* Prototype Version:-
	//minSlider = new Control.Slider('minSliderHandle', 'minSlider', {values:[0, 0.07, 0.14, 0.21, 0.28, 0.35, 0.42, 0.49, 0.56, 0.63, 0.70, 0.775, 0.85, 0.925, 1.0],axis:'horizontal',onChange:setMinSliderValue});
	minSlider = new Control.Slider('minSliderHandle', 'minSlider', {values:[0, 0.0175, 0.035, 0.0525, 0.07, 0.0875, 0.105, 0.1225, 0.14, 0.1575, 0.175, 0.1925, 0.21, 0.2275, 0.245, 0.2625, 0.28, 0.2975, 0.315, 0.3325, 0.35, 0.3675, 0.385, 0.4025, 0.42, 0.4375, 0.455, 0.4725, 0.49, 0.5075, 0.525, 0.5425, 0.56, 0.5775, 0.595, 0.6125, 0.63, 0.6475, 0.665, 0.6825, 0.70, 0.71875, 0.7375, 0.75625, 0.775, 0.79375, 0.8125, 0.83125, 0.85, 0.86875, 0.8875, 0.90625, 0.925, 0.94375, 0.9625, 0.98125, 1.0],axis:'horizontal',onChange:setMinSliderValue});
	minSlider.setValue(0);
	//maxSlider = new Control.Slider('maxSliderHandle', 'maxSlider', {values:[0, 0.07, 0.14, 0.21, 0.28, 0.35, 0.42, 0.49, 0.56, 0.63, 0.70, 0.775, 0.85, 0.925, 1.0],axis:'horizontal',onChange:setMaxSliderValue});
	maxSlider = new Control.Slider('maxSliderHandle', 'maxSlider', {values:[0, 0.0175, 0.035, 0.0525, 0.07, 0.0875, 0.105, 0.1225, 0.14, 0.1575, 0.175, 0.1925, 0.21, 0.2275, 0.245, 0.2625, 0.28, 0.2975, 0.315, 0.3325, 0.35, 0.3675, 0.385, 0.4025, 0.42, 0.4375, 0.455, 0.4725, 0.49, 0.5075, 0.525, 0.5425, 0.56, 0.5775, 0.595, 0.6125, 0.63, 0.6475, 0.665, 0.6825, 0.70, 0.71875, 0.7375, 0.75625, 0.775, 0.79375, 0.8125, 0.83125, 0.85, 0.86875, 0.8875, 0.90625, 0.925, 0.94375, 0.9625, 0.98125, 1.0],axis:'horizontal',onChange:setMaxSliderValue});
	maxSlider.setValue(1);
	*/

	// YAHOO GUI Control version:-
	if(lockToSteps == true)
	{
		minSlider = new YAHOO.widget.Slider.getHorizSlider('minSlider', 'minSliderHandle', 0, sliderWidth, sliderStepSize);
		maxSlider = new YAHOO.widget.Slider.getHorizSlider('maxSlider', 'maxSliderHandle', 0, sliderWidth, sliderStepSize);
	} else {
		minSlider = new YAHOO.widget.Slider.getHorizSlider('minSlider', 'minSliderHandle', 0, sliderWidth);
		maxSlider = new YAHOO.widget.Slider.getHorizSlider('maxSlider', 'maxSliderHandle', 0, sliderWidth);
	}

	if(lockRentalToSteps == true)
	{
		minRentalSlider = new YAHOO.widget.Slider.getHorizSlider('minRentalSlider', 'minRentalSliderHandle', 0, sliderRentalWidth, sliderRentalStepSize);
		maxRentalSlider = new YAHOO.widget.Slider.getHorizSlider('maxRentalSlider', 'maxRentalSliderHandle', 0, sliderRentalWidth, sliderRentalStepSize);
	} else {
		minRentalSlider = new YAHOO.widget.Slider.getHorizSlider('minRentalSlider', 'minRentalSliderHandle', 0, sliderRentalWidth);
		maxRentalSlider = new YAHOO.widget.Slider.getHorizSlider('maxRentalSlider', 'maxRentalSliderHandle', 0, sliderRentalWidth);
	}

	if($('propSale').checked == false)
	{
		//maxSlider.setValue(sliderWidth);
		minSlider.setValue(startMinSliderPosition);
		maxSlider.setValue(startMaxSliderPosition);
	}
	if($('propRent').checked == false)
	{
		//maxRentalSlider.setValue(sliderRentalWidth);
		minRentalSlider.setValue(startMinRentalSliderPosition);
		maxRentalSlider.setValue(startMaxRentalSliderPosition);
	}
	minSlider.subscribe("change", setMinSliderValue);
	maxSlider.subscribe("change", setMaxSliderValue);
	minRentalSlider.subscribe("change", setMinRentalSliderValue);
	maxRentalSlider.subscribe("change", setMaxRentalSliderValue);
	if($('propRent').checked == true)
	{
		//maxRentalSlider.setValue(sliderRentalWidth);
		minRentalSlider.setValue(startMinRentalSliderPosition);
		maxRentalSlider.setValue(startMaxRentalSliderPosition);
	}
	if($('propSale').checked == true)
	{
		//maxSlider.setValue(sliderWidth);
		minSlider.setValue(startMinSliderPosition);
		maxSlider.setValue(startMaxSliderPosition);
	}
	
	/*
	if($('propSale').checked == true)
		$('rentalSliders').className = 'doNotDisplay';
	else
		$('saleSliders').className = 'doNotDisplay';
	*/
	updateSaleRentalDisplay();
}

function setMinSliderValue(value)
{
	$('minSliderValue').value = convertSliderValue(value);
	setSearchDelay();
	$('minPriceDisplay').innerHTML = "&pound;" + formatCurrency($('minSliderValue').value);
}

function setMaxSliderValue(value)
{
	$('maxSliderValue').value = convertSliderValue(value);
	setSearchDelay();
	$('maxPriceDisplay').innerHTML = "&pound;" + formatCurrency($('maxSliderValue').value);
}

function setMinRentalSliderValue(value)
{
	$('minSliderValue').value = convertRentalSliderValue(value);
	setSearchDelay();
	$('minRentalPriceDisplay').innerHTML = "&pound;" + formatCurrency($('minSliderValue').value) + " pw";
}

function setMaxRentalSliderValue(value)
{
	$('maxSliderValue').value = convertRentalSliderValue(value);
	setSearchDelay();
	//$('maxRentalPriceDisplay').innerHTML = "&pound;" + formatCurrency($('maxSliderValue').value) + " pw";
	if($('maxSliderValue').value == '2000')
	    $('maxRentalPriceDisplay').innerHTML = "&pound;" + formatCurrency($('maxSliderValue').value) + "+ pw";
	else
    	$('maxRentalPriceDisplay').innerHTML = "&pound;" + formatCurrency($('maxSliderValue').value) + " pw";
}

function formatCurrency(strValue)
{
	var value = parseInt(strValue, 10);
	var millions, thousands, units;
	if(value >= 1000000)
	{
		millions = Math.floor(value / 1000000);
	}
	else
	{
		millions = 0;
	}
	value -= (1000000 * millions);
	if(value > 1000)
	{
		thousands = Math.floor(value / 1000);
	}
	else
	{
		thousands = 0;
	}
	value -= (1000 * thousands);
	units = value;
	strValue = '';
	if(millions > 0) {
		strValue += millions.toString() + ',';
	}
	if(thousands > 0 || millions > 0)
	{
		if(millions == 0)
			strValue = thousands.toString();
		else
		{
			if(thousands == 0)
			{
				strValue += '000';
			} else if(thousands >= 100)
			{
				strValue += thousands.toString();
			} else if(thousands >= 10)
			{
				strValue += '0' + thousands.toString();
			} else 
			{
				strValue += '00' + thousands.toString();
			}
		}
		strValue += ',';
	}
	if(thousands == 0 && millions == 0)
		strValue = units.toString();
	else if(units >= 100)
		strValue += units.toString();
	else if(units >= 10)
		strValue += '0' + units.toString();
	else
		strValue += '00' + units.toString();
	//*/
	return strValue;
}

function convertSliderValue(value)
{ 
	/* Prototype version:-
	var floatValue = parseFloat(value);
	if(floatValue <= 0.70)
	{
		return Math.round((floatValue / 0.7) * 1000000);
	}
	else
	{
		floatValue = (floatValue - 0.625);
		floatValue = (floatValue / 0.075);
		return Math.round(floatValue * 1000000); 
	}
	*/
	// YAHOO version:-
	
	var floatValue = parseFloat(value);
	//floatValue /= parseFloat(sliderWidth);
	floatValue /= parseFloat(sliderStepSize);
	//var millionValue = 10.0 / 14.0;
	var millionValue = 10.0;
	if(floatValue > millionValue)
	{
		// We are above the 1 million mark
		floatValue -= millionValue
		//floatValue *= 14.0;
		return Math.round(floatValue * 1000000) + 1000000;
	} else {
		//floatValue *= 14.0;
		return Math.round(floatValue * 100000);
	}
}

function convertRentalSliderValue(value)
{ 
	// YAHOO version:-
	
	var floatValue = parseFloat(value);
	floatValue /= parseFloat(sliderRentalStepSize);
	return Math.round(floatValue * 25);
}

var searchDelayCount = 0, timerRunning = false;
function setSearchDelay()
{
	//searchDelayCount = 10;
	//searchDelayCount = 3;
	searchDelayCount = 4;
	if(timerRunning == false)
	{
		timerRunning = true;
		window.setTimeout("searchTick()", 100);
	}
}

function searchTick()
{
	if(searchDelayCount > 0)
	{
		searchDelayCount--;
		
		if(searchDelayCount == 0)
		{
			timerRunning = false;
			search();
		} else {
			window.setTimeout("searchTick()", 100);
		}
	}
}

function search()
{
	//alert("In search()");
	
	var minPrice, maxPrice, saleProperties, includeFlats, includeHouses, includeUnderOffer, includeStudios, include1Bedrooms, include2Bedrooms, include3Bedrooms, include4PlusBedrooms, includeIslington, includeHighbury, includeCamden, mustHaveGarden, mustHaveTerrace;
	
	//minPrice = 0
	//maxPrice = 9999999;
	minPrice = parseInt($('minSliderValue').value);
	maxPrice = parseInt($('maxSliderValue').value);
	//alert(minPrice);
	//alert(maxPrice);
	if(document.getElementById('propSale').checked == true)
		saleProperties = true;
	else
		saleProperties = false;
	if(document.getElementById('flat').checked == true)
		includeFlats = true;
	else
		includeFlats = false;
	if(document.getElementById('house').checked == true)
		includeHouses = true;
	else
		includeHouses = false;
	if(document.getElementById("includeUnderOffer").checked == true)
		includeUnderOffer = true;
	else
		includeUnderOffer = false;
	if(document.getElementById('studio').checked == true)
		includeStudios = true;
	else
		includeStudios = false;
	if(document.getElementById('one_bedroom').checked == true)
		include1Bedrooms = true;
	else
		include1Bedrooms = false;
	if(document.getElementById('two_bedrooms').checked == true)
		include2Bedrooms = true;
	else
		include2Bedrooms = false;
	if(document.getElementById('three_bedrooms').checked == true)
		include3Bedrooms = true;
	else
		include3Bedrooms = false;
	if(document.getElementById('four_bedrooms').checked == true)
		include4PlusBedrooms = true;
	else
		include4PlusBedrooms = false;
	if(document.getElementById('islington').checked == true)
		includeIslington = true;
	else
		includeIslington = false;
	if(document.getElementById('highbury').checked == true)
		includeHighbury = true;
	else
		includeHighbury = false;
	if(document.getElementById('camden').checked == true)
		includeCamden = true;
	else
		includeCamden = false;
	if(document.getElementById('garden').checked == true)
		mustHaveGarden = true;
	else
		mustHaveGarden = false;
	if(document.getElementById('terrace').checked == true)
		mustHaveTerrace = true;
	else
		mustHaveTerrace = false;
	
	//properties.SearchProperties(minPrice, maxPrice, saleProperties, propertyType, includeUnderOffer, minBedrooms, maxBedrooms, includeIslington, includeHighbury, includeCamden, mustHaveGarden, mustHaveTerrace)
	//properties.SearchProperties(0, 9999999, true, 'House', includeUnderOffer, 0, 9, true, true, true, false, false)
	//properties.SearchPropertiesRevised(minPrice, maxPrice, saleProperties, includeFlats, includeHouses, includeUnderOffer, includeStudios, include1Bedrooms, include2Bedrooms, include3Bedrooms, include4PlusBedrooms, includeIslington, includeHighbury, includeCamden, mustHaveGarden, mustHaveTerrace);
	properties.SearchPropertiesRevised(minPrice, maxPrice, saleProperties, includeFlats, includeHouses, includeUnderOffer, includeStudios, include1Bedrooms, include2Bedrooms, include3Bedrooms, include4PlusBedrooms, includeIslington, includeHighbury, includeCamden, mustHaveGarden, mustHaveTerrace);
}

/* NB: "listView" size list:-

(Remaining displays around list view:-)		(width, height)
=============================================================
Hiding Amenities & Hiding Search Panel:-	938px, 480px
Hiding Amenities & Showing Search Panel:-	938px, 380px
Showing Amenities & Hiding Search Panel:-	746px, 480px
Showing Amenities & Showing Search Panel:-	746px, 380px;
//*/

function showMapView()
{
	$('map').style.display = 'block';
	$('listView').style.display = 'none';
	$('mapViewTab').className = 'current';
	$('listViewTab').className = '';
	/* If hiding the Amenities panel:-
	$('googleList').style.display = 'block';
	//*/
	/* If hiding the search criteria:- 
	$('search').style.display = 'block'; 
	//*/
	$('currentViewMode').value = 'MapView';
}

function showListView()
{
	$('listView').style.display = 'block';
	$('map').style.display = 'none';
	$('mapViewTab').className = '';
	$('listViewTab').className = 'current';
	/* If hiding the Amenities panel:-
	$('googleList').style.display = 'none';
	//*/
	/* If hiding the search criteria:- 
	$('search').style.display = 'none';
	//*/
	$('currentViewMode').value = 'ListView';
}

function showPropertyRow(PropertyID)
{
	var propertyRow = $('propertyRow_' + PropertyID.toString());
	//*
	if(propertyRow)
	{
		//propertyRow.style.display = '';
		propertyRow.className = 'listViewRow';
	} else {
		//alert("showPropertyRow: Failed to locate \"propertyRow_" + PropertyID.toString() + "\"");
	} //*/
	/*
	if(propertyRow)
	{
		var rowsWithinDiv = propertyRow.childNodes;
		if(rowsWithinDiv)
		{
			for(var i = 0; i < rowsWithinDiv.length; i++)
			{
				alert(rowsWithinDiv[i].toString());
				alert(rowsWithinDiv[i]);
				rowsWithinDiv[i].style.display = '';
			}
		}
	} //*/
}

function hidePropertyRow(PropertyID)
{
	var propertyRow = $('propertyRow_' + PropertyID.toString());
	//*
	if(propertyRow)
	{
		//propertyRow.style.display = 'none';
		propertyRow.className = 'listViewRow_Hidden';
	} else {
		//alert("hidePropertyRow: Failed to locate \"propertyRow_" + PropertyID.toString() + "\"");
	} //*/
	/*
	if(propertyRow)
	{
		var rowsWithinDiv = propertyRow.childNodes;
		if(rowsWithinDiv)
		{
			for(var i = 0; i < rowsWithinDiv.length; i++)
			{
				alert(rowsWithinDiv[i].toString());
				alert(rowsWithinDiv[i]);
				rowsWithinDiv[i].style.display = 'none';
			}
		}
	} //*/
}

function btnSaveSearch_click()
{
	var saveSearch = confirm("These settings will be saved to your computer");
	if(saveSearch == true)
	{
		$('formAction').value = 'Save Search';
		try {
			$('searchForm').action = 'index.aspx';
		} catch(ex)
		{
			$('searchForm').getAttribute('action').value = 'index.aspx';
		}
		$('searchForm').submit();
	}
}

function hideIframe()
{
	$('innerWindowIframe').style.display = 'none';
	$('container').style.display = '';
	$('footer').style.display = '';
}

function showIframe()
{
	$('innerWindowIframe').style.display = '';
	$('container').style.display = 'none';
	$('footer').style.display = 'none';
}

function openInIframe(url)
{
	//alert(navigator.vendor);
	if(navigator.userAgent.toLowerCase().indexOf('safari') != -1)
		document.location = url.replace('showHeader=false', 'showHeader=true');
	else
		$('innerWindowIframe').src = url;
	//alert(navigator.userAgent);
}