// voir les : AJOUT

if (typeof dhtmlwindow=="undefined")
alert('ERROR: Modal Window')

var dhtmlmodal={
veilstack: 0,
open:function(t, contenttype, contentsource, title, attr, recalonload){
	if(this.veilstack>0) this.closeveil();
	var d=dhtmlwindow //reference dhtmlwindow object
	this.interVeil=document.getElementById("interVeil") //Reference "veil" div
	this.veilstack++ //var to keep track of how many modal windows are open right now
	this.loadveil()
	if (recalonload=="recal" && d.scroll_top==0)
		d.addEvent(window, function(){dhtmlmodal.adjustveil()}, "load")
	var t=d.open(t, contenttype, contentsource, title, attr, recalonload)
	t.controls.firstChild.style.display="none" ;//Disable "minimize" button
	
var duo=contentsource.substring(0,contentsource.indexOf("/"));
	t.controls.onclick=function(){document.getElementById('loupe').style.display = 'none'; dhtmlmodal.close(this._parent, true); document.getElementById('menuf').src = 'modal_win/blk.htm';} //AJOUT
	t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
	t.hide=function(){dhtmlmodal.close(this);} //OVERWRITE default t.hide() method with new one
	this.interVeil.onclick=function(){t.controls.onclick()}
return t
},


loadveil:function(){
	var d=dhtmlwindow
	d.getviewpoint()
	this.docheightcomplete=(d.standardbody.offsetHeight>d.standardbody.scrollHeight)? d.standardbody.offsetHeight : d.standardbody.scrollHeight
	this.interVeil.style.width=(d.docwidth+20)+"px" //+"20px" //set up veil over page
	this.interVeil.style.height=this.docheightcomplete+"px" //set up veil over page
	this.interVeil.style.left=0 //Position veil over page
	this.interVeil.style.top=0 //Position veil over page
	this.interVeil.style.visibility="visible" //Show veil over page
	this.interVeil.style.display="block" //Show veil over page
	this.interVeil.style.cursor="pointer" //AJOUT
	this.interVeil.title='www.immo-forum.fr' //AJOUT
//	Fermer=function(){this.interVeil.title='Fermer ce programme'}
},

adjustveil:function(){ //function to adjust veil when window is resized
	if (this.interVeil && this.interVeil.style.display=="block") //If veil is currently visible on the screen
		this.loadveil() //readjust veil
},

closeveil:function(){ //function to close veil
	this.veilstack--
	if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
		this.interVeil.style.display="none"
},

//AJOUT 1 : pour si page introuvable ou url dans iframe est de site exterieur : fermer quand meme
// try{
//	t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe
//	}
//	catch(e){}

close:function(t, forceclose){ //DHTML modal close function
 // Début de AJOUT 1
if (document.all) {
try{
	t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe
}
	catch(e){}
	}  // Fin de AJOUT 1

	if ((typeof forceclose!="undefined"))
		t.onclose=function(){return true}
	if (dhtmlwindow.close(t)) //if close() returns true
		this.closeveil();
},


show:function(t){
	dhtmlmodal.veilstack++
	dhtmlmodal.loadveil()
	dhtmlwindow.show(t)
}
} //END object declaration


document.write('<div id="interVeil"></div>')
dhtmlwindow.addEvent(window, function(){if (typeof dhtmlmodal!="undefined") dhtmlmodal.adjustveil()}, "resize")