function confirmation(form, message){
	if(window.confirm(message)){
		str = "document."+form+".submit()";
		eval(str);
	}
}

//empeche le clic droit
function ejs_nodroit(){
	return(false);
}
document.oncontextmenu = ejs_nodroit;


function choixImg(id, nbImg, cheminImg, imgClass, titre, auteur){
	with(document){
		var radioBtn = getElementById('radio_'+id);
		var imgSel = getElementById('img_'+id);
		radioBtn.checked = true;
		for(var i = 0; i <nbImg ; i++){
			var img = getElementById('img_'+i);
			img.className = "";
		}
		imgSel.className = "imgSelection";
		var apercuImgSel = getElementById('apercuImg');
		apercuImgSel.src = cheminImg;
		apercuImgSel.className = imgClass;
		var lienTelechargement = getElementById('lientelechargement');
		var lienEcard = getElementById('lienEcard');
		var intro = getElementById('intro_ensouvenir');
		intro.style.display = 'none';
		lienTelechargement.style.display = 'block';
		lienTelechargement.href = "telechargement.php?img="+cheminImg;
		lienEcard.style.display = 'block';
		lienEcard.href = "accueil.php?p=cartePostale&img="+cheminImg+"&titre="+titre+"&auteur="+auteur;
	}
}


/*Fonction utilisez pour affiché et cahcé des informations dans la visite libre*/
function afficheInfoVL(info){
	with(document){
		//image du point d'interrogation
		divAide = getElementById('aide');
		divAide.className = 'cache';
		//block contenant les information
		divInfo = getElementById('information');
		divInfo.className = 'visible';
		//texte à afficher
		divText = getElementById(info);
		divText.className = 'visible';
	}

}
function cacheInfoVL(info){
	with(document){
		//image du point d'interrogation
		divAide = getElementById('aide');
		divAide.className = 'visible';
		//block contenant les information
		divInfo = getElementById('information');
		divInfo.className = 'cache';
		//texte à afficher
		divText = getElementById(info);
		divText.className = 'cache';
	}

}

/*Montre / Cache un div*/
function DivStatus( nom, numero ){
	var divID = nom + numero;
	if ( document.getElementById && document.getElementById( divID ) ) // Pour les navigateurs récents
	{
		Pdiv = document.getElementById( divID );
		PcH = true;
	}
	else if ( document.all && document.all[ divID ] ) // Pour les veilles versions
	{
		Pdiv = document.all[ divID ];
		PcH = true;
	}
	else if ( document.layers && document.layers[ divID ] ) // Pour les très veilles versions
	{
		Pdiv = document.layers[ divID ];
		PcH = true;
	}
	else
	{
		PcH = false;
	}
	if ( PcH )
	{
		Pdiv.className = ( Pdiv.className == 'cachediv' ) ? 'montrediv' : 'cachediv';
	}
}
function changeOnglet(fiche){
	with(document){
		var contenu;
		var onglet;
		if(fiche == 'visiteLibre'){
			window.location.replace('accueil.php?p=recherche&tr=t&lettre=a&deb=0');
		}
		else{
			if ( getElementById && getElementById( 'visiteLibre' ) ){
				contenu = getElementById( 'visiteLibre' );
				onglet = getElementById( 'ongletvisiteLibre' );
				contenu.className = 'contenuInvisible';
				onglet.className = 'ongletInactif';
			}
			
			if ( getElementById && getElementById( 'rechercheAvancee' ) ){
				contenu = getElementById( 'rechercheAvancee' );
				onglet = getElementById( 'ongletrechercheAvancee' );
				contenu.className = 'contenuInvisible';
				onglet.className = 'ongletInactif';
			}
			if ( getElementById && getElementById( 'rechercheGuidee' ) ){
				contenu = getElementById( 'rechercheGuidee' );
				onglet = getElementById( 'ongletrechercheGuidee' );
				contenu.className = 'contenuInvisible';
				onglet.className = 'ongletInactif';
			}
			if ( getElementById && getElementById( 'rechercheTitre' ) ){
				contenu = getElementById( 'rechercheTitre' );
				onglet = getElementById( 'ongletrechercheTitre' );
				contenu.className = 'contenuInvisible';
				onglet.className = 'ongletInactif';
			}
			if ( getElementById && getElementById( fiche ) ){
				div = getElementById( fiche );
				div.className = 'contenuVisible';
				onglet = getElementById('onglet'+fiche);
				onglet.className = 'ongletActif';
			}
		}
	}
}

