	var extention = ".jpg" ;
	var phototimeout = 200;
	var nbimage = 22 ;
	var url;
	var rep;
	var timerID  = null;
	var tant = 0;
	var imageList = new Array();
	var currentImageIndex;
	var bNeedReload = 0;
	
	function flushImageList()
	{
		while(imageList.length != 0)
		{
			imageList.pop();
		}
	}
		
	function addImageToList(imgUrl)
	{
		var img = null;
		img = new Image();
		img.src = imgUrl;
		imageList.push(img);
	}
	
	function addImageListToList(imgPath,number)
	{
		for(i=1;i<=number;i++)
		{
			addImageToList(imgPath + i + ".jpg");
		}
	}
	
	function preloadPhotos()
	{
		waitPhotoLoaded();
		bNeedReload = 0;
	}
	
	function waitPhotoLoaded()
	{
		if(imageList.length!=0)
		{
			var img = null;
			img = imageList[1];
			if((img.width!=0)&&(img.height!=0))
			{
				imageList.shift();
			}
			else
			{
				bNeedReload = 1;
			}
			setTimeout('waitPhotoLoaded()',phototimeout);
		}
		else if(bNeedReload == 1)
		{
			window.location.reload();
		}
	}
	
	function waitforthephoto(imgurl)
	{
		var img = new Image();
		img.src=imgurl;
		if((img.width!=0)&&(img.height!=0))
		{
			window.location.reload();
		}
		else
		{
			setTimeout('waitforthephoto("' + imgurl + '")',phototimeout);
		}
	}
	
	
	function createGallery(path,picnumber)
	{
		for(i=1;i<=picnumber;i++)
		{
			var picture = path + i + ".jpg";
			imageBorder(picture,600,0);
			document.write('<br><br>');
		}
	}
	
	function imageBorder2(imgsrc,imgwidth,imgheight)
	{
		// dessus de l'encadrement
		document.write('<img src="pic/quart_cercle_haut_gauche.gif" width="4"/><img src="pic/bordure.gif" width="');
		document.write(imgwidth);
		document.write('" height="4"/><img src="pic/quart_cercle_haut_droit.gif" width="4"/><br>');
		// encadrement gauche
		document.write('<img src="pic/bordure.gif" width="4" height="');
		document.write(imgheight);
		document.write('"/>');
		// image
		document.write('<img src="');
		document.write(imgsrc);
		document.write('" width="');
		document.write(imgwidth);
		document.write('" height="');
		document.write(imgheight);
		document.write('"/>');
		// encadrement droite
		document.write('<img src="pic/bordure.gif" width="4" height="');
		document.write(imgheight);
		document.write('"/><br>');
		// bas de l'encadrement
		document.write('<img src="pic/quart_cercle_bas_gauche.gif" width="4"/><img src="pic/bordure.gif" width="');
		document.write(imgwidth);
		document.write('" height="4"/><img src="pic/quart_cercle_bas_droit.gif" width="4"/><br>');

	}
	
	function imageBorder(imgsrc,imgwidth,imgheight)
	{
		var img = null;
		img = new Image();
		img.src = imgsrc;
		if(img.width==0)
		{
			setTimeout('waitforthephoto("' + imgsrc + '")',phototimeout);
		}
		if(img.height==0)
		{
			setTimeout('waitforthephoto("' + imgsrc + '")',phototimeout);
		}
		var org_width = img.width;
		var org_height = img.height;
		if(imgwidth != 0)
		{
			img.width = imgwidth;
			if(imgheight == 0)
			{
				img.height = org_height*imgwidth/org_width;
			}
		}
		if(imgheight != 0)
		{
			img.height = imgheight;
			if(imgwidth == 0)
			{
				img.width = org_width*imgheight/org_height;
			}
		}
		// dessus de l'encadrement
		document.write('<img src="pic/quart_cercle_haut_gauche.gif" width="4"/><img src="pic/bordure.gif" width="');
		document.write(img.width);
		document.write('" height="4"/><img src="pic/quart_cercle_haut_droit.gif" width="4"/><br>');
		// encadrement gauche
		document.write('<img src="pic/bordure.gif" width="4" height="');
		document.write(img.height);
		document.write('"/>');
		// image
		document.write('<img src="');
		document.write(imgsrc);
		document.write('" width="');
		document.write(img.width);
		document.write('" height="');
		document.write(img.height);
		document.write('"/>');
		// encadrement droite
		document.write('<img src="pic/bordure.gif" width="4" height="');
		document.write(img.height);
		document.write('"/><br>');
		// bas de l'encadrement
		document.write('<img src="pic/quart_cercle_bas_gauche.gif" width="4"/><img src="pic/bordure.gif" width="');
		document.write(img.width);
		document.write('" height="4"/><img src="pic/quart_cercle_bas_droit.gif" width="4"/><br>');
		if(img.height != 0)
		{
			alert("img name = " + img.src + ", img height = " + img.height + ", img width = " + img.width);
		}
	}
	
	function Images_Aleatoire() // fonction pour afficher une image differente a chaque chargement de la page
	{
		document.write('<form name="form1">');
		numimage = Math.round( Math.random() * ( nbimage - 1 ) + 1 ); // founir un nombre aleatoire entre 1 et nbimage
		rep = 'pic/imgs_aleatoire_accueil/';  // construire le path de l'image a afficher
		url =  rep + 'img' + numimage + extention ;
		document.write('<img src="pic/quart_cercle_haut_gauche.gif" width="8"/><img src="pic/bordure.gif" width="400" height="8"/><img src="pic/quart_cercle_haut_droit.gif" width="8"/><br>');
		document.write('<img src="pic/bordure.gif" width="8" height="400"/><img name="sta" src="' + url + '" onerror="this.onerror=null;" width="400" height="400"/><img src="pic/bordure.gif" width="8" height="400"/><br>');  // ecrire le path dans la document html
		document.write('<img src="pic/quart_cercle_bas_gauche.gif" width="8"/><img src="pic/bordure.gif" width="400" height="8"/><img src="pic/quart_cercle_bas_droit.gif" width="8"/><br>');
		document.write('</form>')
		demarre();
	}
	
	function ChangeImage()  // fonction pour changer l'image toutes les n secondes
	{
		numimage = Math.round( Math.random() * ( nbimage - 1 ) + 1 );  // founir un nombre aleatoire entre 1 et nbimage
		rep = 'pic/imgs_aleatoire_accueil/'  // construire le path de l'image a afficher
		tmpurl = rep + 'img' + numimage + extention ;  
		var reg=new RegExp("^"+tmpurl+".*$","i");  // verifier que l'image courante n'est pas celle qu'on va afficher
		if(url.match(reg)) // si oui, on en prend une autre
		{
			if(numimage == nbimage)
			{
				numimage = nbimage - 1;
			}
			else
			{
				numimage = nbimage + 1;
			}
		}
		url =  rep + 'img' + numimage + extention ;  // retourner l'url de la nouvelle image
	}
	
	function demarre()  // fonction temporisant le changement d'image
	{
		tant = tant+1; // incremente le nombre de secondes passées depuis le lancement du timer
		if (tant < 3 ) { // tant que 5 secondes ne sont pas écoulées
			timerID = setTimeout("demarre()",1000); // fixe l'intervalle de temps a 1s et relance la fonction apres ce délai
		}
		else
		{
			tant = 0; // reinitialise le compteur
			ChangeImage(); // obtenir l'url d'une nouvelle image
			document.form1.sta.src=url;  // changer l'url de l'image dans le document ouvert sans recharger le document complet
			demarre();  // relancer la temporisation
		}
	}
	
	function loadStyle() // permet de charger une feuille de style correspondant au navigateur
	{
		document.write ('<link rel="stylesheet" '); // partie statique
		if (navigator.appName=="Microsoft Internet Explorer") // abomination
		{
			document.write ('href="css/style.css" ');
		}
		else // cas normal
		{
			document.write ('href="css/style.css" ');
		}
		document.write ('type="text/css" media="screen">');
	}
	
	function WarnForbiddenRightClick()
	{
		// alert("Pas possible, niark niark! :oP");
	}
	
	function loadBanner()
	{
		document.write('<div id="hautdepage" align="center"><br><img border="0" src="pic/banniere.gif" width="750" height="80"></div><br>');
	}
	
	function loadMainMenu()
	{
		var TableCreation = '<table border="0" width="100%"><tr align="center"><td width="14%">&nbsp;</td>';
		var TableClose = '<td width="14%">&nbsp;</td></tr></table>';
		//var pageTitle = '';
		//var pageName = '';
		
		document.write(TableCreation); // creation du tableau
		// Accueil
		pageTitle = 'Accueil';
		pageName = 'accueil.php';
		loadMainMenuItem(pageName,pageTitle,1);
		// Nous
		pageTitle = 'Nous';
		pageName = 'nous.php';
		loadMainMenuItem(pageName,pageTitle,2);
		// Le Ragdoll
		pageTitle = 'Le Ragdoll';
		pageName = 'Le_ragdoll.php';
		loadMainMenuItem(pageName,pageTitle,1);
		// Nos Chats
		pageTitle = 'Nos chats';
		pageName = 'Nos_chats.php';
		loadMainMenuItem(pageName,pageTitle,2);
		// Liens
		pageTitle = 'Liens';
		pageName = 'liens.php';
		loadMainMenuItem(pageName,pageTitle,1);
		// Contacts
		pageTitle = 'Contact';
		pageName = 'contact.php';
		loadMainMenuItem(pageName,pageTitle,2);
		
		document.write(TableClose); // fermeture du tableau
	}
	
	function loadMainMenuItem(pageName,pageTitle,PawPosition)
	{
		var tdtag = '<td width="12%"><b><div class="Menu1">';
		var endtd = '</div></b></td>';
		var currentPage = getCurrentPage();
		
		document.write(tdtag);
		if(PawPosition==2)
		{
			if(currentPage == pageName)
			{
				document.write(pageTitle);
			}
			else
			{
				writepagetitle(pageName,pageTitle);
			}
			document.write("<br>");
		}
		if(currentPage == pageName)
		{
			displayMainNonLinkPaw();
		}
		else
		{
			displayMainLinkPaw(pageName);
		}
		if(PawPosition==1)
		{
			document.write("<br>");
			if(currentPage == pageName)
			{
				document.write(pageTitle);
			}
			else
			{
				writepagetitle(pageName,pageTitle);
			}
		}
		document.write(endtd);
	}
	
	function writepagetitle(pageName,pageTitle)
	{
		var tmpArray = pageName.split('.');
		var pgname = tmpArray[0];
		document.write('<a href="');
		document.write(pageName);
		document.write('" onMouseOver="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/Aempreinte_bleue_droite.gif\'" onMouseOut="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/empreinte_bleue_droite.gif\'" style="font-size:18; line-height:2">');
		document.write(pageTitle);
		document.write('</a>');
	}
	
	function displayMainLinkPaw(pageName)
	{
		var tmpArray = pageName.split('.');
		var pgname = tmpArray[0];
		document.write('<a href="');
		document.write(pageName);
		document.write('"><img name="RollImage');
		document.write(pgname);
		document.write('" style="border : 0px; margin: 0px;" src="pic/empreinte_bleue_droite.gif" alt="" onMouseOver="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/Aempreinte_bleue_droite.gif\'" onMouseOut="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/empreinte_bleue_droite.gif\'"  width="40" height="40"/></a>');
	}
	
	function displayMainNonLinkPaw()
	{
		document.write('<img style="border : 0px; margin: 0px;" src="pic/Aempreinte_bleue_droite.gif" width="40" height="40"/>');
	}
	
	function loadSecondMenu()
	{
		var TableCreation = '<table border="0" width="100%" cellspacing="4">';
		var TableClose = '</table>';
		//var pageTitle = '';
		//var pageName = '';
		
		document.write('<td width="2%">&nbsp;</td>');
		document.write('<td width="20%" valign="top">');
		document.write(TableCreation); // creation du tableau
		// Matous
		pageTitle = 'Matous';
		pageName = 'matous.php';
		loadSecondMenuItem(pageName,pageTitle,1);
		// writeEmtyTR();
		// Minettes
		pageTitle = 'Minettes';
		pageName = 'minettes.php';
		loadSecondMenuItem(pageName,pageTitle,2);
		// writeEmtyTR();
		// Chatons
		pageTitle = 'Chatons';
		pageName = 'chatons.php';
		loadSecondMenuItem(pageName,pageTitle,1);
		// writeEmtyTR();
		// Chats stérilisés
		pageTitle = 'Chats stérilisés';
		pageName = 'chats_sterilises.php';
		loadSecondMenuItem(pageName,pageTitle,2);
		// writeEmtyTR();
		// Galeries
		pageTitle = 'Galeries';
		pageName = 'galerie.php';
		loadSecondMenuItem(pageName,pageTitle,1);
		
		document.write(TableClose); // fermeture du tableau
		document.write('</td>');
		document.write('<td width="3%">&nbsp;</td>');
	}
	
	function writeEmtyTR()
	{
		document.write('<tr><td>&nbsp;</td></tr>');
	}
	
	function loadSecondMenuItem(pageName,pageTitle,pawPosition)
	{
		var trtag = '<tr>';
		var tdtag1 = '<td width="60">';
		var tdtag2 = '<td>';
		var endtr = '</tr>';
		var endtd = '</td>';
		var currentPage = getCurrentPage();
		
		document.write(trtag);
		document.write(tdtag1);
		if(currentPage == pageName)
		{
			displaySecondNonLinkPaw(pawPosition);
		}
		else
		{
			displaySecondLinkPaw(pageName,pawPosition);
		}
		document.write(endtd);
		document.write(tdtag2);
		document.write('<b><div class="Menu3">&nbsp;');
		if(currentPage == pageName)
		{
			document.write(pageTitle);
		}
		else
		{
			writepagesecondtitle(pageName,pageTitle);
		}
		document.write('</div></b>');
		document.write(endtd);
		document.write(endtr);
	}
	
	function writepagesecondtitle(pageName,pageTitle)
	{
		var tmpArray = pageName.split('.');
		var pgname = tmpArray[0];
		document.write('<a href="');
		document.write(pageName);
		document.write('" onMouseOver="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/Aempreinte_bleue_haut.gif\'" onMouseOut="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/empreinte_bleue_haut.gif\'" style="font-size: 17">');
		document.write(pageTitle);
		document.write('</a>');
	}
	
	function displaySecondLinkPaw(pageName,pawPosition)
	{
		var tmpArray = pageName.split('.');
		var pgname = tmpArray[0];
		document.write('<a href="');
		document.write(pageName);
		document.write('"><img name="RollImage');
		document.write(pgname);
		document.write('" style="border : 0px; margin: 0px;" src="pic/empreinte_bleue_haut.gif" alt="" onMouseOver="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/Aempreinte_bleue_haut.gif\'" onMouseOut="document.RollImage');
		document.write(pgname);
		document.write('.src=\'pic/empreinte_bleue_haut.gif\'"  width="35" height="35"');
		if(pawPosition==1)
		{
			document.write(' align="left"');
		}
		else
		{
			document.write(' align="right"');
		}
		document.write('/></a>');
	}
	
	function displaySecondNonLinkPaw(pawPosition)
	{
		document.write('<img style="border : 0px; margin: 0px;" src="pic/Aempreinte_bleue_haut.gif" width="35" height="35"');
		if(pawPosition==1)
		{
			document.write(' align="left"');
		}
		else
		{
			document.write(' align="right"');
		}
		document.write('/>');
	}
		
	function getCurrentPage()
	{
		var href = window.location.href;
		var tmpArray = href.split('/');
		var fichier = tmpArray[tmpArray.length - 1];
		return fichier;
	}
	
	function pawlines(pawNumber)
	{
		if(pawNumber>20)
		{
			pawNumber=20;
		}
		document.write('<table border="0" width="100%"><tr>');
		var rest = (100-(3*pawNumber))/2;
		document.write('<td width="');
		document.write(rest);
		document.write('%"></td>');
		var j=0;
		for(i=0;i<pawNumber;i++)
		{
			if(j==0)
			{
				document.write('<td width="3%"><img src="pic/empreinte_bleue_droite.gif" width="18" height="18"/><br/>&nbsp;</td>\n');
				j=1;
			}
			else
			{
				document.write('<td width="3%">&nbsp;<br/><img src="pic/empreinte_bleue_droite.gif" width="18" height="18"/></td>\n');
				j=0;
			}
		}
		document.write('<td width="');
		document.write(rest);
		document.write('%"></td>');
		document.write('</tr></table>');
	}
	
	function openWindow(name,width,height)
	{
		var options = 'menubar=no, status=no, scrollbars=yes, directories=no, location=no, resizable=no, toolbar=no, width=';
		options += width + ', height=' + height;
		window.open(name,"",options);
	}
	
	function createmailto()
	{
		var toto = "info";
		var titi = "kimaragdolls";
		var tutu = "org";
		var emailadress = toto + "@" + titi + "." + tutu;
		document.write('<a href="mailto:');
		document.write(emailadress);
		document.write('" style="color:#3366FF; font-size: 18" onmouseover="this.style.color=\'#0000BD\'" onmouseout="this.style.color=\'#3366FF\'">');
		document.write(emailadress);
		document.write('</a>');
	}
	
	function loadBody()
	{
		document.write('<body onselectstart="return false" align="center" oncontextmenu="WarnForbiddenRightClick(); return true" ondragstart="return false" onMouseOver="window.status=\'Les Ragdolls de Kind Of Magic\'; return true;" style="repeat scroll top left; margin: 0pt; ">');
	}
	
	function endBody()
	{
		document.write('</body>');
	}
	
	function borderpagebegin()
	{
		document.write('<div align="center" style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word;  width: 100%;">');
		document.write('<div align="center" style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word;  background-color: #3366FF; width: 904px;">');
		document.write('<div align="center" style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word;  background-color: #D7B373; width: 900px;">');
		document.write('<div align="center" style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word;  background-color: #996633; width: 804px;">');
		document.write('<div align="center" style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word;  left; background-image: url(pic/arriere_plan.jpg); width: 800px;">');
	}
	
	function borderpageend()
	{
		document.write('</div></div></div></div></div>');
	}
	

