﻿/* Chesterton Humberts Search forms functions */

//Make the call to get the selected areas from the Flash map
function SearchLocationSend() 
{                               
    var flashmovie = document.getElementById("MapSearch");
    
    /*=> getSelectedAreasFromFlash(<area attribute from map.xml>, <area item separator>, <area type separator>)
            - Call to the Actionscript callback function into the Flash map
            - Return a string of the selected areas by regions, counties and districts
    */    
    //flashmovie.getSelectedAreasFromFlash("label", ",", "<|>");
    //flashmovie.getSelectedAreasFromFlash("fullname", ",", "<|>");
    flashmovie.getSelectedAreasFromFlash("id", ",", "<|>");
}

//Function called from the Flash map to populate the hidden field
//with selected areas and to submit the form 
function receiveSelectedAreasFromFlash(selectedAreas) 
{
    // comment out the alert function below for production deployment. Used by SAS to check values returned from Flash.
    //alert("#srchLocationIds value: " + selectedAreas);
    $("#srchLocationIds").attr("value", selectedAreas);
    
    // Use the function below to trigger the submition of the form
    // Could also be used to call a custom Datography form trigger function - currently commented out below for our testing.
    //$("#formpropertysearch").submit();
}