/*

===========================================================================

Elica.js

Author: Alessandra Hornung, <elikassandra@lycos.de>

Last modified: 03/05/02

===========================================================================



COMPATIBILITY: Works with Netscape 4.x, 6.x, IE 4+ on Windows and Macintosh.



VARIABLES:

        ns = Nestcape 4.x

        ie = Internet Explorer 4+

        ns6 = Netscape 6.x and gecko-Browsers

		fertig = boolean, default value false, is set to true when init() has run through



FUNCTIONS:

		first()

		  Checks for the presence of the top frame. If it is absent reloads the frameset.

		  Usage:			 to be called in the <body>-tag in an onLoad event 

		

		show(b,f,bi,fi,nav) 

		  Manages the visibility of the layers of the navigation in the bottom frame,

		  switches off all second-level navigation layers in the top frame and switches

		  on (if needed) the second-level navigation layer indicated by the parameter "nav".

		  based on the Browser detection.

		  Parameters:		 b: back button - "visible"/"hidden"

		  					 f: forward button - "visible"/"hidden"

							 bi: deactivated back button - "visible"/"hidden"

							 fi: deactivated forward button - "visible"/"hidden"

							 nav: 0 - no second-level navigation

							      2 - noi / about us

								  3 - arte / art

								  4 - design

								  5 - contatto / contact 	  



        nochmal()

          fixes a well-known bug in netscape 4.x reloading content when the window is resized

          Usage:             to be called in the <body>-tag in an onResize event

		  

		init()

		  sets the syntax for the layer acces to the proper one for the actual browser.

		  Simplifies the syntax of the funcions an() and aus()

		  Usage:			 to be called in the <body>-tag in an onLoad event

		  					 Needs an array ebn[x] to be defined on the page from which the

							 function is called. The array must be as big as the number x of

							 layers on the page.

		  

		an(id)

		  waits for init() to be through and then shows the layer "id" 

		  

		aus(id)

		  waits for init() to be through and then hides the layer "id" 

		  

		          wechsel(id,img,url)

          Rollover function, based on a Browser detection which takes place on the html page.

          Use: in the <img> tag set both the id and name attributes having the same value

          (Netscape 4.x uses the name attribute, Internet Explorer accepts both,

          Netscape 6.x accepts only the id attribute.)

          Parameters:        id: <div>-id attribute of the division containing the image

                             img: id or name attribute of the image

                             url: path to the new image

*/

	var ua = navigator.userAgent.toLowerCase();

	var nc = false;

	var ie = (document.all) ? true : false;

	var ns6 = (ua.indexOf("netscape6/") != -1) || (ua.indexOf("geko") != -1) ? true : false;

	var fertig=false;

	

	function first()

	{

	nc = (document.layers) ? true : false;

	if (!top.frames["t1"]) 

		top.location.href="intro.html" 

	}

	

	function show(b,f,bi,fi,nav)  

	{

		if(nc)

		{

			top.btm.document.layers[4].visibility=b;

			top.btm.document.layers[5].visibility=f;

			top.btm.document.layers[6].visibility=bi;

			top.btm.document.layers[7].visibility=fi;

			for (var i=2;i<=5;i++)

			{

				top.t1.document.layers[i].visibility="hidden";

			}

			if(nav!=0)

			{

				top.t1.document.layers[nav].visibility="visible";

			}

		}

		else if(ie)

		{

			top.btm.document.all.tags("DIV")[4].style.visibility=b;

			top.btm.document.all.tags("DIV")[5].style.visibility=f;

			top.btm.document.all.tags("DIV")[6].style.visibility=bi;

			top.btm.document.all.tags("DIV")[7].style.visibility=fi;

			for (var i=2;i<=5;i++)

			{

				top.t1.document.all.tags("DIV")[i].style.visibility="hidden";

			}

			if(nav!=0)

			{

				top.t1.document.all.tags("DIV")[nav].style.visibility="visible";

			}

		}

		else if(ns6)

		{

			top.btm.document.getElementsByTagName("DIV")[4].style.visibility=b;

			top.btm.document.getElementsByTagName("DIV")[5].style.visibility=f;

			top.btm.document.getElementsByTagName("DIV")[6].style.visibility=bi;

			top.btm.document.getElementsByTagName("DIV")[7].style.visibility=fi;

			for (var i=2;i<=5;i++)

			{

				top.t1.document.getElementsByTagName("DIV")[i].style.visibility="hidden";

			}

			if(nav!=0)

			{

				top.t1.document.getElementsByTagName("DIV")[nav].style.visibility="visible";

			}

		}

	} 

	

	function init() //accorcia la sintassi delle funzioni an(id) ed aus(id)

	{	

		if(nc)

		{

			for(var i=0; i<ebn.length; i++)

			{

				ebn[i]=document.layers[i];

			}

		}

		else if(ie)

		{

			for(var i=0; i<ebn.length; i++)

			{

				ebn[i]=document.all.tags("DIV")[i].style;

			}

		}

		else if(ns6)

		{

			for(var i=0; i<ebn.length; i++)

			{

				ebn[i]=document.getElementsByTagName("DIV")[i].style;

			}	

		}

		fertig=true;

	}

	



	function an(id) //rende visibile il layer "id" 

	{	

		if (fertig)

		{

			id.visibility="visible";

		}

	}

	

	function aus(id) //rende invisibile il layer "id" 

	{	

		if (fertig)

		{

			id.visibility="hidden";

		}

	}



	function wechsel(id,img,url)

	{

		if(nc)

		document.layers[id].document.images[img].src=url;

		else if(ie)

		document.images[img].src=url;

		else if(ns6)

		document.getElementById(img).setAttribute('src',url);

	}

 

	function nochmal()

	{

	        if(nc)

	        location.reload();

	} 
