function Incident( longitude, lat, description, type, id, reportedBy )
{
    this.id = id;
    this.longitude = longitude;
    this.lat = lat;
    this.description = description;
    this.reportedBy = reportedBy

    this.img = document.createElement('img');

    if(type == 'incident') {
        this.img.src = 'images/icon_incident.gif';
    } else if(type == 'construction') {
        this.img.src = 'images/icon_construction.gif';
    } else {
        this.img.src = 'images/icon_event.gif';
    }

    this.type = type;
    this.img.type = type;
    this.img.style.cursor = 'pointer';

    this.img.referencedObject  = this;
    this.img.viewer = new IncidentViewer(this);

    this.img.onclick     = this.onClick;
    this.img.onmouseover = this.mouseOver;
    this.img.onmouseout  = this.mouseOut;
    this.icon_sizes =  { 290000:{ h:12,w:12} ,195000:{h:16,w:16},135000:{h:20,w:20},55000:{h:20,w:20},12000:{h:28,w:28}};
}

Incident.prototype.mouseOver = function(e)
{
    e=(e)?e:window.event;
    var d = document.getElementById('hoverBox');
    d.style.visibility = "visible";
    if ((getInsideWindowWidth() - e.clientX) < 100) {
        d.style.left = (e.clientX) + (-130) + 'px';
    } else {
        d.style.left = (e.clientX) + (20) + 'px';
    }

    if ((getInsideWindowHeight() - e.clientY) < 20) {
        d.style.top = (e.clientY) + (10) +'px';
    } else {
        d.style.top = (e.clientY) + (-10) +'px';
    }
    d.innerHTML = this.referencedObject.description
}

Incident.prototype.setScale = function (scale) { 

 if(this.icon_sizes[scale] != null) {
        this.img.width=this.icon_sizes[scale].w;
        this.img.height=this.icon_sizes[scale].h;
   }
}

Incident.prototype.mouseOut = function(e)
{
    var d = document.getElementById('hoverBox');
    d.style.visibility = "hidden";
}

Incident.prototype.onClick = function(e)
{
    this.viewer.requestIncidentDetails();
}
