
/*---------------------- GESTION DES STYLES -------------------------------*/
var boolPrint=true;
var parametre=PrmUrl(); 
if(parametre['style']=="pop")
{
	document.write('<link media="all" rel="stylesheet" href="/securite-routiere/css/reset.css" type="text/css" />');
	document.write('<link media="screen" rel="stylesheet" href="/securite-routiere/css/pop.css" type="text/css" />');
	document.write('<link media="print" rel="stylesheet" href="/securite-routiere/css/print.css" type="text/css" />');
	boolPrint=false;
	window.print();
}
else
{
	document.write('<link media="all" rel="stylesheet" href="/securite-routiere/css/reset.css" type="text/css" />');
	document.write('<link media="all" rel="stylesheet" href="/securite-routiere/css/styles.css" type="text/css" />');
	//document.write('<!--[if lt IE 7]><script defer type="text/javascript" src="/securite-routiere/js/pngfix.js"></script> <link media="all" rel="stylesheet" href="/securite-routiere/css/fixie6.css" type="text/css" /><![endif]-->');
}
/*---------------------------------------------------------------------*/

var initValueRecherche
initValueRecherche = 'Rechercher';
$(function(){
/* Action lorsqu'on click sur in input *************************************************************************************************************************/
	$("#rechercher").click
	( 
		function()
		{ 
			if(this.value=='Rechercher') 
			{ 
				this.value = '';
			} 
		} 
	);
	$("#RechercheSynomia").click
	(
		function()
		{
			if(this.value=='Rechercher')
			{
				this.value = '';
			}
		}
	);
/* Action lorsqu'on enleve le focus d'un input *************************************************************************************************************************/
	$("#rechercher").blur(
		function()
		{  
			if(this.value=='')
			{
				this.value = initValueRecherche;
			}
			else
			{
				initValueRecherche = this.value; 
			}
		}
	);
	$("#RechercheSynomia").blur( 
		function()
		{  
			if(this.value=='') 
			{ 
				this.value = initValueRecherche;
			} 
			else 
			{ 
				initValueRecherche = this.value; 
			} 
		} 
	);
/* Action lorsqu'on envoie le formulaire : si le mot clé est "Rechercher", on l'efface ********************************************************************************************/
	$("#formRechercher").submit
	( 
		function()
		{ 
			var obj = document.getElementById('rechercher')
			if(obj)
			{
				if(obj.value=='Rechercher') 
				{ 
					//return false; /* pour annuler l'envoie du formulaire */
					obj.value='';
				}
			}
		} 
	);

	$("form .vide_value").focus(function(){this.value = '';} );
	
	Cpt = 3;
	var Ech = new Array("70%", "80%", "90%", "100%", "110%", "120%", "130%");
	
	$("#dec-font").click(function(){
		if(Cpt > 0) {
			Cpt--;
			document.getElementById("content").style.fontSize = Ech[Cpt];

		}
		return(false);		
	});
	
	$("#inc-font").click(function(){
		if(Cpt < (Ech.length-1)) {
			Cpt++;
			document.getElementById("content").style.fontSize = Ech[Cpt];
		}
		return(false);
	});
	
	treatMoveWindow();
	
	/*
	var l = document.getElementById("topPage");
	if(l){
		var page = document.getElementById("container");
		l.style.display = (page.offsetHeight>600)? "block" : "none";
	}
	*/
});



if(!window.clipboardData) 
{
    window.clipboardData = {
        setData : function(mode,content) {

            var clipboard = document.body;
            var flashclipboard = clipboard.flashclipboard;
            var encoded = encodeURIComponent(content).split('%5Cn').join('%0A');
            if(flashclipboard == null)
            {
                flashclipboard = document.createElement('div');
                clipboard.flashclipboard = flashclipboard;
                clipboard.appendChild(flashclipboard);
            }
            flashclipboard.innerHTML = '<object width="0" height="0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">' 
                               + '<param name="movie" value="/securite-routiere/Images/clipboard_tcm1780-782073.swf" />'
                               + '<param name="flashvars" value="clipboard='+encoded+'" />'
                               + '<embed src="/securite-routiere/Images/clipboard_tcm1780-782073.swf" FlashVars="clipboard='+encoded+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'
                       + '</object>';

        }
    }
}
function CopyText(id)
{
	var objCopy = document.getElementById(id);
	if(!objCopy) return false;
	var code = objCopy.innerHTML;
	code = code.replace(/<.*?>/g,"");
	code = code.replace(/&lt;/g,"<");
	code = code.replace(/&gt;/g,">");
	return window.clipboardData.setData("text",code);
}

function twWindow()
{
this.width = screen.width;
this.height = screen.height;
this.availWidth = screen.availWidth;
this.availheight = screen.availHeight;
this.left = (document.all?window.screenLeft:window.screenX);
this.top = (document.all?window.screenTop:window.screenY);
this.innerwidth = (document.all?document.body.offsetWidth:window.innerWidth);
this.innerheight = (document.all?document.body.offsetHeight:window.innerHeight);
}

document.onmouseover = treatMoveWindow
function treatMoveWindow()
{
	var l = document.getElementById("topPage");
	if(l && boolPrint)
	{
		l.style.visibility = ((document.all?document.documentElement.offsetHeight-document.body.offsetHeight:window.innerHeight-document.body.offsetHeight)<0)? "visible" : "hidden";
	}
}


function selection_pays(pays){
	if(pays.options[pays.options.selectedIndex].value!=""){
		window.open(pays.options[pays.options.selectedIndex].value, 'popup', '');
		pays.options.selectedIndex = 0;
	}
}


function InsertFormRechercheSynomia() {
	var obj, str
	obj = document.getElementById("q_old");
	if(obj)	str = obj.value;
	if(!str) str = 'Rechercher';
	obj = document.getElementById("RechercheSynomia");
	if(obj)	obj.value = str;
	InsertFormRecherche(str)
}

function InsertFormRecherche(mot) {
	var obj
	obj = document.getElementById("Rechercher");
	if(obj) obj.value = mot;
}
function testChangeLanguage(obj) {
	var obj_r
	obj_r = document.getElementById("id_q");
	if(obj_r)
	{
		window.location = obj.href + "?mot=" + obj_r.value; 
		return false;
	}
	else
	{
		var parametre=PrmUrl();
		if(parametre['id'])
		{
			window.location = obj.href + "?id=" + parametre['id'];
			return false;
		}
	}
	return true;
}