var popusWindow = '' ;

function mainOpen(){
	self.name = "mopus" ;
	self.resizeTo(screen.availWidth,screen.availHeight) ;
	self.moveTo(0,0) ;
}

function popus (p) {
	h = screen.availHeight-32;
	popusWindow = window.open(p + ".html","popus", "height="+h+", width=770, resizable=yes, scrollbars=yes, screenX=0, left=0, screenY=0, top=0");
	popusWindow.focus();
}

function popusClose() {
}

function azpop (p) {
	popus("../" + p);
}

function aashow (m) {
	top.somm.result.location = m + ".html" ;
	var xx = "<html><head><link rel='stylesheet' type='text/css' href='../az.css'></head>" + '\n';
		xx += '<body class="mot"  bgcolor="#A9BECE" text="#000000">' + m + '</body></html>' ;
	top.somm.mot.document.write(xx) ;
	top.somm.mot.document.close() ;
}

/*function opus_loadframes() {
	opus_titre() ;
	opus_image(1);
}*/

function goMain() {
	var mopusWindow = window.open("../index.html","mopus","");
	mopusWindow.focus();
}

function goPrev() {
	top.location.href = "../" + pPrev ;
}

function goNext() {
	top.location.href = "../" + pNext;
}

function opus_sommaire() {
	top.location.href = pThis;
}

function opus_titre() {
	var xx = '';
	xx += '<table width="760"><tr valign="top">' + '\n';
	xx += '<td width="80" height="65"><a href=# onclick="top.goMain()"><img src="../logo.gif" alt="Page d\'accueil" width="65" height="65" hspace="0" vspace="0" border="0"></a></td>' + '\n';
	xx += '<td width="640"><span class="chapitre">' + pChapitre.toUpperCase() + '</span><br>'
	xx += '<span class="chapitre">' + pTitre + '</span></td>' + '\n';
	xx += '<td width="30"><a href=# onclick="top.blur()"><img src="../close.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';
	xx += '<td width="30"><a href=# onclick="top.goPrev()"><img src="../prev.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';
	xx += '<td width="30"><a href=# onclick="top.goNext()"><img src="../next.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';	
	xx += '<td width="12" height="45">&nbsp;</td>' + '\n';
	xx += '</tr></table>';
	top.document.clear() ;
	top.document.write(xx) ;
}

