 <!--
// ----------------------------------------------------------------------------------------
// the following are some simple scripts, which enhance the functionality of the site
// if you encounter any problems or have questions
// please refer to Cedric Haindl c.haindl@metafabri.ch
//
// please also note, that the path to the images has to be correct!
// ----------------------------------------------------------------------------------------

// workaround for the infamous Netscape CSS- and Layer-bug:
// reloads the window on resize

if (document.layers) {
origWidth = innerWidth;
origHeight = innerHeight;}
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();}
//if (document.layers) onresize = reDo;

// ----------------------------------------------------------------------------------------
// scripts for the rollover-effect in the  navigation bar
// ----------------------------------------------------------------------------------------

<!--


var selectedtopic = 0;
var selectedSubTopic = 0;
var topicsPresent = 9;
var subTopicsPresent = 0;
var path = "de/";

URL = location.href
if (URL.indexOf("/de/") != -1) path = "../";
if (URL.indexOf("/en/") != -1) path = "../";
if (URL.indexOf("/fr/") != -1) path = "../";
if (URL.indexOf("/it/") != -1) path = "../";
if (URL.indexOf("index_en/") != -1) path = "en/";
if (URL.indexOf("index_fr/") != -1) path = "fr/";
if (URL.indexOf("index_it/") != -1) path = "it/";

if (document.images)  {
	picturesDef = new Array();
		for (i = 1; i <= topicsPresent ; i++)   {
			picturesDef[i] = new Image();
			picturesDef[i].src = path + "images/nav/nav_"  + i + "d.gif";}
	
	picturesHi = new Array();
		for (i = 1; i <= topicsPresent; i++)   {
			picturesHi[i] = new Image();
			picturesHi[i].src = path + "images/nav/nav_"  + i + "h.gif";}
}

function loadSubTopics(picCount) {
	
	picturesSubDef = new Array();
		for (i = 1; i <= picCount; i++)   {
			picturesSubDef[i] = new Image();
			picturesSubDef[i].src = "nav/subnav_" + i + "d.gif";}
	
	picturesSubHi = new Array();
		for (i = 1; i <= picCount; i++)   {
			picturesSubHi[i] = new Image();
			picturesSubHi[i].src = "nav/subnav_" + i + "h.gif";}
	subTopicsPresent = picCount;
}

function changePic(picNum)   {
	if (document.images)  {
	eval("document.topic" + picNum + ".src = picturesHi[picNum].src;");
    }        
}

function changeSubPic(picNum)   {
	if (document.images)  {
	eval("document.subtopic" + picNum + ".src = picturesSubHi[picNum].src;");
    }        
}

function resetPic()   {
	if (document.images)  {
		for (i = 1; i <= topicsPresent; i++)   {
		if ( i != selectedtopic) {
		eval("document.topic" + i + ".src = picturesDef[i].src;");
        }
        }
	}
}

function resetSubPic()   {
	if (document.images)  {
			for (i = 1; i <= subTopicsPresent; i++)   {
				if ( i != selectedSubTopic) {
				eval("document.subtopic" + i + ".src = picturesSubDef[i].src;");
      	}
			}	
	}
}

function resetDocSubPic(firstPic, lastPic)   {
	if (document.images)  {
		if (subTopicsPresent != 0) {
				for (i = firstPic; i <= lastPic; i++) {
					if ( i != selectedSubTopic) {
					eval("document.subtopic" + i + ".src = picturesSubDef[i].src;");
      		}
				}
			}	
	}
}

function checkTopic() {
	URL=location.href
	if (document.images) { 
	resetPic(); 
	
               
	if (URL.indexOf("aktuell/") != -1) selectedtopic = 1;
	if (URL.indexOf("portrait/") != -1) selectedtopic = 2;
	if (URL.indexOf("produkte/") != -1) selectedtopic = 3;
	if (URL.indexOf("bestellungen/") != -1) selectedtopic = 4;
	if (URL.indexOf("wettbewerb/") != -1) selectedtopic = 5;
	if (URL.indexOf("kontakt/") != -1) selectedtopic = 6;
	if (URL.indexOf("kaffee/") != -1) selectedtopic = 7;
	if (URL.indexOf("export/") != -1) selectedtopic = 8;  
	if (URL.indexOf("links/") != -1) selectedtopic = 9;  
      
	if (selectedtopic != 0) {
		eval("document.topic" + selectedtopic + ".src = picturesHi[selectedtopic].src;");}
    }  
}

//-->
