// Concept, design and implementation by
// FutureCom interactive AG
//---- P.O. Box
//---- 8037 Zurich
//---- Switzerland
//---- http://www.futurecom.ch
//----
//---- NMC: she
//---- NMD: gso
//---- ITS: tw, rse, pj, ros

function Cachetable(){
 this.put = cachetablePut;
 this.get = cachetableGet;
 
 this.elements = cachetableElements;
 this.mCounter = 0; 
 this.mListValue = new Array();
 this.mListKey = new Array();
}
 
function cachetablePut(value,key){
 this.mListValue[this.mCounter] = value
 this.mListKey[this.mCounter] = key
 this.mCounter++;
}
 
function cachetableGet(key){
 for(var i = 0; i < this.mListKey.length; i++){
  if(this.mListKey[i]==key){
   return this.mListValue[i];
  }
 }
 return null;
}
 

function cachetableElements(start, end){
 return new __cachetableEnumeration(this.mListValue,start,end);
}
 
function __cachetableEnumeration(list,start,end){ 
 if(start!=null && end!=null){
  this.mCounter = start;
  this.mList = list;
  this.mSize = end;
 }else{
  this.mCounter = 0; 
  this.mList = list; 
  this.mSize = this.mList.length;
 }
 
 this.hasMoreElements = cachetableEnumerationElementsHasMoreElements;
 this.nextElement =  cachetableEnumerationElementsNextElement;
}
 
function cachetableEnumerationElementsHasMoreElements(){
 if(this.mSize <= this.mCounter){
  return false;
 } else {
  return true;
 }
}
function cachetableEnumerationElementsNextElement(){
 var retVal=this.mList[this.mCounter];  
 this.mCounter++;
 return retVal;
}

var table = new Cachetable();


function preload(imgObj,imgSrc) {
     
	if (document.images) {
		
		eval(imgObj +' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
		table.put(imgObj,imgObj)
	}
}
function changeImage(imgName,imgObj) {	
	//var imgObj = new Image();
	if	(table.get(imgObj))	{
		document.images[imgName].src = eval(imgObj+".src");
	}
}

function wopen(url,name,width,height){
	winopen(url,name,width,height,0,0,0,0,0,0,0)
}	

var refWindow;
if (window.popup) { refWindow = window.popup;}


function winopen(url,name,width,height,scrollbars,toolbar,location,directories,status,menubar,resizable){
	
	if (refWindow){
		if (!refWindow.closed) {
			refWindow.close();
		}
	}
	if (refWindow = open(url,
				name,
				"width=" + width 
				+ ",height=" + height 
				+ ",scrollbars=" + scrollbars 
				+ ",toolbar=" + toolbar 
				+ ",location=" + location 
				+ ",directories=" + directories 
				+ ",status=" + status 
				+ ",menubar=" + menubar 
				+ ",resizable=" + resizable
				+ ",top=80" 
				+ ",left=80")) { window.popup = refWindow; }
	window.setTimeout('refWindow.focus();',40);
}

function picturePopup(imagePath,imageWidth,imageHeight) {
	imagePath = '/_zwi/_img/' + imagePath;
	popupPath = '/popup_pictures.asp';
	popupPath += '?imageWidth=' + imageWidth + '&imageHeight=' + imageHeight + '&imagePath=' + imagePath;
	wopen(popupPath,'pictures',imageWidth,imageHeight+52+19);
}