function opus_image(iNew){

	if (iNew == 1000) {
		iImage-- ;
		if (iImage == 0) {
			iImage = pImage.length - 1} ;
		}
		else {
			if (iNew == 1001) {
				iImage++ ; 
				if (iImage == pImage.length) {
					iImage = 1
				}
			}
		else {
			iImage = iNew;
		}
	}

	if ((pImage[iImage] == "") || (pImage[iImage] == null)) {
		opus_sommaire();
	}
	else {
		var xx = "<html><head><title></title>" + "\n";
		xx += "<link rel='stylesheet' type='text/css' href='../morvan.css' title='morvan'>" + "\n";
		xx += "<script language='JavaScript' src='../morvan.js'></script>"  + "\n";
		xx += "<script language='JavaScript'>" +  "\n";
		xx += "var pGabarit ='" + pGabarit + "';\n";
		xx += "var pID ='" + pID + "';\n";
		xx += "var pThis ='" +pThis  + "';\n";
		xx += "var pPrev ='" + pPrev + "';\n";
		xx += "var pNext ='" + pNext + "';\n";
		xx += "var pChapitre ='" + pChapitre + "';\n";
		xx += "var pTitre ='" + pTitre.replace("\'","\\'") + "';\n";
		xx += "var iImage ='" + iImage + "';\n";
		xx += "var pImage = new Array();\n";
		xx += 'yy = "' + pImage + '";\n';
		xx += "pImage = yy.split(',');\n";
		xx += "var pLegende = new Array();\n";
		xx += 'yy = "' + pLegende + '";\n';
		xx += "pLegende = yy.split(',');\n";
		
		xx += "pListe ='" + pListe + "';\n";
		xx += 'var pTexte ="' + pTexte.replace("\'","\\'") + '";\n';
		xx += "</script>" + "\n";
		xx += '</head>'  + '\n'; 
				
		xx += '<body>' + '\n';
		
		xx += '<table width="760"><tr valign="top">' + '\n';
		xx += '<td width="80" height="65"><a href=# onclick="top.goMain()"><img src="../logo.gif" alt="Page d\'accueil" width="65" height="65" hspace="0" vspace="0" border="0"></a></td>' + '\n';
		xx += '<td width="640"><span class="chapitre">' + pChapitre.toUpperCase() + '</span><br>'
		xx += '<span class="chapitre">' + pTitre + '</span></td>' + '\n';
		xx += '<td width="30"><a href=# onclick="top.blur();return false"><img src="../close.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';
		xx += '<td width="30"><a href=# onclick="top.goPrev();return false"><img src="../prev.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';
		xx += '<td width="30"><a href=# onclick="top.goNext();return false"><img src="../next.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';	
		xx += '<td width="12" height="45">&nbsp;</td>' + '\n';
		xx += '</tr></table>';
	
		xx += '<table border="0" cellspacing="0" cellpadding="0">' + '\n';
		
		xx += '<tr>' + '\n';
		xx += '<td width="160" height="390">&nbsp;</td>' + '\n';
		xx += '<td width="520" height="390" align="center" valign="bottom"><a href=# onclick="top.opus_sommaire();return false">' + '\n';
		xx += '<img class="photo" src="' + pID + pImage[iImage] + '.jpg" alt="" width="520" height="390" border="1"></a></td>' + '\n';
		xx += '<td width="80" height="390">&nbsp;</td>' + '\n';
		xx += '</tr>' + '\n';
		
		xx += '<tr>' + '\n';
		xx += '<td width="160">&nbsp;</td>' + '\n';
		xx += '<td width="520">' + '\n';
		xx += '<table width="520" border="0" cellspacing="0" cellpadding="0"><tr>' + '\n';		
		xx += '<td width="412"><div class="legende"><b>' + pLegende[iImage] +'</b> ' + auteur(iImage,1) + '</div></td>' + '\n';
		
		if (pTexte != "<p></p>"){
			xx += '<td width="24" valign="top"><a href=# onclick="top.opus_sommaire();return false"><img src="../somm.gif" alt="Retour" width="24" height="30" border="0"></a></td>' + '\n';
		}
		else{
			xx += '<td width="24" valign="top">&nbsp;</td>' + '\n';
		}
	
		if (pImage.length > 2){
			xx += '<td width="24" valign="top"><a href=# onclick="top.opus_image(1000);return false"><img src="../prec.gif" alt="Précédent" width="24" height="30" border="0"></a></td>' + '\n';
			xx += '<td width="36" valign="top" align="center"><div class = "numero">' + iImage + '/' + (pImage.length -1) + '</div></td>'  + '\n';
			xx += '<td width="24" valign="top"><a href=# onclick="top.opus_image(1001);return false"><img src="../suiv.gif" alt="Suivant" width="24" height="30" border="0"></a></td>' + '\n';
		}
		else{
			xx += '<td width="90" valign="top">&nbsp;</td>' + '\n';
		}
		xx += '</tr></table></td>' + '\n';
		xx += '<td width="80">&nbsp;</td>' + '\n';
		xx += '</tr></table></body></html>';
		
		top.document.clear() ;
		top.document.write(xx) ;
		top.document.close() ;
		
	}
}

