/*
    $Source: /var/cvs/Projects/slbGroup/Common/Scripts/grpInitScript.js,v $
    $Revision: 1.25 $
    $Date: 2004/10/29 15:36:00 $
    $Author: truebner $
*/

// INIT ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function initPage() {
    //checkScreenSize();
    //getLinksToBlur();
    setFavorite();
  setStyle();
    opImg = 1;
}


// INCLUDE ////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function setJSInclude() {
  theArg = setJSInclude.arguments;
  theArgLength = setJSInclude.arguments.length;
  theJSBase = document.getElementsByTagName("base")[0].href+'Common/Scripts/';
  for (i = 0; i < theArgLength; i++) {
    theJSPath = theJSBase+theArg[i]+'.js';
    theJSInclude = document.createElement("script");
    theJSInclude.src = theJSPath; 
    theJSInclude.type = "text/javascript";
    document.getElementsByTagName("head")[0].appendChild(theJSInclude);
  }
}


// OPEN WIN ///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function openWin(theTarget,theParam) {
  if (theParam == 'gb') {   
    newwindow = window.open(theTarget,'theParam','width=779, height=630, location=no, menubar=no, status=no, toolbar=yes, scrollbars=yes, resizable=yes');
    if (window.focus) {
      newwindow.focus()
    }
  } else if (theParam == 'medium') {
    newwindow = window.open(theTarget,'theName','width=640, height=480, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');
    if (window.focus) {
      newwindow.focus()
    }
  } else {
    newwindow = window.open(theTarget,'theName','fullscreen=yes');
    if (window.focus) {
      newwindow.focus()
    }
  }
} 


// OPEN DIV WITH LARGE IMG ////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////


function openLargeImage(node) {
  
  var offsetTrail = node;
  offsetLeft = 0;
  offsetTop = 0;

  thisBody = document.getElementsByTagName("body").item(0);
    
  thisLargeContent = document.createElement("img");
  thisLargeContent.id = "subLargeImg";
  thisLargeContent.src = node.href;
  
  thisLargeContainer = document.createElement("div");
  thisLargeContainer.id = "subLargeDiv";

  thisLargeContainer.appendChild(thisLargeContent);
  
  thisLargeContainer.style.display = "block";
  thisLargeContainer.style.visibility = "hidden";
  thisLargeContainer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"/Common/Images/Content/grpImgLargeBGShadow.png\",sizingMethod=\"scale\")";
  
  browserID = getBrowser();   
  if(browserID == "msie") {
    var offsetLeft = 0;
    var offsetTop = 30;
    
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }

  } else {
    offsetTop = offsetTrail.offsetTop + 25;
    offsetLeft = offsetTrail.offsetLeft;
  }

  thisBody.appendChild(thisLargeContainer);

  // Timeout until image is loaded 
  setTimeout('openLargeImageShadow('+offsetTop+', '+offsetLeft+');',200);

} 

function openLargeImageShadow(offsetTop, offsetLeft) {
  thisLargeBGImg = document.createElement("img");
  thisLargeBGImg.id = "subLargeBGImg";
  thisLargeBGImg.src = "/Common/Images/Content/grpImgLargeBGShadow.png";
  thisLargeBGImg.style.position = "absolute";
  //  alert("width: " + thisLargeContent.width + " - height: " + thisLargeContent.height);
  thisLargeBGImg.style.left = "-12px";
  thisLargeBGImg.style.top = "-12px";
  thisLargeBGImg.style.width = thisLargeContent.offsetWidth + 68 +"px";
  thisLargeBGImg.style.height = thisLargeContent.offsetHeight + 68 +"px";
  thisLargeContainer.style.width = thisLargeContent.offsetWidth + 54 +"px";
  thisLargeContainer.style.height = thisLargeContent.offsetHeight + 54 +"px";
  thisLargeImageHeight = document.getElementById('subLargeImg').height;
//  alert(offsetTop + " - " + offsetLeft);
  if (offsetLeft < 600) {
    offsetLeft = 245;
  } else {
    offsetLeft = 730 - document.getElementById('subLargeImg').width;
  }
  document.getElementById('subLargeDiv').style.left = offsetLeft +"px";
  document.getElementById('subLargeDiv').style.top = offsetTop-thisLargeImageHeight +"px";
  document.getElementById('subLargeDiv').style.visibility = "visible";
  
  
  thisLargeDescription = document.createElement("div");
  thisLargeDescription.id = "subLargeDescription";
  
  subLargeButton = document.createElement("button");
  subLargeButton.id = "subLargeButton";
  subLargeButton.innerHTML = "zurück";
  subLargeButton.style.cursor = "pointer";
  
  thisLargeDescription.appendChild(subLargeButton);
  thisLargeDescription.style.top = thisLargeContent.offsetHeight - 18 +"px";
  thisLargeDescription.style.left = thisLargeContent.offsetWidth - 54 +"px";
  
  
  thisLargeContainer.appendChild(thisLargeDescription);
  thisLargeContainer.appendChild(thisLargeBGImg);
  
  browserID = getBrowser();   
  if(browserID == "msie") {
    thisLargeContainer.attachEvent('onclick', closeLargeImage);
    }  else {
    subLargeButton.addEventListener("click", closeLargeImage, false);
    }
  //setTimeout('closeLargeImage()',4800);
}

