//DinJ, as 2004 09
//
//----------------------------------------------------------------------
// basic settings
function INITIALIZE() {
window.onerror=null;
if (!document.getElementById) {
if (document.all) {
document.getElementById=IEgetElementByID;
}
}
visible='visible';
hidden='hidden';
theUnitTag="px";
if (self.innerHeight) {
WindowHeight="self.innerHeight";
WindowWidth="self.innerWidth";
}
else if (document.documentElement && document.documentElement.clientHeight) {
WindowHeight="document.documentElement.clientHeight";
WindowWidth="document.documentElement.clientWidth";
}
else {
WindowHeight="document.body.clientHeight";
WindowWidth="document.body.clientWidth";
}
if (self.pageYOffset > -1) {
vScroll="self.pageYOffset";
}
else if (document.documentElement && document.documentElement.scrollTop > -1) {
vScroll="document.documentElement.scrollTop + document.body.scrollTop";
}
else {
vScroll="document.body.scrollTop";
}
}
function BodyLoad() {
document.getElementById("Page").style.visibility=visible;
document.getElementById("MainMenu").style.visibility=visible;
ScrollMenu=makeScrollObject([["MainMenu",true]]);
}
function IEgetElementByID(ID) {
return document.all[ID];
}
//----------------------------------------------------------------------
// functions for scrolling objects
function makeScrollObject(theScrollObjectList) {
this.Speed=15;
this.Snap=8;
this.vScrollPos=eval(vScroll);
this.ScrollFlag=false;
this.Length=theScrollObjectList.length;
this.ScrollObjectList=new Array ();
this.checkScroll=checkScroll;
this.setScroll=setScroll;
this.scrollObjects=scrollObjects;
for (var theScrollObject in theScrollObjectList) {
var theFlow=theScrollObjectList[theScrollObject][1];
theScrollObject=document.getElementById(theScrollObjectList[theScrollObject][0]);
theScrollObject.origY=parseInt(theScrollObject.style.top);
theScrollObject.flow=theFlow;
theScrollObject.CurrentScroll=theScrollObject.origY;
theScrollObject.targetY=theScrollObject.CurrentScroll;
theScrollObject.deltaY=0;
//this.ScrollObjectList.push(theScrollObject);
// to include IE prior 5.5
this.ScrollObjectList[this.ScrollObjectList.length]=theScrollObject;
}
this.checkScroll();
return this;
}
function checkScroll() {
if (eval(vScroll) != this.vScrollPos) {
this.vScrollPos=eval(vScroll);
this.ScrollFlag=true;
}
else if (this.ScrollFlag) {
this.setScroll();
}
setTimeout("this.checkScroll();",100);
}
function setScroll() {
//flag menu to disable selection
//correct position of fixed object
this.ScrollFlag=false;
//get TARGET scroll, scroll DELTA
for (var theScrollObject in this.ScrollObjectList) {
with (this.ScrollObjectList[theScrollObject]) {
CurrentScroll=parseInt(style.top);
targetY=(origY+this.vScrollPos);
deltaY=(targetY - CurrentScroll)/this.Speed;
}
if (!this.ScrollObjectList[theScrollObject].flow) {
this.ScrollObjectList[theScrollObject].style.top=this.ScrollObjectList[theScrollObject].targetY + theUnitTag;
}
}
this.scrollObjects();
}
function scrollObjects() {
var finishedScroll=false;
for (var theScrollObject in this.ScrollObjectList) {
with (this.ScrollObjectList[theScrollObject]) {
if (flow) {
if (Math.abs(targetY - CurrentScroll) > this.Snap) {
CurrentScroll=CurrentScroll + deltaY;
style.top=CurrentScroll + theUnitTag;
theNewDeltaY=Math.round((targetY - CurrentScroll)/this.Speed);
if (Math.abs(theNewDeltaY) >= 1) {
deltaY=theNewDeltaY;
}
else {
style.top=targetY + theUnitTag;
finishedScroll=true;
}
}
}
}
}
if (finishedScroll) {
return true;
}
setTimeout("this.scrollObjects();",10);
}
function scrollToTop() {
window.scrollTo(0,0);
}
//----------------------------------------------------------------------
// rollover image menu
function makeImageMenu (theMenuDiv,theMenuImageParentUrlList,theMainMenuItemList,fileDepht,selfref) {
var Menutext="";
var topPos= new Array(125,200,260);
var isFirst=true;

  for (var theMainMenuItem in theMainMenuItemList) {
    var theMenuItemList = theMainMenuItemList[theMainMenuItem];
    var theMenuImageParentUrl = theMenuImageParentUrlList[theMainMenuItem];
    topPosition=topPos[theMainMenuItem];
    for (var theMenuItem in theMenuItemList) {
      if (theMenuItemList[theMenuItem] != "") {
        if (theMenuItemList[theMenuItem] == theMenuItemList[0]) { 
        //is First >> not do 1st time
        if (isFirst) {isFirst=false;} else {Menutext += "&nbsp;<br />";}
          if (theMenuItemList[theMenuItem] == selfref){
            Menutext += "<div class=\"MI\"><img src=\"" + theMenuImageParentUrl + theMenuItemList[theMenuItem] + "_check.gif\" alt=\"\"></div>&nbsp;<br />";
          }
          else {
            Menutext += "<div class=\"MI\"><a style=\"background-image:url(" + theMenuImageParentUrl + theMenuItemList[theMenuItem] + "_icon.gif);\" href=\"" + fileDepht + theMenuItemList[0]  + "/" + theMenuItemList[theMenuItem] + ".html\"></a></div>&nbsp;<br />";
          }
        }
        else {  
          topPosition+=15;
          if (theMenuItemList[theMenuItem] == selfref){
            Menutext += "<div class=\"MI2\"><img src=\"" + theMenuImageParentUrl + theMenuItemList[theMenuItem] + "_check.gif\" alt=\"\"></div>&nbsp;<br />";
          }
          else{
            Menutext += "<div class=\"MI2\"><a style=\"background-image:url(" + theMenuImageParentUrl + theMenuItemList[theMenuItem] + ".gif);\" href=\"" +  fileDepht + theMenuItemList[0]  + "/" + theMenuItemList[theMenuItem] + ".html\"></a></div>&nbsp;<br />";
          }
        }
      }
      else {
        Menutext += "&nbsp;<br />";
      }
    }
  }
  writeLayer(document.getElementById("MainMenu"),Menutext);
}
//----------------------------------------------------------------------
// functions for layers
function writeLayer(theLayer,theLayerText) {
if (!theLayer.innerHTML) {
theLayer.document.open();
theLayer.document.write(theLayerText);
theLayer.document.close();
}
else {
theLayer.innerHTML=theLayerText;
}
}
//----------------------------------------------------------------------
// functions for PopUps
function makePopUp(theMenuID,theMenuItems,theOptions,theDefaultIndex) {
var thePopUpText='<select id="' + theMenuID + '">';
for (var theItem in theMenuItems) {
thePopUpText += '<option value="' + theOptions[theItem] + '" label="' + theMenuItems[theItem] + '"';
if (theItem == theDefaultIndex) {
thePopUpText += ' selected="selected"';
}
thePopUpText += '>' + theMenuItems[theItem] + '</option>';
}
thePopUpText += '</select>';
return thePopUpText;
}
//----------------------------------------------------------------------
// functions for external windows
function displayEXTERNAL(theURL,theWindowName,theWindowProperties) {
externalWINDOW=window.open(theURL,theWindowName,theWindowProperties);
externalWINDOW.focus();
}
//----------------------------------------------------------------------
// string functions
function getEmailFromString(theString) {
var theEmailRegEx=/([0-9a-z]+[0-9a-z\._\+={}\-]*)+@([0-9a-z]+([_\-][0-9a-z]+)*\.)+[a-z][a-z]+/;
var theMatch=theEmailRegEx.exec(theString);
if (!theMatch) {
return "";
}
else {
return theEmailRegEx.exec(theString)[0];
}
}