function opus_imageV(iNew){
	if (iNew == 1000) {
		iImage-- ;
		if (iImage == 0) {
			iImage = pImage.length - 1} ;
		}
		else {
			if (iNew == 1001) {
				iImage++ ; 
				if (iImage == pImage.length) {
					iImage = 1
				}
			}
		else {
			iImage = iNew;
		}
	}

	if ((pImage[iImage] == "") || (pImage[iImage] == null)) {
		opus_sommaire();
	}
	else {
		var xx = '<html><head><title></title>' + '\n';
		xx += "<link rel='stylesheet' type='text/css' href='../morvan.css' title='morvan'></head>"  + '\n'; 
		xx += "<script language='JavaScript' src='../morvan.js'></script>"  + "\n";
		xx += "<script language='JavaScript'>" +  "\n";
		xx += "var pGabarit ='" + pGabarit + "';\n";
		xx += "var pID ='" + pID + "';\n";
		xx += "var pThis ='" +pThis  + "';\n";
		xx += "var pPrev ='" + pPrev + "';\n";
		xx += "var pNext ='" + pNext + "';\n";
		xx += "var pChapitre ='" + pChapitre + "';\n";
		xx += "var pTitre ='" + pTitre.replace("\'","\\'") + "';\n";
		xx += "var iImage ='" + iImage + "';\n";
		xx += "var pImage = new Array();\n";
		xx += 'yy = "' + pImage + '";\n';
		xx += "pImage = yy.split(',');\n";
		xx += "var pLegende = new Array();\n";
		xx += 'yy = "' + pLegende+ '";\n';
		xx += "pLegende = yy.split(',');\n";
		
		xx += "pListe ='" + pListe + "';\n";
		xx += 'var pTexte ="' + pTexte.replace("\'","\\'") + '";\n';
		xx += "</script>" + "\n";
		xx += '</head>'  + '\n'; 
		
		xx += '<body>' + '\n';
		
		xx += '<table width="760"><tr valign="top">' + '\n';
		xx += '<td width="80" height="65"><a href=# onclick="top.goMain()"><img src="../logo.gif" alt="Page d\'accueil" width="65" height="65" hspace="0" vspace="0" border="0"></a></td>' + '\n';
		xx += '<td width="640"><span class="chapitre">' + pChapitre.toUpperCase() + '</span><br>'
		xx += '<span class="chapitre">' + pTitre + '</span></td>' + '\n';
		xx += '<td width="30"><a href=# onclick="top.blur()"><img src="../close.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';
		xx += '<td width="30"><a href=# onclick="top.goPrev()"><img src="../prev.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';
		xx += '<td width="30"><a href=# onclick="top.goNext()"><img src="../next.gif" alt="" width="30" height="40" border="0"></a></td>' + '\n';	
		xx += '<td width="12" height="45">&nbsp;</td>' + '\n';
		xx += '</tr></table>';

		xx += '<table width="0" border="0" cellspacing="0" cellpadding="0">' + '\n';
		xx += '<tr>' + '\n';
		xx += '<td width="160" height="450">&nbsp;</td>' + '\n';
		xx += '<td width="300" height="450"><a href=# onclick="top.opus_sommaire()">' + '\n';
		xx += '<img class="photo" src="' + pID + pImage[iImage] + '.jpg" alt="" border="1"></a></td>' + '\n';
		xx += '<td width="280" height="450">' + '\n';
		
		xx += '<table width="280" border="0" cellspacing="0" cellpadding="0">' + '\n';		
		xx += '<tr><td width="20">&nbsp;</td>' + '\n';
		xx += '<td width="260" height="390" colspan="5" valign="bottom"><div class="legende"><b>' + pLegende[iImage] +'</b> ' + auteur(iImage,1) + '<br>&nbsp;</div></td></tr>' + '\n';
		xx += '<tr><td width="20">&nbsp;</td>' + '\n';
		if (pTexte != "<p></p>"){
			xx += '<td width="24" valign="middle"><a href=# onclick="top.opus_sommaire()"><img src="../somm.gif" alt="Retour" width="24" height="30" border="0"></a></td>' + '\n';}
		else{
			xx += '<td width="24" valign="middle">&nbsp;</td>' + '\n';
		}

		if (pImage.length > 2){
			xx += '<td width="24" valign="top"><a href=# onclick="top.opus_imageV(1000)"><img src="../prec.gif" alt="Précédent" width="24" height="30" border="0"></a></td>' + '\n';
			xx += '<td width="30" valign="top" align="center"><div class = "numero">' + iImage + '/' + (pImage.length -1) + '</div></td>'  + '\n';
			xx += '<td width="24" valign="top"><a href=# onclick="top.opus_imageV(1001)"><img src="../suiv.gif" alt="Suivant" width="24" height="30" border="0"></a></td>' + '\n';
		}
		else{
			xx += '<td width="24">&nbsp;</td>' + '\n';
			xx += '<td width="30">&nbsp;</td>' + '\n';
			xx += '<td width="24">&nbsp;</td>' + '\n';
		}
		xx += '<td width="152">&nbsp;</td></tr></table>' + '\n';
		xx += '</td></tr></table></body></html>';
		
		top.document.clear() ;
		top.document.write(xx) ;
		top.document.close() ;
	}
}


