

//----------------------------functions Dreamweaver----------------------------------
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 preloadimages() { //v1 from Yannick
	imagesrc=new Array();for (i=0; i<preloadlist.length; i++){imagesrc[i]=new Image; imagesrc[i].src=preloadlist[i]}}


function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

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];}
}
//---------------------------------------------------------------------------------------

if (loaded) { document.location.reload() }

function checkBrowser(){
	this.name = navigator.appName.toLowerCase();
	this.ver=navigator.appVersion;
	this.uA = navigator.userAgent.toLowerCase();
	this.dom=document.getElementById?true:false;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?true:false;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?true:false;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?true:false;
	this.ie4=(document.all && !this.dom)?true:false;
	this.mac=this.uA.indexOf("mac")>-1?true:false;
	this.win=this.uA.indexOf("win")>-1?true:false;
	this.ie4mac=this.ie4 && this.mac;
	this.ie5mac=this.ie5 && this.mac;
	this.ns6=(this.uA.indexOf("netscape6")>0) ? true:false;
	this.moz = !this.ns6 && (this.uA.indexOf("mozilla/5")>-1) ? true:false;
	this.ns4=(this.name.indexOf("netscape")>-1 && !this.dom)?true:false;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) && !this.ie4mac;
	this.ie=(this.ie4 || this.ie5 || this.ns6 || this.moz || this.ie6 || this.ie7);
	return this
	}

var is = new checkBrowser();


// sorryPage

//if ( ( ( !is.mac && !is.win ) || ( !is.ie && !is.ns4) ) && document.location.href.indexOf("/antoine/Teasing/sorry.html")==-1 ) document.location = "/antoine/Teasing/sorry.html";

//if ( ( ( !is.mac && !is.win ) || ( !is.ie && !is.ns4 && !is.moz) || is.ns6 ) && document.location.href.indexOf("/antoine/Teasing/sorry.html")==-1 ) document.location = "/antoine/Teasing/sorry.html";


if (is.ns4)
	{ doc="document";sty="";htm=".document";Visible="show";	Hidden="hide";xpos = "e.pageX";	ypos = "e.pageY";
this.captureEvents(Event.RESIZE);
this.onresize = reloadlapage
}

if (is.ie) { doc="document.all";sty=".style";htm="";Visible="visible";Hidden="hidden";xpos = "event.x";ypos = "event.y"; }

var loaded=true

function reloadlapage()
	{
                top.document.location.reload(true)
	}


function getTop ( Layer ) {
	
if (is.ie) {  return parseInt(Layer.style.top ) ; }

if (is.ns4) 	{ return parseInt( Layer.top ); }

}


function getLeft ( Layer ) {
	
if (is.ie) { return parseInt( Layer.style.left ) ; }

if (is.ns4) 	{ return parseInt( Layer.left ) ; }

}

function getHeight(layer) {

  if (is.ns4) {
    if (layer.document.height)
      return layer.document.height;
    else
      return layer.clip.bottom - layer.clip.top;
  }
  if (is.ie) {
    if (layer.style.pixelHeight)
     	 return layer.style.pixelHeight;
    else if (layer.clientHeight)
      	return layer.clientHeight;
	else
		return layer.scrollHeight;
  }
  return -1;
}

function getWidth(layer) {

  if (is.ns4) {
    if (layer.document.width)
      return layer.document.width;
    else
      return layer.clip.right - layer.clip.left;
  }
  if (is.ie) {
    if (layer.style.pixelWidth)
      return layer.style.pixelWidth;
    else
      return layer.clientWidth;
  }
  return -1;
}



function ReSize( Layer , w,h) {
  if (is.ns4)
{
    Layer.resizeTo( w  ,  h );
  
}
  if (is.ie){					
   Layer.style.width = w;  
    Layer.style.height = h;
    }
}





function affiche()
	{
	for (tr=0; tr<arguments.length; tr++)
		{
		is.ns6 ? calque_local=document.getElementById(arguments[tr]) : calque_local=MM_findObj(arguments[tr], self.document);
		if (calque_local) calque_local.style.display = "block";
			{
			if (is.ie) calque_local.style.visibility="visible";
			if (is.ns4) calque_local.visibility="show";
			}
		}
	}

function masque()
	{
	for (tr=0; tr<arguments.length; tr++)
		{
		is.ns6 ? calque_local=document.getElementById(arguments[tr]) : calque_local=MM_findObj(arguments[tr], self.document);
		if (calque_local) calque_local.style.display = "none";
			{
			if (is.ie) calque_local.style.visibility="hidden"
			if (is.ns4) calque_local.visibility="hide"
			}
		}
	}

