// Allgmeine Funktionen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
function close_window() {
    window.close();
}

function drucken() {
    window.print();
}

function screenres() {
    var breite = window.screen.width;
    var hoehe = window.screen.height;
    var aufloesung = breite+"x"+hoehe;
    //alert(aufloesung);
    document.aspnetForm.ctl00$cph_inhalte$txtAufloesung.value = aufloesung;
}

// PopUp Funktionen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function bilder(url) {
    var links = (window.screen.availWidth-600)/2;
    var oben = ((window.screen.availHeight-400)/2)-50;
    newwin = window.open(url,'Ladevorgang','toolbar=0,menubar=0,location=0,status=0,scrollbars=0,resizable=1,width=600,height=400,top='+oben+',left='+links); 
    newwin.focus();
    //setTimeout('newwin.focus();',200); 
}

function mehr(url) {
    var breite = 630;
    var hoehe = 500;
    var links = (window.screen.availWidth-breite)/2;
    var oben = ((window.screen.availHeight-hoehe)/2)-50;
    newwin = window.open(url,'Ladevorgang','toolbar=0,menubar=0,location=0,status=0,scrollbars=1,resizable=1,width='+breite+',height='+hoehe+',top='+oben+',left='+links); 
    setTimeout('newwin.focus();',200); 
}


function glossar(url, b, h){
    if (b == null) { var b = 660; }
	if (h == null) { var h = 550; } //window.screen.availHeight-100;	}
	var offset = 25;
	var links = (window.screen.availWidth-b)/2;
	var oben = ((window.screen.availHeight-h)/2)-offset;
    newwin = window.open(url,'lade','toolbar=0,menubar=0,location=0,status=0,scrollbars=1,resizable=1,width='+b+',height='+h+',top='+oben+',left='+links); 
    setTimeout('newwin.focus();',200); 
}

// Interaktive Funktionen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
function setCheckbox(cID){
    obj = document.getElementById(cID);
    obj.click();
    obj.focus();
}

function setOver(obj){
    obj.style.border = "1px solid #00ff00";
}
function setOut(obj){
    obj.style.border = "1px solid #FFFFCC";
}

function zeichenCounter(){
    var derText = document.aspnetForm.ctl00_cph_inhalte_txtFreitext.value;
    document.aspnetForm.counter.value = 950-derText.length;
}

function handleEnter (field, event) {
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        var i;
        for (i = 0; i < field.form.elements.length; i++)
        if (field == field.form.elements[i])
        break;
        i = (i + 1) % field.form.elements.length;
        field.form.elements[i].focus();
        return false;
    } 
    else
    return true;
} 

function setzeFokus(){
    document.aspnetForm.ctl00$cph_inhalte$cmdLockNext.focus();
}
function setzeFokusThemen(){
    document.aspnetForm.ctl00$cph_inhalte$cmdAntwort.focus();
}

shift = false;
//onKeyUp
function checkTaste(t){
    
    var tt = browser(t);   

    if((tt>=65 && tt<=90) || (tt>=97 && tt<=122)){
        var msg = "Feststelltaste (Caps Lock) ist aktiviert!\n\nDas Passwort wird eventuell falsch eingegeben, wenn die Feststelltaste aktiviert ist. Du solltest die Feststelltaste deaktivieren, bevor Du Dein Passwort eingibst!";
        var wert = document.aspnetForm.ctl00$cph_inhalte$txtPasswort.value;
        var v1 = wert.charAt(wert.length-1);
        var v2 = v1.toUpperCase();
        var v3 = v1.toLowerCase();
        
        // shift und Kleinbuchstabe || kein shift und Großbuchstabe -> caps an
        if ((shift && (v1 == v3)) || (!shift && (v1 == v2))){
	        alert(msg);
        }
        
    } else if (tt == 16){
        shift = false; 
    }
}

//onKeyDown
function checkShift(e){
    var ee = browser(e);
    if (ee == 16){
        shift = true;
    }
}

function browser(id){
    // IE else Mozilla
    if (document.all) 
		return id.keyCode;
	else if (document.layers) 
		return id.which;
    else if (document.getElementById) 
		return id.which;
}


function toggleBox(divbox1, divbox2, txtAktiv, txtNeu) {
    if (document.getElementById(divbox1).style.display == 'none') {
        document.getElementById(divbox1).style.display = 'block';
        document.getElementById(divbox2).innerHTML = txtNeu;
    } else {
        document.getElementById(divbox1).style.display = 'none';
        document.getElementById(divbox2).innerHTML = txtAktiv;
    }
}


function baustelle(){
    alert("Dieser Bereich wird derzeit überarbeitet und wird erst in Kürze wieder erreichbar sein.");
}