function vignette(v,w,h){
var xx = ""

	if (w == 120 && h ==  90) { 
		if (v < pImage.length){		
			xx += '<a href=# onclick="top.opus_image(' + pIndex[v] + ')">' ;
			xx += '<img class="photo" src="' + pID + pImage[pIndex[v]] + '1.jpg"' ;
			xx += ' alt="' + pLegende[pIndex[v]] + auteur(pIndex[v],0) + '"';
			xx += ' width="' + w + '" height="' + h + '" hspace="4" vspace="4" border="1"></a>' ;
		}
		else {
			xx += '<img src="../morvide1.gif" alt="" width="' + w + '" height="' + h + '" hspace="4" vspace="4" border="0"></a>' ;
		}
	}
	if (w ==  68 && h ==  51) { 
		if (v < pImage.length){		
			xx += '<a href=# onclick="top.opus_image(' + pIndex[v] + ')">' ;
			xx += '<img class="photo" src="' + pID + pImage[pIndex[v]] + '2.jpg"' ;
			xx += ' alt="' + pLegende[pIndex[v]] + auteur(pIndex[v],0) + '"';
			xx += ' width="' + w + '" height="' + h + '" hspace="4" vspace="4" border="1"></a>' ;	
		}
		else {
			xx += '<img src="../morvide2.gif" alt="" width="' + w + '" height="' + h + '" hspace="4" vspace="4" border="0"></a>' ;
		}
	}
	if (w ==  68 && h == 102) { 
		if (v < pImage.length){		
			xx += '<a href=# onclick="top.opus_imageV(' + pIndex[v] + ')">' ;
			xx += '<img class="photo" src="' + pID + pImage[pIndex[v]] + '3.jpg"' ;
			xx += ' alt="' + pLegende[pIndex[v]] + auteur(pIndex[v],0) + '"';
			xx += ' width="' + w + '" height="' + h + '" hspace="4" vspace="4" border="1"></a>' ;	
		}
		else {
			xx += '<img src="../morvide3.gif" alt="" width="' + w + '" height="' + h + '" hspace="4" vspace="4" border="0"></a>' ;
		}
	}
	return xx
}	

