/* START: content layer */
var NewsletterLayer = Class.create();

NewsletterLayer.prototype = Object.extend(new Layer, {

	initialize: function(node, trigger) {
		this.node = node;
		this.initSuper(node, trigger);
		var closeButton = Helper.getCloseButton(this.node);
		closeButton.observe("click", function(){this.close();}.bindAsEventListener(this));
		trigger.href="javascript:void(0);";
		if (Info.browser.isIEpre7) {
			this.iframeLining = new IframeLining(this.node);
		}
		this.listener = {'augmentDone' : this.handleOpen.bind(this) };
	},

	open: function() {
		if(HeaderAnimation.diminishable && !HeaderAnimation.augmented) {
			HeaderAnimation.listenerQueue.add(this.listener);
			HeaderAnimation.augment();
		} else {
			Layer.prototype.open.call(this);
		}
	},

	show: function() {
		this.node.setStyle({'display': 'block'});
	},

	hide: function() {
		this.node.setStyle({'display': 'none'});
	},

	beforeOpen: function() {
		if(this.iframeLining)
			this.iframeLining.show();
		return true;
	},

	beforeClose: function() {
		if(this.iframeLining)
			this.iframeLining.hide();
		return true;
	},

	handleOpen: function() {
		HeaderAnimation.listenerQueue.remove(this.listener);
		Layer.prototype.open.call(this);
	}
});
/* END: content layer */
/* START: content layer */
var ContentLayer = Class.create();

ContentLayer.prototype = Object.extend(new Layer, {

	initialize: function(node, trigger) {
		this.node = node;
		this.initSuper(node, trigger);
		
		this.selectedItem = this.trigger.hash;
		
		this.preSelectSector();
		
		var closeButton = Helper.getCloseButton(this.node);

		closeButton.observe("click", function(){this.close();}.bindAsEventListener(this));

		trigger.href="javascript:void(0);";

		if (Info.browser.isIEpre7) {
			this.iframeLining = new IframeLining(this.node);
		}

		//store the listener so it can be accessed by functions add and remove
		this.listener = {'augmentDone' : this.handleOpen.bind(this) };
	},
	preSelectSector: function() {
		if(this.selectedItem) {
			var selArray = this.selectedItem.split("-");
			var selId = "ul"+selArray[0]+" a";
			var selPos = parseInt(selArray[1]);
			var count = 1;

			this.node.select(selId).each(function(item) {
					if(selPos == count) {
						item.addClassName('oswp-selected');
					}
					count++;
				}.bind(this)
			);
		} else {
			if($('ospw-header')) {
				$$('div#ospw-header a').each(function(item) {item.addClassName('oswp-selected');});
			}
		}
	},

	open: function() {
		if(HeaderAnimation.diminishable && !HeaderAnimation.augmented) {
			HeaderAnimation.listenerQueue.add(this.listener);
			HeaderAnimation.augment();
		} else {
			Layer.prototype.open.call(this);
		}
	},

	show: function() {
		this.node.setStyle({'display': 'block'});
	},

	hide: function() {
		this.node.setStyle({'display': 'none'});
	},

	beforeOpen: function() {
		//calculate top value of layer
		if(!this.headerHeight) this.headerHeight = $('header-zone').getDimensions().height + $('toolbar-zone').getDimensions().height;

		//set the top value with header height
		this.node.setStyle({'display': 'block'});
		if(!this.nodeTop) this.nodeTop = /*this.headerHeight +*/ parseInt(this.node.getStyle('top'));
		if(!this.nodeLeft) this.nodeLeft = parseInt(this.node.getStyle('top'));
		if(!this.nodeHeight) this.nodeHeight = this.node.getDimensions().height;
		this.node.setStyle({'display': 'none'});

		this.node.setStyle({'top': this.nodeTop+'px'});
		if(this.iframeLining)
			this.iframeLining.show();
		return true;
	},

	beforeClose: function() {
		if(this.iframeLining)
			this.iframeLining.hide();
		return true;
	},

	handleOpen: function() {
		HeaderAnimation.listenerQueue.remove(this.listener);
		Layer.prototype.open.call(this);
	}
});
/* END: content layer */
/* START: abstract lightbox layer */
var AbstractLightboxLayer = Class.create();

