var _domain = 'calculadora.net';
var DEFAULTSITEHOME = 'http://www.' + _domain;
var USE_SPRITE = true;

function BrowserType() {
    var btype = '';
    try {
        if (document.layers) {
            btype = "nn4"
        }
        if (document.all) {
            btype = "ie"
        }
        if (window.navigator.userAgent.toLowerCase().match("gecko")) {
            btype = "gecko"
        }
    } catch (e) {}
    return (btype)
}
function BrowserVersion() {
    var version = 999;
    try {
        if (navigator.appVersion.indexOf("MSIE") != -1) {
            version = parseFloat(navigator.appVersion.split("MSIE")[1]);
            if (version == 0 || version == null) {
                versione = 999
            }
        }
    } catch (e) {}
    return (version)
}
var _browser_version = BrowserVersion();

function GetReferrer() {
    var retval = '';
    try {
        retval = document.referrer
    } catch (e) {}
    return (retval)
}
function SonoSitoLocale() {
    var ref = GetReferrer();
    ref = ref.toLowerCase();
    return (ref.indexOf('localhost') != -1)
}
function _stoperror() {
    return true
}
if (!SonoSitoLocale()) {
    try {
        window.onerror = _stoperror()
    } catch (e) {}
}
var _time = new Date();

function MakeArray() {
    var lngth = MakeArray.arguments.length;
    for (i = 0; i < lngth; i++) {
        this[i] = MakeArray.arguments[i]
    }
}



function GetCopyYear() {
    return _time.getFullYear()
}
function OpenCopy() {
    OpenNewWindow('http://www.' + _domain + '/documenti/varie/copyright_disclaimer.html', '&copy; 2012-' + GetCopyYear() + ' calculadora', 800, 800)
}

function PrintCopyPopup() {
    PrintCopy()
}




function popUpWin(url, type, strWidth, strHeight) {
    type = type.toLowerCase();
    if (type == "fullscreen") {
        strWidth = screen.availWidth;
        strHeight = screen.availHeight
    } else {
        if (strWidth > screen.availWidth) {
            strWidth = screen.availWidth
        }
        if (strHeight > screen.availHeight) {
            strHeight = screen.availHeight
        }
    }
    strLeft = (screen.availWidth - strWidth) / 2;
    if (strLeft < 0) {
        strLeft = 0
    }
    strTop = (screen.availHeight - strHeight) / 4;
    if (strTop < 0) {
        strTop = 0
    }
    var tools = "";
    if (type == "standard") {
        tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width=" + strWidth + ",height=" + strHeight + ",top=" + strTop + ",left=" + strLeft + ""
    }
    if (type == "stdnomenu") {
        tools = "resizable,toolbar=yes,location=no,scrollbars=no,menubar=no,width=" + strWidth + ",height=" + strHeight + ",top=" + strTop + ",left=" + strLeft + ""
    }
    if (type == "scrollable") {
        tools = "resizable,toolbar=no,location=no,scrollbars=yes,width=" + strWidth + ",height=" + strHeight + ",top=" + strTop + ",left=" + strLeft + ""
    }
    if (type == "console" || type == "fullscreen") {
        tools = "resizable,toolbar=no,location=no,scrollbars=no,width=" + strWidth + ",height=" + strHeight + ",top=" + strTop + ",left=" + strLeft + ""
    }
    var newWindow = window.open(url, '', tools);
    if (newWindow) {
        newWindow.focus()
    }
}
function OpenUrl(url, strWidth, strHeight) {
    popUpWin(url, 'scrollable', strWidth, strHeight)
}
function _PopLayer(el) {
    var browserType = BrowserType();
    if (browserType == "gecko") {
        document.poppedLayer = eval('document.getElementById(el)')
    } else {
        if (browserType == "ie") {
            document.poppedLayer = eval('document.getElementById(el)')
        } else {
            document.poppedLayer = eval('document.layers[el]')
        }
    }
}
function Hide(el, mode) {
    _PopLayer(el);
    if (mode == 1) {
        document.poppedLayer.style.visibility = "hidden"
    } else {
        document.poppedLayer.style.display = "none"
    }
}
function Show(el, mode) {
    _PopLayer(el);
    if (mode == 1) {
        document.poppedLayer.style.visibility = "visible"
    } else {
        document.poppedLayer.style.display = "block"
    }
}




function getElementById(id) {
    return ((typeof document.getElementById != 'undefined') ? document.getElementById(id) : document.all[id])
}







function ReplaceChar(s, c1, c2) {
    var replace = "[" + c1 + "]";
    var re = new RegExp(replace, 'g');
    return (s.replace(re, c2))
}