function closeLargeImage() {
  thisLargeContainer = document.getElementById("subLargeDiv");
  if (thisLargeContainer) {
    thisLargeContainer.parentNode.removeChild(thisLargeContainer);
  }
}


// GET BROWSER ////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function getBrowser() {
  var browser = navigator.userAgent;

  var patternMSIE  = /(MSIE)/g;
  var patternGecko = /(Gecko)/g;
  var patternOpera = /(Opera)/g;
  var patternSafari = /(Safari)/g;

  var isMSIE = patternMSIE.test(browser);
  var isGecko = patternGecko.test(browser);
  var isOpera = patternOpera.test(browser);
  var isSafari = patternOpera.test(browser);
    
    if(isMSIE == true && isOpera == true)  browserID = "opera";
  if(isMSIE == true)  browserID = "msie";
  if(isGecko == true) browserID = "gecko";
  if(isOpera == true) browserID = "opera";
  if(isSafari == true) browserID = "safari";

  return (browserID);
}


// CHECK SCREEN SIZE //////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

// ich glaub es ist besser die divs immer auf display none zusetzen
// und nur im fall >= 1024 auf sichtbar - weil es sonst erst geladen und dann ausgeblendet wird
// erst mal abwarten ob es wirklich zum Einsatz kommt [truebner 30/06/04]

function checkScreenSize() {
  if(screen.width < 1000) {
    document.getElementById("rightContent").style.display = "none";
    document.getElementById("headerRight").style.display = "none";
  }
}


// ACTIVE CONTENT IE //////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

var collBehaviorID = new Array();
var collImg = new Array ();
var countImg = 0;

function attachBehavior() {
  collImg = document.all.tags ("img");
  countImg = collImg.length;
  for (i=0; i < countImg; i++) {
  var iID = collImg[i].addBehavior ("Common/Scripts/grpPNGBehave.htc");
    if (iID) {
      collBehaviorID[i] = iID;
    }
  }
}


// SHOWS NAVI LAYER ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function showNaviLayer(node, subNaviID) 
{
  if (document.getElementById(subNaviID)) 
  {
      var offsetTrail = node;
      var offsetLeft = 0;
      var offsetTop = 41;
      var subNaviIDLeft = 0;
      while (offsetTrail) 
      {
          offsetLeft += offsetTrail.offsetLeft;
          offsetTop += offsetTrail.offsetTop;
          offsetTrail = offsetTrail.offsetParent;
      }
      subNaviIDLeft = offsetLeft;
      subNaviIDTop = offsetTop;
      node.className = "mainNavHover";
      with(document.getElementById(subNaviID)) 
      {
          if ( subNaviID == "item5" && document.getElementsByTagName("body").item(0).id == "CFHStyle" )
          {
              style.left = (subNaviIDLeft) - 102 + 'px'; 
          }
          else
          {
        style.left = (subNaviIDLeft) + 'px';
          }
      style.visibility = 'visible';
      style.top = (subNaviIDTop) + 'px';
      subNaviIDWidth = document.getElementById(subNaviID).offsetWidth;
      subNaviIDHeight = document.getElementById(subNaviID).offsetHeight;
      thisBody = document.getElementsByTagName("body").item(0);
    }
  }       
  return;
}