function afficheInfo(id){
	with(document){
		if ( getElementById && getElementById( id ) ){
			info = getElementById( id );
			info.className = "infoVisible";
		}
	}
}
function cacheInfo(id){
	with(document){
		if ( getElementById && getElementById( id ) ){
			info = getElementById( id );
			info.className = "infoCachee";
		}
	}
}

function MajMotCle(id){
	with (document)
	{
		if(id = 1){
			var numMot1 = choix1.mot_niveau_1.options[choix1.mot_niveau_1.selectedIndex].value;
			if(numMot1 == -1){
				window.location.replace("accueil.php?p=recherche&o=3");
			}
			else{
				if(numMot1 != "")
					window.location.replace("accueil.php?p=recherche&o=3&m1="+numMot1);
				else
					window.location.replace("accueil.php?p=recherche&o=3");
			}
		}
		if(id = 2){
			var numMot1 = choix1.mot_niveau_1.options[choix1.mot_niveau_1.selectedIndex].value; 
			var numMot2 = choix2.mot_niveau_2.options[choix2.mot_niveau_2.selectedIndex].value;
			if(numMot2 == -1){
				window.location.replace("accueil.php?p=recherche&o=3&m1="+numMot1);
			}
			else{
				if(numMot2 != "")
					window.location.replace("accueil.php?p=recherche&o=3&m1="+numMot1+"&m2="+numMot2);
				else
					window.location.replace("accueil.php?p=recherche&o=3&m1="+numMot1);
			
			}
		}
	}
}

function clignotement(id,timer){
	elmnt = document.getElementById(id);
	if(elmnt .className == "champ"){
		elmnt.className = "champColor";
	}
	else{
		elmnt.className = "champ";
	}
	clearInterval(timer);
}
function clignotement2(id,timer){
	elmnt = document.getElementById(id);
	if(elmnt .className == "champ_date" ){
		elmnt.className = "champColor2";
	}
	else{
		elmnt.className = "champ_date";
	}
	clearInterval(timer);
}

