var editWindow;

function openDialog(path, width, height, scrollbars) {
    //    editWindow = window.open("/admin/index.htm","popup"+width+height,"width="+width+",height="+height+",resizable=auto,scrollbars=no");
    //    editWindow.close();
    editWindow = window.open(path, "popup" + width + height, "width=" + width + ",height=" + height + ",resizable=yes,scrollbars=" + scrollbars);
    editWindow.focus();
    return false;
}

// Zeichenzähler für Teaser
function countChars(maxLength) {
    var text = window.document.frm.teaser.value;
    if (text.length > maxLength) {
        text = text.substring(0, maxLength);
        window.document.frm.teaser.value = text;
    }
    window.document.frm.charsLeft.value = maxLength - text.length;

    if (window.document.frm.charsLeft.value < 25) {
        window.document.frm.charsLeft.style.color = "#ff0000";
    } else {
        window.document.frm.charsLeft.style.color = "#404040";
    }
}

// Zeichenzähler für Teaser Rubrik
function countCharsCategory(maxLength) {
    var text = window.document.frm.teaserCategory.value;
    if (text.length > maxLength) {
        text = text.substring(0, maxLength);
        window.document.frm.teaserCategory.value = text;
    }
    window.document.frm.charsLeftCategory.value = maxLength - text.length;

    if (window.document.frm.charsLeftCategory.value < 25) {
        window.document.frm.charsLeftCategory.style.color = "#ff0000";
    } else {
        window.document.frm.charsLeftCategory.style.color = "#404040";
    }
}

function printPage() {
    if (navigator.userAgent.indexOf("Mac") == -1) window.print();
}

function getCookie(name) {
    var retVal = false;
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(name + "=") == 0) retVal = true;
    }
    return retVal;
}

function createCookie(name) {
    var value = "1";
    var days = 20;
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

/**
 * Some browser detection
 */
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var is_gecko = ((clientPC.indexOf('gecko') != -1) && (clientPC.indexOf('spoofer') == -1)
        && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0') == -1));
var is_safari = ((clientPC.indexOf('AppleWebKit') != -1) && (clientPC.indexOf('spoofer') == -1));
var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ));
if (clientPC.indexOf('opera') != -1) {
    var is_opera = true;
    var is_opera_preseven = (window.opera && !document.childNodes);
    var is_opera_seven = (window.opera && document.childNodes);
}


function showFlashOverlay() {
    document.getElementById("flashOverlay").style.display = 'block';
    //    alert('function showFlashOverlay wurde aufgerufen');
}

function hideFlashOverlay() {
    document.getElementById("flashOverlay").style.display = 'none';
    //    alert('function hideFlashOverlay wurde aufgerufen');
}

function swsearch() { 
    var v=document.studienwahl.swsuche.value;
    s="http://www.studienwahl.de/index.aspx?";

    if (v.length>=3) {
        v  = escape(v);
        s= s+"bybegriff=" +v;
        windowHandle = window.open(s);}
    else {
        alert('Bitte geben Sie einen Suchbegriff (mindestens 3 Zeichen) ein!');
    }
}