AbstractLightboxLayer.prototype = Object.extend(new Layer, {

	initialize: function(node, trigger, idstring) {
	},

	open: function() {
		//DEV NOTE: will not be true in pagetypes 1 and 2 but was implemented for 
		//future use of lightbox layers in these pagetypes
		if(HeaderAnimation.diminishable && !HeaderAnimation.augmented) {
			HeaderAnimation.listenerQueue.add(this.listener);
			HeaderAnimation.augment();
		} else {
			Layer.prototype.open.call(this);
		}
	},

	show: function() {
		this.node.setStyle({'display': 'block'});
	},

	hide: function() {
		this.node.setStyle({'display': 'none'});
	},

	beforeOpen: function() {
		//calculate top value of layer
		if(!this.headerHeight) this.headerHeight = $('header-zone').getDimensions().height + $('toolbar-zone').getDimensions().height;

		//position the curtain
		this.curtain.setStyle({'top': this.headerHeight+'px'});

		//set the top value with header height
		this.node.setStyle({'display': 'block'});
		if(!this.nodeTop) this.nodeTop = this.headerHeight + parseInt(this.node.getStyle('top'));
		if(!this.nodeLeft) this.nodeLeft = parseInt(this.node.getStyle('top'));
		if(!this.nodeHeight) this.nodeHeight = this.node.getDimensions().height;
		this.node.setStyle({'display': 'none'});

		//check whether layer is higher than current page
		var wrapper = $('footer-position-wrapper');
		this.diff = parseInt(wrapper.getDimensions().height) - this.nodeTop - this.nodeHeight;
		if(this.diff < 0) {
			//resize the content zone
			var layerOccupation = this.nodeHeight + this.nodeTop;
			layerOccupation = layerOccupation - this.headerHeight;
			
			//difference between layer height and content height
			var diff2 = $('content-zone').getDimensions().height - layerOccupation;
			$('content-zone').setStyle({'height': $('content-zone').getDimensions().height - diff2 + 'px'});
			this.resizeCurtain();
		};

		this.node.setStyle({'top': this.nodeTop+'px'});
		if(this.iframeLining)
			this.iframeLining.show();
		this.curtain.setStyle({'display': 'block'});
		$('footer-position-wrapper').scrollTo();
		return true;
	},

	beforeClose: function() {
		this.curtain.setStyle({'display': 'none'});
		if(this.iframeLining)
			this.iframeLining.hide();
		if(this.diff < 0) {
			if(Info.browser.isIE) {
				$('content-zone').setStyle({'height':'1%'});
			} else {
				$('content-zone').setStyle({'height':'auto'});
			}
		}
		return true;
	},

	handleOpen: function() {
		HeaderAnimation.listenerQueue.remove(this.listener);
		Layer.prototype.open.call(this);
	},

	resizeCurtain: function() {
		if(this.curtain) {
			var wrapper = $('footer-position-wrapper').getDimensions();
			var header = $('header-zone').getDimensions();
			var toolbar = $('toolbar-zone');
			this.contentHeight = parseInt(wrapper.height) - parseInt(header.height) - parseInt(toolbar.getDimensions().height);
			this.contentWidth = parseInt(toolbar.getDimensions().width) + parseInt(toolbar.getStyle('margin-left')) + parseInt(toolbar.getStyle('margin-right'));
			this.curtain.setStyle({'height': this.contentHeight+'px','width': this.contentWidth+'px'});
			if(this.iframeLining)
				this.iframeLining.refresh();
		}
	}
});

/* END: abstract lightbox layer */
/********************************/
/* START: inline lightbox layer */
var InlineLightboxLayer = Class.create();

