// JavaScript Document


			$(document).ready(function(){

$("div.menusclick").click(function(){
if($(this).find("a").attr("href"))
			{
				var lien = $(this).find("a").attr("href");
if(lien!="")
			{
				document.location.href = lien;
			}
			}
});



$("div.sousmenu").hover(function(){

	if($(this).children(".submenu"))
	{

	$(this).children(".submenu").css("display","block");
	}

 },function(){
if($(this).children(".submenu"))
	{
	$(this).children(".submenu").css("display","none");
	}
 });



});
function changeOpac(opacity, id) {
				var object = document.getElementById(id).style;
				object.opacity = (opacity / 100);
				object.MozOpacity = (opacity / 100);
				object.KhtmlOpacity = (opacity / 100);
				object.filter = "alpha(opacity=" + opacity + ")";
			}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}







function taille_position(calque,width,height,pos_top,pos_left,visibility)
{
	if(width!="")
	{
		document.getElementById(calque).style.width = width+"px";
	}
	if(height!="")
	{
		document.getElementById(calque).style.height = height+"px";
	}
	if(pos_top!="")
	{
		document.getElementById(calque).style.top = pos_top+"px";
	}
	if(pos_left!="")
	{
		document.getElementById(calque).style.left = pos_left+"px";
	}
	if(visibility!="")
	{
		document.getElementById(calque).style.visibility = visibility;
	}
}
function taille_navigateur(){
	var taille = new Array();

	if( typeof( window.innerWidth ) == 'number' ) {
		windowwidth = window.innerWidth;
		windowheight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		windowwidth = document.documentElement.clientWidth;
		windowheight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		windowwidth = document.body.clientWidth;
		windowheight = document.body.clientHeight;
	}
	else {
		windowwidth = -1;
		windowheight = -1;
	}

	taillesite = document.getElementById('site').offsetHeight;
	if(taillesite+10>windowheight)
	{
		windowheight2 = taillesite+10;
		windowwidth2 = windowwidth-18;
	}
	else
	{
		windowheight2 = windowheight;
		windowwidth2 = windowwidth;
	}
	
	taille[0] = windowwidth2;
	taille[1] = windowheight;
	taille[2] = windowheight2;
	taille[3] = f_scrollTop();

	
	return taille;
}



			
		
		function reconstruction()
{
	if(document.getElementById('calquecache3') && document.getElementById('calquecache3').style.visibility == 'visible')
	{ 
	  var taillesecran = taille_navigateur();

	windowwidth = taillesecran[0];
	windowheight = taillesecran[1];
windowheight2 = taillesecran[2];
decale_haut = taillesecran[3];
	taille_position('calquecache3',windowwidth,windowheight2,'','','');
	
	}
	if(document.getElementById('calquecache2') && document.getElementById('calquecache2').style.visibility == 'visible')
	{ 
	  var taillesecran = taille_navigateur();

	windowwidth = taillesecran[0];
	windowheight = taillesecran[1];
windowheight2 = taillesecran[2];
decale_haut = taillesecran[3];
	
	document.getElementById('catalogue').style.height = parseInt(windowheight)+"px";
	document.getElementById('catalogue').style.width = parseInt(windowwidth)+"px";
	taille_position('calquecache2',windowwidth,windowheight2,'','','');
	
	}
	if(document.getElementById('calquecache') && document.getElementById('calquecache').style.visibility == 'visible')
	{ 
  var taillesecran = taille_navigateur();

	windowwidth = taillesecran[0];
	windowheight = taillesecran[1];
windowheight2 = taillesecran[2];
decale_haut = taillesecran[3];

  var width_image = document.getElementById('imageview').offsetWidth;
  var height_image = document.getElementById('imageview').offsetHeight;

	var pos_top=parseInt(((windowheight-height_image)/2)-30);

if(pos_top < 0)
{
	pos_top = 0;
}

if(pos_top > 111)
{
	pos_top = 111;
}
if(decale_haut!="0")
{
	pos_top = decale_haut;
}

	var pos_left=parseInt((windowwidth-width_image)/2);

	var pos_top2=parseInt(windowheight/2);
	var pos_left2=parseInt(windowwidth/2);

	var pos_top3=parseInt(pos_top2-50);
	var pos_left3=parseInt(pos_left2-50);

	var pos_top4=parseInt(pos_top+parseInt(height_image/2));
				
windowwidth_bis = windowwidth+18;

 taille_position('calquecache',windowwidth_bis,windowheight2,'','','');
taille_position('attente','100','100',pos_top4,pos_left3,'visible');
 taille_position('imageview','','',pos_top,pos_left,'');

		document.getElementById('imageview_details').style.top = ""+parseInt(parseInt(height_image)+parseInt(pos_top)+20)+"px";
		document.getElementById('imageview_details').style.left = ""+parseInt(pos_left)+"px";
		document.getElementById('imageview_details').style.width = ""+width_image-12+"px";
		document.getElementById('imageview_details').style.height = "30px";

	}
}
		
