﻿// JScript für Frame-Seiten


function validate(eltID, wert, maxcnt)
{
    var maxCount = Math.max(maxcnt, '0');
    			    
	var elt = document.getElementById(eltID);
	var str = elt.value;
	
	if(isNaN(wert) == true){
		elt.value = str.substring(0, str.length - 1);
	}

    if(isNaN(maxCount) == false){

	    if(isNaN(str) == false){
		    if (Math.max(str, '0') > maxCount){
			    elt.value = str.substring(0, str.length - 1);
		    }
	    }	
	}    
}


function chkMail() {

	if (document.formular.tbName) {
		if (document.formular.tbName.value == "") {
			alert ("Bitte geben Sie Ihren Namen an.");
			document.formular.tbName.focus();
			return false;
		}
	}

	if (document.formular.tbBetreff) {
		if (document.formular.tbBetreff.value == "") {
			alert ("Bitte geben Sie einen Betreff an.");
			document.formular.tbBetreff.focus();
			return false;
		}
	}

    if (document.formular.tbEmail) {
		if (document.formular.tbEmail.value == "") {
			alert ("Bitte geben Sie Ihre Email Adresse an.");
			document.formular.tbEmail.focus();
			return false;
		} else {
 			if (document.formular.tbEmail.value.indexOf("@") <=1) {
	            alert ("Ihre E-Mail Eingabe ist nicht korrekt.");
	            document.formular.tbEmail.focus();
	            return false;
	        }
		}
	}

	if (document.formular.tbAnfrage) {
		if (document.formular.tbAnfrage.value == "") {
			alert ("Bitte geben Sie Ihre Anfrage ein!");
			document.formular.tbAnfrage.focus();
			return false;
		}
	}
}

var currentWindow = null;
function openWindow( u ) {
        if ( currentWindow == null || currentWindow.closed ) {
                currentWindow = open( '', '',
                        'toolbar=no,location=no,directories=no,'+
                        'status=no,menubar=no,copyhistory=no,'+
                        'scrollbars=no,resizable=no,'+
                        'width=520,height=323' );
         }
        currentWindow.location = u;
        currentWindow.focus();
}






/*

    //Accordeon-Menü
    // nicht kompatibel zu carousel, d.h. das Carousel kann nicht im Accordeon-Menü aufgerufen werden!
ddaccordion.init({
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: false, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

// Collapsor, kann auch 

$(function(){
	//$('ul a').collapsor();
	$('div.collapse').collapsor({
	    speed: 1000,
	    easing: 'swing',        //Easing for the opening animation. Other than 'swing' or 'linear' must be provided by plugin // Default: 'swing'
	    activeClass: 'active',  //Class added to the element when is active, Default: 'active'
	    openClass: 'open',      //Class added to the element when is open, Default: 'open'
	    sublevelElement: 'div'       //Element that must open or close // Default: 'ul'
	  });
});*/