/****************DEBUT Scripts toujours exécutés**********************/
<!--

// This scripts sets a default text in the status bar
window.defaultStatus='Crottaz Jean-Claude - cabinet dentaire, Vevey';

function stopError()
	{
	return true;
	}
window.onerror=stopError;
/*This scripts maximize the window to the monitor*/
function MaximizeWindow()
	{
	top.window.moveTo(0,0);
	if (document.all)
		{
		top.window.resizeTo(screen.availWidth,screen.availHeight);
		}
	else if (document.layers||document.getElementById)
		{
		if (top.window.outerHeight < screen.availHeight||top.window.outerWidth < screen.availWidth)
			{
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
			}
		}
	}

MM_reloadPage(true);

function MM_reloadPage(init)
	{  //reloads the window if Nav4 resized
 	if (init==true) with (navigator)
		{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4))
			{
 			document.MM_pgW=innerWidth;
			document.MM_pgH=innerHeight;
			onresize=MM_reloadPage;
			}
		}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
		location.reload();
	}

function LoadXiti()
	{
	doc = document;
	datejour = new Date();
	serveur = '20';
	compte = '97028'
	source = 'http://logv'+serveur+'.xiti.com/hit.xiti?s='+compte;
	source += '&p=&hl=' + datejour.getHours() + 'x' + datejour.getMinutes() + 'x' + datejour.getSeconds();
	Xiti_s = screen;
	source += '&r=' + Xiti_s.width + 'x' + Xiti_s.height + 'x' + Xiti_s.pixelDepth + 'x' + Xiti_s.colorDepth;
	source += '&ref=' + doc.referrer.replace('&', '$');
	logo = new Image ;
	logo.src = source; //préchargement image
	//alert(source);
	}

	
// Preload les images contenues dans le répertoire adéquat (basé sur les images existantes (preview)!) répertoire
function Preload(nbreImages)
	{
	imgArray = new Array(nbreImages+1);
	for (var i=1; i<=nbreImages; i++)
		{
		var imgName	= 'document.images.img' + String(i) + '.src' ;		// On construit le nom de l'URL de l'image
		var URL = new String();	URL = eval(imgName);	// on récupère son URL
		var path = new String(); path = URL.split("/") ; // on sépare tous les éléments
		var file = new String() ; file = path[path.length-1] ;  // on trouve le nom du fichier
		var newURL = new String(); newURL = "img/m/" + file;   // nouveau URL relatif de l'image à précharger
		imgArray[i] = new Image();
		imgArray[i].src = String(newURL) ;
		}
	}		
	
/****************FIN Scripts toujours exécutés**********************/

/* Affichage dynamique de la dent */

dent = "../common/img/general/Indicateur_Dent_On.gif"  // avec dent
pasDent = "../common/img/general/Indicateur_Dent_Off.gif" // sans dent

function imgout(imageCible)
	{
	imageCible.src = pasDent ; // supprime la dent
	// défaut connu : la dent s'efface même si la sous rubrique est active... no way to access img.link to compare to document.href.
	}
	
function imgover(imageCible)
	{
    imageCible.src = dent ;// affiche la dent
	}

// changement opacité d'image (IE5) -  rend visible une image à 100
function makevisible(cur,which)
	{
	if (which==0)
		{
		cur.filters.alpha.opacity=100 ;
		cur.style.borderColor="#1D94C2";
		}
	else
		{
		cur.filters.alpha.opacity=80 ;
		cur.style.borderColor="#19338F";
		}
	}

function afficheMain()
	{
	document.body.style.cursor = "pointer" ;
	}

function cacheMain()
	{
	document.body.style.cursor = "auto" ;
	}

// Lance une popup (toute version IE NS)
function launchPopup()
	{
	// version sans parametre avec correction du chemin
	// ouvre une popup contenant l'image xxl (max 533 x 400)
	var URL = document.imagePoster.src ;	// récupération de la source de l'image
	var path = URL.split("/"); // path est un tableau qui contient dossiers et en dernier le nom du fichier
	var file = path[path.length-1] ; // on récupère le nom du fichier
	var newURL = "img/xxl/" + file ; 	
	centerPopup(newURL,'',620,500,'') ;
	}
	
