/**
Date modification: 19.11.2007

**/
function tableaudebord(labelTB,urlTB)
{
if (urlTB=="")
	{
	document.write('<b><Erreur no commune</b>')
	}
else
{

carte="tb"; //variable utilisée pour nommer les id, les ancres
tbleft="25px"; //position du iframe
tbtop="25px";
tbwidth="850px"; //largeur du calque dans le  iframe
tbheight="550px";
tbifwidth="840px"; //largeur du iframe
tbifheight="520px";

document.write('<img height=1 src="/images/espaceur.gif" width=1>'
+'<div id="tb" style="visibility:hidden;height:'+tbheight+';BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: -100; LEFT:'+tbleft+'; BORDER-LEFT: black 1px solid; WIDTH: '+tbwidth+'; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: '+tbtop+';  BACKGROUND-COLOR: #ffffff"><DIV style="FLOAT: right">'
+'<a class=d2w-url-10 href="#" onclick="montre(\''+carte+'\',false,\''+urlTB+'\')">Fermer <img src="/d2wceg/imagesclient/close.jpg" align=absMiddle border=0></a></div>'
+'<iframe id="'+carte+'Frame" src="" frameBorder=0 width='+tbifwidth+' height='+tbifheight+' ></iframe>'
+'</div>');	


	document.write('<div><a class="d2w-texte-1" href="#'+carte+'" onclick="montre(\''+carte+'\',true,\''+urlTB+'\');"><img src="/d2wceg/imagesclient/zoom_tableau_de_bord.gif" border="0" ></a><a class="d2w-texte-2" href="#'+carte+'" onclick="montre(\''+carte+'\',true,\''+urlTB+'\');">'+labelTB+'</a></div>');
}
}
/**
Date modification: 23.11.2007
Situe Moi avec LIGHTBOX IFRAME
**/
function situemoiLBIF(vcn,vx, vy)
{
if (vcn > 62 || vcn < 1)
	{
	document.write('<b><Erreur no commune</b>')
	}
else
{
//ECRIRE LE CALQUE COMME IL FAUT AU CHARGEMENT.
vct = communes(vcn); //retourne le nom de commune
carte="carte";
urlsitn = "http://sitn.ne.ch/"+vct+".html?commune="+vct+"&theme=adresse&x="+vx+"&y="+vy+"&echelle=15000"
document.write('<a class="d2w-texte-2" href="'+urlsitn+'" rel="lightbox|500|650"><img src="/d2wceg/imagesclient/logoSITN.gif" border="0" width="51" height="32"></a><a class="d2w-texte-2" href="'+urlsitn+'" rel="lightbox|500|650">&nbsp;Plan interactif</a>');
}}

/**
Date modification: 23.08.2007

**/
function situemoi(vcn,vx, vy)
{
if (vcn > 62 || vcn < 1)
	{
	document.write('<b><Erreur no commune</b>')
	}
else
{
//ECRIRE LE CALQUE COMME IL FAUT AU CHARGEMENT.
vct = communes(vcn); //retourne le nom de commune
carte="carte";
urlsitn = "http://sitn.ne.ch/"+vct+".html?commune="+vct+"&theme=adresse&x="+vx+"&y="+vy+"&echelle=15000"
document.write('<img height=1 src="/images/espaceur.gif" width=1>'
+'<div id="carte" style="visibility:hidden;height:auto;BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: -100; LEFT: 200px; BORDER-LEFT: black 1px solid; WIDTH: 650px; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 270px;  BACKGROUND-COLOR: #ffffff"><DIV style="FLOAT: right">'
+'<a class=d2w-url-10 href="#" onclick="montre(\''+carte+'\',false,\''+urlsitn+'\')">Fermer <img src="/d2wceg/imagesclient/close.jpg" align=absMiddle border=0></a></div>'
+'<iframe id="'+carte+'Frame" src="" frameBorder=0 width=650 height=618 ></iframe>'
+'</div>');	


	document.write('<a class="d2w-texte-2" href="#carte" onclick="montre(\''+carte+'\',true,\''+urlsitn+'\');"><img src="/d2wceg/imagesclient/logoSITN.gif" border="0" width="51" height="32"></a><a class="d2w-texte-2" href="#carte" onclick="montre(\''+carte+'\',true,\''+urlsitn+'\');">&nbsp;Plan interactif</a>');
}
}
function montre(id,on,urlsitn) {
		if (on){
			document.getElementById(id).style.visibility='visible';
			document.getElementById(id).style.zIndex ='100';
			document.getElementById(id+"Frame").src = urlsitn;
		} else 	{
			document.getElementById(id).style.visibility='hidden';
			document.getElementById(id).style.zIndex ='-100';
			document.getElementById(id+"Frame").src = "";
		}
}

