﻿//////// ZOOM IN AND OUT FUNCTIONALITY
function ResizeFont(Controls, Direction) {

    arCtrls = Controls.split(",");

    if (Direction == '+') {
        for (var i = 0; i < arCtrls.length; i++) {
            elem = document.getElementById(arCtrls[i])
            if (elem.style.fontSize == '') {
                elem.style.fontSize = '14px';
            }
            else {
                curFontSize = parseInt(elem.style.fontSize.replace('px', ''))
                if (curFontSize <= 24) {
                    elem.style.fontSize = parseInt(curFontSize + 2) + 'px'
                }
            }
        }
    }

    if (Direction == '-') {
        for (var i = 0; i < arCtrls.length; i++) {
            elem = document.getElementById(arCtrls[i])
            if (elem.style.fontSize == '') {
                elem.style.fontSize = '12px';
            }
            else {
                curFontSize = parseInt(elem.style.fontSize.replace('px', ''))
                if (curFontSize >= 14) {
                    elem.style.fontSize = parseInt(curFontSize - 2) + 'px'
                }
            }
        }
    }
}

function ResizeFrame(currFrame) {
    currFrame.style.height = parseInt(currFrame.contentWindow.document.body.scrollHeight) + "px";
    //window.scroll(0, 280); 
    window.scroll(0, 0); 
}

//////// WATERMARK FUNCTIONALITY
function WaterMark(txt, evt, wmText) {

    //SPECIAL TREATMENT FOR PASSWORD FIELD
    if (txt.id.search('Password') != -1 && evt.type == "focus") {
        document.getElementById(txt.id).style.display = "none";
        document.getElementById(txt.id.replace('WM', '')).style.display = "";
        document.getElementById(txt.id.replace('WM', '')).focus();
        txt = document.getElementById(txt.id.replace('WM', ''))
    }
    if (txt.id.search('Password') != -1 && evt.type == "blur") {
        if (document.getElementById(txt.id).value == '') {
            document.getElementById(txt.id).style.display = "none";
            document.getElementById(txt.id + 'WM').style.display = "";
            txt = document.getElementById(txt.id + 'WM')
        }
    }

    if (txt.value.length == 0 && evt.type == "blur") {
        txt.style.color = "#999999";
        txt.value = wmText;
    }

    if (txt.value.search("<< ") != -1 && txt.value.search(" >>") != -1 && evt.type == "focus") {
        txt.style.color = "#333333";
        txt.value = "";
    }

}
