var allDivs="";

function set_startseite ( c_hp )
{
	var URL="http://www.ihkadhoc.de";
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) 
	{
		c_hp.style.behavior='url(#default#homepage)';
		c_hp.setHomePage(URL);
	}
	else
	{
	    var startseitepopup = window.open('','startseite','width=329,height=300,screenX=100,screenY=100');
		startseitepopup.document.write('<html><head><title>Browser-Information</title><link rel="STYLESHEET" type="text/css" href="/style.css"></head><body class="popup">Dieser Browsertyp unterstützt diese Aktion nicht!<br>Bitte wählen Sie daher unter Menu Einstellung und tragen dort die Startseite ein!</body></html>');
	}
}
function add_favorite ( path )
{
	var URL="http://www.ihkadhoc.de"+path;
	var Titel='IHK@hoc';
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) 
	{
		window.external.AddFavorite(URL,Titel);
	}
	else
	{
	    var startseitepopup = window.open('','startseite','width=329,height=300,screenX=100,screenY=100');
		startseitepopup.document.write("<html><head><title>Browser-Information</title><link rel=\"STYLESHEET\" type=\"text/css\" href=\"/style.css\"></head><body>Bitte <Strg>+D drücken</body></html>");
	}
}
function ch_wbanner (img_src)
{
	img_src.src="/wbanner.php";
	setTimeout("ch_wbanner(img_src)", 6000);
}
function checkPraesenzort( formular )
   {
	if(window.document.forms[formular].kursnummer.value=="-----")
	    {
		alert("Bitte wählen Sie einen gültigen Präsenzort!");
		window.document.forms[formular].kursnummer.focus();
		return false;
		}
	  return true;
    }
  
function checkOnlineForm()
  {
  if(window.document.form1.email.value=="" || window.document.form1.name.value=="" || window.document.form1.strasse.value=="" || window.document.form1.port.value=="" || window.document.form1.plz.value==""  || window.document.form1.gebdat.value == "" )
	    {
		alert("Bitte geben Sie wenigstens E-Mail, Name, Strasse, PLZ und Ort an!");
		window.document.form1.name.focus();
		return false;
		}
        if ( string2date(window.document.form1.gebdat.value) == null) {
	      alert("Bitte geben Sie das Datum TT.MM.JJJJ an - Danke!");
	      window.document.form1.gebdat.focus();
	      return false;
	  }

  
  if((window.document.form1.elements[17].checked == true) && (window.document.form1.firma.value=="" || window.document.form1.fistrasse.value=="" || window.document.form1.fiort.value=="" || window.document.form1.fiplz.value=="") )
	   {
	   alert("Sie haben als Rechnungsempfänger eine Firma angegeben, bitte füllen Sie die Anschrift Ihrer Firma aus!");
	   window.document.form1.plz.focus();
	   return false;
	   }
		
  if(window.document.form1.AGB.checked == false)
       {
		alert("Akzeptieren Sie bitte die Teilnahmebedingungen");
		window.document.form1.AGB.focus();
		return false;
	   }
  return true;
  }
  
function printOut()
  {
  window.print();
  }

function chooseTown( parameter )
  {
  doc="auswahl.php" + parameter;
  win=window.open(doc,"auswahl","width=750,height=450,menubar=no ");
  }
  
function submitImageWorkarround( index )
  {
  if (index == 2)
     window.document.form1.via.value="Faxanmeldung";
  else
     window.document.form1.via.value="Onlineanmeldung";
  
  }

function checkit( )
   {
  // alert ("Entered checkit");
	if(window.document.forms[0].kursnummer.value=="-----")
	    {
		alert("Bitte wählen Sie einen gültigen Präsenzort!");
		window.document.forms[0].kursnummer.focus();
		return false;
		}
	  return true;
    }
function chTease() 
{
    e = document.getElementById("bild_");
    s = document.getElementById("spruch_");
}

function string2date(string) {
    if (!string) return null;
    string += '';
    string = string.replace(/[-\/]/g, '.'); // Trennzeichen normalisieren 
    string = string.replace(/[^0-9.: ]/g, ''); // ungü Zeichen entfernen 
    string = string.replace(/ +/g, ' '); // doppelte Leerzeichen entfernen 
    var uhr = string.split(" "); // Uhrzeit abtrennen 
    var split = uhr[0].split(".");
    var day = parseInt(split[0], 10);
    var month = parseInt(split[1] || 0, 10);
    var year = parseInt(split[2] || 0, 10);

    if (isNaN(year)) year = getFullYear();

    var check = new Date(year, month - 1, day);
    if (uhr[1]) {
        var uhr = uhr[1].split(':');
        check.setHours(uhr[0] || 0);
        check.setMinutes(uhr[1] || 0);
        check.setSeconds(uhr[2] || 0);
    }

    var day2 = check.getDate();
    var year2 = getFullYear(check);
    var month2 = check.getMonth() + 1;

    return (year2 == year && month == month2 && day == day2) ? check
    : null;
}
function getFullYear(date) {
    if (!date) date = new Date();
    if (typeof date.getFullYear != 'undefined') return date.getFullYear();
    var year = date.getYear();
    if (year < 1000) year += 2000;
    return year;
} 