function adDomaine(){
	with(document){
		var domaine = rechercheAvancee.domaine.options[rechercheAvancee.domaine.selectedIndex].value;
		if(critere_recherche.domaine.value != "")
			critere_recherche.domaine.value = critere_recherche.domaine.value+" ; "+domaine;
		else
			critere_recherche.domaine.value = domaine;
		rechercheAvancee.domaine.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement('critere1', timer)", 500);
		timer1 = setInterval("clignotement('critere1', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere1', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere1', timer3)", 2000);
	}
		
}
function adArtiste(){
	with(document){
		var artiste = rechercheAvancee.artiste.options[rechercheAvancee.artiste.selectedIndex].value;
		if(critere_recherche.artiste.value != "")
			critere_recherche.artiste.value = critere_recherche.artiste.value+" ; "+artiste;
		else
			critere_recherche.artiste.value = artiste;
		rechercheAvancee.artiste.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement('critere2', timer)", 500);
		timer1 = setInterval("clignotement('critere2', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere2', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere2', timer3)", 2000);
	}
		
}
function adMillenaire(){
	with(document){
		var valeur_millenaire = rechercheAvancee.millenaire.options[rechercheAvancee.millenaire.selectedIndex].value;
		var intitule_millenaire = rechercheAvancee.millenaire.options[rechercheAvancee.millenaire.selectedIndex].title;
		var y=document.createElement('option');
		y.text = intitule_millenaire;
		y.title = intitule_millenaire;
		critere_recherche.affich_millenaire.add(y);
		if(critere_recherche.millenaire.value != "")
			critere_recherche.millenaire.value = critere_recherche.millenaire.value+" ; "+valeur_millenaire;
		else
			critere_recherche.millenaire.value = valeur_millenaire;
		rechercheAvancee.millenaire.value = "";
		
		//On fait clignoter le champ
		timer = setInterval("clignotement2('critere3_millenaire', timer)", 500);
		timer1 = setInterval("clignotement2('critere3_millenaire', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere2', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere2', timer3)", 2000);
	}
}
function adSiecle(){
	with(document){
		var valeur_siecle = rechercheAvancee.siecle.options[rechercheAvancee.siecle.selectedIndex].value;
		var intitule_siecle = rechercheAvancee.siecle.options[rechercheAvancee.siecle.selectedIndex].title;
		var y=document.createElement('option');
		y.text = intitule_siecle;
		y.title = intitule_siecle;
		critere_recherche.affich_siecle.add(y);
		if(critere_recherche.siecle.value != "")
			critere_recherche.siecle.value = critere_recherche.siecle.value+" ; "+valeur_siecle;
		else
			critere_recherche.siecle.value = valeur_siecle;
		rechercheAvancee.siecle.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement2('critere3_siecle', timer)", 500);
		timer1 = setInterval("clignotement2('critere3_siecle', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere2', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere2', timer3)", 2000);
	}
}
function adAnnee(){
	with(document){
		var valeur_annee = rechercheAvancee.annee.options[rechercheAvancee.annee.selectedIndex].value;
		var intitule_annee = rechercheAvancee.annee.options[rechercheAvancee.annee.selectedIndex].title;
		var option=document.createElement('option');
		option.text = intitule_annee;
		option.title = intitule_annee;
		critere_recherche.affich_annee.add(option);
		if(critere_recherche.annee.value != "")
			critere_recherche.annee.value = critere_recherche.annee.value+" ; "+valeur_annee;
		else
			critere_recherche.annee.value = valeur_annee;
		rechercheAvancee.annee.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement2('critere3_annee', timer)", 500);
		timer1 = setInterval("clignotement2('critere3_annee', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere2', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere2', timer3)", 2000);
	}
}

function adPeriode(){
	with(document){
		var periode_creation = rechercheAvancee.periode_creation.options[rechercheAvancee.periode_creation.selectedIndex].value;
		if(critere_recherche.periode_creation.value != "")
			critere_recherche.periode_creation.value = critere_recherche.periode_creation.value+" ; "+periode_creation;
		else
			critere_recherche.periode_creation.value = periode_creation;
		rechercheAvancee.periode_creation.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement('critere4', timer)", 500);
		timer1 = setInterval("clignotement('critere4', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere3', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere3', timer3)", 2000);
	}
}
function adDonation(){
	with(document){
		var donation = rechercheAvancee.donation.options[rechercheAvancee.donation.selectedIndex].value;
		if(critere_recherche.donation.value != "")
			critere_recherche.donation.value = critere_recherche.donation.value+" ; "+donation;
		else
			critere_recherche.donation.value = donation;
		rechercheAvancee.donation.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement('critere5', timer)", 500);
		timer1 = setInterval("clignotement('critere5', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere4', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere4', timer3)", 2000);
	}
}
function adMouvement(){
	with(document){
		var courant = rechercheAvancee.courant.options[rechercheAvancee.courant.selectedIndex].value;
		if(critere_recherche.courant.value != "")
			critere_recherche.courant.value = critere_recherche.courant.value+" ; "+courant;
		else
			critere_recherche.courant.value = courant;
		rechercheAvancee.courant.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement('critere6', timer)", 500);
		timer1 = setInterval("clignotement('critere6', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere5', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere5', timer3)", 2000);
	}
}

