function SC_Reseller()
{
  // initialize the member variables for this instance
  this.id = 0;
  this.addrl = '';
  this.addr2 = '';
  this.city = '';
  this.state = '';
  this.rname = '';
  this.zip = '';
  this.latitud = 0;
  this.longitud = 0;
  this.distance = 0;
  this.phone = '';
  this.fax = '';
  this.addr2 = '';
  this.url = "";
  this.priority = '';
  this.marker = null;
  this.markerHTML = '';
  this.eliteDealer = false;

  
  // initialize the member function references 
  // for the class prototype
  _SC_Reseller_prototype_called = true;
  SC_Reseller.prototype.setLongLat = setLongLat;
  SC_Reseller.prototype.getCoords = getCoords;
  SC_Reseller.prototype.generateMarker = generateMarker;
  SC_Reseller.prototype.getDistanceFromCenter =getDistanceFromCenter ;
  SC_Reseller.prototype.generateHtml = generateHtml;
  SC_Reseller.prototype.toString = toString;
  
  function toString(){
  	var str = this.distance+"";
  	while( str.length < 15 ) str = "0" + str;
  	return str
  }
  
  function generateHtml(){
  	this.markerHTML = "<div class='marker_content'>";
  	if ( this.rname != "" )	this.markerHTML +="<strong>"+this.rname+"</strong>";
  	if ( this.eliteDealer != "F" ) this.markerHTML +="&nbsp;<img src='/site/images/goldenstar.png' /> <span class='eliteDistributors' >Elite Distributor</span><br>"; else this.markerHTML +="<br>";
  	if ( this.addrl != "" ) this.markerHTML +=this.addrl+"<br>";
  	if ( this.addr2 != "" ) this.markerHTML +=this.addr2+"<br>";
  	if ( this.city != "" )	this.markerHTML +=""+this.city+", ";
  	if ( this.state != "" )	this.markerHTML +=""+this.state+"<br>";
  	if ( this.fax != "" ) this.markerHTML += ""+this.zip+"<br>";
  	if ( this.phone != "" ) this.markerHTML +=""+this.phone+"<br>";
  	if ( this.url != "" && this.rname != "" ) this.markerHTML += "<a style='color:#0000FF' href='"+this.url+"'>"+this.rname+" OFFICIAL SITE</a><br>";
  	if ( this.email != "" ) this.markerHTML +="<a style='color:#0000FF' href='mailto:"+this.email+"'>E-Mail</a>";
  	this.markerHTML += "</div>";
  	return this.markerHTML;
  }
  
  function getDistanceFromCenter(gMap){
  	this.distance = gMap.getCenter().distanceFrom(this.marker.getPoint());
	this.distance = parseInt((this.distance/1000)*0.621371192);
	return this.distance;
  }
  
  function setLongLat(lon,lat){
  	this.longitud = lon;
  	this.latitud = lat;
  }
  
  function generateMarker(){
  	var point = new GLatLng(this.latitud,this.longitud);
	this.marker = createMarker(point,this.generateHtml());
  }
  
  var markercnt;
  
  function getCoords(){
  	alert("Addres buscada:"+this.addrl + ", " + this.city + ", " + this.state);
  	if ( this.latitud != "" && this.longitud != "" ){
	  	var point = new GLatLng(this.longitud,this.latitud);
		this.marker = createMarker(point,this.generateMarker());
	} else {
		var address = this.addrl + ", " + this.city + ", " + this.state;
		var geocoder = new GClientGeocoder();
		geocoder.getLatLng(address,
			function showLocation(point) {
				if (!point) {
					alert(this.addrl + ", " + this.city + ", " + this.state + " was not found");
				} else {
					//document.marker = createMarker(point,"this.generateHtml()");
					markercnt = createMarker(point,this.generateHtml());
				}
			}
		);
	}
  }
}