
var Msg="Copyright chiens-de-france.com";
function NoRightClick(btnClick)
{
	if(navigator.appName=="Netscape"&& btnClick.which==3)
	{
		alert(Msg);
		return false;
	} 
	else if(navigator.appName=="Microsoft Internet Explorer"&&event.button==2)
	{
		alert(Msg);
		return false;
	}
}
document.onmousedown=NoRightClick;


/* ***************************************************************** */
/* *************** Nombre de caractere dans un champs ************** */
/* ***************************************************************** */

var ns6=document.getElementById&&!document.all
			
function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ 
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}

function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> characteres Maximum.'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

/* ***************************************************************** */
/* ***************************************************************** */
/* ***************************************************************** */

function copier(nom_chp_txt,nom_form)
{
	var chp_txt = eval("document." + nom_form + "." + nom_chp_txt);
	chp_txt.focus();
	chp_txt.select();
	texte = chp_txt.createTextRange();
	texte.execCommand("Copy");
}

function ouverture(page,nom,x,y,scrollbar,resize)
{
	attribut = "width="+x+",height="+y+",scrollbars="+scrollbar+",resizable="+resize;
	window.open(page,nom,attribut);
}

function afficheMaxi(chemin)
{
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML><HEAD><TITLE>Chiens de France</TITLE><BODY bgcolor=#FFFFFF onLoad="window.resizeTo(document.imageTest.width+150,document.imageTest.height+150)"><CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+150,document.imageTest.height+150)"></CENTER><br>&nbsp;&nbsp;&nbsp;<a href="javascript:top.close();"><font face=verdana size=-2>Fermer</font></a>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
	popupImage.document.open();
	popupImage.document.write(html);
	html2='<script language="Javascript">var Msg="Copyright Chiens de France";function NoRightClick(btnClick)	{if(navigator.appName=="Netscape"&& btnClick.which==3){alert(Msg);return false;}if(navigator.appName=="Microsoft Internet Explorer"&&event.button==2){alert(Msg);return false;}}document.onmousedown=NoRightClick;</script>';
	html3='</BODY></HTML>';
	//popupImage.document.write(html2);
	popupImage.document.write(html3);
	popupImage.document.close()
	};
//variable pour l'effacement du texte dans le moteur de recherche
var erased_annu = false;

//on enleve les erreurs eventuelles
function no_error()
{ return true; }
window.onerror = no_error;

function open_popup(page,nom,hauteur,largeur)
//ouvre une popup
{ window.open(page,nom,"status=no,scrollbars=yes,resizable=no,height="+hauteur+",width="+largeur+",top=0,left=0"); }

function confirm_delete(page, texte)
//demande une confirmation avant de supprimer un site ou une categorie
{
	confirmation = confirm('Etes vous sur de vouloir supprimer '+texte+' ? ');
	if(confirmation)
		window.location.replace(page);
}

function message_annu_status(message)
//affiche un texte dans la barre de statut du navigateur
{ window.status = message; }

function check_id_cat()
//verifie si on a bien selectionner une categorie dans la liste deroulante
{
	if (document.form2submit.id_cat.value == 0)
	{
		alert('Veuillez sélectionner une catégorie !');
		return false;
	}
	else
	{ return true; }
}

function checkagree()
{
	if ( document.dlf.agreed.checked != true )
	{
		alert('You must check the box under the license if you wish to accept the terms of the license before continuing with your download');
		return false;
	}
	else
	{
		toggle_form('off');
		return true;
	}
}

var cssdefinition='<style>\n.menuitems{\nborder:0px solid #FFFFFF;\n}\n\n.menuitems\n<\/style>'
	
if (document.all||document.getElementById)
	document.write(cssdefinition)
	
function over_effect(e,state, bgcolor){
	if (document.all)
		source4=event.srcElement
	else if (document.getElementById)
		source4=e.target
	if (source4.className=="menuitems")
	{
		source4.style.borderStyle=state
		source4.style.backgroundColor=bgcolor
	}
	else
	{
		while(source4.tagName!="DIV")
		{
			source4=document.getElementById? source4.parentNode : source4.parentElement
			if (source4.className=="menuitems")
			{
				source4.style.borderStyle=state
				source4.style.backgroundColor=bgcolor
			}
		}
	}
}

// SCRIPT POUR FAIRE APPARAITRE UN TEXTE SUR UN LIEN 1

if (document.getElementById)
{ 
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;}\n')
	document.write('</style>\n')
}

function SwitchMenu(obj)
{
	if(document.getElementById)
	{
		var el = document.getElementById(obj);
		var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
		if(el.style.display != "block")
		{ 
			for (var i=0; i<ar.length; i++)
			{
				if (ar[i].className=="submenu")
					ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
		else
		{
			el.style.display = "none";
		}
	}
}

function SwitchRes(obj)
{
	if(document.getElementById)
	{
		var el = document.getElementById(obj);
		var ar = document.getElementById("resderdiv").getElementsByTagName("span"); 
		if(el.style.display != "block")
		{ 
			for (var i=0; i<ar.length; i++)
			{
				if (ar[i].className=="submenu")
					ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
		else
		{
			el.style.display = "none";
		}
	}
}

// SCRIPT POUR FAIRE APPARAITRE UN TEXTE SUR UN LIEN 2



if (document.getElementById)
{ 
	document.write('<style type="text/css">\n')
	document.write('.submenulogin{display: none;}\n')
	document.write('</style>\n')
}

function SwitchMenulogin(obj)
{
	if(document.getElementById)
	{
		var el = document.getElementById(obj);
		var ar = document.getElementById("masterdivlogin").getElementsByTagName("span"); 
		if(el.style.display != "block")
		{ 
			for (var i=0; i<ar.length; i++)
			{
				if (ar[i].className=="submenulogin")
					ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
		else
		{
			el.style.display = "none";
		}
	}
}

// SCRIPT POUR VERIFIER SI LE CHAMPS EST UN NOMBRE
function checknumber(verif_nbr)
{
	var x    = verif_nbr
	var anum = /(^\d+$)|(^\d+.\d+$)/
	if (anum.test(x))
		testresult=true
	else
	{
		alert("Entrez un nombre valide")
		testresult=false
	}
	return (testresult)
}

function disableRightClick(e)
{
	var message = "Photo sous copyright, veuillez contacter le propriétaire de l'image svp";

	if(!document.rightClickDisabled) // initialize
	{
    	if(document.layers)
		{
			document.captureEvents(Event.MOUSEDOWN);
			document.onmousedown = disableRightClick;
		}
		else document.oncontextmenu = disableRightClick;
		return document.rightClickDisabled = true;
	}
	if(document.layers || (document.getElementById && !document.all))
	{
		if (e.which==2||e.which==3)
		{
			alert(message);
			return false;
		}
	}
	else
	{
		alert(message);
		return false;
	}
}
//disableRightClick();