// HIDES NAVI LAYER ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function hideNaviLayer(node, subNaviID) {
  if (document.getElementById(subNaviID)) {
    document.getElementById(subNaviID).style.visibility = "hidden";
      //document.getElementById(subNaviID).style.display = "none";
      node.className = "mainNav";
  } 
  /**
    leftSide = thisIframe.style.left;
    rightSide = leftSide + thisIframe.offsetWidth;
    topSide = thisIframe.style.top;
    bottomSide = topSide + thisIframe.offsetHeight;
    //alert("leftSide:"+leftSide+"  rightSide:"+rightSide+"  topSide:"+topSide+"  bottomSide:"+bottomSide);

    browserID = getBrowser();
    if((browserID == "opera") || (browserID == "gecko")) {
        return true;
    } else {
       // document.getElementById(thisIframe).style.display = "none";
    }
    **/
}

function hideNaviLayerHover(node, subNaviID) {
  if (document.getElementById(subNaviID)) {
    document.getElementById(subNaviID).style.visibility = "hidden";
  }
  
  /**
    leftSide = thisIframe.style.left;
    rightSide = leftSide + thisIframe.offsetWidth;
    topSide = thisIframe.style.top;
    bottomSide = topSide + thisIframe.offsetHeight;
    //alert("leftSide:"+leftSide+"  rightSide:"+rightSide+"  topSide:"+topSide+"  bottomSide:"+bottomSide);

    browserID = getBrowser();
    if((browserID == "opera") || (browserID == "gecko")) {
        return true;
    } else {
       // document.getElementById(thisIframe).style.display = "none";
    }
    **/
}


// SEND FORM ONCLICK //////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function sendThisForm(thisSubmit) {
  thisSubmit.parentNode.parentNode.parentNode.submit();
}


// REMOVES THE LINK BORDER IN IE4+, NS6 ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

// NOT FOR ACCESSIBLE SITES-REMOVED
function getLinksToBlur() {
    var links = document.getElementsByTagName("a");
    var buttons = document.getElementsByTagName("button");

    for(i=0; i<links.length; i++) {
      links[i].onfocus = unblur
    }
    for(i=0; i<buttons.length; i++) {
      buttons[i].onfocus = unblur
    }
}

function unblur() {
    this.blur();
}


// FLASH DETECTION ////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

var swfObject = new Object();
swfObject.installed = false;
swfObject.version = '0.0';

if (navigator.plugins && navigator.plugins.length) {
  for (x = 0; x < navigator.plugins.length; x++) {
    if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
      swfObject.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
      swfObject.installed = true;
      break;
    }
  }
} else if (window.ActiveXObject) {
  for (x = 2; x < 10; x++) {
    try {
      theFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+x+"');");
      if (theFlash) {
        swfObject.version = x+'.0';
                swfObject.installed = true;
      }
    } catch(e) {}
  }
}

swfVersion4 = (swfObject.installed && parseInt(swfObject.version) >= 4) ? true:false;
swfVersion5 = (swfObject.installed && parseInt(swfObject.version) >= 5) ? true:false;
swfVersion6 = (swfObject.installed && parseInt(swfObject.version) >= 6) ? true:false;
swfVersion7 = (swfObject.installed && parseInt(swfObject.version) >= 7) ? true:false;
swfVersion8 = (swfObject.installed && parseInt(swfObject.version) >= 8) ? true:false;

