pictures = new Array();
var objCount = 0; // number of (changing) images on web-page

function preloadSiteElements(name, first, second, third) 
{  
  // preload images and place them in an array
    
  pictures[objCount] = new Array(4);
  pictures[objCount][0] = new Image();
  pictures[objCount][0].src = first;	//pfeil_o
  pictures[objCount][1] = new Image();
  pictures[objCount][1].src = second;	//pfeil_u
  pictures[objCount][2] = new Image();
  pictures[objCount][2].src = third;	//pfeil
  pictures[objCount][3] = name;
  objCount++;
}

function onSiteElements(name)	//Mouseover
{
     for (var i = 0; i < objCount; i++) 
	 {
        if (document.images[pictures[i][3]] != null)
        {
            //alert("OnMouseOver "+objCount);
            //alert( parent.frames[2].document.URL);
            // ergebnis = parent.frames[2].location.href.match(pics[i][3]);
            //alert( ergebnis );
            if (name != pictures[i][3] && !parent.frames[2].location.href.match(pictures[i][3]) ) 
            {
                // set back all other pictures
          	    document.images[pictures[i][3]].src = pictures[i][0].src;
            } 
		    else 
		    {
                // show the second image because cursor moves across this image
			    if (name == pictures[i][3] && !parent.frames[2].location.href.match(pictures[i][3]))	   
			        document.images[pictures[i][3]].src = pictures[i][1].src;
			    else
				    document.images[pictures[i][3]].src = pictures[i][2].src;
		    }
        }
	  }
}

function changeSiteElements(name)	//OnClick
{
     for (var i = 0; i < objCount; i++) 
	 {
        if (document.images[pictures[i][3]] != null)
//          alert( parent.frames[2].document.URL);
//        ergebnis = parent.frames[2].location.href.match(pics[i][2]);
//        alert( ergebnis );
        if (name != pictures[i][3] ) 
        {
          // set back all other pictures
          document.images[pictures[i][3]].src = pictures[i][0].src;
        } 
		else 
		{
           // show the second image because cursor moves across this image
           document.images[pictures[i][3]].src = pictures[i][2].src;
        }
    }
}

function offSiteElements()	//MouseOut
{
     for (var i = 0; i < objCount; i++) 
	 {
      // set back all pictures
      if (document.images[pictures[i][3]] != null && !parent.frames[2].location.href.match(pictures[i][3])) 
       	document.images[pictures[i][3]].src = pictures[i][0].src;
	 }
}