function MoveTo(leLayer, x, y)
	{ //positionne le coin haut-gauche du layer en x,y

                is.ns6 ? calque_local=document.getElementById(leLayer) : calque_local=MM_findObj(leLayer, document) ;

	if (is.ns4)
		calque_local.moveTo(x, y);
	if (is.ie)
		{
		calque_local.style.left = x+"px";
		calque_local.style.top = y+"px";
		
		//calque_local.style.visibility = "hidden"
		//calque_local.style.visibility = "visible"
		}
	}

var animations=new Array()

function bougeDe(layerName,dx,dy,steps)
	{
	var cccalq
	is.ns6 ? cccalq=document.getElementById(layerName) : cccalq=MM_findObj(layerName, document) ;
	var noo=animations.length
	animations[animations.length]=cccalq
	if (is.ie) 		{ cccalq.style.visibility="visible" ; cccalq.absX=parseInt(cccalq.offsetLeft) ; cccalq.absY=parseInt(cccalq.offsetTop) }
	if (is.ns4) 	{cccalq.visibility="show" ; cccalq.absX=parseInt(cccalq.left) ; cccalq.absY=parseInt(cccalq.top) }
	dx/=steps
	dy/=steps
	cccalq.dx=dx; cccalq.dy=dy;  cccalq.step=steps
	animLayers()
	}

function bougeA(layerName,x,y,steps)
	{
	var cccalq
	is.ns6 ? cccalq=document.getElementById(layerName) : cccalq=MM_findObj(layerName, document) ;
	var noo=animations.length
	animations[animations.length]=cccalq
	if (is.ie) 		{ cccalq.style.visibility="visible" ; cccalq.absX=parseInt(cccalq.offsetLeft) ; cccalq.absY=parseInt(cccalq.offsetTop) }
	if (is.ns4) 	{cccalq.visibility="show" ; cccalq.absX=parseInt(cccalq.left) ; cccalq.absY=parseInt(cccalq.top) }
	dx=(x-cccalq.absX)/steps
	dy=(y-cccalq.absY)/steps
	cccalq.dx=dx; cccalq.dy=dy;  cccalq.step=steps
	animLayers()
	}

function animLayers()
	{
	var goon=false
	for (var klm=0;klm<animations.length;klm++)
		{
		var oLayer=animations[klm]
		if (oLayer.step>0)
			{
			oLayer.absX+=oLayer.dx
			oLayer.absY+=oLayer.dy
			if (is.ie) {
				oLayer.style.left=Math.round(oLayer.absX)
				oLayer.style.top=Math.round(oLayer.absY) }
			if (is.ns4)
				{
				oLayer.left=Math.round(oLayer.absX)
				oLayer.top=Math.round(oLayer.absY) }
			--oLayer.step; goon=true
			}
		}
	if (goon) { setTimeout("animLayers()",20) }
	}

function changeImage(layerName,imgName)
	{
	var imga
	is.ns6 ? imga=document.getElementById("img_"+layerName) : imga=MM_findObj("img_"+layerName, document) ;
	imga.src=imgName
	}
	
	
var scrollLayers = new Array()	
var currentScrollLayer
	
function choppeScrollCalque(layerName)
	{
	var zeCalque
	
	if (scrollLayers[layerName]) zeCalque = scrollLayers[layerName]
	else
		{
		zeCalque = MM_findObj(layerName)
		if (zeCalque)
			{
			zeCalque.scrollLayer = MM_findObj("sub"+layerName)
			
			zeCalque.scroll = false
			zeCalque.scrollSpeed = 1
			zeCalque.scrollSens = 0
			zeCalque.scrollInterval = 3			
			
			if (is.ie)
				{
				zeCalque.getH = function() {return getHeight ( zeCalque )}
					
				zeCalque.getY = function() {return this.scrollLayer.style.pixelTop}
				zeCalque.getX = function() {return this.scrollLayer.style.pixelLeft}
				
				zeCalque.realHeight = ( zeCalque.scrollLayer.scrollHeight ) ? zeCalque.scrollLayer.scrollHeight : getHeight ( zeCalque.scrollLayer ) ;
												
				zeCalque.scrollBy = function(dx,dy)
					{
					this.scrollLayer.style.pixelLeft = this.getX() + dx
					this.scrollLayer.style.pixelTop = this.getY() + dy
					this.scrollLayer.style.visibility = "hidden"
					this.scrollLayer.style.visibility = "inherit"
					}
					
				}
			if (is.ns4)
				{
				
				zeCalque.getY = function() { return parseInt ( this.scrollLayer.top ) }
				zeCalque.realHeight = getHeight ( zeCalque.scrollLayer )			
				zeCalque.scrollBy = function(dx,dy) {	this.scrollLayer.moveBy(parseInt(dx),parseInt(dy)) }
				zeCalque.getH = function() { return parseInt ( getHeight ( this ) ) }
				}
			}
			
		scrollLayers[layerName] = zeCalque
		}
	
	return zeCalque
	}
	
