/*

code under copyright from storesystem.de, Tilman Otto

use without license strictly forbidden

- this script is no freeware !! -

*/
  

function openPopup()
{

  this.selectObj = document.body;

  this.indicSrc = new Image();
  this.indicSrc.src = 'http://zetem.de/images/indicator_medium.gif';
 
  <!-- browser switch -->
  useragvar  = navigator.userAgent.toLowerCase();
  this.ns    = (document.layers) ? true : false;
  this.ie    = (document.all || useragvar.indexOf('webwasher') != -1) ? true : false;
  this.op    = (useragvar.indexOf('opera') != -1) ? true : false;
  this.iemac = (useragvar.indexOf('mac_powerpc') != -1) ? true : false;
	this.khtml = (useragvar.indexOf('khtml') != -1) ? true : false;
	this.ns6   = (window.getSelection);
	
	if(this.op && this.ie)
	{
	    this.ie = false;
	}
  <!-- switch end -->
	
	inst = this;
}


openPopup.prototype = {

	opClick: function()
  	{
		inst.selectObj.onresize = null;
		new Effect.Opacity('screenLayer',{duration:3.0,from:0.65,to:0});
		window.setTimeout(
			function()
			{
				Effect.SwitchOff('gallLayer');
				window.setTimeout(function()
					{
						inst.selectObj.removeChild(inst.divObj);
					},2000);
				window.setTimeout(function()
					{
						inst.selectObj.removeChild(inst.gallObj);
					},1000);																														 
			},1500);
  	},
											
  	resizeWin: function()
  	{
		inst.selectObj.removeChild(opWin.gallObj);
		inst.selectObj.removeChild(opWin.divObj);
		inst.crPopup(inst.imgWidth,inst.imgHeight,inst.imgTitle,inst.url);
  	},
											
  crPopup: function(imgWidth,imgHeight,imgTitle,url) {
	
		this.imgWidth  = imgWidth;
		this.imgHeight = imgHeight;
		this.imgTitle  = imgTitle;
		this.url       = url;
		
		var boxHeight = 20;
		
		var divWidth  = this.selectObj.clientWidth;
		var divHeight = this.selectObj.clientHeight - (boxHeight*2);
		var imgLeft = Math.floor((divWidth - this.imgWidth)/2);
		var imgTop = Math.floor((divHeight - this.imgHeight)/2);
		var indicLeft = Math.floor((divWidth - 32)/2);
		var indicTop = Math.floor((divHeight - 32)/2);
		
	

	  // build transparent layer
  	this.divObj  = Builder.node('div',{id:'screenLayer',style:'top:0px;left:0px;float:none;position:absolute;width:100%;height:100%;z-index:2;background-color:#E7EEEE;filter:alpha(opacity=65);-moz-opacity:.65;opacity:.65;'},
	              [Builder.node('img',{id:'indicator',style:'margin-top:' + indicTop + 'px;margin-left:' + indicLeft + 'px;width:32px;height:32px;'})]
		  				);

    // build image layer					 
	  this.gallObj = Builder.node('div',{id:'gallLayer',style:'top:' + imgTop + 'px;left:' + imgLeft + 'px;float:none;position:absolute;width:' + this.imgWidth + 'px;height:' + this.imgHeight + 'px;z-index:3;'},
	              // top: create outer p-frame
			  			  [[Builder.node('p',{style:'width:' + this.imgWidth + 'px;height:' + (boxHeight + 4) + 'px;margin:0px;'},
	              // top: create inner p-frame
                  [Builder.node('p',
	                              {style:'background-color:#FFFFFF;margin:0px;padding:5px;text-align:center;font-size:12px;font-weight:bold;'},
							  		  					imgTitle)]
                )],
							 
	  						// add image to inner div frame gallObj  
		  					[Builder.node('div',{id:'gallImgDiv',style:'width:' + this.imgWidth + 'px;height:' + this.imgHeight + 'px;'},
			  				  [Builder.node('img',{id:'gallImg',src:this.url,title:this.imgTitle,alt:this.imgTitle,style:'display:none;width:' + this.imgWidth + 'px;height:' + this.imgHeight + 'px;margin:0px;'})]
				  			)],
						 
					  		// bottom: create outer p-frame
						  	[Builder.node('p',{style:'width:' + this.imgWidth + 'px;height:' + (boxHeight + 5) + 'px;margin:0px;'},
	              // bottom: create inner p-frame
                  [Builder.node('p',
	                              {style:'background-color:#FFFFFF;margin:0px;padding:5px;text-align:center;'},
		  							  					'Zum Schließen auf das Bild klicken.')]
                  )]
				  			]
					  	);


  	this.selectObj.appendChild(this.divObj);
  	this.selectObj.appendChild(this.gallObj);
  	$('indicator').src = this.indicSrc.src;
	
	
  	if(this.op) 
	      Element.show('gallImg');
	
  	$('gallImg').onload = function() {
	                          Element.hide('indicator');
		  											Element.show('gallImg');
			  									}

	
  	// makes object draggable
  	new Draggable(this.gallObj,{revert:true});
		
	  // close image on click
  	this.gallObj.onclick = this.opClick;
									
  	// repositioning of image if window has been resized
  	window.onresize = this.resizeWin;

		}
}




function initMenu(strContentID,strImagePath)
{
	//alert(strContentID + " " + strImagePath);

	this.menuArray = $A($('header').getElementsByTagName('img'));
  //String(document.location).match(/(ftp|http):\/\/([_a-z\d\-]+(\.\w+)+)(([_a-z\d\-\\\.\/]+[_a-z\d\-\\\/])+)*\/(\w+)/);
	this.selPage   = strContentID;
	this.strImagePath = strImagePath;
	this.menuItemImg = {};
	instM = this;
}


initMenu.prototype =
{
	menuOver: function()
	{
		this.src = instM.menuItemImg[this.id].src;	
	},
	menuOut: function()
	{
		this.src = instM.strImagePath + 'layout_zetem_navigation_' + this.id + '.gif';	
	},
	buildMenu: function()
	{
		//alert("buildMenu: "+this.selPage + " " + this.strImagePath);
		this.menuArray.each(
			function(menuItem,key)
    		{
				if (menuItem.id != instM.selPage)
				{
					instM.menuItemImg[menuItem.id] = new Image();
					instM.menuItemImg[menuItem.id].src = instM.strImagePath + 'layout_zetem_navigation_' + menuItem.id + '_hover.gif';
					$(menuItem.id).onmouseover = instM.menuOver;
					$(menuItem.id).onmouseout  = instM.menuOut;
				}
				else
				{
					$(menuItem.id).src = instM.strImagePath + 'layout_zetem_navigation_' + menuItem.id + '_hover.gif';
				}
			}
		);
	}
};




