// Alle Galeriebilder vergrößern
function expandGalleryImages() {
	for(i=0; i<document.images.length; i++) {
		try {
			if(document.images[i].name == 'gallery') {
				var src   = document.images[i].src;
				var istmb = src.substr(src.lastIndexOf("/")+1,5);
				path      = src.substr(0,src.lastIndexOf("/")+1);
				if(istmb == 'thumb') {
					// Dateinamen extrahieren
					file = src.substr(src.lastIndexOf("/")+7);
					// BildID extrahieren
					var picid = document.images[i].id;
					picid = picid.substr(4);
					// spanID zusammensetzen
					opt  = 'opt_' + picid;
					// Bild austauschen
					document.images[i].src = path + 'normal_' + file;
					// Titel und alt ändern
					document.images[i].alt   = ' Bild verkleinern ';
					document.images[i].title = ' Bild verkleinern ';
					document.images[i].style.borderTop = 'none';
					// Optionen anzeigen
					document.getElementById(opt).style.clear  = 'left';
					document.getElementById(opt).style.display  = 'block';
					document.getElementById('openclosetop').style.display = 'none';
					document.getElementById('opt_001').style.marginTop = '15px';
				}
			} // Ende if name
		} catch (e) {
		} // Ende try
	} // Ende for
}

// Alle Galeriebilder verkleinern
function impandGalleryImages() {
	for(i=0; i<document.images.length; i++) {
		try {
			if(document.images[i].name == 'gallery') {
				var src   = document.images[i].src;
				var istmb = src.substr(src.lastIndexOf("/")+1,6);
				path      = src.substr(0,src.lastIndexOf("/")+1);
				if(istmb == 'normal') {
					//document.images[i].style.marginRight = '0px';
					// Dateinamen extrahieren
					file  = src.substr(src.lastIndexOf("/")+8);
					// BildID extrahieren
					var picid = document.images[i].id;
					picid = picid.substr(4);
					// spanID zusammensetzen
					opt  = 'opt_' + picid;
					// Optionen verstecken
					document.getElementById(opt).style.display   = 'none';
					document.getElementById('openclosetop').style.display = 'block';
					// Bild austauschen
					document.images[i].style.borderTop = '1px solid #EAEAEA';
					document.images[i].style.float = 'left';
					document.images[i].src = path + "thumb_" + file;
				}
			} // Ende if name
		} catch (e) {
		} // Ende try
	} // Ende for
}

// Galeriebild vergrößern/verkleinern
function resizeImageGallery(src,tmb,ful,id,picid) {
	var istmb = src.substr(src.lastIndexOf("/")+1,5);
	//desc = 'desc_' + picid;
	opt  = 'opt_' + picid;
	// Bild vergrößern
	if(istmb == 'thumb') {
		document.images[id].src   = ful;
		document.images[id].alt   = ' Bild verkleinern ';
		document.images[id].title = ' Bild verkleinern ';
		document.images[id].style.borderTop = 'none';
		document.getElementById(opt).style.clear = 'left';
		document.getElementById(opt).style.display = 'block';
		//document.images[id].style.marginBottom = '10px';
	// Bild verkleinern
	} else if(istmb != 'thumb') {
		if(opt == 'opt_001') {
			document.getElementById('openclosetop').style.display = 'block';
		}
		document.getElementById(opt).style.display = 'none';
		document.images[id].src   = tmb;
		document.images[id].alt   = ' Bild vergrößern ';
		document.images[id].title = ' Bild vergrößern ';
		document.images[id].style.float = 'left';
		document.images[id].style.borderTop = '1px solid #EAEAEA';
		//document.images[id].style.marginBottom = '0px';
	} else {
		exit();
	}
}

