/////////////////////////////////////////////////////////////////////////////////////////////////
function IncludeJavaScript(jsFile)
{
  document.write('<script type="text/javascript" src="' + jsFile + '"></script>'); 
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function getTextContent(elt) {
  var _Text = elt.textContent;
  if (_Text == undefined) {
  	_Text = elt.text;
   	}
   	return _Text;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function LoadImg(id,src)
{
  var img = new Image();
  img.onload = function ()
  {
   document.getElementById(id).src = src;
   img.free;
  }
  img.src = src;
  Images[id] = img;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function PostTitle(FolderObjectListIndex) {
 
 var myContent = {};
 myContent["AddTitle"] = document.getElementById("AddTitle").value;
   
var kw = {
        content: myContent,
        url: "/Photos/XMLPostTitle?Root="+FolderObjectList[FolderObjectListIndex].getAttribute("root")+"&Folder="+FolderObjectList[FolderObjectListIndex].getAttribute("folder")+"&FileName="+FolderObjectList[FolderObjectListIndex].getAttribute("filename"),
        handleAs: "xml",
        load: function(response, ioArgs) {
              while (FolderObjectList[FolderObjectListIndex].childNodes.length > 0) { FolderObjectList[FolderObjectListIndex].removeChild(FolderObjectList[FolderObjectListIndex].childNodes[0]); }
              i = response.getElementsByTagName("object")[0].childNodes.length - 1;
              while (i >= 0) { FolderObjectList[FolderObjectListIndex].appendChild(document._importNode(response.getElementsByTagName("object")[0].childNodes[i],true)); i = i - 1;}
              ShowTitleAndComments(FolderObjectListIndex)
        },
        error: function(data) { alert("An error occurred" + data); }
        };
dojo.xhrPost(kw);
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function PostComment(FolderObjectListIndex) {

 var myContent = {};
 myContent["AddComment"] = document.getElementById("AddComment").value;
 myContent["Nick"] = document.getElementById("Nick").value;

var kw = {
        content: myContent,
        url: "/Photos/XMLPostComment?Root="+FolderObjectList[FolderObjectListIndex].getAttribute("root")+"&Folder="+FolderObjectList[FolderObjectListIndex].getAttribute("folder")+"&FileName="+FolderObjectList[FolderObjectListIndex].getAttribute("filename"),
        handleAs: "xml",
        load: function(response, ioArgs) {
              while (FolderObjectList[FolderObjectListIndex].childNodes.length > 0) { FolderObjectList[FolderObjectListIndex].removeChild(FolderObjectList[FolderObjectListIndex].childNodes[0]); }
              i = response.getElementsByTagName("object")[0].childNodes.length - 1;
              while (i >= 0) { FolderObjectList[FolderObjectListIndex].appendChild(document._importNode(response.getElementsByTagName("object")[0].childNodes[i],true)); i = i - 1;}
              ShowTitleAndComments(FolderObjectListIndex)
        },
        error: function(data) { alert("An error occurred" + data); }
        };
dojo.xhrPost(kw);
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function ShowTitleAndComments(FolderObjectListIndex) 
{ 
if (debug == true) {console.log("ShowTitleAndComments (" + FolderObjectListIndex+")");}
                var Obj = FolderObjectList[FolderObjectListIndex]; 
                  if (Obj.getElementsByTagName("title").length > 0) 
                  {
                     document.getElementById("Title").innerHTML = "<h1>" + getTextContent(Obj.getElementsByTagName("title")[0]) + "</h1>"; 
                  } else {
                     document.getElementById("Title").innerHTML = "<form name=\"FormTitle\" id=\"FormTitle\" action=\"javascript:PostTitle('"+FolderObjectListIndex+"');\"><h1><input style=\"width:200px\" name=\"AddTitle\" id=\"AddTitle\" size=\"35\" maxlength=\"250\" />&nbsp;<input type=\"button\" name=\"Add\" value=\"Proposer un Titre\" onclick=\"PostTitle('"+FolderObjectListIndex+"');\" /></h1></form>";
                  }
                str = "<h2>Commentaires</h2>";
                if (Obj.getElementsByTagName("comment").length >0)
		        {
		           str = str + "<p>";
                   var Comments = Obj.getElementsByTagName("comment");
                   for (var i = 0; i < Comments.length; i++) 
                   { 
                     str = str + "<b>" + (Comments[i].getAttribute("nick")) + " : </b>";
                     str = str + getTextContent(Comments[i]);
                     str = str + "<br /><br />";
                   }
                   str = str + "</p>";
                }
	            document.getElementById("Comments").innerHTML = str+"<hr /><center><form name=\"FormComment\" id=\"FormComment\" action=\"javascript:PostComment('"+FolderObjectListIndex+"');\"><table><tr><td>Pseudo :</td><td><input style=\"width:70px\" id=\"Nick\" name=\"Nick\" size=\"15\" maxlength=\"20\" />&nbsp;<input style=\"width:70px\" type=\"button\" name=\"Add\" value=\"Ajouter\" onclick=\"PostComment('"+FolderObjectListIndex+"');\" /></td></tr><tr><td>Commentaire : </td><td><textarea style=\"width:180px\" id=\"AddComment\" name=\"AddComment\" cols=\"30\" rows=\"3\"></textarea></td></tr></table></form></center>";
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function HideTitleAndComment(func)
{
if (debug == true) {console.log("HideTitleAndComment ("+func+")");}
      var a = new Array();

      a.push(dojo.fadeOut({node: document.getElementById("Title"), duration: 100}));
      a.push(dojo.fadeOut({node: document.getElementById("Comments"), duration: 100}));
      f = dojo.fx.combine(a);
      if (func != null) {
         dojo.connect(f, "onEnd", func);
      }
      f.play();
      
//document.getElementById("Title").style.opacity = "0";
//document.getElementById("Title").style.filter = "alpha(opacity=0)"
//dojo.fadeOut({node: document.getElementById("Title"), duration: 10}).play();

//document.getElementById("Comments").style.opacity = "0";
//document.getElementById("Comments").style.filter = "alpha(opacity=0)";
//dojo.fadeOut({node: document.getElementById("Comments"), duration: 10}).play();

}

/////////////////////////////////////////////////////////////////////////////////////////////////
function ShowObject(FolderObjectListIndex) 
{
if (debug == true) {console.log("ShowObject ("+FolderObjectListIndex+")");}

if ((FolderObjectListIndex >= 0) && (FolderObjectListIndex < FolderObjectList.length)) 
{

LoadImg("T"+FolderObjectListIndex,FolderObjectList[FolderObjectListIndex].getAttribute("normal"));

ShowTitleAndComments(FolderObjectListIndex);

dojo.xhrGet( { 
        url: "/Photos/XMLObject?Root="+FolderObjectList[FolderObjectListIndex].getAttribute("root")+"&Folder="+FolderObjectList[FolderObjectListIndex].getAttribute("folder")+"&FileName="+FolderObjectList[FolderObjectListIndex].getAttribute("filename")+"&DateTimeStamp="+Date(), 
        handleAs: "xml",
        load: function(response, ioArgs) {
              while (FolderObjectList[FolderObjectListIndex].childNodes.length > 0) { FolderObjectList[FolderObjectListIndex].removeChild(FolderObjectList[FolderObjectListIndex].childNodes[0]); }
              i = response.getElementsByTagName("object")[0].childNodes.length - 1;
              while (i >= 0) { 
                    FolderObjectList[FolderObjectListIndex].appendChild(document._importNode(response.getElementsByTagName("object")[0].childNodes[i],true)); 
                    i = i - 1;
                    }
              
              ShowTitleAndComments(FolderObjectListIndex)
              },       
        error: function(response, ioArgs) {
          // alert("Impossible de Charger les données");
          console.error("HTTP status code: ", ioArgs.xhr.status);
          return response;
          }
        });
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function EndMoving()
{
 dojo.fadeIn({node: document.getElementById("Title"), opacity:0, duration: 500}).play();
 dojo.fadeIn({node: document.getElementById("Comments"), opacity:0, duration: 500}).play();
 IsMoving = false;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function MoveObject(FolderObjectListIndex) 
{
console.log("MoveObject ("+FolderObjectListIndex+")");
if ((FolderObjectListIndex >= 0) && (FolderObjectListIndex < FolderObjectList.length)) 
{
  IsMoving = true;
  HideTitleAndComment(dojo.hitch(null, "ShowObject", FolderObjectListIndex)); //"ShowObject");//(FolderObjectListIndex)");
  
    var a = new Array();

        for (var i = eval(FolderObjectListIndex) - 1; i >= 0; i--) { 
            if (((document.getElementById("T"+i).offsetLeft > -ThumbWidth ) && (document.getElementById("T"+i).offsetLeft <= WindowsWidth))  
            || ((ThumbLeft-(FolderObjectListIndex-i)*130 > -ThumbWidth ) && (ThumbLeft-(FolderObjectListIndex-i)*130 <= WindowsWidth)))
               {
		        if (document.getElementById("T"+i).src == ImgLoading) { LoadImg("T"+i, FolderObjectList[i].getAttribute("thumb"));} 
                a.push(dojo.fx.slideTo({node: document.getElementById("T"+i), top: ThumbTop, left: ThumbLeft-(FolderObjectListIndex-i)*130, duration: 2000 }));
               }
		    }

        if ((FolderObjectFocusIndex >= 0) && (FolderObjectFocusIndex != FolderObjectListIndex)) {  
           a.push(dojo.animateProperty({node: document.getElementById("T"+FolderObjectFocusIndex), duration: 2000, properties: { width: { end: ThumbWidth}, height: {end: ThumbHeight}}}));
        }   

        FolderObjectFocusIndex = FolderObjectListIndex;
        a.push(dojo.fx.slideTo({node: document.getElementById("T"+FolderObjectListIndex), top: ObjectTop, left: ObjectLeft, duration: 2000 }));
        a.push(dojo.animateProperty({node: document.getElementById("T"+FolderObjectListIndex), duration: 2000, properties: { width: { end: ObjectWidth}, height: { end: ObjectHeight}}}));

		for (var i = eval(FolderObjectListIndex) + 1; i < FolderObjectList.length; i++) {
            if (((document.getElementById("T"+i).offsetLeft > -ThumbWidth ) && (document.getElementById("T"+i).offsetLeft <= WindowsWidth))  
            || ((ThumbLeft-(FolderObjectListIndex-i)*130 > -ThumbWidth ) && (ThumbLeft-(FolderObjectListIndex-i)*130 <= WindowsWidth)))
               {
		        if (document.getElementById("T"+i).src == ImgLoading) { LoadImg("T"+i, FolderObjectList[i].getAttribute("thumb"));} 
                a.push(dojo.fx.slideTo({node: document.getElementById("T"+i), top: ThumbTop, left: ThumbLeft-(FolderObjectListIndex-i+1)*130, duration: 2000 }));
               }
		    }
        f = dojo.fx.combine(a);
	    dojo.connect(f, "onEnd", "EndMoving");
        f.play();
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_Load(Type,Root,Folder,func) 
{
HideTitleAndComment(null);
document.getElementById("Thumbs").innerHTML = "<img src=\""+ImgLoading+"\" /> Chargement de l'album en cours...";

if (Type == "A") {var u = "/Photos/XMLListObjects?Root="+Root+"&Folder="+Folder+"&DateTimeStamp="+Date();}
if (Type == "C") {var u = "/Photos/XMLLastComments?Last=25&Root="+Root+"&Folder="+Folder+"&DateTimeStamp="+Date();}
if (Type == "D") {var u = Folder + ".xml";}


dojo.xhrGet( { 
        url: u, 
        handleAs: "xml",

        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) { 
		  if (response == null) 
          {
	        alert("Impossible de Charger les données");
          } else {
		// Variable FolderObjectList à supprimer
            FolderObjectList = response.getElementsByTagName("object");
            if (FolderObjectList.length == 0) 
            { document.getElementById("Thumbs").innerHTML = "L'album est vide..."; }//'<p style="text-align: center;">L'album est vide...</p>'; }
            else { func(FolderObjectList); }
          }
          return response;
        },

        // The ERROR function will be called in an error case.
        error: function(response, ioArgs) {
          console.error("HTTP status code: ", ioArgs.xhr.status);
          return response;
          }
        });
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Folder_Load(Root) 
{
HideTitleAndComment(null);
document.getElementById("Thumbs").innerHTML = "<img src=\""+ImgLoading+"\" /> Chargement de la liste des albums...";

dojo.xhrGet( { 
        url: "Folder.xml", 
        handleAs: "xml",
        load: function(response, ioArgs) { 
		  if (response == null) 
          { alert("Impossible de Charger les données"); } else {
            FolderList = response.getElementsByTagName("folder");
            var str ="";
          	for (var i = 0; i < FolderList.length; i++) 
            { 
	            str = str + FolderList[i].getAttribute("id")+"<br/>";
            }
            document.getElementById("Folder").innerHTML = str;
          }
          return response;
        },
        error: function(response, ioArgs) {
          console.error("HTTP status code: ", ioArgs.xhr.status);
          return response;
          }
        });
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_ShowComments(FOL) 
{
 if (debug == true) {console.log("XNet_Photos_ShowComments (" + FOL.length+")");}
 	str = "";
	for (var i = 0; i < FOL.length; i++) { 
	   str = str + "<img id=\'T"+i+"' style=\"z-index:1;position:absolute;height:128px;width:128px;top:"+eval(50+ThumbHeight*i)+"px;left:0px\" onclick=\"javascript:XNet_Photos_ShowThumb();MoveObject('" + i + "');\" alt=\"" + FOL[i].getAttribute("filename") + "\" src=\"" + ImgLoading + "\" />";
       str = str + "<p style=\"z-index:1;position:absolute;height:120px;width:300px;top:"+eval(50+ThumbHeight*i)+"px;left:140px;overflow:auto;\">";	   
	   if (FOL[i].getElementsByTagName("title").length > 0) 
       {
         str = str + getTextContent(FOL[i].getElementsByTagName("title")[0])+"<br />";
       }
       var Comments = FOL[i].getElementsByTagName("comment");
       for (var j = 0; j < Comments.length; j++) 
       { 
         str = str + "<b>" + (Comments[j].getAttribute("nick")) + " : </b>";
         str = str + getTextContent(Comments[j]);
         str = str + "<br />";
       }
       str = str + "</p>";	   
    }
	document.getElementById("LastComments").innerHTML = "<h1>Derniers Commentaires</h1>"+str;
    document.getElementById("Thumbs").innerHTML = "";
	for (var i = 0; i < FOL.length; i++) { 
             LoadImg("T"+i, FOL[i].getAttribute("thumb"));
	    }
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function HideLastFoldersComments() 
{
document.getElementById("LastFolders").style.visibility="hidden";
document.getElementById("LastComments").style.visibility="hidden";
document.getElementById("Footer").style.visibility="hidden";
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_ShowThumb(FOL) 
{
 
 if (debug == true) {console.log("XNet_Photos_ShowThumb (" + FolderObjectList.length+")");}
 if (debug == true) {console.log(document.getElementById("LastFolders")!=null);}

 if (document.getElementById("LastFolders")!=null)
  { dojo.fadeOut({node: document.getElementById("LastFolders"), opacity:0, duration: 1000, onEnd: HideLastFoldersComments}).play(); }
 if (document.getElementById("LastComments")!=null)
  { dojo.fadeOut({node: document.getElementById("LastComments"), opacity:0, duration: 1000, onEnd: HideLastFoldersComments}).play(); }
 if (document.getElementById("Footer")!=null)
  { dojo.fadeOut({node: document.getElementById("Footer"), opacity:0, duration: 1000, onEnd: HideLastFoldersComments}).play(); }
 	str = "";
	for (var i = 0; i < FolderObjectList.length; i++) { 
	   str = str + "<img id=\'T"+i+"' style=\"z-index:1;position:absolute;height:128px;width:128px;top:"+ThumbTop+"px;left:"+eval(WindowsWidth+ThumbWidth)+"px\" onclick=\"javascript:MoveObject('" + i + "');\" alt=\"" + FolderObjectList[i].getAttribute("filename") + "\" src=\"" + ImgLoading + "\" />";
	    }
	document.getElementById("Thumbs").innerHTML = str;
	MoveObject(0);
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientHeight) {
         windowHeight = document.documentElement.clientHeight;
    }
    else {
     if (document.body&&document.body.clientHeight) {
         windowHeight=document.body.clientHeight;
      }
     }
    }
    return windowHeight;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function getWindowWidth() {
    var windowWidth=0;
    if (typeof(window.innerWidth)=='number') {
        windowWidth=window.innerWidth;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientWidth) {
         windowWidth = document.documentElement.clientWidth;
    }
    else {
     if (document.body&&document.body.clientWidth) {
         windowWidth=document.body.clientWidth;
      }
     }
    }
    return windowWidth;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_Layout() 
{

WindowsWidth = getWindowWidth();
WindowsHeight = getWindowHeight();

TopMargin = 0;
LeftMargin = 0;

if (document.getElementById("Header")!=null) { TopMargin = document.getElementById("Header").offsetHeight }
if (document.getElementById("Folders")!=null) { LeftMargin = document.getElementById("Folders").offsetWidth }
//if (document.getElementById("Title")!=null) { TopMargin = eval(TopMargin) + eval(document.getElementById("Title").offsetHeight) }

TopMargin = eval(TopMargin) + 15;
LeftMargin = eval(LeftMargin) + 15;

// Réduire ObjectWidth & ObjectHeight si écran trop petit.
 ObjectHeight = WindowsHeight - ThumbHeight - TopMargin;
 ObjectWidth = WindowsWidth - LeftMargin - 300; // 250: Taille Mini Comments
 
 //alert("H: "+ObjectHeight +"("+WindowsHeight+") / W: "+ObjectWidth+"("+WindowsWidth+")");

 if ( ObjectHeight < ObjectWidth ) { ObjectWidth = ObjectHeight; } else { ObjectHeight = ObjectWidth; }
 if ( ObjectHeight < 128 ) { ObjectWidth = 128; ObjectHeight = 128; }
 
// Positionnement Image Centrale
 ObjectTop = TopMargin; //((WindowsHeight - ObjectHeight - ThumbHeight - 25) / 2);
 ObjectLeft = LeftMargin;
 
// Positionnement Folders / LastFolders / LastComments
if (document.getElementById("Folders")!=null) { 
  document.getElementById("Folders").style.position = "absolute";
  document.getElementById("Folders").style.top = eval(ObjectTop) + "px";
  document.getElementById("Folders").style.height = eval (WindowsHeight) - eval (ObjectTop) - eval (ThumbHeight) - 30 + "px";
  document.getElementById("Folders").style.maxHeight = eval (WindowsHeight) - eval (ObjectTop) - eval (ThumbHeight) - 30 + "px";
}

if (document.getElementById("LastFolders")!=null) { 
  document.getElementById("LastFolders").style.position = "absolute";
  document.getElementById("LastFolders").style.top = eval(ObjectTop) + "px";
  document.getElementById("LastFolders").style.height = eval (WindowsHeight) - eval (ObjectTop) - eval (ThumbHeight) - 30 + "px";
  document.getElementById("LastFolders").style.maxHeight = eval (WindowsHeight) - eval (ObjectTop) - eval (ThumbHeight) - 30 + "px";
 }
if (document.getElementById("LastComments")!=null) { 
  document.getElementById("LastComments").style.position = "absolute";
  document.getElementById("LastComments").style.top = eval(ObjectTop) + "px";
  document.getElementById("LastComments").style.height = eval (WindowsHeight) - eval (ObjectTop) - eval (ThumbHeight) - 30 + "px";
  document.getElementById("LastComments").style.maxHeight = eval (WindowsHeight) - eval (ObjectTop) - eval (ThumbHeight) - 30 + "px";
  }
if (document.getElementById("Footer")!=null) { 
  document.getElementById("Footer").style.position = "absolute";
  document.getElementById("Footer").style.top = eval(WindowsHeight) - eval(ThumbHeight) + "px";
  document.getElementById("Footer").style.height = eval(ThumbHeight) + "px";
  document.getElementById("Footer").style.maxHeight = eval(ThumbHeight) + "px";
  }
// Positionnement Title / Commentaire
  document.getElementById("Title").style.position = "absolute";
  document.getElementById("Title").style.top = eval(ObjectTop) + "px"; 
  document.getElementById("Title").style.left = eval(ObjectLeft) + eval(ObjectWidth) + 5 + "px";
  document.getElementById("Title").style.width = eval (WindowsWidth) - eval(ObjectLeft) - eval(ObjectWidth) - 20 + "px";

  document.getElementById("Comments").style.position = "absolute";
  document.getElementById("Comments").style.top = eval(ObjectTop) + eval(document.getElementById("Title").offsetHeight) + 20 + "px";
  document.getElementById("Comments").style.maxHeight = eval (ObjectHeight) - 60 + "px";
  document.getElementById("Comments").style.left = eval(ObjectLeft) + eval(ObjectWidth) + 5 + "px";
  document.getElementById("Comments").style.width = eval (WindowsWidth) - eval(ObjectLeft) - eval(ObjectWidth) - 20 + "px";

// Positionnement Thumb
 ThumbTop = WindowsHeight - ThumbHeight;
 ThumbLeft = (WindowsWidth - ThumbWidth) / 2;

if (debug == true) 
  {
  console.log("WindowsWidth  : "+WindowsWidth+" / WindowsHeight : "+WindowsHeight);
  console.log("ThumbLeft     : "+ThumbLeft+   " / ThumbTop      : "+ThumbTop);
  console.log("ObjectLeft    : "+ObjectLeft+  " / ObjectTop     : "+ObjectTop);
  console.log("ObjectWidth   : "+ObjectWidth+ " / ObjectHeight  : "+ObjectHeight);
}

}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_Resize() 
{
     XNet_Photos_Layout();
     window.clearTimeout (ResizeTimeout);
   if (!IsMoving)
   {
     ResizeTimeout = window.setTimeout("MoveObject(FolderObjectFocusIndex);", 500);
   }  
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_AutoPlay() 
{
   window.clearTimeout (AutoPlayTimeout);
   MoveObject((eval(FolderObjectFocusIndex)+1) % FolderObjectList.length);
   AutoPlayTimeout = window.setTimeout("XNet_Photos_AutoPlay();", 10000);
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function XNet_Photos_SwapImg(ImgID,ImgSrc) 
{

  img2 = document.getElementById(ImgID+"-2");
  if (img2.hint == "Out")
  {
   img1 = document.getElementById(ImgID+"-1");
  } else {
   img1 = document.getElementById(ImgID+"-2");
   img2 = document.getElementById(ImgID+"-1");
  }   
    
  img2.style.position = img1.style.position;
  img2.style.top = img1.offsetTop+"px"; 
  img2.style.left = img1.offsetLeft+"px"; 
     
  img2.onload = function ()
  {
    //dojox.fx.crossFade({ img1, img2 }).play;
    
    var a = new Array();

      a.push(dojo.fadeOut({node: img1, duration: 2000}));
      a.push(dojo.fadeIn({node: img2, duration: 2000}));
      f = dojo.fx.combine(a);
      f.play();
      img1.hint = 'Out';
      img2.hint = 'In';
  }
  img2.src = ImgSrc;
  
}



/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////

var debug = true;

var FolderList;
var FolderObjectList;
var FolderObjectFocusIndex = -1;

var WindowsWidth = getWindowWidth();
var WindowsHeight = getWindowHeight();

var TopMargin = 180; // Inutile recalculé
var LeftMargin = 270; // Inutile recalculé

var ThumbTop = 700;
var ThumbLeft = 500;
var ThumbWidth = 128;
var ThumbHeight = 128;

var ObjectTop = 100;  // Inutile recalculé
var ObjectLeft = 300; // Inutile recalculé
var ObjectWidth = 640;
var ObjectHeight = 640;

var ResizeTimeout;
var AutoPlayTimeout;

var ImgLoading = "http://www.grosjeanne.name/Pictures/loading.gif"; //Mettre l'URL complete

var IsMoving = false;
var Images = new Array();

//IncludeJavaScript('/js/dojo-release-1.1.1/dojo/dojo.js');
//IncludeJavaScript('/js/dojo-release-1.1.1/dojo/fx.js');

        var djConfig = {
            parseOnLoad: true,
            isDebug: false,
            locale: 'fr-fr'
        };
    
IncludeJavaScript('/js/dojo-release-1.2.3/dojo/dojo.js');
IncludeJavaScript('/js/dojo-release-1.2.3/dojo/fx.js');

// Changeset 14532
// workaround for bug in Safari 3.  See #7189 
 		                        if (/3[\.0-9]+ Safari/.test(navigator.appVersion)) 
 		                        { 
 		                                window.console = { 
 		                                    origConsole: window.console, 
 		                                    log: function(s){ 
 		                                                this.origConsole.log(s); 
 		                                        }, 
 		                                        info: function(s){ 
 		                                                this.origConsole.info(s); 
 		                                        }, 
 		                                        error: function(s){ 
 		                                                this.origConsole.error(s); 
 		                                        }, 
 		                                        warn: function(s){ 
 		                                                this.origConsole.warn(s); 
 		                                        } 
 		                                }; 
 		                        } 
 	
// Workaround for ImportNode in InternetExplorer
document._importNode = function(node, allChildren) 
{
 if (!document.importNode)
 {
  return(node); // IE does not support importNode, but does not enforce CrossImport to document DOM ... so .... 
 }
 else
 {
  return(document.importNode(node, allChildren))
 }
}


