
	function fixed_top(select,offS){
		return Number(offS+document.documentElement.scrollTop+document.body.scrollTop)+'px';
	}
	function fixed_left(select,offS){
		return Number(offS+document.documentElement.scrollLeft+document.body.scrollLeft)+'px';
	}
	function fixed_bottom(select,offS){
		return Number(-offS+document.documentElement.clientHeight-select.offsetHeight+document.documentElement.scrollTop+document.body.scrollTop)+'px';
	}
	function fixed_right(select,offS){
		return Number(-offS+document.documentElement.clientWidth-select.offsetWidth+document.documentElement.scrollLeft+document.body.scrollLeft)+'px';
	}

var lasttype="type_moment";
function loadContenu(idelement,type){
	$(lasttype).removeClassName('current');
	lasttype=idelement;
	$(idelement).addClassName('current');
	$('courant_contenu').innerHTML='<div class="loader">Chargement des manifestations en cours...<br\/><img src="/images/bar_loading.gif" alt="Chargement en cours" /><\/div>';
	var url = '/load_contenu/';
	lastmanifid=1;
	new Ajax.Request(url, {
		method: 'post',
		parameters: "modeAjax=1&type="+type, 
		onSuccess: function(response) {
			$('courant_contenu').innerHTML=response.responseText;
		}
	});
	
}

function loadAllCarte(crit,total_fenetre){
	var url = '/load_carte/';
	var criteres=crit.evalJSON();
	criteres.total_fenetre=total_fenetre;
	
	dm_googlemaps_object.load();
	new Ajax.Request(url, {
		method: 'post',
		parameters: criteres, 
		onSuccess: function(response) {
			var text = response.responseText || '[]';
			try {
				var obj = text.evalJSON() || '';
			} catch(e) {
				var obj = {};
			}
			//dm_googlemaps_object.load();
			for(i=0;i<obj.length;i++){
				if(obj[i]){
					pres=(obj[i]);
					//dm_googlemaps_object.markerDepuisAdresse(pres.ADRPROD_CP+' '+pres.ADRPROD_LIBELLE_COMMUNE,pres.ADRPROD_CP+' '+pres.ADRPROD_LIBELLE_COMMUNE,pres.ADRPROD_CP+' '+pres.ADRPROD_LIBELLE_COMMUNE);
					dm_googlemaps_object.markerDepuisLatlng(pres.LATITUDE,pres.LONGITUDE,pres.NOM+'<br\/>'+pres.TYPE_NOM,pres.PRODUIT);
				}
			}
			dm_googlemaps_object.calculZoom();
			//	dm_googlemaps_object.autoload_idmag='{$idmag}';
			
		}
	});
}

var lastmanifid=1;
function manif_precedent(){
	var id="groupe_manif_";
	if($(id+lastmanifid)!=undefined){
		$(id+lastmanifid).style.display='none';
		lastmanifid--;
		if($(id+lastmanifid)==undefined){
			lastmanifid=40;
			while($(id+lastmanifid)==undefined){
				lastmanifid--;
			}
		}
		$(id+lastmanifid).style.display='block';
	}	
}
function manif_suivant(){
	var id="groupe_manif_";
	if($(id+lastmanifid)!=undefined){
		$(id+lastmanifid).style.display='none';
		lastmanifid++;
		if($(id+lastmanifid)==undefined)
			lastmanifid=1;
		$(id+lastmanifid).style.display='block';
	}	
}

var lastmmid=1;
function manque_precedent(){
	var id="manque_manif_";
	if($(id+lastmmid)!=undefined){
		$(id+lastmmid).style.display='none';
		lastmmid--;
		if($(id+lastmmid)==undefined){
			lastmmid=40;
			while($(id+lastmmid)==undefined){
				lastmmid--;
			}
		}
		$(id+lastmmid).style.display='block';
	}	
}
function manque_suivant(){
	var id="manque_manif_";
	if($(id+lastmmid)!=undefined){
		$(id+lastmmid).style.display='none';
		lastmmid++;
		if($(id+lastmmid)==undefined)
			lastmmid=1;
		$(id+lastmmid).style.display='block';
	}	
}




//définis le cookie
function setCook(nom,valeur) {
  document.cookie = nom + "=" + escape(valeur)
}
function getCook(nom) {
	deb = document.cookie.indexOf(nom + "=")
	if (deb >= 0) {
	    deb += nom.length + 1
	    fin = document.cookie.indexOf(";",deb)
	    if (fin < 0) fin = document.cookie.length
	    return unescape(document.cookie.substring(deb,fin))
	    }
	return ""
}


function loadPrint(page){
	 res=window.open(page,"impression","menubar=no, status=no, scrollbars=yes, menubar=no, width=600, height=600");
	 res.focus();
}

var numpub=1;
var temps=new Array();
function defile_pubs(){
	var numpubafter=numpub;
	numpub++;
	if(!$('pub_'+numpub)){
		numpub=1;
	}
	if($('pub_'+numpub)){
		$('pub_'+numpubafter).hide();
		$('pub_'+numpub).show();
		setTimeout("defile_pubs()",(temps[numpub]*1000));
	}
}


