//
// (c) 2007 F22F Amsterdam
//
function fcs_maps_marker(lat,lon,title) {
  this.lat=parseFloat( replcomma(lat) );
  this.lon=parseFloat( replcomma(lon) );
  this.title=title;
}

function openInfoWindowHtml(htmltext) {
    $('#fcs_marker').html('');
    //$('#fcs_marker').append('&nbsp;');
    //$('#fcs_marker').append(this.title);
    //$('#fcs_marker').append('&nbsp;');
    //$('#fcs_marker').append(this.lat);
    //$('#fcs_marker').append('&nbsp;');
    //$('#fcs_marker').append(this.lon);
    //$('#fcs_marker').append('<br /> ');
    $('#fcs_marker').append(htmltext);
    $('#fcs_marker').show('slow');

// calculate offset
 var w=760;
 var h=540; //width heigth;

  var x,y;

 if(isNaN(this.lat)) {
  x=parseInt( 0*3+w/2);
  y=parseInt( 0*3+h/2);
 } else {
  x=parseInt( parseFloat(this.lon)*3+w/2);
  y=parseInt( parseFloat(this.lat)*3+h/2);
 }

    $('#fcs_marker').append('&nbsp;');
    $('#fcs_marker').append( parseInt(this.lat*100)/100 );
    $('#fcs_marker').append('&nbsp;');
    $('#fcs_marker').append( parseInt(this.lon*100)/100 );
    $('#fcs_marker').append('&nbsp;');
    $('#fcs_marker').append('');
    $('#fcs_marker').append(x);
    $('#fcs_marker').append(',');
    $('#fcs_marker').append(y);
//    $('#fcs_marker').append( '&nbsp;<A HREF=# onClick="$(\'div#fcs_marker\').hide(\'slow\');" >[x]</A>' );
    $('#fcs_marker').append( '<div id="fcs_marker_inner"><A HREF=# onClick="$(\'div#fcs_marker\').hide(\'slow\');" >X</A></div>' );
//<div id="fcs_marker_inner"></div>
//    $('#fcs_marker_inner').html( '&nbsp;<A HREF=# onClick="$(\'div#fcs_marker\').hide(\'slow\');" >[x]</A>' );
//    $('#fcs_marker_inner').show('slow');


  // $("#fcs_marker").animate({left:100,top:200},500);
  $("#fcs_marker").animate({
    left: x, top:y
  }, 500);

}

fcs_maps_marker.prototype.openInfoWindowHtml = openInfoWindowHtml

function replcomma(s)
{
  //replaces , with .
  var r, re;
  re = /\,/;
  r = s.replace(re, ".");
  return(r);
}

function openInfoWindowHtml_OLD(htmltext) {
    $('#fcs_map').html('');
    $('#fcs_map').append(' ');
    $('#fcs_map').append(this.title);
    $('#fcs_map').append(' ');
    $('#fcs_map').append(this.lat);
    $('#fcs_map').append(' ');
    $('#fcs_map').append(this.lon);
    $('#fcs_map').append('<br /> ');
    $('#fcs_map').append(htmltext);
}





