lang = lang?lang:'en';
Event.observe(window, 'load', lightwindowInit, false);
var myLightWindow = null;
var contact = null;
var name;

// NOTE: To change the path for the close2.gif (red xcross), go to lightwindow.js row 164
// NOTE: To change the path for the AjaxLoading throbber, go to lightwindow.js row 207
function lightwindowInit() {
	myLightWindow = new lightwindow( {
		resizeSpeed : 10,
		overlay : {
			opacity : 0.7,
			image : '/web/portal/SiteCollectionDocuments/lightwindow/images/black.png',
			presetImage : '/web/portal/SiteCollectionDocuments/lightwindow/images/macFFBgHack.png'
		},
		hideFlash : false
	});
	
	$$('a').each(function(element){
	    if(element.href.length > 2 && !element.href.match(/(javascript:|siemens.ca|workspace|mailto|http\:\/\/w1.siemens.com\/answers\/ca\/(en|fr)\/index\.htm\?tab=(industry|energy|healthcare))/i)) {
	        element.onclick = null;
	        element.keydown = null;
	        element.keypress = null;
	        element.observe('click', function(event) {
	            Event.stop(event);
                if(element.innerHTML.match(/<img/i)) {
                    name = '';
                } else {
                    name = element.innerHTML;
                }
	            showMedia( 447, 287, '/web/portal/SiteCollectionDocuments/lightwindow/disclaimer-'+ lang + '.html?name='+encodeURIComponent(name).replace(/%/g, "xPERCENTx")+'&url='+encodeURIComponent(element.href).replace(/%/g, "xPERCENTx"));
	        })
	    }
	});
	
}

function showMedia( pWidth, pHeight, pHref ) {
	try {
		myLightWindow.activateWindow({
			href: pHref,
			width: pWidth,
			height: pHeight,
			iframeEmbed : true, // Diese Option hat 0 Auswirkung, wird entgegen der Dokumentation einfach ignoriert. siehe nächste Zeile
			type : 'external' // Der Type bestimmt, ob das neue Fenster ein DIV oder ein iFrame ist, 'External' öffnet immer iFrame, 'Page' ein Div 
		});
	} catch( e ) {
		// alert( e );
	}
}