// JavaScript Document

function AddIframeModal(url, wWidth, wHeight) {
    $.modal('<iframe src="' + url + '" width="' + wWidth + '" height="' + wHeight + '" onload="LoadingFadeOut()" frameborder="0" style="border:0"></iframe>', {
        //closeHTML: "",
        containerCss: {
            height: wHeight, //minimum
            width: wWidth,
            padding: 0
        }
        , overlayClose: false
        , onShow: function () {
            document.body.scroll = "no";
            document.body.style.overflow = "hidden";
        }
        , onClose: function () {
            document.body.scroll = "";
            document.body.style.overflow = "";
            $.modal.close();
        }
    });
}

function AddIframeModalRelH(url, wWidth, wPad) {
    wHeight = $(window).height() - wPad;

    $.modal('<iframe src="' + url + '" width="' + wWidth + '" height="' + wHeight + '" onload="LoadingFadeOut()" frameborder="0" style="border:0"></iframe>', {
        //closeHTML: "",
        containerCss: {
            height: wHeight, //minimum
            width: wWidth,
            padding: 0
        }
        , overlayClose: false
        , onShow: function () {
            document.body.scroll = "no";
            document.body.style.overflow = "hidden";
        }
        , onClose: function () {
            document.body.scroll = "";
            document.body.style.overflow = "";
            $.modal.close();
        }
    });
}

function BlockScreen() {
    $.modal('<div style="padding:10px; text-align:center;"><img src="http://www.inventionevaluator.com/img/icon-processing.gif" border="0"></div><div style="padding:10px; text-align:center;">Please wait while processing</div>', {
        closeHTML: "",
        containerCss: {
            height: 120,
            width: 200,
            border: 0,
            padding: 10
        }
        , overlayClose: false
        , onShow: function () {
            document.body.scroll = "no";
            document.body.style.overflow = "hidden";
        }
        , onClose: function () {
            document.body.scroll = "";
            document.body.style.overflow = "";
            $.modal.close();
        }
    });
}

function LoadingFadeOut() {
    //It is inside simple modal code
    $('#simplemodal-hidden').fadeOut(500);
}

function WordCount(inputStr) {
    wCounter = 0;

    if (inputStr.length > 0) {
        arr = inputStr.replace(/\s/g, ' ');
        arr = arr.split(' ');


        for (i = 0; i < arr.length; i++) {
            if (arr[i].length > 0)
                wCounter++;
        }
    }

    return wCounter;
}
		
