/*
	--------------------------------------------------------------------------------- 
	datei:		guj_default.js
	project:	relaunch von guj.de
	--------------------------------------------------------------------------------- 
*/
/*
	--------------------------------------------------------------------------------- 
	funktion loadCSS():
	fragt den benutzten Brauser ab, und laedt in Abhaengigkeit davon eine
	Brauser-spezifische externe CSS-Datei ein.
	--------------------------------------------------------------------------------- 
*/
function loadCSS (cssHome) {
	
	var cssPfad = cssHome + 'css/';
	var d = document;
	var w = window;
	
	var ie = ((d.all) && (w.offscreenBuffering)) ? true : false;
	var ns = ((d.layers) && (d.captureEvents) && (!d.getElementById)) ? true : false;
	var mz = ((d.getElementById) && (document.createTextNode)) ? true : false;
	var op = ((d.getElementById) && (!document.createTextNode)) ? true : false;
	var nsmac 	= ((document.layers) && (document.captureEvents) && (!document.getElementById) && (navigator.userAgent.indexOf("Mac")>-1)) ? true : false;
	
	if (ns) {
		document.write('<LINK REL="StyleSheet" HREF="'+cssPfad+'guj_nn.css" TYPE="text/css">') 
	}
	if (ie || mz || op || nsmac) {
		document.write('<LINK REL="StyleSheet" HREF="'+cssPfad+'guj_ie.css" TYPE="text/css">') 
	}
}

/*
	--------------------------------------------------------------------------------- 
	funktion bildwechsel():
	mouse-over-effect, tauscht images bei mouse-over-image aus.
	uebergabewerte:
		name = eindeutiger name [id] des bildes
		Bild = dateiname mit pfadangabe
	--------------------------------------------------------------------------------- 
*/
function bildwechsel(name,Bild) {
	if(document.images)
	{
		document.images[name].src=Bild
	}
}

/*
	--------------------------------------------------------------------------------- 
	funktion dateneingabe():
		macht ein pop-up.
		laedt das template dateneingabe.
		abhaengig von der uebermittelten maskeNr wird festgelegt:
			- die empfaenger-adresse der abgesendeten daten
		 	- die pflichtfelder
	uebergabewerte:
		maskeNr = eindeutige nr [id] der dateneingabemaske
		
	--------------------------------------------------------------------------------- 
*/
function dateneingabe( maskenHome, maskeNr ) {

	maskenPfad = maskenHome + 'dateneingabe/';
	
	d = document;
	w = window;
	
	iemac 	= ((document.all) || (document.getElementById)) && (navigator.userAgent.indexOf("Mac")>-1) ? true : false;
	ie 		= ((document.all) || (document.getElementById)) && (window.offscreenBuffering) && (!iemac) ? true : false;
	nsmac 	= ((document.layers) && (document.captureEvents) && (!document.getElementById) && (navigator.userAgent.indexOf("Mac")>-1)) ? true : false;
	ns = ((d.captureEvents) && (!d.getElementById) && (!nsmac)) ? true : false;
	mz = ((d.getElementById) && (!d.all)) ? true : false;
	op = ((d.getElementById) && (navigator.userAgent.indexOf('Opera') != -1)) ? true : false;
	
	popheight = 570;
	
	if (ie) {
		popheight = 570;
	}
	
	if (ns || mz || op ) {
		popheight += 30;
	}
	
	if (iemac) {
		popheight -= 80;
	}
	if (nsmac) {
		popheight -= 40;
	}

	window.open( maskenPfad + "dateneingabe.php4?maskennr=" + maskeNr, "dateneingabe","toolbar=no,width=337,height=" + popheight + ",directories=no,status=no,scrollbars=no,resize=no,menubar=no")

}