function scrollUp(layerName)
	{
	var zeCalque = choppeScrollCalque(layerName)
	if (zeCalque)
		{
		zeCalque.scroll = true
		zeCalque.scrollSens = 1
		
		currentScrollLayer = zeCalque
		doZeScroll(currentScrollLayer)
		}
	}
	
function scrollDown(layerName)
	{
	var zeCalque = choppeScrollCalque(layerName)
	if (zeCalque)
		{
		zeCalque.scroll = true
		zeCalque.scrollSens = -1
		
		currentScrollLayer = zeCalque
		doZeScroll(currentScrollLayer)
		}
	}
	
function doZeScroll(zeCalque)
	{
	if (zeCalque.scroll && ( (zeCalque.scrollSens>0 && zeCalque.getY()<0 ) || ( zeCalque.scrollSens<0 && ( ( zeCalque.realHeight+zeCalque.getY() )>zeCalque.getH() ) ) ) )
		{
		zeCalque.scrollBy(0,zeCalque.scrollSpeed*zeCalque.scrollSens)
		setTimeout("doZeScroll(currentScrollLayer)",zeCalque.scrollInterval)
		}
	}
	
function scrollStop(layerName)
	{
	var zeCalque = choppeScrollCalque(layerName)
	if (zeCalque)
		{
		zeCalque.scroll = false
		}
	}



// -----------------  fonctions pour le deplacement du footer ------------------
  
  var maxH=0
  
  function getPageHeight()
  	{
	if (is.ie)
		{
		var divs = document.all.tags("DIV")
		for (var i=0; i<divs.length; i++)
			{
			var localTop = getIEtop(divs[i])
			var localHeight = getIEheight(divs[i])
			if (localTop+localHeight>maxH) maxH = localTop+localHeight
			}	
		}
	if (is.ns4)
		{
		getNScontentHeight(document)
		}
	//return maxH
	}
  
  
  
 function getIEtop(calque)
  {
    y = 0;
    obj = calque;
    while (obj.offsetParent != null && obj.offsetParent !=document.body) {
      y += obj.offsetTop;
      obj = obj.offsetParent;
    }
    y += obj.offsetTop;
    return y;
  }
  
  function getIEheight(calque)
  	{
var zeHeight = 0
if (parseInt( calque.scrollHeight )>zeHeight ) zeHeight = parseInt( calque.scrollHeight )
if (parseInt( calque.clientHeight )>zeHeight ) zeHeight = parseInt( calque.clientHeight )
if (parseInt( calque.offsetHeight)>zeHeight ) zeHeight = parseInt( calque.offsetHeight)
	return zeHeight 	
	}
	
	
function getNStop(calque)
	{
	y = 0;
	return calque.top
	}
	
function getNScontentHeight(calque, previousTop)
	{
	if (!previousTop) previousTop = 0
	for (var i=0;i<calque.layers.length;i++)
		{
		localTop = previousTop + calque.layers[i].top
		var zeHeight = getHeight(calque.layers[i] )
		if (zeHeight+localTop>maxH) maxH = zeHeight+localTop
		getNScontentHeight(calque.layers[i].document , localTop)
		}
	}

var tblcount=0

function tbl2001()
{
if (is.ie)
{
if (event.ctrlKey && event.altKey) tblcount+=1
else tblcount=0
if (tblcount>10) { tblcount = 0 ; window.open("http://vip.tribalddb.fr/Tribal/grettings.html","grettings","width=500,height=400") }
}
}




// DRAG :

//Debug function ******************
function MessageBugs(txt){alert(txt); return false}

//Lib objects  ********************
function TheCalque(obj,nest){
  
  nest=(!nest) ? "":'document.'+nest+'.'
  this.evnt=is.dom? document.getElementById(obj):
    is.ie4?document.all[obj]:is.ns4?eval(nest+"document.layers." +obj):0;	
  if(!this.evnt) return MessageBugs('Le calque n\' existe pas ('+obj+')')
  
  this.css=is.dom||is.ie4?this.evnt.style:this.evnt; 
  this.ref=is.dom||is.ie4?document:this.css.document;
  this.x=parseInt(this.css.left)||this.css.pixelLeft||this.evnt.offsetLeft||0;
  this.y=parseInt(this.css.top)||this.css.pixelTop||this.evnt.offsetTop||0
  this.w=this.evnt.offsetWidth||this.css.clip.width||
    this.ref.width||this.css.pixelWidth||0; 
  this.h=this.evnt.offsetHeight||this.css.clip.height||
    this.ref.height||this.css.pixelHeight||0
  this.c=0 //Clip values
  if((is.dom || is.ie4) && this.css.clip) {
  this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); 
  this.c=this.c.split(' ');
  for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}
  }
  this.ct=this.css.clip.top||this.c[0]||0; 
  this.cr=this.css.clip.right||this.c[1]||this.w||0
  this.cb=this.css.clip.bottom||this.c[2]||this.h||0; 
  this.cl=this.css.clip.left||this.c[3]||0
  this.obj = obj + "Object"; eval(this.obj + "=this")
  return this
}