function auteur(v,style){
	var w = pImage[v]+ "_ _ _ " ;
	var x = w.split("_");
	var y = "";
	var z = "";
	switch(x[2].toLowerCase()){		
	case '' 		: z = '' ; break	
	case ' ' 		: z = '' ; break
	case 'acm' 		: z = '&copy; Académie du Morvan' ; break
	case 'al' 		: z = '&copy; Antoine Lentz' ; break
	case 'am' 		: z = '&copy; Alain Millot' ; break
	case 'amv' 		: z = '&copy; AMV' ; break
	case 'ap' 		: z = '&copy; André Paris' ; break
	case 'apat' 	: z = '&copy; Alligny Patrimoine' ; break
	case 'apap' 	: z = '&copy; Association Pannecière APAP-OT' ; break
	case 'as' 		: z = '&copy; Agnès Sourd' ; break
	case 'bar' 		: z = '&copy; Michel Barbotte' ; break
	case 'blc' 		: z = '&copy; Bibliothèque de Lucenay-Chissey' ; break
	case 'bus' 		: z = '&copy; Mme Bussières' ; break
	case 'cb' 		: z = '&copy; Christian Behaghel' ; break
	case 'cbal'		: z = '&copy; A. Lombard' ; break
	case 'cbfr'		: z = '&copy; F. Refait' ; break
	case 'cbga'		: z = '&copy; G. Arnal' ; break
	case 'cbgh'		: z = '&copy; G. Hunault' ; break
	case 'cbjc'		: z = '&copy; J. Cordier' ; break
	case 'cbjm'		: z = '&copy; J. Moret' ; break
	case 'cblb'		: z = '&copy; L. Boudin' ; break
	case 'cbob'		: z = '&copy; Olivier Bardet' ; break
	case 'cbon'		: z = '&copy; O. Nawrot' ; break
	case 'cbrd'		: z = '&copy; R.Dupre' ; break
	case 'cbxx'		: z = '&copy; mnhn-cbnbp' ; break
	case 'cc'		: z = '&copy; Claude Correia' ; break
	case 'ccc'		: z = '&copy; Capucine Crosnier' ; break
	case 'cx'		: z = '&copy; mnhn-cbnbp' ; break
	case 'cdd' 		: z = 'Collecte Danielle Develay' ; break
	case 'cl' 		: z = '&copy; Claude Lemmel' ; break
	case 'clp' 		: z = '&copy; Claude Péquinot' ; break
	case 'cm' 		: z = '&copy; Conseil municipal' ; break
	case 'cmp'		: z = 'Collecte Michelle Perault' ; break
	case 'cmv'		: z = 'Collecte Mémoire vive' ; break
	case 'cp' 		: z = 'Carte postale ancienne' ; break
	case 'crpf'		: z = '&copy; CRPF' ; break
	case 'da' 		: z = '&copy; D. Ablitzer' ; break
	case 'dlo' 		: z = '&copy; Dr Lucien Olivier' ; break
	case 'dm'       : z = '&copy; D. Magnin' ; break
	case 'ds' 		: z = '&copy; Daniel Sirugue' ; break
	case 'eg' 		: z = '&copy; Elodie Gilard' ; break
	case 'el' 		: z = '&copy; Eric de Laclos' ; break
	case 'es' 		: z = '&copy; Emilie Sauvage' ; break
	case 'fb'       : z = '&copy; Francis Billault' ; break
	case 'fc'       : z = '&copy; Frédérique Cocheril' ; break
	case 'fs'		: z = '&copy; François Schwaab' ; break
	case 'fr'       : z = '&copy; Frédéric Refait' ; break
	case 'ft'       : z = '&copy; Frédéric Tillier' ; break
	case 'gc'		: z = '&copy; Gérard Chaventon' ; break
	case 'gl'		: z = '&copy; Gabriel Lhenri' ; break
	case 'gp'		: z = '&copy; Ginette Picard' ; break
	case 'hj'		: z = '&copy; Hervé Jacob' ; break
	case 'jb'		: z = '&copy; Jacqueline Bernard' ; break
	case 'jc'		: z = 'Dessin &copy; Jean Chevallier' ; break
	case 'jc2'		: z = '&copy; Jean Cottin' ; break
	case 'jl'		: z = '&copy; Jean Leger' ; break
	case 'jpe'		: z = '&copy; JP Ehrmann' ; break
	case 'jpj'		: z = '&copy; Dechaume-Lagey' ; break
	case 'js'       : z = '&copy; Janick Sanson' ; break
	case 'kc'       : z = '&copy; Capucine Crosnier' ; break
	case 'ld'		: z = '&copy; Laetitia Daget' ; break
	case 'lp'       : z = '&copy; Laurent Paris' ; break
	case 'mairie'	: z = '&copy; Mairie' ; break
	case 'mb'		: z = '&copy; Michel Belin' ; break
	case 'mub'		: z = '&copy; Murielle Boudard' ; break
	case 'mc'		: z = '&copy; InSitu+Com&Graph' ; break
	case 'mm'		: z = '&copy; Marguerite Montes' ; break
	case 'mnatp'	: z = '&copy; Musée national des Arts et Traditions Populaires' ; break
	case 'mp'		: z = '&copy; Michelle Perault' ; break
	case 'mv'		: z = '&copy; Mémoire vive' ; break	
	case 'np'		: z = '&copy; Nadine Paul' ; break
	case 'nv'		: z = '&copy; Nicolas Varanguin (SHNA)' ; break
	case 'ob'       : z = '&copy; Olivier Bardet' ; break
	case 'omnes'       : z = '&copy; Denis Omnes' ; break
	case 'p21'		: z = 'Atelier Delarozière &copy; Inventaire général' ; break
	case 'p58'		: z = 'M.E. Desmoulins &copy; Inventaire général' ; break
	case 'pg'		: z = '&copy; Philippe Guilbert' ; break
	case 'pga'		: z = '&copy; Philippe Garguil' ; break
	case 'ph'		: z = '&copy; Philippe Hoeltzel' ; break
	case 'phg'		: z = '&copy; Philippe Gayet' ; break
	case 'phl'		: z = '&copy; Philippe Leroy' ; break
	case 'phm'		: z = '&copy; Philippe Memet' ; break
	case 'pm'		: z = '&copy; PNRM' ; break
	case 'pnrm'		: z = '&copy; PNRM' ; break
	case 'pp'		: z = '&copy; Philippe Pulce' ; break
	case 'rb'		: z = '&copy; Robert Bezard' ; break
	case 'rg'		: z = '&copy; René Goguey' ; break
	case 'rgi'		: z = '&copy; Rémy Gillard' ; break
	case 'rr'		: z = '&copy; R. Rosoux' ; break
	case 'rv'		: z = '&copy; René Viard' ; break
	case 'sb1'		: z = '&copy; Serge Bernard' ; break
	case 'sb'		: z = '&copy; Sylvain Bellenfant' ; break
	case 'sg1'      : z = '&copy; Sophie Guibon' ; break
	case 'sg'       : z = '&copy; Sylvain Guillebault' ; break
	case 'si'		: z = '&copy; Syndicat d initiatives' ; break
	case 'sl'		: z = '&copy; Serge Lemercier' ; break
	case 'sn'		: z = '&copy; Confrérie Saint-Nicolas Clamecy' ; break
	case 'sr'		: z = '&copy; Stéphane Roué (SHNA)' ; break
	case 'vh'		: z = '&copy; Vincent Houis' ; break
	default			: z = '&copy; ' + x[2] ; break
	}

	if (style == 1){
		y = '<b>' + x[1].charAt(0).toUpperCase() + x[1].substr(1) + '</b>' ;
	}
	else  {
		y = x[1].charAt(0).toUpperCase() + x[1].substr(1) ;
	}
	if (z!='') {
		y += ' (' + z + ')';
	}
	return y
}
