// Enable correct resizing in Navigator 4.x
 // (IE 4+ and Navigator 6 do it perfectly)
 // Usage: Just LINK to your HTML page 

 function handleResize() 
 {
   if (window.prevWidth != window.innerWidth || 
       window.prevHeight != window.innerHeight) 
   {
     history.go(0);
     return false;
   }
 }

 if (navigator.appName.indexOf("Netscape") >= 0 &&  
     parseInt(navigator.appVersion) == 4)
 {
   window.prevWidth = window.innerWidth;
   window.prevHeight = window.innerHeight;
   window.captureEvents(Event.RESIZE);
   window.onresize = handleResize;
 }


 
 // convert all characters to lowercase to simplify testing 
var agt=navigator.userAgent.toLowerCase(); 

//BROWSER VERSION
// Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
var is_major = parseInt(navigator.appVersion); 
var is_minor = parseFloat(navigator.appVersion); 

//BROWSER TYPE 
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
            && (agt.indexOf('webtv')==-1));
            
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6up = (is_nav && (is_major >= 5)); 
 
 
var is_ie   = (agt.indexOf("msie") != -1); 
var is_ie3  = (is_ie && (is_major < 4)); 
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );  
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);  
var is_dom = (document.getElementById);

//PLATFORM 
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac    = (agt.indexOf("mac")!=-1);
var is_sun   = (agt.indexOf("sunos")!=-1);
var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
var is_hpux  = (agt.indexOf("hp-ux")!=-1);
var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
var is_linux = (agt.indexOf("inux")!=-1);
var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
var is_mpras    = (agt.indexOf("ncr")!=-1); 
var is_reliant  = (agt.indexOf("reliantunix")!=-1);
var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
       (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
       (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
var is_sinix = (agt.indexOf("sinix")!=-1);
var is_freebsd = (agt.indexOf("freebsd")!=-1);
var is_bsd = (agt.indexOf("bsd")!=-1);
var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
             is_sco ||is_unixware || is_mpras || is_reliant || 
             is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);




// unterschiedliche Stylesheets fuer PC und MAC    
// Files and directory structures
var cssDir = "../../styles/";
var winNSCSS = "ns.css";
var winIECSS = "main.css";
var macCSS = "mac.css";
var unixCSS = "main.css";


//  Select the appropriate stylesheet
if ((is_nav4up ||is_nav6up || is_ie4up) || (!is_nav && !is_ie)) {
  ChooseStyleSheet();
}


// Function to choose the style sheet for use based on the platform and browser version
function ChooseStyleSheet() {

var fileHead = cssDir;
var styles;

//Windows
if (is_win) {
  //Netscape Win
  if (is_nav) {
    styles = fileHead + winNSCSS;
  } 
  
  if (is_nav4up) {
    styles = fileHead + winNSCSS;

  } 
  else

  if (is_nav6up) {
    styles = fileHead + winIECSS;
    
  } 
  else 
  {
  // Windows Netscape fonts need to be larger than those for IE
  styles = fileHead + winIECSS;
  }
} 

//Mac
else if (is_mac) {
  //Internet Explorer 5
  if (is_ie5up) {
    // Default font settings for Mac IE5 match Win IE fonts
    styles = fileHead + winIECSS;
  }
  else

  if (is_nav) {
    styles = fileHead + macCSS;
    
  } 
  else
  {
    //rest of Mac
    styles = fileHead + macCSS;
  }
} 

//Unix
else if (is_unix) {
  styles = fileHead + unixCSS;
}

//rest
else 
{
  // Default style = macCSS,
  // Macintosh stylesheets have the largest font sizes, which will ensure readability
  styles = fileHead + macCSS;
}

  document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + styles + "\">");
  return true;
}
 
 
 
 
 
 


var activeSub=0;
var SubNum=0;

//function reDo(){ window.location.reload() }
//   window.onresize = reDo;
    
screeny=screen.availHeight/2-300;
screenx=screen.availWidth/2-400;


    //Define global variables

	    var timerID = null;
		var timerOn = false;
		var timecount = 1000;
		var what = null;
		var newbrowser = true;
		var check = false;

    	function init(){
    	//  alert ("Running Init");
          if (document.layers) {
                      //  alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                      //  alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                      //  alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
		window.status='Ziele erreichen mit F&A Training und Coaching';
		check = true;
  	 	}

	// Turns the layers on and off
        function showLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}

        function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }
        
        function hidebig(){
			
                hideLayer('layer32');
                hideLayer('layer33');
				
				}
                
                function startTimebig() {
	        if (timerOn == false) {
                timerID=setTimeout( "hidebig()" , timecount);
                timerOn = true;

	        }

		}
        


		function hideAll(){
				hideLayer('layer1');
				hideLayer('layer2');
             	hideLayer('layer3');
				hideLayer('layer4');
				hideLayer('layer5');

				
				}


		function startTime() {
	        if (timerOn == false) {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;

	        }

		}


		function stopTime() {
	        if (timerOn) {
    	        clearTimeout(timerID);
                timerID = null;
                timerOn = false;
	        }
		}

		function onLoad(){
			init();
			
			}
            
     


function trimString(str) {
	
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');

}


