﻿function DeleteHistory() {
history.forward(1);
}

function showLightBox(url, title, height, reload) {
vReload = reload;
window.parent.document.getElementById("backover").style.display = "block";
window.parent.document.getElementById("applicationmodel").style.display = "block";
window.parent.document.getElementById("AdminTitle").style.display = "block";
window.parent.document.getElementById("lblTitle").innerText = title;
window.parent.document.getElementById("AdminContent").innerHTML = "<iframe frameborder=0 src='" + url + "' width='100%' height='" + height + "' scrollbars=no scrolling=no />"
window.parent.document.getElementById("AdminContent").style.height = (parseInt(height) + 10) + "px";
var modelwid = screen.width;
var divwidth = document.getElementById("applicationmodel").style.width;
var str = divwidth;
divwidth = str.replace(/px/, "");
var diff = modelwid - divwidth;
var leftvalue = diff / 2;
var modelhight = screen.height;
var divheight = document.getElementById("applicationmodel").style.height;
var strht = divheight;
divheight = strht.replace(/px/, "");
var diffht = modelhight - divheight;
var topvalue = diffht / 10;
//alert(topvalue);
if (topvalue < 0) {
topvalue = 10;
}
else
{
topvalue=35;
}
//alert(topvalue);

document.getElementById("applicationmodel").style.left = leftvalue + "px";
document.getElementById("applicationmodel").style.top = topvalue + "px";
//alert(document.body.clientHeight);
}

function hideLightBox(reload) {
if (reload != null) {
vReload = reload;
}
window.parent.document.getElementById("backover").style.display = "none";
// window.parent.document.getElementById("applicationmodel").style.display = "none";
if (vReload == 'true') {
var sPath = window.parent.document.location.href;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
window.parent.document.location.href = sPage;
}
}

function RedirectFromIndex(reload, val) {
if (reload != null) {
vReload = reload;
}
//   window.parent.document.getElementById("backover").style.display = "none";
window.parent.document.getElementById("applicationmodel").style.display = "none";
if (vReload == 'true') {
var sPath = window.parent.document.location.href;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
if (val == 'Buildings') {
window.parent.location = "OsaMyBuildings.aspx";
}
else if (val == 'Super') {
window.parent.location = "../OsaAdminAccountsDetails.aspx";
}
else if (val == 'Account') {
window.parent.location = "../OsaAdminAccountsDetails.aspx";
}
else if (val == 'Version2') {        }
}
}
function RedirectFromIndexVersion3(reload, val) {
if (reload != null) {
vReload = reload;
}
window.parent.document.getElementById("applicationmodel").style.display = "none";
if (vReload == 'true') {
if (val == 'Super') {
window.parent.location = "../OsaAdminAccountsDetails.aspx";
}
else if (val == 'Account') {
window.parent.location = "../OsaAdminAccountsDetails.aspx";
}
}
}

function RedirectFromIndexVersion2(reload, val) {

if (reload != null) {
vReload = reload;
}
window.parent.document.getElementById("applicationmodel").style.display = "none";
if (vReload == 'true') {
if (val == 'Super') {
window.parent.location = "../../Projects/newAdmin/AdminAccounts.aspx";
}
else if (val == 'Account') {
window.parent.location = "../../Projects/newAdmin/AdminAccounts.aspx";
}
}
}
