
var rollImgPath = "";
var orgImgPath = "";
var initDone;
var rollExt = '.down';
var splitAr = new Array();
var iNArray = new Array();
var counter = 0;
var HoverArray = new Array();
var iNarrayOrgSrc = new Array();
var ImgContainer = new Array();

function initNavRollover(){
	if (document.images) {
		for(i=0; i<= document.images.length-1; i++){
			if(document.images[i].name != ""){
				thisOrgSrc = document.images[i].src;
				splitAr = thisOrgSrc.split("/");
				thisImgSrcName = splitAr[splitAr.length-1];
				if(document.images[i].name == thisImgSrcName){
					rollImgPath = thisOrgSrc.substr(0,thisOrgSrc.length-thisImgSrcName.length);
					HoverImgSrc = getHoverImg(thisImgSrcName);
					iNarrayOrgSrc[document.images[i].name] = document.images[i].src;
					HoverArray[document.images[i].name] = new Image;
					HoverArray[document.images[i].name].src = HoverImgSrc;
          ImgContainer[counter] = document.images[i].name;
          counter++;
				}//if
			}//if
		}//for
		initDone=true;
	} else {
		initDone=false;
	}//if
}//function

function getHoverImg(OrgImgSrc){
	thisImgTail = OrgImgSrc.substring(OrgImgSrc.length-4,OrgImgSrc.length);
	thisImgMain = OrgImgSrc.substring(0,OrgImgSrc.length-4);
	thisHoversrc = rollImgPath+thisImgMain+rollExt+thisImgTail;
	return thisHoversrc;
}

function place(name) {
	if (initDone) {document.images[name].src=HoverArray[name].src;} // if
}//function
function remake(name) {
	if (initDone) {document.images[name].src=iNarrayOrgSrc[name];} // if
}//function


/**
 * Opens a simple popup-window
 *
 * @param string url
 * @param integer width
 * @param integer height
 * @return object
 */
function openPopup(url, width, height)
{
  // i guess this way every window will have its unique name
  i = 0;
  opts = 'width='+width+', height='+height+', top=150, left=150, '+
         'scrollbars=no, location=no, menubar=no, resizable=no, '+
         'status=no, toolbar=no';
  return window.open(url, 'window_'+i++, opts);
} // end openPopup()


// das gleiche wie openPopup nur moderner

function popup(url) {

  var width = (arguments.length > 1) ? parseInt(arguments[1]) : 620;
  var height = (arguments.length > 2) ? parseInt(arguments[2]) : 380;
  var title = (arguments.length > 3) ? arguments[3] : '';
    var props = "width=" + width + ",height=" + height + ",resizable=no,menubar=no,locationbar=no,status=no,scrollbars=no,depend=yes,left=10,top=10";
  var popup;
 
  if (popup = window.open(url, title, props)) {
 
    popup.focus();
    return true;
  }
 
  return false;
} // end function popupwindow