function checkName(feld_id, req_size, type) {

  var Set = '';
  if(type == 'name') {
  Set += 'abcdefghijklmnopqrstuvwxyzüäöàèéÉÀÈÖÄÜABCDEFGHIJKLMNOPQRSTUVWXYZß\'.- ';
  }
  else if(type == 'number') {
  Set += '0123456789()-+ ';
  }
  else if(type == 'street' || type == 'company') {
 
  Set += 'abcdefghijklmnopqrstuvwxyzüäöàèéÉÀÈÖÄÜABCDEFGHIJKLMNOPQRSTUVWXYZß\'.0123456789&- ';
  }
  
  var inhalt = document.getElementById(feld_id).value;

  var error = false;
  var Laenge = inhalt.length;
  //  alert(inhalt);
  if(trimString(inhalt).length < req_size)
  {
   //alert('zu klein');
   error = true;
  }
  else {
     	for (i=0;i<=Laenge;i++)
		{
		//alert(inhalt);
		 zeichen=inhalt.charAt(i);
		 if (Set.indexOf(zeichen)==-1)
			{
		     error = true;
			 break;
		
			}
    	}
 	  }
	  if(error) {
	  //setWrong('R' + feld_id, 'W' + feld_id);
	  return false;
	  }
	  else {
	  //setRight('R' + feld_id, 'W' + feld_id);
	  return true;
	  } 
	  
 }
 

 


function checkPLZ(feld_id, req_size) {

  var Set='0123456789 ';
  var inhalt = document.getElementById(feld_id).value;
  var error = false;
  var Laenge = inhalt.length;
  //alert(inhalt);
   if(trimString(inhalt).length < req_size || trimString(inhalt).length > 8)
  {
   error = true;
  }
  else {
     	for (i=0;i<=Laenge;i++)
		{
		 zeichen=inhalt.charAt(i);
		 if (Set.indexOf(zeichen)==-1)
			{
		     error = true;
			 break;
		
			}
    	}
 	  }
	  if(error) {
	  //setWrong('R' + feld_id, 'W' + feld_id);
	  return false;
	  }
	  else {
	  //setRight('R' + feld_id, 'W' + feld_id);
	  return true;
	  } 
	 
 }
 

 
function checkMail(feld_id, req_size)
{
		var Set='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.@0123456789_-';
	    var inhalt = document.getElementById(feld_id).value;
		var error = false;
		var Laenge = inhalt.length;
        if(trimString(inhalt).length < req_size)
		{
		   error = true;
		}
		else if (inhalt.indexOf ('@',0) == -1 ||
		inhalt.indexOf ('.',0) == -1) {
		error = true;
		}
		else {
     	for (i=0;i<=Laenge;i++)
		{
		 zeichen=inhalt.charAt(i);
		 if (Set.indexOf(zeichen)==-1)
			{
		     error = true;
			 break;
		
			}
    	 }
 	    }
	  if(error) {
	  //setWrong('R' + feld_id, 'W' + feld_id);
	  return false;
	  }
	  else {
	  //setRight('R' + feld_id, 'W' + feld_id);
	  return true;
	  } 
	  
}

function checkAll() {
        //alert(document.getElementById('firma').value);  
		var message = 'Folgende Felder sind leer oder enthalten unerlaubte Sonderzeichen:\n\n';
		var error = false;
		//alert(message);
		if(!checkName('firma', 2, 'company')) {
		message += '- Seminarteilnehmer: Firma \n';
		error = true;
		}
		//alert(message);
		if(!checkName('vorname', 2, 'name')) {
		message += '- Seminarteilnehmer: Vorname \n';
		error = true;
		}
		//alert(message);
		if(!checkName('name', 2, 'name')) {
		message += '- Seminarteilnehmer: Name \n';
		error = true;
		}
		//alert(message);
		if(!checkName('strasse', 2, 'street')) {
		message += '- Seminarteilnehmer: Strasse \n';
		error = true;
		}
		//alert(message);
		if(!checkPLZ('plz', 4)) {
		message += '- Seminarteilnehmer: PLZ \n';
		error = true;
		}
		//alert(message);
		if(!checkName('ort', 2, 'name')) {
		message += '- Seminarteilnehmer: Ort \n';
		error = true;
		}
		//alert(message);
		if(!checkName('land', 0, 'name')) {
		message += '- Seminarteilnehmer: Land \n';
		error = true;
		}
		//alert(message);
		if(!checkName('telefon', 6, 'number')) {
		message += '- Seminarteilnehmer: Telefon \n';
		error = true;
		}
		//alert(message);
		if(!checkMail('email', 4)) {
		message += '- Seminarteilnehmer: eMail \n';
		error = true;
		}
		
		
		
		/*
		if(!checkName('firma_z', 2, 'company')) {
		message += '- Rechnungsadresse: Firma \n';
		error = true;
		}
		
		if(!checkName('strasse_z', 2, 'street')) {
		message += '- Rechnungsadresse: Strasse \n';
		error = true;
		}
		//alert(message);
		if(!checkPLZ('plz_z', 4)) {
		message += '- Rechnungsadresse: PLZ \n';
		error = true;
		}
		//alert(message);
		if(!checkName('ort_z', 2, 'name')) {
		message += '- Rechnungsadresse: Ort \n';
		error = true;
		}
		//alert(message);
		if(!checkName('land_z', 1, 'name')) {
		message += '- Rechnungsadresse: Land \n';
		error = true;
		}
		//alert(message);
		if(!checkName('telefon_z', 6, 'number')) {
		message += '- Rechnungsadresse: Telefon \n';
		error = true;
		}
		//alert(message);
		if(!checkMail('email_z', 4)) {
		message += '- Rechnungsadresse: eMail \n';
		error = true;
		}
		*/
		
		//alert(message);
		if(error) {
		alert(message);
		return false;
		}
		else {
		return true;
		}
}

        

