﻿// resizes a window depending on its content and a given width to the optimal size
function resizeWindowToOptimalSize(oW,divId) {
    if( !document.getElementById ) return false;
    var oH = document.getElementById(divId); if( !oH ) { return false; }
    var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
    window.resizeTo( oW, oH );
    var myW = 0, myH = 0, d = document.documentElement, b = document.body;
    if( window.innerWidth ) { myW = window.innerWidth; myH = window.innerHeight; }
    else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
    else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
    if( window.opera && !document.childNodes ) { myW += 16; }
    window.resizeTo( oW + ( oW - myW ), oH + ( oH - myH ) );
}

function ValidateCaptchaInput(oSrc, args) {
    args.IsValid = false;
    var CaptchaControlDivID = "pnCaptcha";
    var CaptchaControl = document.all ? document.all[CaptchaControlDivID] : document.getElementById(CaptchaControlDivID);
    if (CaptchaControl) 
    {
        var CaptchaControlTextBoxes = CaptchaControl.all ? CaptchaControl.all.tags("input") : CaptchaControl.getElementsByTagName("input");
        if (CaptchaControlTextBoxes) 
        {
            if (CaptchaControlTextBoxes[0].value != "") 
            {
                args.IsValid = true;
            }
        }
    }
    return args.IsValid;
}