function onOrderImgChange(on) {
	if (belenusHome.oben.document.getElementById("shopIcon") == null) return; // bugfix for my IE6.0 which complains
																													 //	that element does not exist at startup
																													 // when items are in basket
	if(on) {
		belenusHome.oben.document.getElementById("shopIcon").className ="activeShopIcon";
	} else {
		belenusHome.oben.document.getElementById("shopIcon").className = "inactiveShopIcon";
	}
}


// if the cookie has fill the basket
var blinky = null;
var show = false; var i = 0; 
if(belenusHome.belenusBasket[0].length>0 && belenusHome.saveCartOnExit != false) {
	belenusHome.blinky = belenusHome.setInterval("blink()",belenusHome.fullBasketDelayOnInit);
}

function blink() {
  if(show) {
  	belenusHome.onOrderImgChange(true);
    show = false;  
  } else {
    belenusHome.onOrderImgChange(false);
    show = true;
  }
  i = i+1;
  if(i >=belenusHome.fullBasketTwinkle*2) {
    belenusHome.clearInterval(blinky);
    belenusHome.onOrderImgChange(true);
  }
}

function treeVisibility() {
	var minWidth = 2;
	/*
		this function only work in ie5.* because at the ns7.* is a bug
		the ns didn't repaint the page then the frameset property ("rows|cols") will be change,
		u can do a little workaround, and set all framesets properties (top & so on)
		but ns7.* also lost javascript communication between the different frames,(at repaint ns reloads the sites) so it wasn't unable 
		to work with them....
		this is an known bug from ns7.*
	*/
	if(document.getElementById && belenusHome.browserName == "Internet Explorer") {
		var currentMode = (belenusHome.document.getElementById("TreeFrame").width <= minWidth) ? "off" : "on";
		if(currentMode == "off") { //tree is not visible
			//set now to visible mode
			var newFrameWidth = (belenusHome.oldTreeFrameWidth <= minWidth) ? belenusHome.treeFrameWidth : belenusHome.oldTreeFrameWidth;
			belenusHome.document.getElementById("PartsFrame").setAttribute("cols",newFrameWidth+",*,0");
			// because ie has a bug in his behavior we need to set the noresize attribute again!
			belenusHome.document.getElementById("TreeFrame").noresize = "false";
			belenusHome.document.getElementById("ContentFrame").noresize = "false";
			belenusHome.document.getElementById("InvisibleFrame").noresize = "true";
		} else { // tree is visible
			//set now to invisible mode
			belenusHome.oldTreeFrameWidth = eval(parseInt(belenusHome.document.getElementById("TreeFrame").width)+1);
			var undef;
			if(belenusHome.oldTreeFrameWidth == undef) {
				belenusHome.oldTreeFrameWidth = belenusHome.treeFrameWidth;
			}
			belenusHome.document.getElementById("PartsFrame").setAttribute("cols","0,*,0");
		}
	}
}


/*** generate & handling of the dropDownBox functions follows now ***\
\*** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ***/

/*
  1st param allowed values:
    0 - invisible
    1 - visible in both versions
    2 - visible only in the static version
    3 - visible only in the dynamic version
    
  2nd param is the name of the function which should be called at selecting this entry (using a switch statement)
        and also for reach a dicison, if the entry should be shown (e.g. language option, only if more than one language is defined at the preferences.js...)
        A LIST OF SPECIAL BEHAVIOR MENU ENTRIES:
        - divider
        -language
        -printServer
  
  3rd param is the label which should be shown in the drop down box
*/

var opts = new Array();
  opts[0] =  new Array(1, "none", belenusHome.ld['selectMenu0']);
  opts[1] =  new Array(1, "divider", belenusHome.ld['selectDivider']);
  opts[2] =  new Array(1, "tree", belenusHome.ld['selectMenu1']);
  opts[3] =  new Array(1, "divider", belenusHome.ld['selectDivider']);
  opts[4] =  new Array(1, "img", belenusHome.ld['selectMenu3']);
  opts[5] =  new Array(1, "spl", belenusHome.ld['selectMenu4']);
  opts[6] =  new Array(1, "imgSpl", belenusHome.ld['selectMenu5']);
  opts[7] =  new Array(1, "divider", belenusHome.ld['selectDivider']);
  opts[8] =  new Array(3, "notes", belenusHome.ld['p_titleN']);
  opts[9] =  new Array(3, "favs", belenusHome.ld['p_titleF']);
  opts[10] = new Array(1, "divider", belenusHome.ld['selectDivider']);
  opts[11] = new Array(1, "language", belenusHome.ld['selectMenu6']);
  opts[12] = new Array(3, "printServer", belenusHome.ld['selectMenu7on']);
  opts[13] = new Array(1, "filter", belenusHome.ld['selectMenu2']);