function getTheFlash(theObjectBGColor, theObjectPath, theParentID, theClaim) {
    browserID = getBrowser(); 
    
    if (swfVersion5) {
        /**if ((browserID == "opera") || (browserID == "gecko")) {
          theObject = document.createElement("object");
      theObject.type = "application/x-shockwave-flash";
      theObject.data = theObjectPath; 
      theObject.id = theParentID+'Object'; 
      theObjectID = theObject.id;
                      
      theParam1 = document.createElement("param");
      theParam1.name = "movie"; 
      theParam1.value = theObjectPath; 
      
      theParam2 = document.createElement("param");
      theParam2.name = "quality"; 
      theParam2.value = "high";
      
      theParam3 = document.createElement("param");
      theParam3.name = "wmode"; 
      theParam3.value = "transparent";
      
      theParam4 = document.createElement("param");
      theParam4.name = "menu"; 
      theParam4.value = "true";
        document.getElementById(theParentID).appendChild(theObject);
            for (i = 0; i < 4 ; i++) {
            document.getElementById(theObjectID).appendChild('theParam'+i);
          } 
        } else {**/
        document.write("<object type=\"application/x-shockwave-flash\" data=\""+theObjectPath+"\">");
        document.write("  <param name=\"movie\" value=\""+theObjectPath+"\" />");
        document.write("  <param name=\"quality\" value=\"high\" />");
        document.write("  <param name=\"wmode\" value=\"transparent\" />");
    document.write("  <param name=\"bgcolor\" value=\""+theObjectBGColor+"\" />");
        document.write("  <param name=\"flashvars\" value=\""+theClaim+"\" />");
        document.write("  <param name=\"menu\" value=\"false\" />");
        document.write("</object>");
    //}        
    } else {
        document.writeln('<img src="/Common/Images/Content/grpTransparent.gif" alt="Bitte Flash installieren" />')
    }
} 


// SET FAV IN IE //////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function setFavorite() {
    browserID = getBrowser(); 
    try {
    
    if((browserID == "opera") || (browserID == "gecko")) {
          node = document.getElementById("addFavoriteLink");
      document.getElementById("footerTop").removeChild(node); 
      }  else {
          return true;
      }
    } catch (e) {
      //alert(e);
    }
}


// SET SPECIFIC STYLES ////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function setStyle() {
  browserID = getBrowser();
  if(browserID == "safari") {
    alert();
    document.getElementsByTagName("body").item(0).style.overflow = "auto";
  } else {
    //
  }
} 


// CHECK VALID DATE ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function checkDateFields() {
  err = 0;
  message = 'Die Felder für das Datum sind nicht korrekt ausgefüllt!\nBeispiel: 01.01.2002';
  
  myForm = document.archive;
  
  lookFor_2 = /[0-9]{2}/;
  lookFor_4 = /[0-9]{4}/;
      
  if(lookFor_2.test(myForm.from_day.value) == false)    { err++; }
  if(lookFor_2.test(myForm.from_month.value) == false)  { err++; }
  if(lookFor_4.test(myForm.from_year.value) == false)   { err++; }
  
  if(lookFor_2.test(myForm.until_day.value) == false)   { err++; }
  if(lookFor_2.test(myForm.until_month.value) == false) { err++; }
  if(lookFor_4.test(myForm.until_year.value) == false)  { err++; }
  
  if(err > 0) {
    alert(message); 
    return false;
  } else {
    return true;  
  }
}


// CLEAR INPUTS ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function clearFormInputs(node) {
  inputLength = document.getElementById(node).getElementsByTagName("input").length;
  areaLength = document.getElementById(node).getElementsByTagName("textarea").length;
  for(i=0; i < inputLength ;i++) {
    if (document.getElementById(node).getElementsByTagName("input")[i].type != "hidden") {
      document.getElementById(node).getElementsByTagName("input")[i].value = "";
    }
  }
  for(i=0; i < areaLength ;i++) {
    document.getElementById(node).getElementsByTagName("textarea")[i].value = "";
  }
}


