function ejs_nodroit() {return(false);}
document.oncontextmenu = ejs_nodroit;

function comptable(theRow, thePointerColor, theNormalBgColor)
{
    var theCells=null;
    if(thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if(typeof(document.getElementsByTagName) != 'undefined') {
        theCells=theRow.getElementsByTagName('td');
    }
    else if(typeof(theRow.cells) != 'undefined') {
        theCells=theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt =theCells.length;
    var currentColor=null;
    var newColor    =null;
    // Opera does not return valid values with "getAttribute"
    if(typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor=theCells[0].getAttribute('bgcolor');
        newColor    =(currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c=0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor=theCells[0].style.backgroundColor;
        newColor    =(currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c=0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor=newColor;
        }
    }
    return true;
}


function getVar(nomVariable) {
var infos = document.location.href;
if (infos.indexOf(nomVariable)!=-1)
{return true;}
else
{return false;}}


if (getVar("goto") == false) {if(window.parent.length!=0) {window.top.location.replace(document.location.href);}}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=239,left = 300,top = 230');");
}

function expert_comptable() {window.location=red;}

function SubMe(){document.getElementById("formc").submit();}

function mo(o){o.className=='f'?o.className='n': o.className=o.className; }

function mx(o){o.className=='n'?o.className='f': o.className=o.className; }

var GB_ROOT_DIR = "http://" + location.host + "/greybox/";

var alertTimerId = 0;

function goto_url(url)
{

  if (document.getElementById("plusvite").value == "je suis presse")
  {
    alertTimerId = setTimeout('go(\''+ url + '\')',20000);
  }
  else
  {
	document.getElementById("plusvite").value = "redirection immediate";
	go(url);
  }
}

function go(url) {window.location.href=url;}


function thumbit(path) {


path1=path.split("/");
if (path1[0] !="") {document.write('<img src="http://open.thumbshots.org/image.aspx?url=' + path1[0] + '" class="thumb"/>');


}}


/* image rool over du bas
comptabilite_en_ligne_fr= new Image( );
centre_de_gestion_agree_net= new Image( );
association_de_gestion_agree_net= new Image( );
comptable_en_ligne_net= new Image( );
expert_comptable_en_ligne_net= new Image( );
commissariat_aux_comptes_net= new Image( );
comptable_agree_net= new Image( );
centre_de_gestion_agree_fr= new Image( );
expert_comptable_agree_net= new Image( );
commissariatauxcomptes_eu= new Image( );
association_de_gestion_agree_fr= new Image( );
moteur_comptable_fr = new Image( );
moteur_recherche_xpert_comptable_fr = new Image( );
moteur_comptable_com = new Image( );
moteur_comptable_net = new Image( );

comptabilite_en_ligne_fr.src='comptabilite-en-ligne.frr.gif';
centre_de_gestion_agree_net.src='centre-de-gestion-agree.netr.gif';
association_de_gestion_agree_net.src='association-de-gestion-agree.netr.gif';
comptable_en_ligne_net.src='comptable-en-ligne.netr.gif';
expert_comptable_en_ligne_net.src='expert-comptable-en-ligne.netr.gif';
commissariat_aux_comptes_net.src='commissariat-aux-comptes.netr.gif';
comptable_agree_net.src='comptable-agree.netr.gif';
centre_de_gestion_agree_fr.src='centre-de-gestion-agree.frr.gif';
expert_comptable_agree_net.src='expert-comptable-agree.netr.gif';
commissariatauxcomptes_eu.src='commissariatauxcomptes.eur.gif';
association_de_gestion_agree_fr.src='association-de-gestion-agree.frr.gif';
moteur_comptable_fr.src='moteur-comptable.frr.gif';
moteur_recherche_xpert_comptable_fr.src='moteur-recherche-xpert-comptable.frr.gif';
moteur_comptable_com.src='moteur-comptable.comr.gif';
moteur_comptable_net.src='moteur-comptable.netr.gif';*/

/*
function o(id) {var bob = "";
var reg=new RegExp("(_)", "g");
var reg1=new RegExp("(_fr)", "g");
var reg2=new RegExp("(_eu)", "g");
var reg3=new RegExp("(_net)", "g");
var reg4=new RegExp("(e_com)", "g");

bob11 = id.replace(reg4, "e.com");
bob = bob11.replace(reg1, ".fr");
bob1 = bob.replace(reg2, ".eu");
bob2 = bob1.replace(reg3, ".net");
bob3 = bob2.replace(reg, "-");

document[id].src= '' + bob3 + 'r.gif';}

function oo(id) {var bob = "";
var reg=new RegExp("(_)", "g");
var reg1=new RegExp("(_fr)", "g");
var reg2=new RegExp("(_eu)", "g");
var reg3=new RegExp("(_net)", "g");
var reg4=new RegExp("(e_com)", "g");

bob11 = id.replace(reg4, "e.com");
bob = bob11.replace(reg1, ".fr");
bob1 = bob.replace(reg2, ".eu");
bob2 = bob1.replace(reg3, ".net");
bob3 = bob2.replace(reg, "-");
document[id].src= '' + bob3 + '.gif';}*/

function cob() {for (i = 1; i <= 116; i++) {if ($('#pub_contextuelle'+i).val() != undefined) {interstitiel($('#pub_contextuelle'+i).val());i = 116;}}}

function interstitiel(url) {
$("#avant").insertBefore("#cont");
$("#apres").insertAfter("#cont");
var largeur_divs = $("#cont").width();

if( typeof( window.innerWidth ) == 'number' ) {myWidth = window.innerWidth;myHeight = window.innerHeight;
var larg_dispo = (myWidth - largeur_divs);
larg_dispo = parseInt((larg_dispo - 18) / 2);}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;myHeight = document.documentElement.clientHeight;
var larg_dispo = (myWidth - largeur_divs);
larg_dispo = parseInt((larg_dispo) / 2);}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {//IE 4 compatible
myWidth = document.body.clientWidth;myHeight = document.body.clientHeight;
var larg_dispo = (myWidth - largeur_divs);
larg_dispo = parseInt((larg_dispo - 2) / 2);}

var haut_dispo = parseInt(myHeight * 3);

if (larg_dispo < 0) {larg_dispo = 0;}
else if (larg_dispo < 50) {larg_dispo = 50;document.write('<style type="text/css">body {width:1254px;}</style>');}

/*if (larg_dispo > 50) {*/


if ($("body").css("background-repeat") =="repeat") {
if (url.indexOf("expert-comptable-en-ligne.fr")!=-1) {
txt_de_la_pub = "VOTRE expert comptable en ligne, cabinet d expertise comptable, comptabilité sur internet et CONSEILS... Devis Gratuit...";
document.write('<style type="text/css">body {background-image:url(http://www.expert-comptable-en-ligne.fr/comptabilite-en-ligne/i/fd-votre.png);background-repeat:no-repeat;background-color:white;background-position:top center;background-attachment:fixed;}</style>');}
else if (url.indexOf("expert-comptable-en-ligne.com")!=-1) {
txt_de_la_pub = "VOTRE expert comptable en ligne, cabinet d expertise comptable pour les BNC / Agent commerciaux... Devis Gratuit";
document.write('<style type="text/css">body {background-image:url(http://www.expert-comptable-en-ligne.com/comptabilite-en-ligne/i/fd-votre-bnc.png);background-repeat:no-repeat;background-color:white;background-position:top center;background-attachment:fixed;}</style>');}
else if (url.indexOf("comptable-en-ligne.fr")!=-1) {
txt_de_la_pub = "MON Comptable en ligne, cabinet d expertise comptable, comptabilité sur internet et CONSEILS... Devis gratuit...";
if (Math.random() <= 0.5) {document.write('<style type="text/css">body {background-image:url(http://www.comptable-en-ligne.fr/comptabilite-en-ligne/i/fd-mon.png);background-repeat:no-repeat;background-color:white;background-position:top center;background-attachment:fixed;}</style>');}
else {document.write('<style type="text/css">body {background-image:url(http://www.comptable-en-ligne.fr/comptabilite-en-ligne/i/fd-monbis.png);background-repeat:no-repeat;background-color:white;background-position:top center;background-attachment:fixed;}</style>');}}


else if (url.indexOf("compta247.fr")!=-1) {

if (larg_dispo == 50) {txt_de_la_pub = "Compta 247, logiciel de comptabilité en ligne 100% gratuit, 100% technologique...";
document.write('<style type="text/css">body {background-image:url(http://www.compta247.fr/g/fd-c247-b.jpg);background-repeat:no-repeat;background-color:white;background-position:top center;background-attachment:fixed;}</style>');}
else {txt_de_la_pub = "Compta 247, logiciel de comptabilité en ligne 100% gratuit, 100% technologique...";
document.write('<style type="text/css">body {background-image:url(http://www.compta247.fr/g/fd-c247.jpg);background-repeat:no-repeat;background-color:white;background-position:top center;background-attachment:fixed;}</style>');}

}



}

document.getElementById('avant').innerHTML = "<a href='"+url+"' title='"+txt_de_la_pub+"'><img src='http://"+ location.host +"/images/blank.gif' width='"+ larg_dispo +"' height='"+ haut_dispo +"' alt='"+txt_de_la_pub+"'></a>";
document.getElementById('apres').innerHTML = "<a href='"+url+"' title='"+txt_de_la_pub+"'><img src='http://"+ location.host +"/images/blank.gif' width='"+ larg_dispo +"' height='"+ haut_dispo +"' alt='"+txt_de_la_pub+"'></a>";//}

document.write('<style type="text/css">#apresi, #avanti {width:'+larg_dispo+'px;}</style>');

}


var x=1*3; 
function shw() 
{ 
//document.getElementById('r').innerHTML='rest'+parseInt(x/60)+'minun'+parseInt(x%60)+'secon'; 
x--; 
if (x<0) {
//alert('il est heur'); 
$.ajax({
	type: "POST",
	url: "search_key.php",
	data:"time="+x,
	success: function(data){
		//alert(data);
	}
});
x=1*3; 
} 
else setTimeout('shw();',1000); 
} 




function over(text,touch){
$("#r").empty();
shw(); 


var leng = text.length;
var len=$("#autoSuggestionsList li").length;
var div_h = $("#suggestions").height();
var list_h = $("#autoSuggestionsList").height();
var div_suggestions = document.getElementById("suggestions");
var text1="";
if(text.indexOf(" ")>0){
var tab = text.split(" ");
text2 = tab[tab.length-1];
for(var t=0;t<tab.length-1;t++){
text1+=tab[t]+" ";
}
}
else{
text2=text;
}
if(text.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	} else {
		if(touch==40 && len>1){
			 var m = n-1;
   		$("#autoSuggestionsList li:nth-child("+n+")").focus();
   	    div_suggestions.scrollTop = li_h;
   	    if(n<len-1){
   	    li_h= li_h + $("#autoSuggestionsList li:nth-child("+n+")").height();
   	    }
   		$("#autoSuggestionsList li:nth-child("+n+")").css("background-color","#a0b64b");
   		$("#autoSuggestionsList li:nth-child("+m+")").css("background-color","");
   		n++;
   		if(n>=len){
   			n=len;
   		}
		}
		else if(touch==38 && len>1){
			 n = n-1;
			 if(n<=1){
				 n = 1;
			 }
			 var l = n+1;
		    	$("#autoSuggestionsList li:nth-child("+n+")").focus();
		    	$("#autoSuggestionsList li:nth-child("+n+")").css("background-color","#a0b64b");
		    	$("#autoSuggestionsList li:nth-child("+l+")").css("background-color","");  
		    	li_h= li_h - $("#autoSuggestionsList li:nth-child("+n+")").height();
		    	div_suggestions.scrollTop = li_h;
		    	if(n==1){
		    		div_suggestions.scrollTop = 0;
		    		li_h = 0;
		    	}
		 }
		else if(touch==13 && len>1){
			 for(var i=1;i<=len;i++){
				var color= $("#autoSuggestionsList li:nth-child("+i+")").attr("style");
				if(color == "background-color: rgb(160, 182, 75);"){
					var value = $("#autoSuggestionsList li:nth-child("+i+")").text();
					var c = value.indexOf(" ");
					var tab1 = value.substr('0',c);
					var tab2 = value.substr(c); 
					affiche_num(tab1+"_"+tab2);
				}
			 }
			 div_suggestions.scrollTop = 0;
	    	 li_h = 0;
			}
			else{


$.ajax({
	type: "POST",
	url: "search_key.php",
	data:"text="+text2+"&leng="+leng+"&text1="+text1,
	success: function(data){
		if(data.length >0) {
			//alert(data);
			$('#suggestions').show();
			$('#autoSuggestionsList').html(data);
		}
	}
});
		n=1;
		div_suggestions.scrollTop = 0;
		li_h = 0;
}
}
$(document).click(function(evt){
var evt = window.event?window.event:evt,target=evt.srcElement||evt.target; 
if(target.id != "my_text"){$('#suggestions').hide();}
	n=1;
        div_suggestions.scrollTop = 0;
		li_h = 0;
});}

function affiche_in(thisValue,text1){$("#my_text").val("");$("#my_text").val(text1+thisValue);}

function ringbas(id_affich){$("#bas").children().each(function(){if($(this).attr("id") == id_affich) {$(this).fadeIn();}else if ($(this).attr("id") != "") {$(this).css("display","none");}})}

function filtre(q) {

q.replace(" ","+");
q.replace("é","e");
alert(q);
return q;
	
}

