// No More IE6 Background Flicker - http://www.hedgerwow.com/360/bugs/dom-fix-ie6-background-image-flicker.html
(function(){ /*Use Object Detection to detect IE6*/ var m = document.uniqueID /*IE*/ && document.compatMode /*>=IE6*/ && !window.XMLHttpRequest /*<=IE6*/ && document.execCommand ; try{ if(!!m){ m("BackgroundImageCache", false, true) /* = IE6 only */ } }catch(oh){}; })();
// Load Function on DOM.Contentload - crossbrowser
function onContent(f){//(C)webreflection.blogspot.com
var b=navigator.userAgent,d=document,w=window,
c="__onContent__",e="addEventListener",o="opera",r="readyState",
s="<scr".concat("ipt defer src='//:' on",r,"change='if(this.",r,"==\"complete\"){this.parentNode.removeChild(this);",c,"()}'></scr","ipt>");
w[c]=(function(o){return function(){w[c]=function(){};f(o?o():o)}})(w[c]);
if(d[e])d[e]("DOMContentLoaded",w[c],false);
if(/WebKit|Khtml/i.test(b)||(w[o]&&parseInt(w[o].version())<9))
(function(){/loaded|complete/.test(d[r])?w[c]():setTimeout(arguments.callee,1)})();
else if(/MSIE/i.test(b))d.write(s);
};
/*
addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
*/
function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}

/*
JSTarget function by Roger Johansson, www.456bereastreet.com
*/
var JSTarget = {
	init: function(att,val,warning) {
		if (document.getElementById && document.createElement && document.appendChild) {
			var strAtt = ((typeof att == 'undefined') || (att == null)) ? 'class' : att;
			var strVal = ((typeof val == 'undefined') || (val == null)) ? 'x-link' : val;
			var arrLinks = document.getElementsByTagName('a');
			var oLink;
			var oRegExp = new RegExp("(^|\\s)" + strVal + "(\\s|$)");
			for (var i = 0; i < arrLinks.length; i++) {
				oLink = arrLinks[i];
				if ((strAtt == 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(strAtt)))) {
					oLink.onclick = JSTarget.openWin;
				}
			}
		}
	},
	openWin: function(e) {
		var event = (!e) ? window.event : e;
		if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return true;
		else {
		    var oWin = window.open(this.getAttribute('href'), '_blank');
			if (oWin) {
				if (oWin.focus) oWin.focus();
				return false;
			}
			oWin = null;
			return true;
		}
	}
};

function googlemaps() {
 if(document.getElementById("headmap")) {	
 document.getElementById("headmap").style.width = "44em";
 document.getElementById("headmap").style.height = "20em";
// document.getElementById("headmap").style.marginTop = "1em";
  if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("headmap"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GOverviewMapControl());
	map.setCenter(new GLatLng(48.207329, 16.34506), 15);
	// Create our "tiny" marker icon
	var icon = new GIcon();
	icon.image = "/neu/assets/content/icon-googlemaps.gif";
//		icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	icon.iconSize = new GSize(24, 37);
//		icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(18, 27);
	icon.infoWindowAnchor = new GPoint(5, 1);		
	// Creates a marker at the given point with the given number label
	function createMarker(point) {
	  var marker = new GMarker(point, icon);
	  GEvent.addListener(marker, "click", function() {
	marker.openInfoWindowHtml('<strong>Stummer & Partner</strong><br />Headoffice Wien<br /> Lerchenfelderstraße 88-90<br /> A-1080 Wien<br />Tel. +43 (1) 4034082-0');
	  });
	  return marker;
	}				
   map.addOverlay(createMarker(new GLatLng(48.2072, 16.3453)));
  }
 }
 if(document.getElementById("kremsmap")) {	
 document.getElementById("kremsmap").style.width = "44em";
 document.getElementById("kremsmap").style.height = "20em";
// document.getElementById("kremsmap").style.marginTop = "1em";
  if (GBrowserIsCompatible()) {
	var map2 = new GMap2(document.getElementById("kremsmap"));
	map2.addControl(new GSmallMapControl());
	map2.addControl(new GOverviewMapControl());
	map2.setCenter(new GLatLng(48.40712, 15.610381), 14);
	// Create our "tiny" marker icon
	var icon2 = new GIcon();
	icon2.image = "/neu/assets/content/icon-googlemaps.gif";
//		icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	icon2.iconSize = new GSize(24, 37);
//		icon.shadowSize = new GSize(22, 20);
	icon2.iconAnchor = new GPoint(18, 27);
	icon2.infoWindowAnchor = new GPoint(5, 1);		
	// Creates a marker at the given point with the given number label
	function createMarker2(point) {
	  var marker2 = new GMarker(point, icon2);
	  GEvent.addListener(marker2, "click", function() {
	marker2.openInfoWindowHtml('<strong>Stummer & Partner</strong><br />Office Krems<br /> Dr. Gschmeidlerstraße 8/31<br /> A-3507 Krems<br />Tel. +43 (1) 4034082-0');
	  });
	  return marker2;
	}				
   map2.addOverlay(createMarker2(new GLatLng(48.40712, 15.610381)));
  }
 }
 
}
// -----------------------------------------------------------------------



var glos = {
	init: function(listid) {
		if(window.location.hash != '') {
			if (document.getElementById && document.getElementsByTagName) {
				this.resetList(listid);
				this.setActive(window.location.hash);
			}	
		}
	},
	resetList: function(listid) {
		var arrDT = document.getElementById(listid).getElementsByTagName('dt');
		var arrDD = document.getElementById(listid).getElementsByTagName('dd');
		this.setClass(arrDT);
		this.setClass(arrDD);
	},
	setClass: function(nodes) {
		var el;
		for (var i = 0; i < nodes.length; i++) {
			el = nodes[i];
			this.setOpacity(el, 0.3);
			el.className = "";
		}
	},
	setActive: function(hash) {
		var id = hash.split("#");
		var el = document.getElementById(id[1]);
		el.className = "active";
		this.getNextElementNode(el).className = "active";
		this.setOpacity(el, 1);
		this.setOpacity(this.getNextElementNode(el), 1);
	},
	getNextElementNode: function(node) {
		node = node.nextSibling;
		while (node && node.nodeType != 1) {
		  node = node.nextSibling;
		}
		return node;
	},
	setOpacity: function(element,alpha) {
		var style = element.style;		
		if( style.opacity != undefined ) { //Opera
		style.opacity = alpha;
		}
		else if( style.MozOpacity != undefined ) { //Moz and older
		style.MozOpacity = alpha;
		}
		else if( style.KhtmlOpacity != undefined ) { //Moz and older
		style.KhtmlOpacity = alpha;
		}
		else if( style.filter != undefined ) { //IE
			if(alpha == 1) {
				style.filter = "";
			} else {
				style.filter = "alpha(opacity="+alpha * 100+")";
			}
		}
	}
}
// -----------------------------------------------------------------------

addEvent(window, 'load', googlemaps);
addEvent(window, 'load', function(){JSTarget.init();glos.init('glossar');});

