jQuery.noConflict();
class_map = function(id) {
	var sLatLng = new google.maps.LatLng(0, 0);
	var myOptions = {
		zoom: 0,
		center: sLatLng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
		};
	this.map = new google.maps.Map(document.getElementById(id), myOptions);
	this.bounds = new google.maps.LatLngBounds();
	this.image_01 = new google.maps.MarkerImage('./images/coupe/g_orange.png',
		new google.maps.Size(19, 37),
		new google.maps.Point(0,0),
		new google.maps.Point(10, 36));
	this.image_02 = new google.maps.MarkerImage('./images/coupe/g_vert.png',
		new google.maps.Size(19, 37),
		new google.maps.Point(0,0),
		new google.maps.Point(10, 36));
	this.image_03 = new google.maps.MarkerImage('./images/coupe/g_noir.png',
		new google.maps.Size(19, 37),
		new google.maps.Point(0,0),
		new google.maps.Point(10, 36));
	this.shadow = new google.maps.MarkerImage('./images/coupe/g_ombre.png',
		new google.maps.Size(23, 11),
		new google.maps.Point(0,0),
		new google.maps.Point(1,10));
	};
jQuery.extend(class_map.prototype, {
	PutMap:function(add,coo,txt,cat) {
		var obj = this;
		var mark=this.choiceMark(cat);
		var geocoder = new google.maps.Geocoder();
		if (geocoder) {
			geocoder.geocode(
				{'address' : add},
				function(results, status) {
					if (status == google.maps.GeocoderStatus.OK) {
						var latlng;
						if (coo!='') {
							var  reg=new  RegExp("[ ,]+",'g')
							var ll = coo.split(reg);
							latlng = new google.maps.LatLng(ll[0],ll[1]);
							}
							else {
								latlng = results[0].geometry.location;
								}										
						var infowindow = new google.maps.InfoWindow({
								content:txt,
								maxWidth: 200
							});
						var marker = new google.maps.Marker({
							map: obj.map, 
							position: latlng,
							shadow: obj.shadow,
							icon: mark
							});
						var empty = obj.bounds.isEmpty();
						obj.bounds.extend(latlng);
						if (empty) {
							obj.map.setZoom(14);
							obj.map.setCenter(latlng);
							}
							else {
								obj.map.fitBounds(obj.bounds);
								}						
						google.maps.event.addListener(marker, 'click', function() {
							infowindow.open(obj.map,marker);
							});
						//alert(obj.map.getZoom());
						}
					}
				);
			}
		},
	choiceMark:function(cat) {
		switch(cat) {
			 case 6:
				return this.image_01;
			 break;
			 case 5:
				return this.image_02;
			 break;
			 case 7:
				return this.image_03;
			 break;
			 }
		}
	});