function adMotCle(){
	with(document){
		var mot_cle = rechercheAvancee.mot_cle.value;
		if(critere_recherche.mots_cles.value != "")
			critere_recherche.mots_cles.value = critere_recherche.mots_cles.value+" ; "+mot_cle;
		else
			critere_recherche.mots_cles.value = mot_cle;
		rechercheAvancee.mot_cle.value = "";
		//On fait clignoter le champ
		timer = setInterval("clignotement('critere7', timer)", 500);
		timer1 = setInterval("clignotement('critere7', timer1)", 1000);
		//timer2 = setInterval("clignotement('critere6', timer2)", 1500);
		//timer3 = setInterval("clignotement('critere6', timer3)", 2000);
	}
}
function clearField(id){
	with(document){
		if(getElementById && getElementById(id)){
			var field = getElementById(id);
			field.value = "";
		}
	}
}
function clearSelect(id){
	with(document){
		if(getElementById && getElementById(id)){
			var select = getElementById(id);
			for (i=select.length ; i > 0 ;i--){
				select.remove(select.options[i]);
			}

		}
	}
}

function changeFiche(fiche){
	with(document){
		if ( getElementById && getElementById( fiche ) )
		{
			fiche_courante = getElementById( fiche );
			if(fiche_courante.style.display = 'none'){
				if(fiche == 'fichedescriptive'){
					fiche_inv = getElementById( 'fichedescriptive' );
					fiche_vis = getElementById( 'fichedetaillee' );
					ong_not_sel = getElementById( 'ongletFDes' );
					ong_sel = getElementById( 'ongletFDet' );
					
				}
				if(fiche == 'fichedetaillee'){
					fiche_inv = getElementById( 'fichedetaillee' );
					fiche_vis = getElementById( 'fichedescriptive' );
					ong_not_sel = getElementById( 'ongletFDet' );
					ong_sel = getElementById( 'ongletFDes' );
				}
				fiche_inv.style.display = 'block';
				fiche_inv.style.visibility = 'visible';
				fiche_vis.style.display = 'none';
				fiche_vis.style.visibility = 'hidden';
				ong_sel.className = 'ongletnotselected';
				ong_not_sel.className = 'ongletselected';
			}
		}
	}
}

function changeLienRenseignement(lienActif){
	with(document){
		var lien = getElementById("lienDescriptif");
		lien.className = "";
		lien = getElementById("lienHistorique");
		lien.className = "";
		lien = getElementById("lienBiographie");
		lien.className = "";
		lien = getElementById("lienAnnexes");
		lien.className = "";
		lien = getElementById(lienActif);
		lien.className = "lienRenseignementActif";
	}
}

function changePhoto(sensChangement, numPhoto){
	with(document){
		var nomPhoto;
		nomPhoto = "photo"+numPhoto;
		if ( getElementById && getElementById( nomPhoto ) ){
			var photoCourante;
			var numPhoto2;
			var nomPhoto2;
			photoCourante = getElementById(nomPhoto);
			if(sensChangement == 'suivant'){
				numPhoto2 = numPhoto+1;
				
			}
			else if (sensChangement == 'precedent'){
				numPhoto2 = numPhoto-1;
			}
				
			nomPhoto2 = "photo"+numPhoto2;
			
			if ( getElementById && getElementById( nomPhoto2 ) ){
				var photo2;
				//on cache la photo courante
				photoCourante.className = 'photoinvisible';
				
				
				//on affiche la photo suivante
				photo2 = getElementById( nomPhoto2 );
				
				photo2.className = 'photovisible';
			
			}
		}
	}
}

function changeRenseignement(div){
	with(document){
		var contenu;
		if ( getElementById && getElementById( 'descriptifoeuvre' ) ){
			contenu = getElementById( 'descriptifoeuvre' );
			contenu.style.display = 'none';
			contenu.style.visibility = 'hidden';
		}
		if ( getElementById && getElementById( 'acquisition' ) ){
			contenu = getElementById( 'acquisition' );
			contenu.style.display = 'none';
			contenu.style.visibility = 'hidden';
		}
		if ( getElementById && getElementById( 'biographie' ) ){
			contenu = getElementById( 'biographie' );
			contenu.style.display = 'none';
			contenu.style.visibility = 'hidden';
		}
		if ( getElementById && getElementById( 'renseignementannexe' ) ){
			contenu = getElementById( 'renseignementannexe' );
			contenu.style.display = 'none';
			contenu.style.visibility = 'hidden';
		}
		if ( getElementById && getElementById( div ) ){
			div = getElementById( div );
			div.style.display = 'block';
			div.style.visibility = 'visible';
		}
	}
}