//------------------------------ID READER--------------------------------//

//----------------------------------------------------------------------

// functions for LABEL on links

function showLABEL(theTITLE,theWIDTH) {
	if (theLINKLABELvisible==false) {
				theLINKLABELTXT=("<P CLASS=\"LINKlabelTIT\"><FONT COLOR=\"#FF0000\"><SUB>.</SUB></FONT>"+theTITLE+"<FONT COLOR=\"#FF0000\">.</FONT></P>");
			theLINKLABEL.document.open();
			theLINKLABEL.document.write(theLINKLABELTXT);
			theLINKLABEL.document.close();
		showLAYER(theLINKLABEL)
		theLINKLABELvisible=true;
	}
}

function getMOUSEMOVE(e) {
if ((NS4)||(IE4)) {
	if (theLINKLABELvisible==true) {
			mouseX=event.x;
			mouseY=event.y;
			if (IE5) {
				mouseX=mouseX+document.body.scrollLeft;
				mouseY=mouseY+document.body.scrollTop;
			}
			theLINKLABEL.style.left=(mouseX+mouseXoffset);
			theLINKLABEL.style.top=(mouseY+mouseYoffset);
		}
}
}

function getMOUSEUP(e) {
	if (theLINKLABELvisible) {
		hideLAYER(theLINKLABEL);
		theLINKLABELvisible=false;
	}
	if (NS4) {
		thePOPupDIV.visibility = hidden;
	}
}

//----------------------------------------------------------------------

//----------------------------------------------------------------------
// functions for a popUP menu with title line followed by divider

function submitPOPup(theFORM,thePOPup) {
if ((thePOPup.selectedIndex>1)&&(thePOPup[thePOPup.selectedIndex].value!="-")) {
	theFORM.submit();
}
else {
	thePOPup.selectedIndex=0;
}
}

function selectPOPup(theFORM,thePOPup) {
if (thePOPup[thePOPup.selectedIndex].value=="-") {
	thePOPup.selectedIndex=0;
}
}