﻿/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */




//fonctions de défilement (horizontal ou vertical)
var i
i = 0
var speed = 1
var t1
function scrollGauche() {
	i = i + speed
	var div = document.getElementById('news')
	div.scrollLeft = i
	if (i > div.scrollLeft + 160) {i = 0}
		t1=setTimeout("scrollGauche()",20)
}
function scrollHaut() {
	i = i + speed
	var div = document.getElementById('news')
	div.scrollTop = i
	if (i > div.scrollHeight - 160) {i = 0}
		t1=setTimeout("scrollHaut()",20)
}

//fonction permettant d'afficher une addresse mail afin d'eviter les bots et spam
function genadresse() {
    var domain = "mediationconseil";           // indiquez ici le nom de votre domaine
    var pays  ="fr";                    // fr, com, be, ch
    var atsign = String.fromCharCode(64);  // c'est le signe @
    var point  = String.fromCharCode(46);  // c'est le "." point
    var adr =  "accueil" + atsign + domain + point + pays;
    document.write(
    "<" + "a" + " " + "href=" + "ma" +String.fromCharCode(105) + "lto" +String.fromCharCode(58) + adr +">" + adr + "</a>");
  }

//fonction pour afficher image suivante / precedente / 1ere
var dossier="img/dus/";
var numero = 1;
function objet() {
	this.length = objet.arguments.length
	for (var i = 0; i < this.length; i++) this[i+1] = objet.arguments[i]
}
var nom = new objet ("DUS1.png", "DUS2.png", "DUS3.png", "DUS4.png", "DUS5.png", "DUS6.png", "DUS7.png", "DUS8.png", "DUS9.png");
	
function suivante() {
	numero += 1;
	if (numero == nom.length + 1) numero=1;
	document.getElementById('image').src = dossier+nom[numero];
} 

function precedent(){
	numero -= 1;
	if (numero < 1) numero=1;
	document.getElementById('image').src = dossier+nom[numero];
}

function gofirst(){
	numero = 1;
	document.getElementById('image').src = dossier+nom[numero];
}

function getNews(index){
	var req = null; 
	if (window.XMLHttpRequest){
		req = new XMLHttpRequest();
		if (req.overrideMimeType) {
			req.overrideMimeType('text/xml');
		}
	} 
	else if (window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	req.onreadystatechange = function(){ 
		if(req.readyState == 4){
			if(req.status == 200){
				var content= req.responseText;
				myWin=window.open("","myWin","menubar,scrollbars,left=30px,top=40px,height=400px,width=400px,resizable=yes"); 
				myWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.02//EN""http://www.w3.org/TR/html4/strict.dtd">'); 
				myWin.document.write('<html><head>');
				myWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
				myWin.document.write('<title>Nouveauté Juridique</title>');
				myWin.document.write('<link rel="stylesheet" href="/css/designIE7-FF.css" />');
				myWin.document.write('</head><body style="overflow:auto"><div id="body" style="padding-left:10px;font-size:0.7em;">' + content + '</div></body></html>') ;
			} else {
				var content="Error: returned status code " + req.status + " " + req.statusText;
				myWin=window.open("","myWin","menubar,scrollbars,left=30px,top=40px,height=400px,width=400px,resizable=yes"); 
				myWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.02//EN""http://www.w3.org/TR/html4/strict.dtd">'); 
				myWin.document.write('<html><head>');
				myWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
				myWin.document.write('<title>Nouveauté Juridique</title>');
				myWin.document.write('<link rel="stylesheet" href="/css/designIE7-FF.css" />');
				myWin.document.write('</head><body style="overflow:auto"><div id="body" style="padding-left:10px;font-size:0.7em;">' + content + '</div></body></html>') ;
			}	
		}
	}; 
	req.open("GET", "functions/getNews.php?news_id=" + index, true); 
	req.send(null);
}

function sendForm(id){
	document.getElementById(id).submit();
}