// RESIZE IMG /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/**
function makeBig() {
  var the_image;

  // if this is Safari NN6 or IE4+
  if (document.documentElement || document.all) {
    the_image = document.the_button;
    the_image.height = the_image.height + 2;
    the_image.width = the_image.width + 2;
  } 
  if (parseInt(the_image.height < 110) {
    setTimeout("makeBig();", 10);
  }
}
**/


// CAL ////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  
  /**
  if (update && p.inputField) {
    p.inputField.value = cal.date.print(p.ifFormat);
        // ADDED BY TWINC
        thisDayID = p.myInputID+"DayInput";
        thisMonthID = p.myInputID+"MonthInput";
        thisYearID = p.myInputID+"YearInput";
        
        document.getElementById(thisDayID).value = cal.date.print(p.ifFormatDay);
        document.getElementById(thisMonthID).value = cal.date.print(p.ifFormatMonth);
        document.getElementById(thisYearID).value = cal.date.print(p.ifFormatYear);
        
    if (typeof p.inputField.onchange == "function")
      p.inputField.onchange();
  } 
  **/
  if (cal.dateClicked) {
    cal.callCloseHandler();
  }
}

function closeHandler(cal) {
  cal.hide();
  calendar = null;
}

function showCalendar(theButton, format) {
  var el = document.getElementById(theButton);
  if (calendar != null) {
    calendar.hide();
  } else {
      var cal = new Calendar(true, null, selected, closeHandler);
    calendar = cal;
    cal.create();
  }
  calendar.setDateFormat(format);    // set the specified date format
  //calendar.parseDate(el.value);      // try to parse the text in field
  calendar.sel = el;                 // inform it what input field we use
  calendar.singleClick = true;
  calendar.dragging = false;
  calendar.cache = true;
  calendar.showAtElement(el, "Tl");        // show the calendar
  
  return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled.  In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here.  However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.

function isDisabled(date) {
  var today = new Date();
  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}


// GET ABSOLUTE PATH (http://server/slbGroup/) ////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function getAbsolutePath(visiblePath) {
  documentPath = document.URL;
  var indicator = '/slbGroup/';
  var indicatorPos = documentPath.indexOf(indicator);
  var prefixPath = documentPath.substr(0, indicatorPos+indicator.length);
  return prefixPath;
}


// CHECK CONTACT FORM /////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function checkMail(strMail){
  objRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
  blnIsMail = objRegExp.test(strMail.toLowerCase());
  return blnIsMail;
}

function checkDate(strDate){
  objRegExp = /^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/;
  blnIsDate = objRegExp.test(strDate);
  return blnIsDate;
}

function checkPhone(strPhone) {
  objRegExp = /^(\+)?([0-9])+([\s]?[0-9]+)*([\-]?[0-9]+)*$/;
  blnIsPhone = objRegExp.test(strPhone);
  return blnIsPhone;
}

function checkDateOfBirth(strDate){
  blnIsBDate = false;
  if (checkDate(strDate)) {
    arrDate = strDate.split(".");
    if (arrDate[0] > 0 && arrDate[0] < 32) {
      if (arrDate[1] > 0 && arrDate[1] < 13) {
        act_year = (new Date()).getFullYear();
        if (arrDate[2] > (act_year - 80) && (arrDate[2] < act_year)) {
          blnIsBDate = true;
        }
      }
    }
  }
  return blnIsBDate;
}
  
