﻿var ver = 0;
function getVersion() {
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;
        var ieversion = new Number(RegExp.$1) // capture x.x portion and store as a number
        if (ieversion >= 9)
            return 9;
        else if (ieversion >= 8)
            return 8;
        else if (ieversion >= 7)
            return 7;
        else if (ieversion >= 6)
            return 6;
        else if (ieversion >= 5)
            return 5;
    }
    else
        return 0;

}

function openProductDialog(inId) {
    
    $('.DialogBG').css({ display: 'block', height: $(document).height() });
    $('.Dialog').css({ display: 'block', width: '100px', height: '100px', left: '50%', marginLeft: '-50px', top: '50%', marginTop: '-50px', border: '2px solid white', backgroundColor: '#e0eef2' });

    var st = ($(document).scrollTop() - 250) + 'px';
    
    if (ver == 0 || ver >= 9)
        $('.Dialog').animate({ display: 'block', width: '780px', height: '1070px', left: '50%', top: '50%', marginLeft: '-405px', marginTop: st }, 1200);
    else
        $('.Dialog').css({ display: 'block', width: '780px', height: '1070px', left: '50%', top: '50%', marginLeft: '-405px', marginTop: st });

    $('<div class="Dialog_Close"></div>').appendTo('.Dialog');
    $('.Dialog_Close').css({ float: 'left', marginTop: '-15px', marginLeft: '-15px' });
    $('.Dialog_Close').click(function () {
        if (ver == 0 || ver >= 9) {
            $('.DialogBG').hide(500);
            $('.Dialog').hide(500);
        }
        else {
            $('.DialogBG').css({ display: 'none' });
            $('.Dialog').css({ display: 'none' });
        }

        $('.Dialog').empty();
    });
    $('.DialogBG').click(function () {
        if (ver == 0 || ver >= 9) {
            $('.DialogBG').hide(500);
            $('.Dialog').hide(500);
        }
        else {
            $('.DialogBG').css({ display: 'none' });
            $('.Dialog').css({ display: 'none' });
        }

        $('.Dialog').empty();
    });
    setTimeout(function () {
        $('<iframe id="frmsendtofriend" scrolling="no" frameborder="0" src="popupprod.aspx?productid=' + inId + '" style="width:780px;height:1070px;"></iframe>').appendTo('.Dialog');
    }, 1300);

}