// Lance un popup (toute version IE NS)
// version avec parametre URL
// ouvre une popup contenant l'image xxl
function launchThisPopup(URL)
	{
	centerPopup(URL,'',620,500,'');
	}	

function lireLayer(layerID)
	{
	var contenu = '' ;
	if(document.getElementById)
		{
		contenu = document.getElementById(layerID).innerHTML ;
        }
	else if(document.all)
		{
		contenu = document.all[layerID].innerHTML ;
        }
	else if(document.layers)
		{
		with(document.layers[layerID].document)
			{
			open();
			contenu = read();
			close();
			}
		}
	return(contenu) ;
	}

// lance une popup centrée sur l'écran
// s'appelle comme suit : <a href="JavaScript:newWindow('centered.htm','popup',300,200,'')">click to open the popup window</a>
// paramètres : URL, titre, largeur, hauteur, options
// fonction technique, on ne l'appelle pas dans la page HTML, on utilise les fonctions intermédiaire pour diminuer le nombre de paramètre !

function centerPopup(sourceImage,myname,w,h,features)
	{
	var legende = lireLayer('MyLegend') ; // recherche la légende de l'image en cours
		legende = legende.split("-<BR>").join(""); // supprime les -<BR> hardodés
		legende = legende.split("<BR>").join(""); // supprime les <BR> hardodés
		legende = legende.split("<!---->").join("<BR>"); // ajoute les br à la place des commentaires		
	
	if(screen.width) { var winl = (screen.width-w)/2; var wint = (screen.height-h)/2;}
	else { winl = 0; wint = 0; } if(winl < 0) winl = 0;	if(wint < 0) wint = 0;
	
	var settings = 'height=' + h + ','; //hauteur
		settings += 'width=' + w + ','; //largeur
		settings += 'top=' + wint + ','; //position verticale
		settings += 'left=' + winl + ',';//position horizontale
		settings += features; // autres
		
	laPopup = window.open('',myname,settings) ;
	
	var ContenuPopup = '<html><head><title>Jean-Claude Crottaz, Médecin-dentiste</title>';
		ContenuPopup += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">' ;
		ContenuPopup += '<link rel=\"stylesheet\" href=\"../common/css/styles.css\" type=\"text/css\">' ;		
		ContenuPopup += '</head>';
		ContenuPopup += '<body bgcolor=\"#006699\" leftmargin=\"0\" topmargin=\"0\">';
		ContenuPopup += '<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\">';
		ContenuPopup += '<tr><td align=\"center\" valign=\"middle\">';		
		ContenuPopup += '<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
		ContenuPopup += '<tr><td align=\"center\" valign=\"middle\">';
		ContenuPopup += '<img src=\"' ;
		ContenuPopup += sourceImage ; // source (URL) de l'image à affcher
		ContenuPopup += '"name=\"IMAGERECUE\"></td></tr><tr><td class=\"legend\">';
		ContenuPopup += '<div align="\center\" class=\"legend\"><br>';
		ContenuPopup += '<center>' + legende + '<center>' ; 				// légende de l'image à affcher
		ContenuPopup += '</div></td></tr></table></td></tr></table>';
		
	laPopup.document.write(ContenuPopup);
	laPopup.window.focus();
	}

// change le contenu d'un layer (texte)
function writeLayer(layerID,txt)
	{
	// Texte reçu formatté pour garantir une police constante dans NS 4.7
	
	var fText = '<font face=\"Arial, Helvetica, sans-serif\" color=\"#FFFFFF\"size=\"1\">' + txt + '</font>';
	
	if(document.getElementById)
		{
		document.getElementById(layerID).innerHTML = fText;
        }
	else if(document.all)
		{
		document.all[layerID].innerHTML = fText;
        }
	else if(document.layers)
		{
		with(document.layers[layerID].document)
			{
			open();
			write(fText);
			close();
			}
		}
	}
	
