/* auteur: Usager non enregistré */
/* Date de création: 08.07.2003 */

ns4 = false ;
ns6 = false ;
ie4 = false ;
ie5 = false ;

function detNav2()
{
  if ((document.all) && (document.getElementById)) ie5 = true;
  if ((document.all) && (!document.getElementById)) ie4 = true;
  if (document.layers) ns4 = true;
  if ((document.getElementById) && (!document.all)) ns6 = true;
}

function styleCalque(idCalque)
{
  if (document.all) calqueStyle = document.all[idCalque].style;
  if (document.layers) calqueStyle = document.layers[idCalque];
  if (document.getElementById) 
  calqueStyle = document.getElementById(idCalque).style;
  return calqueStyle;
}
function Calque(idCalque)
{
  if (document.all) calqueStyle = document.all[idCalque];
  if (document.layers) calqueStyle = document.layers[idCalque];
  if (document.getElementById) 
  calqueStyle = document.getElementById(idCalque);
  return calqueStyle;
}

function file(fichier)
{
	if(window.XMLHttpRequest) // FIREFOX
	xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // IE
	xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
	return(false);
	xhr_object.open("GET", fichier, false);
	xhr_object.send(null);
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
} 

function add_annonces(message)
{
	TEST = file('add_annonces_DB.php?message='+escape(message));
	block2 = Calque("msg");
	Text2 = file('add_annonces.php');
	block2.innerHTML = '';
	block2.innerHTML = TEST+Text2;
	return TEST;
}

function upd_annonces(ID, message)
{
	TEST = file('upd_annonces_DB.php?ID='+escape(ID)+'&message='+escape(message));
	block2 = Calque("msg");
	Text2 = file('add_annonces.php');
	block2.innerHTML = '';
	block2.innerHTML = TEST+Text2;
	return TEST;
}

function del_annonces(ID)
{
	TEST = file('del_annonces_DB.php?ID='+escape(ID));
	block2 = Calque("msg");
	Text2 = file('add_annonces.php');
	block2.innerHTML = '';
	block2.innerHTML = TEST+Text2;
	return TEST;
}

function add_agenda(date, texte)
{
	TEST = file('add_agenda_DB.php?date='+escape(date)+'&texte='+escape(texte));
	
	block2 = Calque("msg_data");
	block2.innerHTML = TEST+block2.innerHTML;
	
	return TEST;
}

function logout()
{
	file('logout.php');
}

function ShowDiv(fichier)
   {
   
	block = styleCalque("datapage");  
    block.left = 0;
	block.top = 0;
    block.active = 0;
	block.background = 'white';
	//block.bgcolor = #FFFFFF;
	block.visibility='visible';
	block2 = Calque("datapage");

	//htmltext = file(fichier);
	//block2.innerHTML="<p align='center'><img src='"+path+photo+"' width='"+w+"' height='"+h+"' alt='photor' /></p>";
	block2.innerHTML=fichier;
   }
   
function HideDiv()
  {
    n = (document.layers) ? 1 : 0;
    ie = (document.all) ? 1 : 0;
   
    if (n) {
    block = document.mymessage;
	//monmessage = document.lemessage;
    }
    if (ie) {
    block = mymessage.style;
	//monmessage = lemessage.style;
    }
   
    block.active = 0;
	block.visibility='hidden';
  }   
  
  
function Get_PosY()
{
    
	   if (window.pageYOffset)
		{
			  pos = window.pageYOffset
		}
		else if (document.documentElement && document.documentElement.scrollTop)
		{
			pos = document.documentElement.scrollTop
		}
		else if (document.body)
		{
	    pos = document.body.scrollTop
	    }
		if (pos > 100) pos = pos -100;
  return pos;		
} 
  
function ShowPhoto(trouve, w,h, modifiable, photo, titre, commentaire, path)
   {
   
	block = styleCalque("mainPhoto");  
    block.left = 10;
	 //block.top = Get_PosY();
    block.active = 0;
	block.top = Get_PosY();
	block.background = 'white';
	//block.bgcolor = #FFFFFF;
	block.visibility='visible';
	block2 = Calque("mainPhoto");
	
	block2.left = 10;

	if (h > 400) { 
      w = w/h*400;
	  h = 400;
	}
	htmltext = file('getDataPhotos.php?photoname='+escape(photo)+'&getpath='+escape(path));
	//block2.innerHTML="<p align='center'><img src='"+path+photo+"' width='"+w+"' height='"+h+"' alt='photor' /></p>";
	block2.innerHTML=htmltext;
 }

//function Affiche_info(photo, w, h, modi="false", titre='title', commentaire='comment')
function Affiche_info(photo, w, h, modi)
  {
    
  if (photo != '')
    {
	   ShowDiv(photo,w,h, modi, titre, commentaire);
	}  
  }
  
function add_photo(filename, path, titre, comment)
{
	TEST = file('add_photos_DB.php?photoname='+escape(filename)+'&path='+escape(path)+'&titre='+escape(titre)+'&comment='+escape(comment));
	block2 = Calque("mainPhoto");
	block2.innerHTML = TEST+block2.innerHTML;
	return TEST;
}
function upd_photo(filename, path, titre, comment)
{
	TEST = file('upd_photos_DB.php?photoname='+escape(filename)+'&path='+escape(path)+'&titre='+escape(titre)+'&comment='+escape(comment));
	block2 = Calque("mainPhoto");
	block2.innerHTML = TEST+block2.innerHTML;
	return TEST;
}  
  
function logout()
{
	file('logout.php');
}  