function situemoi_ancienne200707(vcn,vx, vy)
{
if (vcn > 62 || vcn < 1)
	{
	document.write('<b><Erreur no commune</b>')
	}
else
{
document.write('<A class="d2w-texte-2" href="javascript:opencarto('+vcn+','+vx+','+vy+')"><img src="/d2wceg/imagesclient/logoSITN.gif" border="0" width="51" height="32">&nbsp;Plan interactif</A>');
}
}
function situemoi_old_190707(vcn,vx, vy)
{
if (vcn > 62 || vcn < 1)
	{
	document.write('<b><Erreur no commune</b>')
	}
else
{
document.write('<A class="d2w-texte-2" href="javascript:opencarto('+vcn+','+vx+','+vy+')"><img src="/d2wceg/imagesclient/logoSITN.gif" border="0" width="51" height="32">&nbsp;Plan interactif</A>');
}
}
function opencarto(vcn,vx,vy)
{
var vct = ""

var commune = new Array (63);

commune [1] = "neuchatel";
commune [2] = "hauterive";
commune [3] = "saint-blaise";
commune [4] = "marin-epagnier" 
commune [5] = "";
commune [6] = "cornaux";
commune [7] = "";
commune [8] = "";
commune [9] = "lelanderon";
commune [10] = "";
commune [11] = "boudry";
commune [12] = "cortaillod";
commune [13] = "colombier";
commune [14] = "auvernier";
commune [15] = "peseux";
commune [16] = "corcelles-cormondreche";
commune [17] = "bole";
commune [18] = "rochefort";
commune [19] = "";
commune [20] = "bevaix";
commune [21] = "gorgier";
commune [22] = "saint-aubin-sauges";
commune [23] = "";
commune [24] = "";
commune [25] = "";
commune [26] = "motiers";
commune [27] = "couvet";
commune [28] = "";
commune [29] = "";
commune [30] = "";
commune [31] = "fleurier";
commune [32] = "buttes";
commune [33] = "cote-aux-fees";
commune [34] = "saint-sulpice";
commune [35] = "";
commune [36] = "";
commune [37] = "cernier";
commune [38] = "chezard-saint-martin";
commune [39] = "";
commune [40] = "";
commune [41] = "";
commune [42] = "";
commune [43] = "";
commune [44] = "";
commune [45] = "";
commune [46] = "fontainemelon";
commune [47] = "";
commune [48] = "";
commune [49] = "valangin";
commune [50] = "";
commune [51] = "lesgeneveys-sur-coffrane";
commune [52] = "";
commune [53] = "";
commune [54] = "lesbrenets";
commune [55] = "";
commune [56] = "labrevine";
commune [57] = "";
commune [58] = "lesponts-de-martel";
commune [59] = "";
commune [60] = "neuchatel";
commune [61] = "";
commune [62] = "lasagne";
vct = commune [vcn];

if (vct == "")
	{
	vct = "neuchatel"
	}

MM_openBrWindow('http://sitn.ne.ch/'+vct+'.html?commune='+vct+'&theme=adresse&x='+vx+'&y='+vy+'&echelle=15000','guichet','resizable=yes,scrollbars=yes,width=651,height=590')
}

