$(document).ready(function(){
	setTimeout('afficherContenu()', 200);	
	
	$('.lien_bottom').hover(function(){
			$(this).animate({top:'-5px',height:'55px'},250);
									 });
	
	$('.lien_bottom').mouseout(function(){
			$(this).animate({top:'0px',height:'50px'},250);
									 });
	
	
});

function afficherContenu(){
	document.getElementById("princ_cont").style.display = 'block';
	
	if(afficherMap){
		latlng = new google.maps.LatLng(latitude,longitude);
		latlng2 = new google.maps.LatLng((latitude+0.02),longitude);
		myOptions = {
		  zoom: 12,
		  center: latlng2,
		  mapTypeId: google.maps.MapTypeId.HYBRID 
		}
		map = new google.maps.Map(document.getElementById("GoogleMap"), myOptions);
		createMarker(latlng,"hdr", contenuMarqueur);
	}
}




function menu_actif(obj,base_url){
	document.getElementById(obj).style.backgroundImage='url('+base_url+'/images/sous-menu_over.jpg)';
	document.getElementById(obj).style.backgroundRepeat='no-repeat';
	document.getElementById(obj).style.color='#fff';
}

function menu_inactif(obj_inactif){
	document.getElementById(obj_inactif).style.backgroundImage='';
	document.getElementById(obj_inactif).style.color='#000000';
}




function getEntreprise(id_categ){
	//alert(id_categ);
	$('#liste_entreprise').html("<img src='admin/images/ajax-loader.gif' title='veuillez patienter...' alt='veuillez patienter...' border='0' />").load("ajax/getEntreprise.php", {categ:id_categ});
}

var id_old='';
function afficheDetailEntreprise(id){
	if(id_old !=''){
		$('#detail_entreprise_'+id_old).hide(500);
	}
	if(id_old != id){
		$('#detail_entreprise_'+id).show(500);
		id_old = id;
	}else{
		id_old='';	
	}
}

var latlng = null;
var latlng2 = null;
var myOptions = null;

var latitude = 49.474167;
var longitude = 5.958333;

var gmarkers = [];
var htmls = [];
var to_htmls = [];
var from_htmls = [];
var i=0;

var map=null;
var marker=null;

function createMarker(point,name,html) {

	html = html + '<div id="bulle_m'+i+'" class="bulleGM" style="text-align:left;"><a href="javascript:tohere('+i+')" title="Depuis Monswiller" style="color:#000; font-weight:bold;">&raquo; Se rendre &agrave; Audun le Tiche</a><br/><br/><a href="javascript:fromhere('+i+')" title="Vers Monswiller" style="color:#000; font-weight:bold;">&raquo; Partir d\'Audun le Tiche</a><div class="cleaner"></div><br /></div>' +
	
		'<div id="bulle_t'+i+'" class="bulleGM" style="height:40px;display:none;overflow:visible;" ><span style="color:black">Lieu de d&eacute;part:</span><form action="http://maps.google.fr/maps" method="get" target="_blank" style="margin:0px;padding:0px;" >' +
	'<input type="text" SIZE=20 MAXLENGTH=40 name="saddr" id="saddr" value="" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;color:#000000;" />' +
	'<INPUT value="Envoyer" TYPE="SUBMIT" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;color:#000000;margin-left:3px;">' +
	'<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() +
	'"/><br/><br/><a href="#" onclick="general_bulleGM();return false;" >&raquo; revenir</a></form></div>' +
	
	'<div id="bulle_f'+i+'" class="bulleGM" style="height:40px;display:none;overflow:visible;" ><span style"color:black">Lieu d\'arriv&eacute;e:</span><form action="http://maps.google.fr/maps" method="get"" target="_blank" style="margin:0px;padding:0px;">' +
	'<input type="text" SIZE=20 MAXLENGTH=40 name="daddr" id="daddr" value="" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;color:#000000;" />' +
	'<INPUT value="Envoyer" TYPE="SUBMIT" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;color:#000000;margin-left:3px;">' +
	'<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
	'"/><br/><br/><a href="#" onclick="general_bulleGM();return false;" >&raquo; revenir</a></form></div>';

	html = "<div style='width:300px; height:140px;'>" + html +"</div>";
	var infowindow = new google.maps.InfoWindow({
		content: html
	});
	
	marker = new google.maps.Marker({
		position: latlng,
		map: map,
		title:""
	});
	infowindow.open(map,marker);
	
	google.maps.event.addListener(marker, 'click', function() {
		$(".bulleGM").each(function() {this.style.display = ((this.id.indexOf("bulle_m")==0)?"block":"none");});
		infowindow.open(map,marker);
	});

	gmarkers[i] = marker;
	htmls[i] = html;
	i++;
	return marker;
}

function general_bulleGM() {
	$(".bulleGM").each(function() {this.style.display = ((this.id.indexOf("bulle_m")==0)?"block":"none");});
}

function tohere(i) {
	$(".bulleGM").each(function() {this.style.display = ((this.id.indexOf("bulle_t")==0)?"block":"none");});
}

function fromhere(i) {
	$(".bulleGM").each(function() {this.style.display = ((this.id.indexOf("bulle_f")==0)?"block":"none");});
}

function base_url() {
	if(document.domain.indexOf("hdrsw11.com") != -1)
		return "/~monswill";
	return "";
}



	

