/* 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_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 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 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 ShowObject(obj)
{
	block = styleCalque(obj); 
	block.visibility='invisible';
	
}

function ShowDiv(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;
	/*
	if (trouve == 'true')  {
		fonction = 'upd_photo(getfilename.value, getpath.value, gettitre.value, getcomment.value)';
		addup = 'update';
	}
	else {
		fonction = 'add_photo(getfilename.value, getpath.value, gettitre.value, getcomment.value)';
		addup = 'add';
	}
	if (modifiable=='true') {
	block2.innerHTML="<form name='BD' action='' method='GET'>"+
		"<table align='center' border='0'>"+
		  "<tr>"+
			"<td>Titre :</td>"+
			"<td><input name='gettitre' type='text' value='"+titre+"' maxlength='50'></td>"+
		  "</tr>"+
		  "<tr>"+
			"<td>comment</td>"+
			"<td><input type='text' name='getcomment' maxlength='250'  value='"+commentaire+"' ></td>"+
		  "</tr>"+
		  "<tr>"+
			"<td>path</td>"+
			"<td><TEXTAREA rows='1' cols='30' name='getpath' maxlength='250' readonly>"+path+"</TEXTAREA></td>"+
		  "</tr>"+		  
		  "<tr>"+
			"<td>file</td>"+
			"<td><TEXTAREA rows='1' cols='30' name='getfilename' maxlength='250' readonly>"+photo+"</TEXTAREA></td>"+
		  "</tr>"+		  		  
		  "<tr>"+
		  	"<td colspan='2' align='center'><input type='button' value='"+addup+"' onClick='"+fonction+"'></td>"+
		  "</tr>"+
		"</table>"+
		"</form>"+
	"<p align='center'><img src='../"+path+photo+"' width='"+w+"' height='"+h+"' alt='photo' /></p>";
	} else {
		block2.innerHTML="<b>"+titre+"</b><br>"+
		  "<p align='center'><img src='../"+path+photo+"' width='"+w+"' height='"+h+"' alt='photor' /></p>";
		}
*/
	//mymessage.innerHTML="ASDasd";
	//lemessage.innerHTML=message;
   }
   
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 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);
	}  
  }
  