function contactemoi(vprenom,vnom)
{
if ((vnom == undefined) )
	{
		document.write(' <a href="/contact.asp?prenom='+vprenom+'&nom='+vnom+'" ><img src="/d2wceg/imagesclient/mail3.gif" border="0" align="absmiddle" alt="'+vprenom+ '"></a>');

	}
else
{
		document.write(' <a href="/contact.asp?prenom='+vprenom+'&nom='+vnom+'" ><img src="/d2wceg/imagesclient/mail3.gif" border="0" align="absmiddle" alt="'+vprenom+ ' ' +vnom+'"></a>');	
}

}


function contactemoidomaine(vnom,vdomaine)
{
if (vdomaine == undefined)
	{
		vdomaine = "ne.ch"
	}
document.write('<a href="/contact.asp?nom='+vnom+'&domaine='+vdomaine+'" ><img src="/d2wceg/imagesclient/mail3.gif" border="0" align="absmiddle"></a>');	
}


function allemand()
{
var v_url=location.href;
document.write("<A href='"+v_url+"'>lien</A>");

}

/*
Objet: entrer le numéro de commune renvoit le nom de la commune
Création. 29  juin 2007
*/
function communes(v_num){

var commune = new Array (63);
commune [0] = "index";
commune [1] = "neuchatel";
commune [2] = "hauterive";
commune [3] = "saint-blaise";
commune [4] = "marin-epagnier" 
commune [5] = "index";
commune [6] = "cornaux";
commune [7] = "cressier";
commune [8] = "index";
commune [9] = "lelanderon";
commune [10] = "index";
commune [11] = "boudry";
commune [12] = "cortaillod";
commune [13] = "colombier";
commune [14] = "auvernier";
commune [15] = "peseux";
commune [16] = "corcelles-cormondreche";
commune [17] = "bole";
commune [18] = "rochefort";
commune [19] = "index";
commune [20] = "bevaix";
commune [21] = "gorgier";
commune [22] = "saint-aubin-sauges";
commune [23] = "index";
commune [24] = "index";
commune [25] = "index";
commune [26] = "motiers";
commune [27] = "couvet";
commune [28] = "travers";
commune [29] = "index";
commune [30] = "index";
commune [31] = "fleurier";
commune [32] = "buttes";
commune [33] = "cote-aux-fees";
commune [34] = "saint-sulpice";
commune [35] = "index";
commune [36] = "index";
commune [37] = "cernier";
commune [38] = "chezard-saint-martin";
commune [39] = "index";
commune [40] = "index";
commune [41] = "index";
commune [42] = "index";
commune [43] = "index";
commune [44] = "fontaines";
commune [45] = "index";
commune [46] = "fontainemelon";
commune [47] = "leshauts-geneveys";
commune [48] = "index";
commune [49] = "valangin";
commune [50] = "index";
commune [51] = "lesgeneveys-sur-coffrane";
commune [52] = "index";
commune [53] = "index";
commune [54] = "lesbrenets";
commune [55] = "index";
commune [56] = "labrevine";
commune [57] = "index";
commune [58] = "lesponts-de-martel";
commune [59] = "index";
commune [60] = "index";
commune [61] = "index";
commune [62] = "lasagne";
return (commune[v_num]);
}
	

/*
Objet: afficher la carte stin dans un iframe 650x518 px
Création. 29 juin 2007
*/
function afficherplanstin(v_num,v_taille)
{
	var vct = "index";

vct=communes(v_num);
/*pas de test d'erreur nom écrit en dur dans direct2web */

document.write('<IMG height=500 src="/images/espaceur.gif" width=1>'
+'<DIV id=Carte style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 3; LEFT: 200px; BORDER-LEFT: black 1px solid; WIDTH: 650px; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 200px; HEIGHT: auto; BACKGROUND-COLOR: #ffffff"><DIV style="FLOAT: right"><A class=d2w-url-10 href="javascript:history.go(-1)">Fermer <IMG src="/images/close.jpg" align=absMiddle border=0></A></DIV>'
+'<IFRAME src="http://sitn.ne.ch/'+vct+'.html?noComCant='+v_num+'&theme=adresse&taille='+v_taille+'" frameBorder=0 width=650 height=618 ></IFRAME>'
+'</DIV>');	
}

