var MaxMenuItems = 100;
function ShowMenu(MenuNo) {
if (document.getElementById("Submenu" + MenuNo)) {
document.getElementById("Submenu" + MenuNo).style.visibility = "visible";
}
}
function HideMenu(MenuNo) {
if (document.getElementById("Submenu" + MenuNo)) {
document.getElementById("Submenu" + MenuNo).style.visibility = "hidden";
}
}
// ExceptNo - multiple params like 1,3,8
function HideMenuAll(ExceptNo) {
var i;
var arr;
var found;
ExceptNo = ExceptNo + ',';
arr = ExceptNo.split(",");
for(i = 1; i <= MaxMenuItems; i++) {
found = 0;
for (x in arr) {
if (arr[x] == i) {
found = 1;
}
}
if ((found == 0) && (document.getElementById("Submenu" + i))) {
document.getElementById("Submenu" + i).style.visibility = "hidden";
}
}
}
// IMAGE BUTTONS
function SwitchImg()
{
var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
(store.indexOf('document.all[')==0 && document.all==null))
store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
obj = eval(store);
if (obj != null) {
switcher[keep++] = obj;
switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
obj.src = SwitchImg.arguments[rem+2];
} }
document.Data = switcher;
}
function RestoreImg()
{
if (document.Data != null)
for (var rem=0; rem<(document.Data.length-1); rem+=2)
document.Data[rem].src=document.Data[rem+1];
}
// TreeCollapse, TreeExpand
function TreeExpandToogle(ID) {
var ExpandButton = document.getElementById("tree_expand"+ID);
var ExpandArea = document.getElementById("tree"+ID);
if (ExpandArea) {
if (ExpandArea.style.display == "") {
if (ExpandButton)
ExpandButton.innerHTML = "
";
ExpandArea.style.display = "none";
} else {
if (ExpandButton)
ExpandButton.innerHTML = "
";
ExpandArea.style.display = "";
}
}
}
// Popup window
function PopupNewWindow(url, width, height, params) {
if (params == "")
params = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no';
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
params = params + ',width=' + width + ',height=' + height + ',screenX=' + left + ',screenY=' + top;
window.open(url, '' ,params);
}
//
// reload element using ajax..
function Ajax(ElementName, URL) {
var request = null;
try {
request = new XMLHttpRequest();
}
catch(e) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e) {
}
}
if (request != null) {
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
document.getElementById(ElementName).innerHTML = request.responseText;
}
}
}
}
request.open("GET", URL + '&Ajax=' + ElementName, true);
request.send(null);
}
// GalleryShow - display gallery window, set position..
function GalleryShowWindow() {
var Control = document.getElementById("gallery");
if (Control) {
Control.style.display = "block";
Control.style.position = "absolute";
window.scrollTo(0,0);
// alert(pageYOffset);
}
}
// GalleryHid - hide gallery window
function GalleryHideWindow() {
var Control = document.getElementById("gallery");
if (Control) {
Control.style.display = "none";
}
}
// display gallery image
function GalleryShowFromURL(ImageURL) {
GalleryShowWindow();
Ajax('gallery', '?Proc=gallery&ImageURL='+ImageURL+'');
}
function GalleryShowByGalleryID(GalleryID, AttachmentType) {
GalleryShowWindow();
Ajax('gallery', '?Proc=gallery&GalleryID=' + GalleryID + '&AttachmentType=' + AttachmentType);
}
function GalleryShowForAttachmentID(AttachmentID, AttachmentType) {
GalleryShowWindow();
Ajax('gallery', '?Proc=gallery&AttachmentID=' + AttachmentID + '&AttachmentType=' + AttachmentType);
}
function PreloadGalleryImage(URL) {
var GS = document.getElementById('gallery');
var GSP = document.getElementById('gallery_picture_frame');
var GSN = document.getElementById('gallery_navigator');
var Pic = document.getElementById("gallery_picture");
var GalleryImage = new Image();
var ScreenWidth = 0;
var ScreenHeight = 0;
// height
var theHeight = 0;
if (window.innerHeight) {
theHeight=window.innerHeight;
} else
if (document.documentElement && document.documentElement.clientHeight) {
theHeight=document.documentElement.clientHeight;
} else
if (document.body) {
theHeight=document.body.clientHeight;
}
ScreenHeight = theHeight;
// width
var theWidth = 0;
if (window.innerWidth) {
theWidth=window.innerWidth;
} else
if (document.documentElement && document.documentElement.clientWidth) {
theWidth=document.documentElement.clientWidth;
} else
if (document.body) {
theWidth=document.body.clientWidth;
}
ScreenWidth = theWidth;
function GalleryResize(NewWidth, NewHeight) {
if (NewWidth == 0) {
NewWidth = 400;
}
if (NewHeight == 0) {
NewHeight = 400;
}
var toolbar;
if (GSN == null) {
toolbar = 0;
} else {
toolbar = 24;
GSN.style.display = "block";
GSN.style.position = "absolute";
GSN.style.left = "16px";
GSN.style.top = "16px";
GSN.style.width = NewWidth + "px";
GSN.style.height = "24px";
}
GSP.style.display = "block";
GSP.style.position = "absolute";
GSP.style.left = "16px";
GSP.style.top = (16+toolbar)+"px";
GSP.style.width = NewWidth + "px";
GSP.style.height = NewHeight + "px";
GS.style.left = ((ScreenWidth-NewWidth-32) / 2) + "px";
GS.style.top = ((ScreenHeight-NewHeight-32-toolbar) / 2) + "px";
GS.style.width = (NewWidth+32) + "px";
GS.style.height = (NewHeight+32+toolbar) + "px";
}
function ImageLoaded() {
// RESIZE WINDOW
var NewWidth = GalleryImage.width;
var NewHeight = GalleryImage.height;
var Prop = 0;
if (NewWidth == 0)
NewWidth = 400;
if (NewHeight == 0)
NewHeight = 400;
if ((NewWidth > ScreenWidth - 64) || (NewHeight > ScreenHeight - 88)) {
if ((NewWidth / (ScreenWidth - 64)) <= (NewHeight / (ScreenHeight - 88))) {
Prop = (NewHeight / (ScreenHeight - 88));
if (Prop > 0) {
NewWidth = NewWidth / Prop;
NewHeight = NewHeight / Prop;
}
} else {
Prop = (NewWidth / (ScreenWidth - 64));
if (Prop > 0) {
NewWidth = NewWidth / Prop;
NewHeight = NewHeight / Prop;
}
}
}
// alert('G6');
Pic.src = GalleryImage.src;
GalleryResize(NewWidth, NewHeight);
Pic.width = NewWidth;
Pic.height = NewHeight;
}
GalleryImage.onload = ImageLoaded;
GalleryImage.src = URL;
}