// JavaScript Document
document.observe('dom:loaded', function() {
	new Contact(); 

	/*	business	*/
	sIFR.replaceElement(named({sSelector:"div.contact-right-content div.sifr-h4 div.p p", sFlashSrc: SIFR_SLAB_PATH, sColor:"#333333", sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:"div#contactcrumb-zone dd span.sifr", sFlashSrc: SIFR_SLAB_PATH, sColor:"#333333", sHoverColor:"#990000", sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:"div#contactcrumb-zone dd span.sifr-selected", sFlashSrc: SIFR_SLAB_PATH, sColor:"#990000", sHoverColor:"#990000", sWmode:"transparent"}));

	/*	business_mail	*/
	sIFR.replaceElement(named({sSelector:"div.main-contact-block div.contact-left-content div.formhead", sFlashSrc: SIFR_SLAB_PATH, sColor:"#333333", sWmode:"transparent"}));
	
	/*	corporate press contact headlines	*/
	sIFR.replaceElement(named({sSelector:"div#pressresults div.sifr-h3 h3",sFlashSrc:SIFR_SLAB_PATH,sColor:"#666666",sWmode:"transparent"}));
	
	/*  corporate ir contact headlines  */
	sIFR.replaceElement(named({sSelector:"div.irheaddiv h4",sFlashSrc:SIFR_SLAB_PATH,sColor:"#666666",sWmode:"transparent"}));
	
	/* IE layer styling */
	if(self != top)
	{
		$$('#toolbar-layer-contact .main-contact-block')[0].setStyle({
			paddingTop: '0'
		});
		$('footer-position-wrapper').setStyle({
			backgroundColor: '#E7E8EB'
		});
	}
});

/**
 * Overwrite default script here to make toggle available.
 */
function init_contactLayer() {
	if ($("toolbar-nav")) {
		
		$('site-id-layer').style.zIndex = 1001;
		/*
		$('toolbar-nav').down('li.active').removeClassName('active');
		$('toolbar-layer-contact').removeClassName('active-layer');	
		
		var trigger = $("toolbar-nav").down('li').down('a');
		var node = $("toolbar-layer-contact");
		var layer = new ContactContentLayer(node, trigger);
		layer.toggle();
		*/
	}
}


/* START: contact content layer e. g. contact layer                         */

var ContactContentLayer = Class.create();

ContactContentLayer.prototype = Object.extend(new Layer, {

	initialize: function(node, trigger) {
		this.initSuper(node, trigger);
	},

	hide: function() {
		this.node.removeClassName("active-layer");
		this.trigger.up().removeClassName("active");
	},

	show: function() {
		this.node.addClassName("active-layer");
		this.trigger.up().addClassName("active");
		this.trigger.addClassName("clicked"); // avoids hover effect (only for the first time)
		this.trigger.observe("mouseout",
			function(e) {
				var elm = Event.findElement(e, "a");
				elm.removeClassName("clicked");
				elm.stopObserving("mouseout");
			}
		);
	},

	setOffset:function(offset) {
		this.node.style.top = "166px";
	}

});

/* END: contact content layer                                               */



var Contact = Class.create();

Contact.prototype = {

	initialize: function() {
		if(top!=self) {
			this.crop();
		}
	},
	crop: function() {
		document.body.style.backgroundImage = "url('')";
		/*document.body.style.backgroundColor = '#e7e8eb';	why*/
		if($('logo')) $('logo').style.display = 'none';
		if($('header-zone')) $('header-zone').style.display = 'none';
		if($('toolbar-zone')) $('toolbar-zone').style.display = 'none';
		if($('breadcrumb-zone')) $('breadcrumb-zone').style.display = 'none';
		if($('footer-zone')) $('footer-zone').style.display = 'none';
		if($('content-zone')) $('content-zone').style.marginLeft = '0px';
		if($('toolbar-layer-contact')) {
			$('toolbar-layer-contact').style.top = '0px';
			$('toolbar-layer-contact').style.left = '0px';
		}
		top.showContactIFrame();
		
		Event.observe(window,'unload',function() {top.hideContactIFrame();}.bindAsEventListener(this));
		
	}
}