/* Fonction d'arrondi à 5 cts */
	function arr05(montant)
	{
	montant = Math.round(montant/0.05)*0.05;
	montant = Math.round(montant*100)/100;
	return montant;
	}	

/* Fonction convertissant un montant en équivalent littéral, arrondi à 5cts et tronqué à 2 chiffres après la virgule */
	function nbtotxt(montant)
	{
	txtmontant = '';
	montant = arr05(montant);
	if (montant == Math.round(montant))
	    {txtmontant = montant + '.00';}
	else
		{
		if (montant == (Math.round(montant*10)/10))
	    	{
			txtmontant = montant + '0';}
		else
	    	{			
			txtmontant = montant;}
		}
	return (txtmontant)	;
	}


/************************************************************
TEST XML JS                                                                                          
Objet: afficher la carte stin dans un iframe 650x518 px
Test: utilise les fonctions js/xml xmlhttprequest .
Création. 29 juin 2007
Modification: 2 juillet 2007
sous firefox 1.5: Erreur : uncaught exception: Permission refusée d'appeler la méthode XMLHttpRequest.open
/************************************************************/
var xmlhttp, vname, vnum, vtaille

function loadXMLDoc(url) 
{
xmlhttp=null

// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=onResponse;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

function checkReadyState(obj)
{
  if(obj.readyState == 4)
  {
    if(obj.status == 200)
    {
      return true;
    }
    else
    {
      alert("Problem retrieving XML data");
    }
  }
}

function onResponse() 
{
  
  if(checkReadyState(xmlhttp))
  {
  var response = xmlhttp.responseXML.documentElement;
  txt=""
  x=response.getElementsByTagName("commune")
  for (i=0;i<x.length;i++)
    {
	xx=x[i].getElementsByTagName("numero")
		if (xx[0].firstChild.data==vnum)
		{
			xx=x[i].getElementsByTagName("nom")
			txt=xx[0].firstChild.data;
		}
	}
vname=txt

document.write('<IMG height=500 src="/images/espaceur.gif" width=1>'
+'<DIV id=Carte style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 3; LEFT: 200px; BORDER-LEFT: black 1px solid; WIDTH: 650px; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 200px; HEIGHT: auto; BACKGROUND-COLOR: #ffffff"><DIV style="FLOAT: right"><A class=d2w-url-10 href="javascript:history.go(-1)">Fermer <IMG src="/images/close.jpg" align=absMiddle border=0></A></DIV>'
+'<IFRAME src="http://sitn.ne.ch/'+vname+'.html?noComCant='+vnum+'&theme=adresse&taille='+vtaille+'" frameBorder=0 width=650 height=618 ></IFRAME>'
+'</DIV>');	
	//alert('test javascript/xml, le numéro de la commune est '+vnum+' et le nom de la commune est '+vname)

  }
}


/*afficher la carte stin dans un iframe*/
function afficherplanstinXML(v_num,v_taille)
{	
	vnum = v_num
	vtaille = v_taille
	//loadXMLDoc("http://commune-d2w.ne.ch/communes.xml")
	loadXMLDoc("/communes.xml")
	//alert('test javascript/xml, le numéro de la commune est '+vnum+' et le nom de la commune est '+vname)
}


function afficheregov(v_url,v_hauteur)
{


document.write('<IMG height=500 src="/images/espaceur.gif" width=1>'
+'<DIV id=Carte style="BORDER-RIGHT: black 0px solid; BORDER-TOP: black 0px solid; Z-INDEX: 3; LEFT: 230px; BORDER-LEFT: black 0px solid; WIDTH: 650px; BORDER-BOTTOM: black 0px solid; POSITION: absolute; TOP: 200px; HEIGHT: auto; BACKGROUND-COLOR: #ffffff">'
+'<IFRAME src='+v_url+' frameBorder=0 width=650 height='+v_hauteur+' ></IFRAME>'
+'</DIV>');	
}