dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.StackContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dojox.image.SlideShow");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.Tooltip");
dojo.require("dijit.Dialog");
dojo.require("dojox.layout.ContentPane");
dojo.require("dojo.parser");
//global variables  
// catalogs

var nlsCatGeneral =  new Object(eval((new XMLHttpLoader()).getSync("./data/content/common_stuff/general_nls_content.json")));


//end global variables

	

dojo.addOnLoad(function(){


dojo.parser.parse();

		
		var buildUI = function(){



	    	var filestore = new dojo.data.ItemFileReadStore({
 			 	url: "../../../data/context/collaborations.json"
 			 });




			var slideshow = new dojox.image.SlideShow({
				slideShowInterval: 10,
				loop: true,
				autoLoad: true,
				id: 'defaultslideshow',
				autoStart: false,
				noLink: true,
				dynamicScale: true
				}).placeAt(dojo.body());
		
			
			dojo.style(dijit.byId("defaultslideshow").domNode, {
				"position": "absolute",
				"left": "0px",
				"top": "0px",
				"width": "100%",
				"height": "100%",
				"text-align": "left",
				"margin": "0px",
				"padding": "0px",
				"z-index": "0",
				"border": "none"
				});
        	
    	
				
		slideshow.setDataStore(
    	  filestore,
      		{ query: {}, count:1 },
     		{
        imageThumbAttr: "thumb",
        imageLargeAttr: "large"
      		}
    	);
				
		
			
		
			










var statuscheck = function(){	



	var footerscript = function(){
	//detect layouting fail and correct the problem  
	if (dijit.byId("outer")._contentBox.h === 0) { location.reload();}

	//internationalize footer content
	nls.regCatId("i18n_newsletter_tooltip", nlsCatGeneral.i18n_newsletter_tooltip);
				

        connectNewsLetterTooltip();


};


var footerscript_trigger = function(){return (dijit.byId("bottom_region").isLoaded === true) ? footerscript : dojo.connect(dijit.byId("bottom_region"),"onLoad", footerscript);};

footerscript_trigger();




var headerscript = function(){
		
		//detect layouting fail and correct the problem  
		if (dijit.byId("outer")._contentBox.h === 0) { location.reload();}
		
	
		//internationalize stuff
		// animations
		//static texts
		nls.regCatId("i18n_about", nlsCatGeneral.about);
		nls.regCatId("i18n_exhibitions", nlsCatGeneral.exhibitions);
		nls.regCatId("i18n_artists", nlsCatGeneral.artists);
		nls.regCatId("i18n_collaborations", nlsCatGeneral.collaborations);
		nls.regCatId("i18n_profile", nlsCatGeneral.profile);
		nls.regCatId("i18n_manifesto", nlsCatGeneral.manifesto);		
		//tooltips
		nls.regCatId("i18n_homebutton_tooltip", nlsCatGeneral.homeButtonTooltip);
		
	};


headerscript();

		
	};


			
			// do all the layout etc

statuscheck();



		};
		
		dojo.addOnLoad(buildUI);
		


  });
	


