﻿$(document).ready(function() {
    var positionBox = getPositionBox("boxPropaganda");
    var leftBox = positionBox[0];
    var topBox = positionBox[1];
   // $("#boxPropaganda").css("left", leftBox);
   // $("#boxPropaganda").css("top", topBox);
    $("#boxPropaganda").fadeIn(2000, timedFecharBoxPropaganda(14000));
})

function timedFecharBoxPropaganda(delay) {
    var t = setTimeout("fecharBoxPropaganda()", delay);
}

function fecharBoxPropaganda() {
    $("#boxPropaganda").fadeOut(1000);
}

function teste() {
    var objBrowse = navigator.appName;
    alert(getPositionBox("boxPropaganda"));
}

function getPageSize() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight
    arrayPageSize = new Array(w, h)
    return arrayPageSize;
}

function getPageSizeWidth() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    return w;
}

function getPageSizeHeight() {
    var de = document.documentElement;
    var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight
    return h;
}

function getPositionBox(idDiv) {
    var d = document.getElementById(idDiv);
    var w = getPageSizeWidth();
    var h = getPageSizeHeight();
    var wBox = 360;
    var hBox = 260;
    var leftBox;
    var topBox;

    leftBox = ((w - wBox) / 2);
    topBox = ((h - hBox) / 2);

    arrayPositionBox = new Array(leftBox, topBox);

    return arrayPositionBox;
}