function createMarker(point, html, icon, property, symbol, exchange) {
    var marker = new GMarker(point, { icon: iconlist[icon], title: property + " (" + symbol + "-" + exchange + ")" });

    GEvent.addListener(marker, "click", function () {
        summary(html);  // not looked at yet
    });
    return marker;
}

function summary(propertyid) {
    // Dialog

    
    loadCompanyDialogData(propertyid);

}

function loadCompanyDialogData(propertyId) 
{
    jQuery('#company-header').html('');
    jQuery('#company-summary').html('');
    jQuery('#property-description').html('');

    loadUrl1 = '/includes/dynamic/property-summary.php?Property=' + propertyId;
    loadUrl2 = '/includes/dynamic/company-summary.php?Property=' + propertyId;
    jQuery.get(loadUrl1, getPropertyResult);
    jQuery.get(loadUrl2, getCompanyResult);

}

var companyLoaded = false;
var propertyLoaded = false;

function getCompanyResult(data) {
    var obj = jQuery.evalJSON(jQuery.trim(data));
	
	jQuery('#company-header').html(obj.Company);
	jQuery('#company-summary').html(obj.Summary);
	companyLoaded = true;
    showDialog();

}

function getPropertyResult(data) {
    
    var obj = jQuery.evalJSON(jQuery.trim(data));
    jQuery('#property-description').html(obj.Description);
    propertyLoaded = true;
    showDialog();
}
function showDialog() {
    if (!companyLoaded || !propertyLoaded) return;
    
    jQuery('#tabs').tabs();
    jQuery("#tabs").tabs("select", 0);
    
    
    jQuery('#dialog').dialog(
    {
        dialogClass: 'none',
        width: 720
    });

    jQuery("#dialog img").each(function () {
        var maxWidth = 645;
        var img = jQuery(this);
        if (img.width() > maxWidth) {
            img.width(maxWidth);
        }
    });

    companyLoaded = false;
    propertyLoaded = false;
}


// PARSE URL FOR /COMPANY/
function getco() {
    var company = document.location.pathname;
    // location.search;
    // var company = window.location.pathname;
    company = company.substring(6);
    //alert (company);

    return (company == 'php') ? jQuery.QueryString['keyword'] : company;
}



// center map and change zoom level according to parameters
function recenter(y, x, z) {
    setstatus("recenter");
    if (map != undefined) {
        map.setCenter(new GLatLng(y, x), z);
    }
}