function checkContactFields() {
  noerror = true;
  message = 'Bitte füllen Sie alle mit * gekennzeichneten Felder aus.\nEs fehlen:\n';
  myForm = document.getElementById('contactForm');
  formType = myForm.formType.value
  
  switch (formType) {
    case 'vb':
      if (myForm.contactCorpInput.value == "") {
        message += 'Firma\n'; noerror = false;
      }
      if (myForm.contactNameInput.value == "") {
        message += 'Name, Vorname\n'; 
        noerror = false;
      }
      if (myForm.contactTelInput.value == "") {
        message += 'Telefon\n'; 
        noerror = false;
      }
      if (!checkMail(myForm.contactMailInput.value)) {
        message += 'E-Mail bitte richtig angeben\n'; 
        noerror = false;
      }
      break;
    case 'norm':
      if (myForm.contactSurnameInput.value == "") {
        message += 'Name\n'; 
        noerror = false;
      }
      if (myForm.emailTo.value == "info@sachsenfonds.com") {
        if (myForm.contactNameInput.value == "") { 
          message += 'Vorname\n'; 
          noerror = false; 
        }
      } 
      if (myForm.contactMailInput.value == "") {
        message += 'E-Mail\n'; 
        noerror = false;
      }
      if (myForm.contactZIPInput.value != "" && isNaN(myForm.contactZIPInput.value)) {
        message += 'Zahlenwert für PLZ\n'; 
        noerror = false;
      }
      break;
    case 'feedback':
      if (myForm.contactSurnameInput.value == "") {
        message += 'Name\n'; 
        noerror = false;
      }
      if (myForm.contactMailInput.value == "") {
        message += 'E-Mail\n'; 
        noerror = false;
      } else {
        if (!checkMail(myForm.contactMailInput.value)) {
          message += 'E-Mail bitte richtig angeben\n'; 
          noerror = false;
        }
      }
      break;
    case 'feedbackPhone':
      if (myForm.contactSurnameInput.value == "") {
        message += 'Name\n'; 
        noerror = false;
      }
      if (myForm.contactMailInput.value == "") {
        message += 'E-Mail\n'; 
        noerror = false;
      } else {
        if (!checkMail(myForm.contactMailInput.value)) {
          message += 'E-Mail bitte richtig angeben\n'; 
          noerror = false;
        }
      }
      if (myForm.contactPhoneInput.value == "") {
        message += 'Telefonnummer\n'; 
        noerror = false;
      }
      break;
    default:
      if (!checkMail(myForm.contactMailInput.value)) {
        message += 'E-Mail bitte richtig angeben\n'; 
        noerror = false;
      }
      break;
  }

  if (noerror == false) alert(message);
  return noerror; 
}

// SUBMIT THE QUICK NAVIGATION BOX //////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
function submitQuickNavi() {
  myform = document.getElementById('quickNavForm');
  if (myform.quickJumpSelect.value != "") myform.submit();
  else {
    if (myform.visitAsSelect) {
      if (myform.visitAsSelect.value != "") myform.submit();
    }
  }
}

/////////////////////////////////////////////////////////////////////////////////////
function submitMyForm( id ) {
  myform = document.getElementById( id );
  myform.submit();
}


// CHECK SACHSENFONDS MATERIALS ORDER //////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
function checkOrderMaterial()
{
  noerror = true;
  minval = false;
  message = 'Bitte belegen Sie die Felder nur mit numerischen Werten.\n';
  inputs = document.getElementById('orderMaterials').getElementsByTagName('input');
  for (i=0; i<inputs.length; i++)
  {
    if (inputs[i].name != "fond")
    {
      if (inputs[i].value != "")
      {
        minval = true;
        if (isNaN(inputs[i].value))
        {
          if (inputs[i].name.indexOf("|") > -1)
          {
            pos = inputs[i].name.indexOf("|");
            message += inputs[i].name.substring(0, pos) + " - " + inputs[i].name.substring(pos + 1) +"\n";
          }
          else {
            message += inputs[i].name + "\n";
          }
          noerror = false;
        }
      }
    }
  }
  if (minval == false) {
    noerror = false;
    message = "Bitte wählen Sie mindestens ein Produkt aus."
  }
  if (noerror == false) alert(message);
  return noerror; 
}

function checkOrderUser()
{
  noerror = true;
  message = 'Bitte füllen Sie alle mit * gekennzeichneten Felder aus.\nEs fehlen:\n';

  myForm = document.getElementById('orderMaterials');
  if (myForm.contactPersonName.value == "") { message += 'Ansprechpartner\n'; noerror = false; }
  if (myForm.contactName.value == "") {message += 'Vor- und Nachname\n'; noerror = false; }
  if (myForm.contactCompanyInput.value == "") {message += 'Firma\n'; noerror = false; }
  else {
    if (!checkMail(myForm.contactEmail.value)) {
      message += 'E-Mail bitte richtig angeben\n'; noerror = false;
    }
  }

  if (noerror == false) alert(message);
  return noerror; 
}

