﻿// JScript File

// JScript File

function DisplayLayer(LayerId, x, y)
{

		document.getElementById(LayerId).style.display = '';
		document.getElementById(LayerId).style.position = 'relative';
		document.getElementById(LayerId).style.left = x + "px";
		document.getElementById(LayerId).style.top = y + "px";
		document.getElementById(LayerId).style.visibility = "visible";
}
function Navigate(url)
{
	window.document.location.href = url;

}
function ChangeClass(element, cssName)
{
    element.className = cssName ;
}
function ShowPreview(preview)
{
//window.alert(cardID); 
DisplayLayerCentered('dialogPageView');
ChangeFrame(preview);
document.getElementById("LightBox").style.display = '';
document.getElementById("LightBox").style.visibility = 'visible';
document.getElementById("LightBox").style.height = document.documentElement.scrollHeight +  "px";
document.getElementById("LightBox").style.top = 0 + "px";
}
function HideLayer(LayerID)
{
    document.getElementById(LayerID).style.display = 'none';
	document.getElementById(LayerID).style.visibility = 'hidden';
}
function DisplayLayerCentered(LayerId)
{
	//if (LayerId != "")
	//{
		//window.alert(tempX);
		document.getElementById(LayerId).style.display = '';
		document.getElementById(LayerId).style.position = 'absolute';
		//document.getElementById(LayerId).style.left = x + "px";
		//document.getElementById(LayerId).style.top = y + "px";
		
		document.getElementById(LayerId).style.visibility = "visible";
        CenterObject(LayerId);
	//}
}
function CenterObject(divid)

{
//window.alert(divid);
//window.alert(document.getElementById(divid));
//window.alert(document.getElementById(divid).offsetheight);
//window.alert(document.getElementById(divid).offsetheight);
var height = 0;
if (document.getElementById(divid).offsetheight)
{
    height = document.getElementById(divid).offsetheight;
}
else
{
    height = document.getElementById(divid).style.height.replace("px","");
}
//window.alert(height);
var IpopTop =  document.documentElement.scrollTop + (document.body.clientHeight - height) / 2;

var IpopLeft = (document.body.clientWidth - document.getElementById(divid).offsetWidth) / 2;

var left = Math.floor(IpopLeft + document.body.scrollLeft);

var top = Math.floor(IpopTop + document.body.scrollTop);

document.getElementById(divid).style.left = left + "px";
document.getElementById(divid).style.top = top + "px";
//window.alert("left: " + left + " top: " + top);


}