InlineLightboxLayer.prototype = Object.extend(new AbstractLightboxLayer, {
	/*
	 * @base		: AbstractLightboxLayer
	 * @node		: layer div holding the hidden content
	 * @trigger		: element that show triggers the layer
	 * @idstring	: unique id of trigger rel attribute, so that multiple layers can be instantiated
	 */
	initialize: function(node, trigger, idstring) {
		//lightbox layers can not occur in these page types
		if(pageType == "1" || pageType == "2") return;
		this.idstring = idstring;
		this.layerIdstring = "layer-content-"+idstring; 
		this.node = node;
		this.curtainidstring = "lightbox-curtain"+idstring;
		this.replacer = "replacer-"+idstring;
		
		this.initSuper(node, trigger);
		var closeButton = Helper.getCloseButton(this.node);
		closeButton.observe("click", function(){this.close();}.bindAsEventListener(this));
		trigger.href="javascript:void(0);";
		//create the curtain
		new Insertion.After($('content-zone'), "<div id='"+this.curtainidstring+"' class='lightbox-curtain'>&nbsp;</div>");
		this.curtain = $(this.curtainidstring);
		this.resizeCurtain();
		if (Info.browser.isIEpre7) {
			this.iframeLining = new IframeLining(this.curtain);
		}
		//store the listener so it can be accessed by functions add and remove
		this.listener = {'augmentDone' : this.handleOpen.bind(this) };
		//add an event handler to resize the curtain when window is resized
		Event.observe(window, "resize", function(){this.resizeCurtain();}.bindAsEventListener(this));
		
		/*
		 * @id	: this block is used to move the original div content into the layercontent	and if necessary back
		 */
		new Insertion.After($(this.idstring), "<div id='"+this.replacer+"'>&nbsp;</div>");		
		var content = $(this.idstring);
		$(this.idstring).remove();
		$(this.layerIdstring).appendChild(content);
	},
    afterOpen: function() {
		if(typeof fireSifrHandler == 'function') {
            fireSifrHandler();   
        }
	}    
});

/* END: inline lightbox layer     */
/**********************************/
/* START: external lightbox layer */

var ExternalLightboxLayer = Class.create();

