var val = 1;


try {
    jQuery(document).ready(function() {
        jQuery(":text[title], textarea[title]").example(false, {
            class_name: 'example'
        });
    });
}
catch (e) {
}

function popup(url, name, size_and_location, attributes) {
	
    var tokArray1 = size_and_location.split(";");
    var bef = "";

    if (typeof tokArray1[0] !="undefined") {
        bef = bef + "width=" + tokArray1[0];
    }
    if (typeof tokArray1[1] !="undefined") {
        bef = bef + ",height=" + tokArray1[1];
    }
    if (typeof tokArray1[2] !="undefined") {
        bef = bef + ",left=" + tokArray1[2];
    }
    if (typeof tokArray1[3] !="undefined") {
        bef = bef + ",top=" + tokArray1[3];
    }

    var tokArray2 = attributes.split(";");

    if (tokArray2[0]=="all") {
        bef = bef + ",location=yes";
        bef = bef + ",menubar=yes";
        bef = bef + ",resizable=yes";
        bef = bef + ",scrollbars=yes";
        bef = bef + ",status=yes";
        bef = bef + ",toolbar=yes";
    } else {
        for(i=0;i<tokArray2.length;i++) {
            bef = bef + "," + tokArray2[i] + "=yes";
        }
    }

    w = eval(window.open(url, name, bef));
    w.focus();
}

function deactivate(formname, bname, text) {
    eval('document.forms[formname].'+bname+'.value    = text');
    eval('document.forms[formname].'+bname+'.disabled = true');
    document.forms[formname].direction.value = bname;
    document.forms[formname].submit();
}

function linkDirection(val) {
    if(val==1) {
        document.forms['naviform'].action = 'http://www.dhd24.com/azl/index.php';
    }
    if(val==2) {
        document.forms['naviform'].action = 'http://blogs.dhd24.com/index.php';
    }
    if(val==3) {
        document.forms['naviform'].action = 'http://forum.dhd24.com/search.php';
    }
}

function linkDirection2() {
    document.forms['naviform'].action = document.forms['naviform'].where.value;
    document.forms['naviform'].where.value = "";
    return true;
}

function switchHelptext(in_html_obj, in_substring) {
    if (in_html_obj.value.substr(0,15) == in_substring) {
        in_html_obj.className = '';
        in_html_obj.value = '';
    }
    return true;
}

/**
  * Liefert rekursiv die Werte des Elternelements zurück
  * @param elem		HTML-Element bei dem begonnen werden soll
  * @param prop		Eigenschaft die ermittelt werden soll
  */
function getParentProps(elem, prop) {

    var result = 0;

    while(elem != null) {
        result += elem[prop];
        elem = elem.offsetParent;
    }

    return result;
}

function nl2br(str) {

    var str = str.replace(/\r/g, "");
    return str.replace(/\n/g, "<br />");
}

function htmlspecialchars(strInput, intType) {

    if("undefined" == typeof strInput) {
        strInput = "";
    }

    if("number" != typeof intType) {
        intType = 2;
    }

    intType = Math.max(0, Math.min(3, parseInt(intType)));

    var arrHtml = new Array();

    arrHtml[38] = "&amp;";
    arrHtml[60] = "&lt;";
    arrHtml[62] = "&gt;";

    if(1 == intType || 3 == intType) {
        arrHtml[39] = "&#039;";
    }
    if(2 == intType || 3 == intType) {
        arrHtml[34] = "&quot;";
    }

    if("string" == typeof strInput) {

        for(var i = 0; i < arrHtml.length; i++) {
            if("string" != typeof arrHtml[i]) {
                continue;
            }

            eval("strInput = strInput.replace(/" + String.fromCharCode(i) + "/g, \"" + arrHtml[i] + "\");");
        }
    }

    return strInput;
}

function getPos(e) {
    var left = 0;
    var top  = 0;

    while (e.offsetParent) {
        left += e.offsetLeft;
        top  += e.offsetTop;
        e     = e.offsetParent;
    }

    left += e.offsetLeft;
    top  += e.offsetTop;

    return {
        x:left,
        y:top
    };
}