// Vom Inhaltsframe aus die Flash-Navi beeinflussen
function setFlashNavi(curmain, cursub) {
	//alert("setFlashNavi(" + curmain + "," + cursub + ")");
	if (parent.fnavigat.this_page_loaded == 1) {
		parent.fnavigat.setNaviMovieVar("main", curmain);
		parent.fnavigat.setNaviMovieVar("sub", cursub);
		parent.fnavigat.startNaviMovie();
	} else {
		setTimeout("setFlashNavi(" + curmain + "," + cursub + ")", 500);
	}
}

function mozillaScrollbarHack() {
	if (document.getElementById && !document.all) {
		// == Spielerei nur für Moz/NS-Design-Quatsch: Scrollbalken "erkennen"
		//var sichtbareHoehe = document.body.clientHeight;
		//var seitenHoehe    = document.height;
		if (document.body.clientHeight < document.height) {
			// == Es muß ein Scrollbalken vorhanden sein
			document.body.style.paddingLeft = "14px";
		} else {
			document.body.style.paddingLeft = "0px";
		}
	}
}

function findeFlash(flash) {
	var browsername = navigator.userAgent.toLowerCase();
	var opera = (browsername.indexOf("opera") > -1);
	if (opera) return;

	// http://aktuell.de.selfhtml.org/artikel/programmiertechnik/liveconnect/
	if (document.all) {
		if (document.opera) {
			var movie = eval(window.document + flash);
			if (movie.SetVariable) {
				return movie;
			}
		}
		if (document.all[flash]) {
			return document.all[flash];
		}
		return;
	}

	if(document.layers) {
		if(document.embeds) {
			var movie = document.embeds[flash];
			if (movie.SetVariable) {
				return movie;
			}
		}
		return;
	}

	if (!document.getElementById) {
		return;
	}

	var movie = document.getElementById(flash);
	if (movie) {
		if (movie.SetVariable) {
			return movie;
		}
	}
	if (movie) {
		var movies = movie.getElementsByTagName('embed');
		if (!movies || !movies.length) {
			return;
		}

    movie = movies[0];
    if (movie.SetVariable) {
    	return movie;
    }
	}
    return;
}


// ============================================================================================================================================
// ============================================================================================================================================
// ============================================================================================================================================


// Allgemein: Bild vergrößert darstellen
function allgVergroessern(datei, grafik_pfad_gross, breite, hoehe) {
	wb = breite;
	wh = hoehe;
	if (screen.width - 60	< wb) wb = screen.width  - 60;
	if (screen.height - 130 < wh) wh = screen.height - 130;
	aver_win = window.open(datei + "?fname=" + grafik_pfad_gross + "&b=" + breite + "&h=" + hoehe, "AVER", "left=30,top=30,scrollbars=no,resizable=no,width=" + wb + ",height=" + wh);
	aver_win.focus();
}

// News: Bild vergrößert darstellen
function vergroessern(datei, grafik_pfad_gross, breite, hoehe, lang) {
	wb = breite + 20;	// Scrollbalken
	wh = hoehe  + 20;
	if (screen.width - 60	< wb) wb = screen.width  - 60;
	if (screen.height - 130 < wh) wh = screen.height - 130;
	ver_win = window.open(datei + "?lang=" + lang + "&fname=" + grafik_pfad_gross + "&b=" + breite + "&h=" + hoehe, "VER", "left=30,top=30,scrollbars=yes,resizable=yes,width=" + wb + ",height=" + wh);
	ver_win.focus();
}

// Registrierung: Einverständniserklärung
function popup_ok(pfad) {
	var winMod = 'scrollbars=yes,menubar=no,location=no,border=no,toolbar=no,resizable=yes,status=no';

	var w = 500;
	var h = 500;
	var xp = Math.round((screen.width  - w) / 2);
	var yp = Math.round((screen.height - h) / 2);

	popup_okWin = open(pfad,'popup_okWin','left='+xp+',top='+yp+',width='+w+',height='+h+','+winMod);
	popup_okWin.focus();
}

// ============================================================================================================================================
// ============================================================================================================================================
// ============================================================================================================================================

// Sitemap der Produktsuche
function pop_sitemap(pfad, w, h) {
	pop_smap = window.open(pfad, "pop_smap_win", "left=20,top=20,scrollbars=no,resizable=yes,width=" + w + ",height=" + h);
	pop_smap.focus();
}

function notlogged() {
	var msg = "This content is restricted to registered users only.\n"
			+ "If you are already registered, please log in via \"My account\" in order to\n"
			+ "authenticate. Otherwise, please use our registration form to gain access.";
	if (confirm(msg)) {
		location.href = '../myaccount/login.aspx?src=' + escape(location.href);
	}
}

function notloggedpdf(quelle) {
	var msg = "Only registered users can view datasheets.\n\n"
			+ "If you are already registered, please click \"OK\" to login.\n"
			+ "Otherwise, please use our registration-form to gain access.";
	if (confirm(msg)) {
		var args = notloggedpdf.arguments;
		if (args.length == 1) {
			location.href = '../myaccount/login.aspx?src=' + escape(quelle);
		} else {
			location.href = '../myaccount/login.aspx?src='+escape(location.href);
		}
	}
}