ExternalLightboxLayer.prototype = Object.extend(new AbstractLightboxLayer, {
	/*
	 * @base		: AbstractLightboxLayer
	 * @node		: layer div holding the hidden content
	 * @trigger		: element that show triggers the layer
	 * @idstring	: unique id of trigger rel attribute, so that multiple layers can be instantiated
	 */
	initialize: function(node, trigger, idstring) {
		//lightbox layers can not occur in these page types
		if(pageType == "1" || pageType == "2") return;
		this.idstring = idstring;
		this.layerIdstring = "layer-content-"+idstring; 
		this.node = node;
		this.iframehref = trigger.href;
		this.iframecurrenthref = this.iframehref;
		this.iframeidstring = "iframe-"+idstring;
		this.iframeisloaded = false;
		this.iframeheight = 50;
		this.curtainidstring = "lightbox-curtain"+idstring;
		
		var iframe = document.createElement('iframe');
		iframe.setAttribute('id', this.iframeidstring);
		iframe.setAttribute('name', this.iframeidstring);
		iframe.setAttribute('src', "about:blank");
		iframe.setAttribute('height', this.iframeheight+'px');
		iframe.setAttribute('width', '100%');
		//use camel case here for frameBorder else IE will ignore this attribute
		iframe.setAttribute('frameBorder', '0');
		iframe.setAttribute('border', '0');
		iframe.setAttribute('marginwidth', '0');
		iframe.setAttribute('marginheight', '0');
		iframe.setAttribute('scrolling', 'no');
		
	
		this.initSuper(node, trigger);
		var closeButton = Helper.getCloseButton(this.node);
		closeButton.observe("click", function(){this.close();}.bindAsEventListener(this));

		trigger.href="javascript:void(0);";

		//create the curtain
		new Insertion.After($('content-zone'), "<div id='"+this.curtainidstring+"' class='lightbox-curtain'>&nbsp;</div>");
		this.curtain = $(this.curtainidstring);
		this.resizeCurtain();

		if (Info.browser.isIEpre7) {
			this.iframeLining = new IframeLining(this.curtain);
		}

		//store the listener so it can be accessed by functions add and remove
		this.listener = {'augmentDone' : this.handleOpen.bind(this) };

		//add an event handler to resize the curtain when window is resized
		Event.observe(window, "resize", function(){this.resizeCurtain();}.bindAsEventListener(this));
		
		//appending unique iframe to the layer div
		$(this.layerIdstring).appendChild(iframe);
		
	},
	/*
	 * Check if the real destination was loaded before. 
	 * If yes, then just correct the curtain else set the location to initiate iframe. 
	 */
	afterOpen: function() {
		if(!this.iframeisloaded) {
			this.setIFrameLocation();
			this.iframeisloaded = true;
		} else if(this.iframehref != this.iframecurrenthref) {
			this.setIFrameLocation();
		} else {
			this.correctCurtain();
		}
	},
	/*
	 * Can be used to do some cleanup if necessary.
	 */
	afterClose: function() {
		//do some cleanup here if necessary
	},
	/*
	 * Switch the iframe.src attribute from "about:blank" to its real location 
	 */
	setIFrameLocation: function() {
		
		new Insertion.Before($(this.iframeidstring), "<div id='lightbox-preloader'>&nbsp;</div>");
		Event.observe($(this.iframeidstring),'load',function(e){this.rechunkIFrame(e);}.bindAsEventListener(this));
		$(this.iframeidstring).style.visibility = 'hidden';
		$(this.iframeidstring).src = this.iframehref;
	},
	/*
	 * Corrects the content-zone and curtain height if the iframe is higher than the content-zone height.
	 */
	correctCurtain: function() {
		
		if(this.curtain) {
			var wrapper = $('footer-position-wrapper').getDimensions();
			var header = $('header-zone').getDimensions();
			var toolbar = $('toolbar-zone');
			
			var footer = $('footer-zone');
			
			var footerPosY = footer.cumulativeOffset()[1];

			var curtainHeight = parseInt(wrapper.height) - parseInt(header.height) - parseInt(toolbar.getDimensions().height);
			if(parseInt(this.iframeheight) > 380){

				this.diff = -1;
				
				if(parseInt(this.iframeheight) > curtainHeight ) {
					var contentZoneHeight = parseInt(this.iframeheight) + this.nodeTop;
					$('content-zone').setStyle({'height': contentZoneHeight + 'px'});
					curtainHeight = contentZoneHeight + 44;//add 44px offset for footer					
				}
				
				this.contentHeight = curtainHeight;
				this.contentWidth = parseInt(toolbar.getDimensions().width) + parseInt(toolbar.getStyle('margin-left')) + parseInt(toolbar.getStyle('margin-right'));
				this.curtain.setStyle({'height': this.contentHeight+'px','width': this.contentWidth+'px'});
				if(this.iframeLining) {
					this.iframeLining.refresh();
				}
			}
		}
	},
	/*
	 * This is necessary to cut some parts off from the destination source like header and footer.
	 * TODO: note: do rechunking in "beforeOpen" function.
	 */
	rechunkIFrame: function(loadevt) {
		
		var crossevt=(window.event)? event : loadevt
		var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
		if(iframeroot) {
			if(iframeroot.contentWindow) {
				
				this.iframecurrenthref = iframeroot.contentWindow.location;
			
				iframeroot.contentWindow.document.body.style.backgroundImage = "url('')";
				iframeroot.contentWindow.document.body.style.backgroundColor = '#fff';
				if(iframeroot.contentWindow.document.getElementById('header-zone')) {
					iframeroot.contentWindow.document.getElementById('header-zone').style.display = 'none';
				}
				if(iframeroot.contentWindow.document.getElementById('toolbar-zone')) {
					iframeroot.contentWindow.document.getElementById('toolbar-zone').style.display = 'none';			
				}
				if(iframeroot.contentWindow.document.getElementById('breadcrumb-zone')) {
					iframeroot.contentWindow.document.getElementById('breadcrumb-zone').style.display = 'none';
				}
				if(iframeroot.contentWindow.document.getElementById('footer-zone')) {
					iframeroot.contentWindow.document.getElementById('footer-zone').style.display = 'none';
				}
				if(iframeroot.contentWindow.document.getElementById('content-zone')) {
					iframeroot.contentWindow.document.getElementById('content-zone').style.marginLeft = '0px';
				}
				
				var h = iframeroot.contentWindow.document.getElementById('content-zone').offsetHeight + 0;// ie has 50 px more than ff
				
				iframeroot.height = h;
				this.iframeheight = h;
			
			} else if(iframeroot.contentDocument) {
				
				this.iframecurrenthref = iframeroot.contentDocument.location;
			
				iframeroot.contentDocument.document.body.style.backgroundImage = "url('')";
				iframeroot.contentDocument.document.body.style.backgroundColor = '#fff';
				if(iframeroot.contentDocument.document.getElementById('header-zone')) {
					iframeroot.contentDocument.document.getElementById('header-zone').style.display = 'none';
				}
				if(iframeroot.contentDocument.document.getElementById('toolbar-zone')) {
					iframeroot.contentDocument.document.getElementById('toolbar-zone').style.display = 'none';
				}
				if(iframeroot.contentDocument.document.getElementById('breadcrumb-zone')) {
					iframeroot.contentDocument.document.getElementById('breadcrumb-zone').style.display = 'none';
				}
				if(iframeroot.contentDocument.document.getElementById('footer-zone')) {
					iframeroot.contentDocument.document.getElementById('footer-zone').style.display = 'none';
				}
				if(iframeroot.contentDocument.document.getElementById('content-zone')) {
					iframeroot.contentDocument.document.getElementById('content-zone').style.marginLeft = '0px';
				}
				
				var h = iframeroot.contentDocument.document.getElementById('content-zone').offsetHeight + 0;
				
				iframeroot.height = h;
				this.iframeheight = h;
			
			} else {
				//NOTE: ('missing contentWindow or contentDocument. alternative by now not supported');
				return;
			}
		
			this.iframeisloaded = true;
				
			if($('lightbox-preloader')) {
				$('lightbox-preloader').remove();
			}
			
			this.correctCurtain();
			
			$(this.iframeidstring).style.visibility = 'visible';	
		}
	}
});