/*
	--------------------------------------------------------------------------------- 
	funktion popUpResize():
		passt die groesse des popUp-Browserfensters an die Brauservariante an.
		wird beim henri-nannen-test verwendet
	uebergabewerte:
		popUpX = X-size [= horizontal = breit;] des brauserfensters
		popUpY = Y-size [= vertikal = hoch ;] des brauserfensters
	--------------------------------------------------------------------------------- 
*/
function popUpResize( popUpX, popUpY ) {

	var nsmac 	= ((document.layers) && (document.captureEvents) && (!document.getElementById) && (navigator.userAgent.indexOf("Mac")>-1)) ? true : false;
	var ns 		= ((document.layers) && (document.captureEvents) && (!document.getElementById) && (!nsmac)) ? true : false;
	var mzmac 	= ((document.getElementById) && (document.createTextNode) && (!document.all) && (navigator.userAgent.indexOf("Mac")>-1)) ? true : false;
	var mz 		= ((document.getElementById) && (document.createTextNode) && (!document.all) && (!mzmac)) ? true : false;
	var iemac 	= ((document.all) || (document.getElementById)) && (navigator.userAgent.indexOf("Mac")>-1) ? true : false;
	var ie 		= ((document.all) || (document.getElementById)) && (window.offscreenBuffering) && (!iemac) ? true : false;
	var op 		= ((document.getElementById) && (!document.createTextNode)) ? true : false;		

	if (iemac){
		window.resizeTo(popUpX-5,popUpY-30)
	}
	if (ie){
		window.resizeTo(popUpX,popUpY)
	}
	if (ns){
		window.resizeTo(popUpX-5,popUpY-30)
	}
	if (nsmac){
		window.resizeTo(popUpX-5,popUpY-20)
	}
	if (mz){
		window.resizeTo(popUpX,popUpY)
	}
	if (mzmac){
		window.resizeTo(popUpX-3,popUpY-30)
	}
	if (op){
		window.resizeTo(popUpX,popUpY)
	}
}


/*
    WebSnapr - Preview Bubble Javascript
*/

// Point this variable to the correct location of the bg.png file
var bubbleImagePath_oben = '/images/bubble_down.png';
var bubbleImagePath_unten = '/images/bg.png';

// DO NOT EDIT BENEATH THIS
if(typeof Array.prototype.push!="function"){
	Array.prototype.push=ArrayPush;

	function ArrayPush(_1){
		this[this.length]=_1;
	}
}

function WSR_getElementsByClassName(_2,_3,_4){
	var _5=(_3=="*"&&_2.all)?_2.all:_2.getElementsByTagName(_3);
	var _6=new Array();
	_4=_4.replace(/\-/g,"\\-");
	var _7=new RegExp("(^|\\s)"+_4+"(\\s|$)");
	var _8;
	for(var i=0;i<_5.length;i++){
		_8=_5[i];
		if(_7.test(_8.className)){
			_6.push(_8);
		}
	}
	return (_6);
}

function bindBubbles_unten(e){
	lbActions=WSR_getElementsByClassName(document,"a","previewlink");
	for(i=0;i<lbActions.length;i++){
		if(window.addEventListener){
			lbActions[i].addEventListener("mouseover",attachBubble_unten,false);
			lbActions[i].addEventListener("mouseout",detachBubble,false);
		}else{
			lbActions[i].attachEvent("onmouseover",attachBubble_unten);
			lbActions[i].attachEvent("onmouseout",detachBubble);
		}
	}
}

function bindBubbles_oben(e){
	lbActions=WSR_getElementsByClassName(document,"a","site_previewlink");
	for(i=0;i<lbActions.length;i++){
		if(window.addEventListener){
			lbActions[i].addEventListener("mouseover",attachBubble_oben,false);
			lbActions[i].addEventListener("mouseout",detachBubble,false);
		}else{
			lbActions[i].attachEvent("onmouseover",attachBubble_oben);
			lbActions[i].attachEvent("onmouseout",detachBubble);
		}
	}
}