function montre(divID){
	if ( document.getElementById && document.getElementById( divID ) ) // Pour les navigateurs récents
	{
		Pdiv = document.getElementById( divID );
		if(Pdiv.style.visibility = 'hidden'){
			Pdiv.style.display = 'block';
			Pdiv.style.visibility = 'visible';
		}
	}
}
function cache(divID){
	if ( document.getElementById && document.getElementById( divID ) ) // Pour les navigateurs récents
	{
		Pdiv = document.getElementById( divID );
		if(Pdiv.style.visibility = 'visible'){
			Pdiv.style.display = 'none';
			Pdiv.style.visibility = 'hidden';
		}
	}
}

function MajAperçu(photo, img, id){
	if ( document.getElementById && document.getElementById( img ) ){
		var imgsrc = 'file:///'+document.getElementById(photo+"_"+id).value;
		document.getElementById(img).src = imgsrc;
		//document.write(document.getElementById(img).src);
	}
	
}

function setChemin(numPhoto, numParagraphe){
	with(document){
		var chemin = "";
		var instr = "";
		instr = 'chemin = form_modif_page.photo'+numPhoto+'_'+numParagraphe+'.value';
		eval(instr);
		instr = 'form_modif_page.chemin_photo'+numPhoto+'_'+numParagraphe+'.value = chemin';
		eval(instr);
	}
}
/**
	Frédéric Saunier
	http://www.tekool.net/javascript/backtothehtml

	This program is part of a free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

**/

/*****************************************************************************
* BackToTheHtml Command
*///**************************************************************************
function BackToTheHtml(node)
{
	if(node == null)
		this.node = document; 
	else
		this.node = node; 
};
BackToTheHtml.prototype.node = null;

BackToTheHtml.prototype.execute = function()
{
	this.activateObject();
}

BackToTheHtml.prototype.activateObject = function(domObject)
{
	var aDomObject = this.node.getElementsByTagName('object');
	var activationObject;
	for(var i=0; i<aDomObject.length; i++)
		if
		(
			aDomObject[i].getAttributeNode('BackToTheHtml') == null
			&&
			(activationObject = this.getActivationObject(aDomObject[i])) != null
		)
			activationObject.execute();
};

BackToTheHtml.prototype.getActivationObject = function(domObject)
{
	var classid = domObject.classid.toUpperCase().substr('clsid:'.length);
	var mimeType = domObject.type.toLowerCase();

	switch(true)
	{
		case 
			classid == 'D27CDB6E-AE6D-11CF-96B8-444553540000' 
			||
			mimeType == 'application/x-shockwave-flash'
		:
			return new ActivateObjectFlash(domObject);

		default :
			return null;
	}
};

BackToTheHtml.uniqueID = function(prefix)
{
	var sPrefix;
	if(prefix == null)
		sPrefix = 'uniqueId';
	else
		sPrefix = prefix;
		
	var i=0;
	while(document.getElementById(sPrefix + (i++)))
		;
	return sPrefix + (i-1);
};

BackToTheHtml.isParentOf = function(parent,child)
{
	var found = false;
	for(var i=0; i<parent.childNodes.length; i++)
		if(parent.childNodes[i] == child)
			return true;
		else
			found = arguments.callee(parent.childNodes[i],child);

	return found;
}

/*****************************************************************************
* ActivateObject Command
*///**************************************************************************
function ActivateObject(domObject)
{
	this.domObject = domObject;
}

ActivateObject.prototype.domObject = null;
ActivateObject.prototype.classid = null;
ActivateObject.prototype.aHtmlAttribute = ['accessKey','align','alt','archive','border','code','codeBase','codeType','declare','dir','height','hideFocus','hspace','lang','language','name','standby','tabIndex','title','useMap','vspace','width'];
ActivateObject.prototype.aObjectProperty = null;

ActivateObject.prototype.execute = function()
{
	this.xndObjectId = BackToTheHtml.uniqueID();
	this.setTextHtml();
	this.writeObject();

	this.xndObject = document.getElementById(this.xndObjectId);
	this.setSpecialProperties();
	this.removeOriginalObject();
}