// Contentbild vergrößern/verkleinern
function resizeImage(src,tmb,ful,id) {
	var istmb = src.substr(src.lastIndexOf(".")-3,3);
	if(istmb == 'tmb') {
		document.images[id].src   = ful;
		document.images[id].alt   = ' Bild verkleinern ';
		document.images[id].title = ' Bild verkleinern ';
		document.images[id].align = 'bottom';
		document.images[id].style.marginTop = '0px';
		document.images[id].style.marginLeft = '0px';
		document.images[id].style.marginRight = '0px';
	} else {
		document.images[id].src   = tmb;
		document.images[id].alt   = ' Bild vergrößern ';
		document.images[id].title = ' Bild vergrößern ';
		document.images[id].align = 'left';
		document.images[id].style.marginTop = '0px';
		document.images[id].style.marginLeft = '0px';
		document.images[id].style.marginRight = '15px';
		document.images[id].style.marginBottom = '5px';
	}
}

// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 

function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {

	// Detect Client Browser type
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
	var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
	jsVersion = 1.1;

	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
			// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
	return (reqVer ? false : 0.0);
}

function showVideo(path,txt_version,txt_stream,autostart) {
	// Flashcheck
	var requiredMajorVersion = 8;
	var requiredMinorVersion = 0;
	var requiredRevision = 0;
	var jsVersion = 1.0;
	
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {
		// Stream und Version
		if(!txt_version){ txt_version = document.getElementById("version").value; }
		if(!txt_stream){ txt_stream = document.getElementById("stream").value; }
		// Größe
		if(txt_stream == 'high') {
			width  = 585;
			height = 349;
			txt_isdndsl = '<a style="font-size:10px" href="javascript:showVideo(\'' +path+ '\',\'\',\'low\',1);" title=" Video für ISDN-Verbindungen starten ">ISDN</a>';
		} else {
			width  = 290;
			height = 183;
			txt_isdndsl = '<a style="font-size:10px" href="javascript:showVideo(\'' +path+ '\',\'\',\'high\',1);" title=" Video für DSL-Verbindungen starten ">DSL</a>';
		}
		// Dateipfad
		file = path+'_'+txt_version+'_'+txt_stream+'.flv';
		// Containerinhalt
		var content = '<input name="version" id="version" type="hidden" value="'+txt_version+'">'
		+ '<input name="stream" id="stream" type="hidden" value="'+txt_stream+'">'
		+ '<object id="video" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
		+ 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"'
		+ 'type="application/x-shockwave-flash"'
		+ 'width="'+width+'" height="'+height+'">'
		+ '<param name="movie" value="flvplayer.swf?file=' + file + '&autoStart=' + autostart + '" />'
		+ '<param name="SCALE" value="exactfit" />'
		+ '<param name="wmode" value="transparent" />'
		+ '<embed src="flvplayer.swf?file=' + file + '&autoStart=' + autostart + '"'
		+ 'name="video"'
		+ 'quality="high"'
		+ 'bgcolor="#000000"'
		+ 'width="'+width+'"'
		+ 'height="'+height+'"'
		+ 'scale="exactfit"'
		+ 'loop="false"'
		+ 'type="application/x-shockwave-flash"'
		+ 'wmode="transparent"'
		+ 'swliveconnect="true"'
		+ 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
		+ '</embed>'
		+ '</object>';
	} else {
		var content = '<div style="clear:both; max-width:575px; width:575px; padding:5px; text-align:left; background:#DFDFDF"><a href="http://www.macromedia.com/go/getflashplayer" target="_blank"><img align="left" src="../images/btn/get_flash_player.gif" border="0" width="88" height="31" style="margin-right:10px; margin-top:3px" /></a>'
		+ '<font size="-2" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000"><strong>Flash Player nicht aktuell.</strong></font>'
		+ '<font face="Verdana, Arial, Helvetica, sans-serif" size="-2">'
		+ ' Der Macromedia Flash Player wird zum Abspielen von Videos auf dieser Seite benötigt.'
		+ ' Bitte klicken Sie <a href="http://www.macromedia.com/go/getflashplayer" target="_blank" style="color:#FF0000"><strong>hier</strong></a>, um die aktuelle Version zu laden.'
		+ ' Die Installation dauert nicht länger als eine Minute (DSL).</div>'
	}
	// neues Video laden
	document.getElementById("container_media").innerHTML = content;
	try {
		document.getElementById("isdndsl").innerHTML = txt_isdndsl;
	} catch (e) {
	}
}