function attachBubble_unten(_b){
	var _c;
	if(_b["srcElement"]){
		_c=_b["srcElement"];
	}else{
		_c=_b["target"];
	}
	var _d=_c.href.replace(/http:\/\//, "");
	var _s=_d.replace(/\./g, ""); // loesche alle Punkte
	_s=_s.replace(/\//g, ""); // loesche alle Slashes
	_s=_s.replace(/-/g, ""); // loesche alle Bindestriche
	// confirm(_s);
	var _e=findPos(_c)[0]+5;
	var _f=findPos(_c)[1]+12;
	var _10=document.createElement("div");
	document.getElementsByTagName("body")[0].appendChild(_10);
	_10.className="previewbubble";

	if (BrowserDetect.browser == 'Explorer') {
		_10.style.width="240px";
		_10.style.position="absolute";
		_10.style.top=_f;
		_10.style.zIndex=99999;
		_10.style.left=_e;
		_10.style.textAlign="left";
		_10.style.height="190px";
		_10.style.paddingTop="0";
		_10.style.paddingLeft="0";
		_10.style.paddingBottom="0";
		_10.style.paddingRight="0";
		_10.style.marginTop="0";
		_10.style.marginLeft="0";
		_10.style.marginBottom="0";
		_10.style.marginRight="0";
		_10.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bubbleImagePath_unten + "',sizingMethod='image')";
	} else {
		_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+_f+"px ; left: "+_e+"px ; background: url("+ bubbleImagePath_unten +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
	}

	if (BrowserDetect.browser == 'Safari' || BrowserDetect.browser == 'Konqueror' ) {
		var _height = _f;
		_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+ _height +"px ; left: "+_e+"px ; background: url("+ bubbleImagePath_unten +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
	}

	var img=document.createElement("img");
	_10.appendChild(img);
	
	if (BrowserDetect.browser == 'Explorer') {
		img.style.paddingTop="0";
		img.style.paddingLeft="0";
		img.style.paddingBottom="0";
		img.style.paddingRight="0";
		img.style.margin="auto";
		img.style.marginTop="25px";
		img.style.marginLeft="25px";
		img.style.marginBottom="0";
		img.style.marginRight="0";
		img.style.borderTop="0";
		img.style.borderLeft="0";
		img.style.borderBottom="0";
		img.style.borderRight="0";
	} else {
		img.setAttribute("style","padding-top: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; margin-top: 25px; margin-left: 12px; margin-bottom: 0; margin-right: 0; border: 0");
	}

	img.setAttribute("src","/bilder/presse/screenshots/"+_s+".gif");
	img.setAttribute("width",200);
	img.setAttribute("height",150);
	img.setAttribute("alt","Snapshot");
}


function attachBubble_oben(_b){
	var _c;
	if(_b["srcElement"]){
		_c=_b["srcElement"];
	}else{
		_c=_b["target"];
	}
	var _d=_c.href.replace(/http:\/\//, "");
	var _s=_d.replace(/\./g, ""); // loesche alle Punkte
	_s=_s.replace(/\//g, ""); // loesche alle Slashes
	_s=_s.replace(/-/g, ""); // loesche alle Bindestriche
	// confirm(_s);
	var _e=findPos(_c)[0]+5;
	var _f=findPos(_c)[1]-190;
	var _10=document.createElement("div");
	document.getElementsByTagName("body")[0].appendChild(_10);
	_10.className="previewbubble";

	if (BrowserDetect.browser == 'Explorer') {
		_10.style.width="240px";
		_10.style.position="absolute";
		_10.style.top=_f;
		_10.style.zIndex=99999;
		_10.style.left=_e;
		_10.style.textAlign="left";
		_10.style.height="190px";
		_10.style.paddingTop="0";
		_10.style.paddingLeft="0";
		_10.style.paddingBottom="0";
		_10.style.paddingRight="0";
		_10.style.marginTop="0";
		_10.style.marginLeft="0";
		_10.style.marginBottom="0";
		_10.style.marginRight="0";
		_10.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bubbleImagePath_oben + "',sizingMethod='image')";
	} else {
		_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+_f+"px ; left: "+_e+"px ; background: url("+ bubbleImagePath_oben +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
	}

	if (BrowserDetect.browser == 'Safari' || BrowserDetect.browser == 'Konqueror' ) {
		var _height = _f;
		_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+ _height +"px ; left: "+_e+"px ; background: url("+ bubbleImagePath_oben +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
	}

	var img=document.createElement("img");
	_10.appendChild(img);
	
	if (BrowserDetect.browser == 'Explorer') {
		img.style.paddingTop="0";
		img.style.paddingLeft="0";
		img.style.paddingBottom="0";
		img.style.paddingRight="0";
		img.style.margin="auto";
		img.style.marginTop="10px";
		img.style.marginLeft="25px";
		img.style.marginBottom="0";
		img.style.marginRight="0";
		img.style.borderTop="0";
		img.style.borderLeft="0";
		img.style.borderBottom="0";
		img.style.borderRight="0";
	} else {
		img.setAttribute("style","padding-top: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; margin-top: 10px; margin-left: 12px; margin-bottom: 0; margin-right: 0; border: 0");
	}

	img.setAttribute("src","/bilder/presse/screenshots/"+_s+".gif");
	img.setAttribute("width",200);
	img.setAttribute("height",150);
	img.setAttribute("alt","Snapshot");
}



function detachBubble(_12){
	lbActions=WSR_getElementsByClassName(document,"div","previewbubble");
	for(i=0;i<lbActions.length;i++){
		lbActions[i].parentNode.removeChild(lbActions[i]);
	}
}

if ( window.location.protocol == "http:" ) {
	if(window.addEventListener){
		addEventListener("load",bindBubbles_unten,false);
		addEventListener("load",bindBubbles_oben,false);
	}else{
		attachEvent("onload",bindBubbles_unten);
		attachEvent("onload",bindBubbles_oben);
	}
}

function findPos(obj){
	var _14=curtop=0;
	if(obj.offsetParent){
		_14=obj.offsetLeft;
		curtop=obj.offsetTop;
		while(obj=obj.offsetParent){
			_14+=obj.offsetLeft;
			curtop+=obj.offsetTop;
		}
	}
	return [_14,curtop];
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};

if ( window.location.protocol == "http:" ) {
	BrowserDetect.init();
}