//Moving object to **************
TheCalque.prototype.moveIt = function(x,y){
  this.x=x;this.y=y; this.css.left=x;this.css.top=y
}


// DRAG DROP - DEBUT ----------------------------------------------------------------------
ddIsActive=0; dd_obj=0; dd_mobj=0
function DragDrop(){
  ddIsActive=1
  if(is.ns4){
    document.captureEvents(Event.MOUSEMOVE|Event.MOUSEDOWN|Event.MOUSEUP)
  }
  document.onmousemove=DragDrop_move;
  document.onmousedown=DragDrop_down
  document.onmouseup=DragDrop_up
}
TheCalque.prototype.dragdrop = function(obj){
  if(!ddIsActive) DragDrop()
  this.evnt.onmouseover=new Function("DragDrop_over("+this.obj+")")
  this.evnt.onmouseout=new Function("dd_mobj=0")
  if(obj) this.ddobj=obj
}
TheCalque.prototype.nodragdrop = function(){
  this.evnt.onmouseover=""; this.evnt.onmouseout=""
  dd_obj=0; dd_mobj=0
}
// DRAG DROP - FUNCTIONS GLOBALES -----------------------------------------------------------
function DragDrop_over(obj){dd_mobj=obj}
function DragDrop_up(e){dd_obj=0; if(is.ns4) routeEvent(e)}
function DragDrop_down(e){ //Mousedown
  if(dd_mobj){
    x=(is.ns4 || is.ns6)?e.pageX:event.x||event.clientX
    y=(is.ns4 || is.ns6)?e.pageY:event.y||event.clientY
    dd_obj=dd_mobj
    dd_obj.clX=x-dd_obj.x; 
    dd_obj.clY=y-dd_obj.y
  }
  if(is.ns4) routeEvent(e)
}
function DragDrop_move(e,y,rresize){ //Mousemove
  x=(is.ns4 || is.ns6)?e.pageX:event.x||event.clientX
  y=(is.ns4 || is.ns6)?e.pageY:event.y||event.clientY
  if(dd_obj){
    nx=x-dd_obj.clX; ny=y-dd_obj.clY
    if(dd_obj.ddobj) dd_obj.ddobj.moveIt(nx,ny)
    else dd_obj.moveIt(nx,ny)
  }
  if(!is.ns4) return false      
}



/*--------------------------------------------------------------------------------------------------*/

var ns4=(document.layers);
var ie4=(document.all&&!document.getElementById);
var ie5=(document.all&&document.getElementById);
var ns6=(!document.all&&document.getElementById);
var mac=(navigator.appVersion.indexOf("Mac")>=0)?1:0;
var dom=(document.getElementById)? 1:0;
var ie = (ie4 || ie5)?1:0;

function SesameFull(page){
	if(!mac){
		if(!ns4 && !ns6){
			//window.open(page,"pop","fullscreen=1");
			//window.open(page,"pop","scrollbars=0, menubar=0,location=0,status=0,toolbar=0");
			var largeurEcran = screen.availWidth-10
			var hauteurEcran = screen.availHeight-30
			param = "top=0,left=0,width="+largeurEcran+",height="+hauteurEcran+",scrollbars=0, menubar=0,location=0,status=0,toolbar=0";
			window.open(page,"monhotel",param)
		}
		else{
			var largeurEcran = screen.availWidth-10
			var hauteurEcran = screen.availHeight-30
			param = "top=0,left=0,width="+largeurEcran+",height="+hauteurEcran+",scrollbars=0, menubar=0,location=0,status=0,toolbar=0";
			window.open(page,"monhotel",param)
		}
	}
	else{
			var largeurEcran = screen.availWidth-10
			var hauteurEcran = screen.availHeight-30
			param = "top=0,left=0,width="+largeurEcran+",height="+hauteurEcran+",scrollbars=0, menubar=0,location=0,status=0,toolbar=0";
			window.open(page,"monhotel",param)
		}
}