/* END: external lightbox layer */
var NEWSLETTER_REL_REGEX = /^newsletter-(.+)$/;
var CONTENT_REL_REGEX = /^content-(.+)$/;
var INLIGHTBOX_REL_REGEX = /^in-lightbox-(.+)$/;
var EXTLIGHTBOX_REL_REGEX = /^ext-lightbox-(.+)$/;
var ADDITIONAL_TRIGGER_LINKS_REL_REGEX=/^trigger-(.+)$/;

function init_ext_lightboxLayers() {
	if ($("content-zone")) {
		$A($("content-zone").getElementsByTagName("a")).each(
			function(trigger) {
				trigger = $(trigger);
				if (INLIGHTBOX_REL_REGEX.test(trigger.rel)) { // layer link
					
					var id = trigger.rel.replace(INLIGHTBOX_REL_REGEX, "$1");

					var elm = "<div id='lightbox-layer-"+id+"' class='lightbox-layer'><div class='close'><a href='javascript:void(0);'>";
					elm += "<span class='access'>Close Layer</span></a></div>";
					elm += "<div class='layer-content'><div id='layer-content-"+id+"'></div></div></div>";

					new Insertion.Before($('footer-position-placeholder'), elm);

					var node = $("lightbox-layer-" + id);
					var key="lightbox-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new InlineLightboxLayer(node,trigger,id);
					
				} else if (EXTLIGHTBOX_REL_REGEX.test(trigger.rel)) { // layer link
					
					var id = trigger.rel.replace(EXTLIGHTBOX_REL_REGEX, "$1");
					
					var elm = "<div id='lightbox-layer-"+id+"' class='lightbox-layer'><div class='close'><a href='javascript:void(0);'>";
					elm += "<span class='access'>Close Layer</span></a></div>";
					elm += "<div class='layer-content'><div id='layer-content-"+id+"'></div></div></div>";

					new Insertion.Before($('footer-position-placeholder'), elm);
					
					var node = $("lightbox-layer-" + id);
					var key="lightbox-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new ExternalLightboxLayer(node,trigger,id);
					
				} else if(CONTENT_REL_REGEX.test(trigger.rel)) {
					
					var id = trigger.rel.replace(CONTENT_REL_REGEX, "$1");
					var node = $("content-layer-" + id);
					var key="content-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new ContentLayer(node,trigger);

				} else if(NEWSLETTER_REL_REGEX.test(trigger.rel)) {
					
					var id = trigger.rel.replace(NEWSLETTER_REL_REGEX, "$1");
					var node = $("newsletter-layer-" + id);
					var key="newsletter-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new NewsletterLayer(node,trigger);

				} else if(ADDITIONAL_TRIGGER_LINKS_REL_REGEX.test(trigger.rel)){

					var manualTriggerId=trigger.rel.replace(ADDITIONAL_TRIGGER_LINKS_REL_REGEX,"$1");
                    
					Event.observe(trigger,'click',function(e){navigateToLayer(manualTriggerId,trigger.href);Event.stop(e);}.bind(this));
				}
				
			}.bind(this)
		);
		var uid = 0;
		$$('a[href*="/orderform.php?type="]').each(function(trigger){
		
					var id = "orderform"+uid;
					
					var elm = "<div id='lightbox-layer-"+id+"' class='lightbox-layer layer-orderform'><div class='close'><a href='javascript:void(0);'>";
					elm += "<span class='access'>Close Layer</span></a></div>";
					elm += "<div class='layer-content'><div id='layer-content-"+id+"'></div></div></div>";

					new Insertion.Before($('footer-position-placeholder'), elm);
					
					var node = $("lightbox-layer-" + id);
					var key="lightbox-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new ExternalLightboxLayer(node,trigger,id);
					
					uid++;
		}.bind(this));
		
		
		$$('a[href*="/newsletterform.php"]').each(function(trigger){
		
					var id = "newsletterform"+uid;
					
					var elm = "<div id='lightbox-layer-"+id+"' class='lightbox-layer layer-newsletterform'><div class='close'><a href='javascript:void(0);'>";
					elm += "<span class='access'>Close Layer</span></a></div>";
					elm += "<div class='layer-content'><div id='layer-content-"+id+"'></div></div></div>";

					new Insertion.Before($('footer-position-placeholder'), elm);
					
					var node = $("lightbox-layer-" + id);
					var key="lightbox-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new ExternalLightboxLayer(node,trigger,id);
					
					uid++;
		}.bind(this));
				
		
		
	}
	if($('newsletter-layer-infobox')) {
		$A($('newsletter-layer-infobox').getElementsByTagName("a")).each(
			function(trigger) {
				trigger = $(trigger);
				if (INLIGHTBOX_REL_REGEX.test(trigger.rel)) { // layer link
					
					var id = trigger.rel.replace(INLIGHTBOX_REL_REGEX, "$1");

					var elm = "<div id='lightbox-layer-"+id+"' class='lightbox-layer'><div class='close'><a href='javascript:void(0);'>";
					elm += "<span class='access'>Close Layer</span></a></div>";
					elm += "<div class='layer-content'><div id='layer-content-"+id+"'></div></div></div>";

					new Insertion.Before($('footer-position-placeholder'), elm);

					var node = $("lightbox-layer-" + id);
					var key="lightbox-layer-"+id;
					GLOBAL_LAYER_CONTROLLER[key]=new InlineLightboxLayer(node,trigger,id);
				}
			}.bind(this)
		);
	}
	
	
}
/********************************************************************/
function checkDeepLinks(){
	var param=getUrlParameter("photonewstab");
	if(param){navigateToLayer("lightbox-layer-photonews");}
	param=getUrlParameter("rss");
	if(param){navigateToLayer("lightbox-layer-rss");}
	param=getUrlParameter("press");
	if(param){
		var url = 'http://w1.siemens.com/press' + param;
		if(window.location.host.indexOf('stage.siemens.com') > -1) {
			url = 'https://stage.siemens.com/cc/corp/press' + param;
		}
		showUrlExternalLightboxLayer(url);	
	}
}

function showUrlExternalLightboxLayer(url) {
	var trigger = new Element('a', {href: url}).update('show');
	
	var id = "directshow";
	
	var elm = "<div id='lightbox-layer-"+id+"' class='lightbox-layer'><div class='close'><a href='javascript:void(0);'>";
	elm += "<span class='access'>Close Layer</span></a></div>";
	elm += "<div class='layer-content'><div id='layer-content-"+id+"'></div></div></div>";

	new Insertion.Before($('footer-position-placeholder'), elm);
	
	var node = $("lightbox-layer-" + id);
	var key = "lightbox-layer-"+id;
	var layer = new ExternalLightboxLayer(node,trigger,id);
	layer.toggle();

}

Event.onDOMReady(function(){
	init_ext_lightboxLayers();
	checkDeepLinks();
});