
$(document).ready(function(){
	// Ueberschriften mit "groesser als" Zeichen
	$("h1").prepend("&gt;&gt;&nbsp;");
	$("h2").prepend("&gt;&gt;&nbsp;");
	
	// IE6: Einblenden der Subnav, da kein li:hover unterstuetzt wird
	if ($.browser.msie && $.browser.version=="6.0") {
		$("div#nav-main ul li").hover(
			function () {
				$(this).addClass("jqaktiv");
				$(this).children("ul").addClass("subnavaktiv");
			},
			function () {
				$(this).removeClass("jqaktiv");
				$(this).children("ul").removeClass("subnavaktiv");
			}
		);
	}
	
	if ($("ul.bildliste-rahmen a").length || $(".resize a").length) {
		$('ul.bildliste-rahmen a, .resize a').zoomimage({
			beforeZoomIn: img_clear,
			controls: false,
			hideSource: false,
			border: 1
		});
	}
	
});

// Schliesst zoomimage Bilder
function img_clear () {
	$(".resize a").zoomimageClear();
}


// Anzeige von Flash Dateien
function ReWriteFlashExtended (id, url, width, height, version) {
	version = (version=='')?4:version;
	var flash = "";
	if (document.getElementById) {	
		if (document.getElementById(id)) {	
			flash += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + ',0,2,0" width=' + width + ' height=' + height + '">';
			flash += '<param name="movie" value=' + url + '>';
			flash += '<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>';
			flash += '</object>';
			document.getElementById(id).innerHTML = flash;
		}
	}
}


// Druckfunktion
function drucken(langdir) {
	var page = window.location.href;
	var mypath = "http://www.simon.de/drucken.php?ld="+langdir+"&page="+page;
	Fenster = window.open(mypath, "", "width=700, height=700, top=10, left=10, scrollbars=1, resizable=1");
	if (Fenster){
		Fenster.moveTo(screen.width/2-(700/2),screen.height/2-(700/2));
		Fenster.focus();
  	}
}


// Sitemap und Impressum in neuem Fenster
function popup (url,name,breite,hoehe,x,y){
 	var MyWindow =0;
 	MyWindow = window.open(url,name,'toolbar=0,location=0,directories=0,statusbar=0,menubar=0,scrollbars=1,resizable=yes,width='+breite+',height='+hoehe);
 	if (MyWindow){
		MyWindow.moveTo(screen.width/2-(breite/2+x),screen.height/2-(hoehe/2+y));
		MyWindow.focus();
  	}
}


// Sitemap: Öffnen in Parent
function openParent(URL){
	opener.parent.location.href=URL;
	window.close();
}


// Mini-Galerie (Bsp: Sinter)
function setgalerie(img) {
	var bild = img;	
	$("div#galerie-gross").children("img").attr("src", bild);
}


// Pop-Up
function newWin(which, breite, hoehe){
 var NewWindow =0;
  NewWindow = window.open(which,"new",'width='+breite+',height='+hoehe+',toolbar=0,menubar=0,directories=0,statusbar=0,location=0,resizable=no,scrollbars=no'); 
   if (NewWindow){
    NewWindow.moveTo(screen.width/2-(breite/2),screen.height/2-(hoehe/2));
    NewWindow.focus();
  }
}

// Mouseover Texte Fertigungsprozess

var aktiv = "";

function showdetails (text) {
	if (document.getElementById(text)) {
		document.getElementById(text).style.display = 'block';
	}	
	aktiv = text;
}

function hidedetails () {
	if (document.getElementById(aktiv)) {
		document.getElementById(aktiv).style.display = 'none';
	}
}


// Geschaeftsfelder Sinter / Galvano

var active_index = 0;

function setIcon (index, top, left, extraicons, schaubild) {
	// Wechselt das Schaubild, falls erforderlich
	setBlueprint (schaubild);
	
	// Blendet gelben Punkt ein, wenn Koordinaten durchgegeben werden
	if (top > 0) {
		$('img#leuchtpunkt').css('margin-top', top);
		$('img#leuchtpunkt').css('margin-left', left);
		$('img#leuchtpunkt').show();
	}
	// Zusatz-Icons
	if (extraicons == 'haushalt-1')	{
		$('img#leuchtpunkt').after('<img id="leuchtpunkt-zusatz" src="../../media/images/sinter/leuchtpunkt-haushalt-1.gif" alt="Highlight" />');
		$('img#leuchtpunkt-zusatz').css('margin-top', top);
		$('img#leuchtpunkt-zusatz').css('margin-left', left-20);
	}
}

function hideIcon (index) {
	// Blendet den gelben Punkt aus, wenn nichts aktiv ist
	if (active_index != index) {
		$('img#leuchtpunkt').hide();
		$('img#leuchtpunkt-zusatz').hide();
	}	
}

function setContent (index, schaubild) {
	hideContent (index);
	
	// Wechselt das Schaubild, falls erforderlich
	setBlueprint (schaubild);
	
	// Blendet die Zusatz-Inhalte ein
	$('div#geschaeftsfelder-details').show();
	$(('p#text-' + index)).show();
	$(('p#bild-' + index)).show();
	
	// Setzt die "active" Variable und aktiv Klassen
	$(('li#link-' + index)).addClass('aktiv');
	$(('li#picto-' + index)).addClass('aktiv');
	active_index = index;
}

function hideContent (index, schaubild) {
	// Wechselt das Schaubild, falls erforderlich
	setBlueprint (schaubild);
	
	// Blendet die Zusatz-Inhalte aus	
	$('div#geschaeftsfelder-details').hide();
	$(('p#text-' + active_index)).hide();
	$(('p#bild-' + active_index)).hide();
	
	// Entfernt die "active" Variable und aktiv Klassen
	$(('li#link-' + active_index)).removeClass('aktiv');
	$(('li#picto-' + active_index)).removeClass('aktiv');
}

// Wechselt das Schaubild, falls erforderlich
function setBlueprint (schaubild) {
	if (schaubild != "") {
		if (document.getElementById('blaupause')) {
			document.getElementById('blaupause').src = "../../media/images/sinter/" + schaubild;
		}
	}
}