ActivateObject.prototype.setTextHtml = function()
{
	var str = '';
	str += '<object BackToTheHtml ' + '\n';
	str += ' classid="clsid:' + this.classid + '" ' + '\n';

	//Add HTML attributes to the <object> tag
	for(var i=0; i<this.aHtmlAttribute.length; i++)
	{
		var name = this.aHtmlAttribute[i];
		if(typeof this.domObject[name] != 'undefined' && this.domObject[name].toString() != '')
			str += '\t' + name + '="' + this.domObject[name].toString() + '" ' + '\n';
	}

	str += 'id="' + this.xndObjectId + '" ' + '\n';
	str += '>';

	for(var i=0; i<this.aObjectProperty.length; i++)
	{
		var name = this.aObjectProperty[i];
		if(typeof this.domObject[name] != 'undefined' && this.domObject[name].toString() != '' )
			str += '\t<param name="' + name + '" value="' + this.domObject[name].toString() + '"></param>' + '\n';
	}
	str += '</object>';

	this.textHtml = str;
};

ActivateObject.prototype.writeObject = function()
{
	this.domObject.insertAdjacentHTML("afterEnd",this.textHtml);
};

ActivateObject.prototype.setSpecialProperties = function()
{
	if(typeof this.domObject.className != 'undefined' && this.domObject.className.toString() != '')
		this.xndObject.className = this.domObject.className

	if(typeof this.domObject.style.cssText != 'undefined' && this.domObject.style.cssText.toString() != '')
		this.xndObject.style.cssText = this.domObject.style.cssText;

	if(typeof this.domObject.SWRemote != 'undefined' && this.domObject.SWRemote.toString() != '')
		this.xndObject.FlashVars = this.domObject.SWRemote;

	if(typeof this.domObject.codebase == 'undefined' || this.domObject.codebase.toString() == '')
		this.xndObject.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0';

	if(typeof this.domObject.id != 'undefined' && this.domObject.id.toString() != '')
		this.xndObject.id = this.domObject.id;

};

ActivateObject.prototype.removeOriginalObject = function()
{
	this.domObject.parentNode.removeChild(this.domObject);
};

/*****************************************************************************
* ActivateObjectFlash Command
*///**************************************************************************
function ActivateObjectFlash(domObject)
{
	ActivateObject.call(this,domObject);
}
ActivateObjectFlash.prototype = new ActivateObject;
ActivateObjectFlash.prototype.aObjectProperty = ['FrameNum','Playing','Quality','Quality2','Scalemode','Scale','AlignMode','SAlign','BackgroundColor','BGColor','Loop','Movie','WMode','Base','DeviceFont','EmbedMovie','SWRemote','FlashVars','AllowScriptAccess'];
ActivateObjectFlash.prototype.classid = 'D27CDB6E-AE6D-11CF-96B8-444553540000';


/*****************************************************************************
* Script initialisation
*///**************************************************************************
if(typeof ActiveXObject != 'undefined' && typeof Function.call != 'undefined')
{
	var styleId = BackToTheHtml.uniqueID();
	document.write('<style id="' + styleId + '" ></style>');
	var domStyle = document.getElementById(styleId);

	var isHead = false;
	var aHead = document.getElementsByTagName('head');
	for(var i=0; i<aHead.length; i++)
		if(BackToTheHtml.isParentOf(aHead[i],domStyle))
			isHead = true;

	if(isHead)
	{
		document.write('<style type="text/css">OBJECT{visibility:hidden;}</style>');
		document.onreadystatechange = function()
		{
			if(document.readyState == 'complete')
			{
				new BackToTheHtml().execute();
				document.styleSheets[document.styleSheets.length-1].addRule("OBJECT","visibility:visible;");
				//alert('head');
				//alert(document.body.innerHTML);
			}
		}
	}
	else
	{
		new BackToTheHtml().execute();
		//alert('body');
		//alert(document.body.innerHTML);
	}
	
	domStyle.parentNode.removeChild(domStyle);
}