﻿
var isPopupRollIn = false; //variable shows if popup need to be roll again(true) or just visible(false)
var isPopupVisible = false; //variable shows if popup should be visible
var isRollingnow = false; // variable shows if rolling animation is going now
var isStartPopupShow = false;
function popuprollin() {
    if ((!isPopupRollIn) && (!isRollingnow)) {
        isRollingnow = true;
        isPopupRollIn = true;
        var t1 = new Tween(document.getElementById('IE8DowlloadPopup').style, 'top', Tween.regularEaseOut, 0, 183, 1, 'px');
        t1.start();
        isPopupVisible = true;
        setTimeout("isRollingnow=false", 1000);
    }
}
function popuprollout() {
    if ((isPopupRollIn) && (!isRollingnow)) {
        isRollingnow = true;
        isPopupRollIn = false;
        var t2 = new Tween(document.getElementById('IE8DowlloadPopup').style, 'top', Tween.regularEaseOut, 183, -20, 1, 'px');
        t2.start();
        isPopupVisible = false;
        setTimeout("isRollingnow=false", 1000);
    }
}
function showpopup() {
    document.getElementById('IE8DowlloadPopup').style.display = 'block';
    isPopupVisible = true;
    popuprollin();
}
function hidepopup() {
    if (!isStartPopupShow)
        setTimeout("if (!isPopupVisible) { popuprollout();}", 20);
}

function RollPopupOnStart() {
    if (document.getElementById('IE8DowlloadPopup')) {
        var a = 0;  // findCookie("firsttime");
        if (a != 1) {
            //addCookie("firsttime", 1, 2);
            isStartPopupShow = true;
            showpopup();
            setTimeout("isPopupVisible = false;  isStartPopupShow =false; hidepopup();", 10000);
        }
        else {
            isPopupVisible = false; isStartPopupShow = false;
        }
    }
}        

function online_os() {
    $useragent = navigator.userAgent;
    //navigator.userAgent contains information  about operation system
    $os = 'Unknown';

    /* In the next part this name is getted from $useragent variable. It is embodied by checking, if  $useragent contains string with name of specific OS. There are different OS (Windows versions, Linux, Mac OS, BeOS)  are enumerated. For example, if operation system is Windows 7,  the  $useragent variable contains string  “Win”, that means, that operation system is Windows, and string “NT 6.1” that displays version. In this case function $ useragent.indexOf("Win") returns value more than ‘-1’ and $useragent.indexOf("NT 6.1") also returns value more than ‘-1’. So than $os variable that stores operation system name will get value 'Windows 7'    */

    if ($useragent.indexOf("Win") > -1) {
        //next code block will be used if operation system is Windows
        if ($useragent.indexOf("NT 6.0") > -1) // checks if version   //of Windows is NT 6.0
            $os = 'Windows Vista';
        if ($useragent.indexOf("NT 5.2") > -1)
            $os = 'Windows Server 2003 or XPx64';
        if ($useragent.indexOf("NT 5.1") > -1 || $useragent.indexOf("Win32") > -1 || $useragent.indexOf("XP") > -1)
            $os = 'Windows XP';
        if ($useragent.indexOf("NT 5.0") > -1)
            $os = 'Windows 2000';
        if ($useragent.indexOf("NT 4.0") > -1 || $useragent.indexOf("NT 3.5") > -1)
            $os = 'Windows NT';
        if ($useragent.indexOf("Me") > -1)
            $os = 'Windows Me';
        if ($useragent.indexOf("98") > -1)
            $os = 'Windows 98';
        if ($useragent.indexOf("95") > -1)
            $os = 'Windows 95';
        if ($useragent.indexOf("NT 6.1") > -1) {
            $os = 'Windows 7';
        }
    }

    // this isn’t necessary, but can be used in different projects
    if ($useragent.indexOf("Linux") > -1
    			|| $useragent.indexOf("Lynx") > -1
    			|| $useragent.indexOf("Unix") > -1) $os = 'Linux';
    if ($useragent.indexOf("Macintosh") > -1
    			|| $useragent.indexOf("PowerPC") > -1) $os = 'Macintosh';
    if ($useragent.indexOf("OS/2") > -1) $os = 'OS/2';
    if ($useragent.indexOf("BeOS") > -1) $os = 'BeOS';
    // ------------------------------------------------------------
    /* In the next part information about operation system is used. According to variable $os, that stores operation system name, the value for variable $hrefVal is set.*/

    var $hrefVal = '#';
    if ($os.indexOf("Windows XP") > -1) {
        $hrefVal = "http://go.microsoft.com/fwlink/?LinkID=142198";
    }
    else if ($hrefVal.indexOf("Windows Vista") > -1) {
        $hrefVal = "http://go.microsoft.com/fwlink/?LinkID=142200";
    }
    else if ($os.indexOf("Windows Server 2003 or XPx64") > -1) {
        $hrefVal = "http://go.microsoft.com/fwlink/?LinkID=142202";
    }
    else if ($os.indexOf("Windows 7") > -1) {
        $hrefVal = "http://ieaddons.com/nl/";
    }

    return $hrefVal;
}
function getInternetExplorerVersion() {
    var rv = -1;
    // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}