function infos_zones()
{
	if(document.getElementById('txtpassword2'))
	{
	document.getElementById("txtpassword2").setAttribute("autocomplete","off");
	}
	if(document.getElementById('txtuser'))
	{
	document.getElementById("txtuser").setAttribute("autocomplete","off");
	}
	
		if(document.getElementById('zone_gauche'))
	{
	var taille_g = 0;
	var taille_d = 0;
	if(document.getElementById('zone_droite'))
	{
	taille_d = document.getElementById('zone_droite').offsetHeight;
	}
	if(document.getElementById('zone_gauche'))
	{
	taille_g = document.getElementById('zone_gauche').offsetHeight;
	}
	if(taille_d < 500 && taille_g < 500)
	{
		taille_g = 500;
	}
	if(taille_d >= taille_g)
	{
		document.getElementById('contenu').style.height = taille_d+"px";
				if(document.getElementById('separation_v2'))
		{
			document.getElementById('separation_v2').style.height = taille_d+"px";
		}
	}
	if(taille_d <= taille_g)
	{
		document.getElementById('contenu').style.height = taille_g+"px";
		if(document.getElementById('separation_v2'))
		{
			document.getElementById('separation_v2').style.height = taille_g+"px";
		}
	}
	}
	if(document.getElementById('calquecache'))
	{
	taille_position('calquecache','0','0','0','0','hidden');
	}
	if(document.getElementById('calquecache2'))
	{
	taille_position('calquecache2','0','0','0','0','hidden');
	}
	if(document.getElementById('calquecache3'))
	{
	taille_position('calquecache3','0','0','0','0','hidden');
	}
		if(document.getElementById('attente'))
	{
	taille_position('attente','0','0','0','0','hidden');
	}
		if(document.getElementById('imageview'))
	{
	taille_position('imageview','0','0','0','0','hidden');
	}
	if(document.getElementById('fermer'))
	{
	taille_position('fermer','','','','','hidden');
	}
	if(document.getElementById('imageview_details'))
	{
	taille_position('imageview_details','0','0','0','0','hidden');
	}
}
function infos_zone(zone1,zone2,zone3)
{

if(last_infos && last_infos!="")
			{
				document.getElementById(last_infos).style.display = "none";
			}
	var taille_g = 0;
	var taille_d = 0;
	if(document.getElementById(zone1))
	{
	taille_d = document.getElementById(zone1).offsetHeight+15;
	}
	if(document.getElementById(zone2))
	{
	taille_g = document.getElementById(zone2).offsetHeight+15;
	}
	if(taille_d >= taille_g)
	{
		document.getElementById('contenu').style.height = taille_d+"px";
		document.getElementById(zone3).style.height = taille_d+"px";
	}
	if(taille_d <= taille_g)
	{
		document.getElementById('contenu').style.height = taille_g+"px";
		document.getElementById(zone3).style.height = taille_g+"px";
	}
	
	if(document.getElementById('calquecache'))
	{
	taille_position('calquecache','0','0','0','0','hidden');
	}
	if(document.getElementById('calquecache2'))
	{
	taille_position('calquecache2','0','0','0','0','hidden');
	}
	if(document.getElementById('calquecache3'))
	{
	taille_position('calquecache3','0','0','0','0','hidden');
	}
		if(document.getElementById('attente'))
	{
	taille_position('attente','0','0','0','0','hidden');
	}
		if(document.getElementById('imageview'))
	{
	taille_position('imageview','0','0','0','0','hidden');
	}
	if(document.getElementById('fermer'))
	{
	taille_position('fermer','','','','','hidden');
	}
	if(document.getElementById('imageview_details'))
	{
	taille_position('imageview_details','0','0','0','0','hidden');
	}


}	
function carte_nantes(){
	document.getElementById("toAddress").value = "8 rue Monteil 44000 Nantes";
	org_adress = '8 rue Monteil 44000 Nantes';
	info_html = '<strong><u>Arinfo</u></strong><br /><br />8 rue Monteil<br /><b>44000 Nantes</b><br /><br /> <a href="javascript:afficherecherche();">S\'y rendre</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:zoommapin()">Zoomer</a>';

   	$.getScript("js/maps.js", function(){

   agrandir();
 });
}
 function carte_rennes(){
	 document.getElementById("toAddress").value = "3 rue de paris 35510 Cesson-sevigne";
	org_adress = '3 rue de paris 35510 Cesson-sevigne';
	info_html = '<strong><u>Arinfo</u></strong><br /><br />3a rue de Paris<br /><b>35510 Cesson-Sevign&eacute;</b><br /><br /> <a href="javascript:afficherecherche();">S\'y rendre</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:zoommapin()">Zoomer</a>';

   	$.getScript("js/maps.js", function(){

   agrandir();
 });
	//$("#tests_maps").load("map_nantes.html");

}

function catalogue_arinfo(){
  var taillesecran = taille_navigateur();

	windowwidth = taillesecran[0];
	windowheight = taillesecran[1];
windowheight2 = taillesecran[2];
decale_haut = taillesecran[3];

	windowwidth_bis = windowwidth+18;
	changeOpac("60","calquecache2")
	document.getElementById('catalogue').style.height = parseInt(windowheight)+"px";
	document.getElementById('catalogue').style.width = parseInt(windowwidth)+"px";
	taille_position('calquecache2',windowwidth,windowheight2,'','','visible');
	document.getElementById('catalogue').style.display = "block";
}
function cachecatalogue(){
	
	document.getElementById('catalogue').style.height = "1px";
	document.getElementById('catalogue').style.width = "1px";
	document.getElementById('catalogue').style.display = "none";
	document.getElementById('calquecache2').style.height = "1px";
	document.getElementById('calquecache2').style.width = "1px";
	document.getElementById('calquecache2').style.visible = "hidden";
}

window.onload=infos_zones;
window.onresize=reconstruction;			
			
		
