window.onload = function ()
{
	enableDropdownMenuForIE = function ()
	{
        $$('#navcontainer ul.stufe_eins li.opened, #navcontainer ul.stufe_eins li.selected').each (function (atag) 
		{
			
			var child = atag.getLast ();
			
			if (child.getTag() == 'ul')
			{
				atag.addEvent ("mouseover", function() {child.setStyle ("display", 'block');});
				atag.addEvent ("mouseout", function() {child.setStyle ("display", 'none');});
			}
	
		});
		
		$$('.classicSizeLink').each (function (atag)
		{
			var background = atag.getElement ('.classicSizeBox');
			var color = atag.getElement ('.classicSizeName');
			if (background && color)
			{
				atag.addEvent ("mouseover", function() 
				{
					color.removeClass  ('classicSizeName');
					color.addClass  ('classicSizeNameAct');
				});
				atag.addEvent ("mouseout", function() 
				{
					color.removeClass  ('classicSizeNameAct');
					color.addClass  ('classicSizeName');
				});
			}
		});
	}
	
	if (window.ie6)
	{
		enableDropdownMenuForIE ();
	}
	
	details = function() 
	{
		var setSizeIMG = function (el, cEl)
		{
			widthIMG = el.width;
			heightIMG = el.height;
			width = cEl.clientWidth;
			height = cEl.clientHeight; 
			    
			fDX  =  width /  widthIMG;
			fDY = height / heightIMG;
			
			if (fDX > fDY)
			{
				// setWidth = parseInt (widthIMG * fDY);
				setHeight = height;
			}
			else
			{
				//  setWidth = width;
				setHeight = parseInt (heightIMG * fDX);
			}
			
			//el.setStyle('width', setWidth);	
			//el.setStyle('height', setHeight);
			//marginLeft = parseInt ((width - setWidth) / 2);
			//marginLeft = marginLeft;
			marginTop = parseInt ((height - setHeight) / 2);
			//el.setStyle('margin-left', marginLeft);	
			if (isNaN (marginTop))
			{
				marginTop = 0;
			}
			if (el.setStyle)
			{
				el.setStyle ('margin-top', marginTop);
			}
			//cEl.setOpacity(1);
		}
		
		setSizeIMG ($('detailsImageHouse'), $('detailsImageBox'));
		
		$$('.detaisImageThumbSize').each( function (el)
		{
			setSizeIMG (el.getFirst (), el);
		});
		
		$$('.footprint').each( function (el)
		{
			setSizeIMG (el.getFirst (), el);
		});
		
	}
	details ();
	
	houseImagePop = function ()
	{
		if ($('popUp'))
		{ 
			$('popUp').addEvent ('click', function (e)
			{
				e = new Event(e).stop();	
				href = $('popUp').getProperty ('href');
				window.open(href, '', 'scrollbars=no,resizable=no,menubar=no,width=740,height=500');		
			});
		}
		if ($('popUp2'))
		{ 
			$('popUp2').addEvent ('click', function (e)
			{
				e = new Event(e).stop();	
				href = $('popUp2').getProperty ('href');
				window.open(href, '', 'scrollbars=no,resizable=no,menubar=no,width=740,height=500');		
			});
		}
		
		if ($('popUpFoot'))
		{ 
			$('popUpFoot').addEvent ('click', function (e)
			{
				e = new Event(e).stop();	
				href = $('popUpFoot').getProperty ('href');
				window.open(href, '', 'scrollbars=no,resizable=no,menubar=no,width=896,height=724');		
			});
		}
		var popThumbs = $$('.popThumb');
		popThumbs.each (function (elem) 
		{
			var href4 = elem.getProperty ('href');
			elem.addEvent ('click', function (e)
			{
				e = new Event(e).stop();	
				window.open(href4, '', 'scrollbars=no,resizable=no,menubar=no,width=740,height=500');
			});		
		});
	} 
	houseImagePop ();	
}