<!--
// Script für 4steps2web
// Michael Ettl 30.06.2003
// zuletzt geändert am 22.11.2007 von Martin Jäger

function do_init(level)
{
  /* Pruefung wegen Paket */
  if (level==0) { check_frameset(); }

  /* Externe Links in neuem Fenster
 if (1==0) 
 {
  var c=document.links;
  for(var i=0;i<c.length;i++) {
   if(!(c[i].href.search("4steps2web")> -1 || c[i].href.search(document.location.hostname)> -1)) {
     c[i].target="_blank";
   }
  }
 } 
 */
}

function check_frameset() 
{
 // Prueft ob bei DemoPaket die Seiten im korrekten Frame sind
 //  es sollte keine externe Verlinkung von Seiten direkt mögliche sein 
 if (window.name != 'Hauptframe')   { 
 	alert("Der Aufruf einzelner Seiten (ohne Rahmen) ist nur in den bezahlten Varianten möglich!\n\nYou can not open this page directly (without ad-frame) in the free version!\n\n4steps2web - http://www.4steps2web.net");
 	document.location='index.htm'; 
 }
}

function check_parent()
{
	/* left/top/bottom nicht ohne entspr. frameset aufrufbar */
	if(parent.frames.length==0) {
		parent.location.href="index.htm";
	}
}

/**
   *	Beschreibung:
   *   	öffnet ein neues Fenster und zeigt darin das gewünschte Bild in Originalgröße an
   *	Parameter:
   *		x) src	- URL des Bildes
   *		x) string	- zusätzlicher Text für das Bild
   *		x) width	- Breite des Fensters
   *		x) height	- Höhe des Fensters
   **/
function large_img(src, string, width, height) {	
	var scroll = 'no';
	if (screen.availWidth < (width+12) || screen.availHeight < (height+73)) {
		scroll	= 'yes';
	}	
	var win = window.open('', '', 'width='+width+',height='+height+',resizable=yes,left=100,top=20,scrollbars='+scroll+',toolbar=no,menubar=no,status=yes');
	win.document.open('text/html');
	win.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
	win.document.writeln('<html>');
	win.document.writeln(' <head>');
	win.document.writeln('  <title>'+src+'</title>');
	win.document.writeln('  <link rel="stylesheet" type="text/css" href="style.css">');
	win.document.writeln(' </head>');
	win.document.writeln(' <body>');
	win.document.writeln('  <center>');
	if (string != '')
		win.document.writeln('   <h1>'+string+'</h1>');
	win.document.writeln('    <img src="'+src+'" alt="'+src+'" />');
	win.document.writeln('  </center>');
	win.document.writeln(' </body>');
	win.document.writeln('</html>');
	win.document.close();
}

/**
   *	Beschreibung:
   *   	öffnet ein YouTubeVideo in einem neuen Fenster
   *	Parameter:
   *		x) ytId	- YouTubeID des gewünschten Videos
   *		x) width	- Breite des Fensters
   *		x) height	- Höhe des Fensters
   **/
function openYoutube(ytId, width, height) {
	var win = window.open('', '', 'width='+width+',height='+height+',noscrollbars,left=430,top=20');
	win.document.open('text/html');
	win.document.writeln('<html>');
	win.document.writeln(' <head>');
	win.document.writeln('  <title>YouTube</title>');
	win.document.writeln(' </head>');
	win.document.writeln(' <body bgcolor="#ffffff">');
	win.document.writeln('  <center>');
	win.document.writeln('   <object width="425" height="350">');
	win.document.writeln('    <param name="movie" value="http://www.youtube.com/v/'+ytId+'"></param>');
	win.document.writeln('    <param name="wmode" value="transparent"></param>');
	win.document.writeln('    <embed src="http://www.youtube.com/v/'+ytId+'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>');
	win.document.writeln('   </object>');
	win.document.writeln('  </center>');
	win.document.writeln(' </body>');
	win.document.writeln('</html>');
	win.document.close();
}

/**
   *	Beschreibung:
   *   	wechselt auf das gewünschte Bild der Diashow
   *	Parameter:
   *		x) target	- ID des gewünschten Bildes
   *		x) max	- Anzahl der Bilder
   **/
function changePic(target, max) {	
	var object = document.getElementById('diaShow4S2W');
	
	// wenn das letzte erreicht wurde, wird wieder beim 1. begonnen - 1 -> N
	if (target > max)
		target = 1;
	// wenn das 1. erreicht wurde, wird wieder beim letzen begonnen - N -> 1
	else if (target < 1)
		target = max;
	
	object.alt = target;
	object.src = aDiashow[target-1]['src'];
}
// Variable zum Stoppen der Diashow
var stop = false;
/**
   *	Beschreibung:
   *   	startet die Diashow
   *	Parameter:
   *		x) current	- ID des aktuellen Bildes
   *		x) max		- Anzahl der Bilder
   *		x) time		- Zeit in Millisekunden bis zum nächsten Bilderwechsel 
   **/
function playDiaShow(current, max, time) {
	var object = document.getElementById('diaShow4S2W');
	if (current == 1)
		stop = false;
	// wenn das letzte Bild erreicht wurde, wird wieder beim 1. begonnen
	if (current > max)
		current = 1;
	if (stop == false) {
		object.alt = current;
		object.src = aDiashow[current-1]['src'];
		setTimeout('playDiaShow('+(current+1)+', '+max+', '+time+')', time);
	}
}
/**
   *	Beschreibung:
   *   	stoppt die Diashow
   **/
function stopDiaShow() {
	stop = true;
}
//-->
