function GmapsClass(objName){
	this.map = null;
	this.markers = [];
	this.markersData = [];
	this.infoWin = [];
	this.geoPoint = [];
	this.geocoder = new GClientGeocoder();
	this.bounds = new GLatLngBounds();
	this.objName = objName;
	this.selection = [];
	
	this.isBrowserCompatible = function(){
		if (GBrowserIsCompatible()) {
			return true;
		}else{
			return false;
		}
	}
	
	this.initializeMap = function(divTarget, lat, lng, zoomLevel){
		if(this.isBrowserCompatible){
			this.map = new GMap2(document.getElementById(divTarget));
			
			this.map.setCenter(new GLatLng(lat, lng), zoomLevel);
			//this.map.addControl(new GSmallMapControl());
			//this.map.setMapType(G_PHYSICAL_MAP);
		}else{
			alert('Browser is not compatible');
		}
	}
		
	this.setMarkerByLatLng = function (lat, lng, infoWinHtml, i, data){
		var icon = new GIcon();
		icon.image = "http://localhost/www/visio_j/pics/icons/air_icon.png";
		icon.iconSize = new GSize(50,50);
		icon.iconAnchor = new GPoint(25,25);
		icon.title = 'WOW';
		
		var point = new GLatLng(lat, lng);
		var marker = new GMarker(point, icon);
		this.bounds.extend(point);
		
		this.map.addOverlay(marker);
		
		if(infoWinHtml != ''){
			//marker.bindInfoWindowHtml('<div style="width:'+Math.floor(winWidth * 0.8 )+'px;height:'+Math.floor(winHeight * 0.65 )+'px;">'+infoWinHtml+'</div>');	
			
		}
				
		// set event
		if(data){
			GEvent.addListener(marker, "click", function() {
				try{
					if(data[1] != ''){
						set_ddms_by_target_location(data[1], data[2], data[3], data[4]);
						hide_detail_win(false); 
						get_special_offer_flights(data[4]); 
						getFlightsInMonth();
					}
				}catch(E){}
			});		
		}
		
		this.markers.push(marker);		
		this.markersData.push([lat, lng, data[1], data[2], data[3], data[4]]);
		this.centerMap();
	}
		
	this.setLine = function(lat_1, lng_1, lat_2, lng_2, data){

		var polyline = new GPolyline([
			  new GLatLng(lat_1, lng_1),
			  new GLatLng(lat_2, lng_2)
			], data[0], data[1]);
		this.map.addOverlay(polyline);
	
	}
			
	this.setInfoWindow = function(markerId, html){
		this.markers[markerId].bindInfoWindowHtml(html);
	}
	
	this.centerMap = function(){
		if(this.map.getBoundsZoomLevel(this.bounds) > 13){
			z = 7	
		}else{
			z = this.map.getBoundsZoomLevel(this.bounds);
		}
		this.map.setZoom(z);
		this.map.setCenter(this.bounds.getCenter());		
	}
	
	this.centerMapByMarker = function(lat, lng){
		this.map.setZoom(7);
		this.map.setCenter(new GLatLng(lat, lng));		
	}
	
	this.resetMap = function(){
		this.map.clearOverlays()
		this.markers = [];
		this.infoWin = [];
		this.geoPoint = [];
		this.selection = [];
		this.bounds = new GLatLngBounds();
	}
}