// vérifie si le browser peut manipuler les images
function canManipulateImages()
	{
	if (document.images)
		return true ;
	else
		return false ;
	}
	
// Stock le résultat du test précédent.	
gImageCapableBrowser = canManipulateImages() ;

// change les images et le texte du layer joint
function loadPosterImage(newURL,text)
	{
	if (gImageCapableBrowser)
		{
		document.imagePoster.src = newURL ;
		writeLayer('MyLegend',text) ;
		return false ;
		}
	else
		{
		return true ;
		}
	}
	
// Flooble.com's Animated Text script. Will animate a specified 
	// bit of text (determined by the ID of containing tag) by 
	// highlighting it with specified color one character at a time 
	// in a moving pattern.
	//
	// Summary of use: 
	//     call animate(tagID, color); where "tagID" is the ID 
	//     of the tag that contains text to be animated,
	//     and "color" is the color to use to highlight the text with.
	//
	// For more information, and detailed instructions, see 
	//     http://www.flooble.com/scripts/animate.php
	//
	// Copyright (c) 2002 by Animus Pactum Consulting Inc.
	// This script comes with no warranties whatsoever. 
	// Animus Pactum Consulting will not be responsible
	// for any damages resulting from its use.

var ie4 = false;
if(document.all)
	{
    ie4 = true;
	}   
	    
function setContent(name, value)
	{
	var d;  
    if (ie4)
		{ 
        d = document.all[name];
		}
	else
		{
        d = document.getElementById(name);
        }
		  
    d.innerHTML = value;    
    }       

function getContent(name)
	{
	var d;
    if (ie4)
		{
        d = document.all[name];
        }
	else
		{
        d = document.getElementById(name);
 	    }
		
    return d.innerHTML;
	}

function setColor(name, value)
	{
	var d;  
	if (ie4)
		{ 
		d = document.all[name];
        }
	else
		{
		d = document.getElementById(name);
		}
		
	d.style.color = value;  
	}

function getColor(name)
	{
	var d;
	if (ie4)
		{
		d = document.all[name];
		}
	else
		{
		d = document.getElementById(name);
		}
		
	return d.style.color;
	}


function animate(name, col)
	{
	var value = getContent(name);
	if (value.indexOf('<span') >= 0)
		{
		return;
		}
		
	var length = 0;
	var str = '';
	var ch;
	var token = '';
	var htmltag = false;	
	for (i = 0; i < value.length; i++)
		{
		ch = value.substring(i, i+1);
		
		if (i < value.length - 1)
			{
			nextch = value.substring(i+1, i+2);
			}
		else
			{
			nextch = ' ';
			}
			
		token += ch;
		
		if (ch == '<' && '/aAbBpPhHiIoOuUlLtT'.indexOf(nextch) >= 0)
			{
			htmltag = true;
			}
			
		if (ch == '>' && htmltag)
			{
			htmltag = false;
			}
			
		if (!htmltag && ch.charCodeAt(0) > 30 && ch != ' ' && ch != '\n')
			{		
			str += '<span id="' + name + '_' + length + '">' + token + '</span>';
			token = '';
			length++;
			}
			
		}
	setContent(name, str);
	command = 'animateloop(\'' + name + '\', ' + length + ', 0, 1, \'' + col + '\')';
	setTimeout(command , 100);
	}

function animateloop(name, length, ind, delta, col)
	{
	var next = ind + delta;
	if (next >= length)
		{
		delta = delta * -1;
		next = ind + delta;
		}
	if (next < 0)
		{
		delta = delta * -1;
		next = ind + delta;
		}
		
	setColor(name + '_' + ind, getColor(name + '_' + next));
	setColor(name + '_' + next, col);
	command = 'animateloop(\'' + name + '\', ' + length + ', ' + next + ', ' + delta + ', \'' + col + '\')';
	setTimeout(command , 100);
	}
	
function MM_openBrWindow(theURL,winName,features)
	{
	lapopup = window.open(theURL,winName,features);
	laPopup.window.focus();
	}
	
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
	
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->