// the follow function allows you, to paint the dropDownBox everywhere
// @ windowObj the window object is needed, use SELF
// @ dropDownBoxID here you must give the dropDownBox an ID "String" expected, so you can use several dropDownBoxs  
// @ usedOptionArray here you must deliver the function a correct array, which defines the content of the dropDownBox
function paintDropDownBox(windowObj, dropDownBoxID, usedOptionArray) {
  var w = windowObj.document;
  var ipVersion = belenusHome.interpartsVersion; // static or dynamic
  var lastEntryType = null;
  var selected = "selected"; // used for select the first entry, by default...
  
  w.write('<select id="'+dropDownBoxID+'" onChange="belenusHome.callOptsFn(this.options[this.selectedIndex].value, this.selectedIndex, self, \''+dropDownBoxID+'\')">');
  for(optsIndex in usedOptionArray) {

    if(usedOptionArray[optsIndex][0] > 0) { // first check if the current entry is visible..
      if((usedOptionArray[optsIndex][0] == 1) || (usedOptionArray[optsIndex][0] == 2 && ipVersion == "static") || (usedOptionArray[optsIndex][0] == 3 && ipVersion == "dynamic")) { // is the current entry visible (also check if static or dynamic version)
        if((usedOptionArray[optsIndex][1] == "divider" && lastEntryType == "divider") || (usedOptionArray[optsIndex][1] == "divider" && lastEntryType == null)) {
          // do nothing.... because the last entry was also a divider...
        } else {
          // now decide if the entry will be shown...
          if(usedOptionArray[optsIndex][1] == "language") { // check, if more than one language is given... 
              if(belenusHome.getLanguagesCurrentFirst("GUI").split(",").length > 1 || belenusHome.getLanguagesCurrentFirst("DATA").split(",").length > 1) {
                w.write('<option '+selected+' value="'+usedOptionArray[optsIndex][1]+'">'+usedOptionArray[optsIndex][2]+'</option>');
                lastEntryType = usedOptionArray[optsIndex][1];
                selected = '';
              }          
          } else if(usedOptionArray[optsIndex][1] == "printServer") { // check if the printServer feature is enabled
            if(belenusHome.printServerSwitcher == true) {
              w.write('<option '+selected+' value="'+usedOptionArray[optsIndex][1]+'">'+usedOptionArray[optsIndex][2]+'</option>');
              lastEntryType = usedOptionArray[optsIndex][1];
              selected = '';
            }
          } else { // if none special behavior is wished..
            w.write('<option '+selected+' value="'+usedOptionArray[optsIndex][1]+'">'+usedOptionArray[optsIndex][2]+'</option>');
            lastEntryType = usedOptionArray[optsIndex][1];
            selected = '';
          }
          
        }
      }
    }
    
  }
  w.write('</select>');
}


// this function will be called by the dropDownBox itself...
// it contains the different functions which will be called on a user selection in the dropDownBox
// customize !!!
function callOptsFn(switchCase, selectedIndex, windowObj, dropDownBoxID) {
  switch(switchCase) {
    case "normal":
      // do nothing.... unneeded, but for the legibility
      break;
    
    case "tree": // turn tree on/off
      belenusHome.treeVisibility(); 
      break;
     
    case "img": // only show ImageView
      if(belenusHome.DetailFrame != null) belenusHome.DetailFrame.showOnlyImageView();
      else alert(belenusHome.ld['firstACategory']); 
      break;
      
    case "spl": // only show sparePartsList
      if(belenusHome.DetailFrame != null) belenusHome.DetailFrame.showOnlyTable();
      else alert(belenusHome.ld['firstACategory']);     
      break;
      
    case "imgSpl": // show both together img&spl
      if(belenusHome.DetailFrame != null) belenusHome.DetailFrame.showImageViewAndTable(belenusHome.partsDrawingHeight);
      else alert(belenusHome.ld['firstACategory']);         
      break;
      
    case "notes": // open the notes popup
      belenusHome.WM.openWindow("notes","",false);
      break;
      
    case "favs": // open the favs popup
      belenusHome.WM.openWindow("favorites","",false);
      break;
      
    case "language": // open the languageChooser popup
      belenusHome.WM.openWindow("languageChooser");    
      break;
      
    case "printServer": // load the printServer frames
      if(belenusHome.printServer == false) {
        belenusHome.printServer = true;
        belenusHome.document.getElementById("ContentFrame").setAttribute("src","print_server/index.html");
        windowObj.document.getElementById(dropDownBoxID).options[selectedIndex].text = belenusHome.ld["selectMenu7off"];
      } else {
        belenusHome.printServer = false;
        var tmp = belenusHome.currentTreePath;
        belenusHome.belLocateInCatalog("/");
        setTimeout("belenusHome.belLocateInCatalog('"+tmp+"')",500);
        windowObj.document.getElementById(dropDownBoxID).options[selectedIndex].text = belenusHome.ld["selectMenu7on"];
      }    
      break;
      
    case "filter":
      if(belenusHome.DetailFrame != null) {
        belenusHome.DetailFrame.showFilter()
      }
      break;
      
    default:
      // do nothing....
      break;    
  } 
  // reset to first entry....    
  //windowObj.document.getElementById(dropDownBoxID).selectedIndex = 0;        
}