// CHECK SACHSENFONDS Presentations ////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
function checkPresentationFields()
{
  noerror = true;
  if (document.getElementById('presentationForm').presentationSurnameInput)
  {
    message = 'Bitte füllen Sie alle mit * gekennzeichneten Felder aus.\nEs fehlen:\n';

    myForm = document.getElementById('presentationForm');
    if (myForm.presentationSurnameInput.value == "") { message += 'Nachname\n'; noerror = false; }
    if (myForm.presentationNameInput.value == "") {message += 'Vorname\n'; noerror = false; }
    if (myForm.presentationMailInput.value == "") {message += 'E-Mail\n'; noerror = false; }
    else {
      if (!checkMail(myForm.presentationMailInput.value)) {
        message += 'E-Mail bitte richtig angeben\n'; noerror = false;
      }
    }
    if (noerror == false) alert(message);
  }
  return noerror; 
}

// CHECK SACHSENLB Applications ////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
function checkApplicationFields() {
  noerror = true;
  message = 'Bitte füllen Sie alle mit * gekennzeichneten Felder aus.\nEs fehlen:\n';

  myForm = document.getElementById('contactForm');
  if (myForm.contactSurnameInput.value == "") { message += 'Name\n'; noerror = false; }
  if (myForm.contactNameInput.value == "") { message += 'Vorname\n'; noerror = false; }
  if (myForm.contactZIPInput.value != "" && isNaN(myForm.contactZIPInput.value)) {
    message += 'Zahlenwert für PLZ\n'; noerror = false;
  }
  if (myForm.contactMailInput.value == "") {message += 'E-Mail\n'; noerror = false; }
  else {
    if (!checkMail(myForm.contactMailInput.value)) {
      message += 'E-Mail bitte richtig angeben\n'; noerror = false;
    }
  }
  if (myForm.contactTelInput.value == "") {message += 'Telefonnummer\n'; noerror = false; }

  if (noerror == false) alert(message);
  return noerror;
}

// CHECK SACHSENLB BewerberDB Applications ////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
function checkApplicationFieldsBewerberDB() {
  noerror = true;
  message = 'Bitte füllen Sie alle mit * gekennzeichneten Felder aus.\nEs fehlen:\n';

  myForm = document.getElementById('contactForm');
  if (myForm.hrFamilyName.value == "") { message += 'Nachname\n'; noerror = false; }
  if (myForm.hrGivenName.value == "") { message += 'Vorname\n'; noerror = false; }
  if (myForm.hrAddressLine.value == "") { message += 'Straße\n'; noerror = false; }
  if (myForm.hrPostalCode.value == "") { 
    message += 'Postleitzahl\n'; noerror = false;
  } else {
    if (isNaN(myForm.hrPostalCode.value)) {
      message += 'Zahlenwert für PLZ\n'; noerror = false;
    }
  }
  if (myForm.hrMunicipality.value == "") { message += 'Ort\n'; noerror = false; }
  if (myForm.hrCountryCode.value == "0") { message += 'Land\n'; noerror = false; }
  if (myForm.hrDateOfBirth.value == "") { 
    message += 'Geburtsdatum\n'; noerror = false; 
  } else {
    if (!checkDateOfBirth(myForm.hrDateOfBirth.value)) {
      message += 'gültiges Geburtsdatum bitte in folgendem Format angeben DD.MM.JJJJ\n'; noerror = false;
    }
  }
  if (myForm.hrInternetEmailAddress.value == "") { 
    message += 'E-Mail-Adresse\n'; noerror = false; 
  } else {
    if (!checkMail(myForm.hrInternetEmailAddress.value)) {
      message += 'E-Mail bitte richtig angeben\n'; noerror = false;
    }
  }
  if (myForm.hrTelephone.value == "") { 
    message += 'Telefonnummer\n'; 
    noerror = false;
  } else {
    if (!checkPhone(myForm.hrTelephone.value)) {
      message += 'Telefonnummer bitte in folgendem Format angeben: +xx xxx xxxxxxx\n';
      noerror = false;
    }
  }
  if (myForm.hrMobile.value != "") {
    if (!checkPhone(myForm.hrMobile.value)) {
      message += 'Mobilnummer bitte in folgendem Format angeben: +xx xxx xxxxxxx\n';
      noerror = false;
    }
  }
  if (myForm.val_text.value == "") { message += 'Code bitte angeben\n'; noerror = false; }
  if (noerror == false) alert(message);
  return noerror;
}

