///////////////////////////////////////////////////////// // // Copyright © 2002-2005 Softpress Systems Ltd. // All rights reserved. // http://www.softpress.com/ // ///////////////////////////////////////////////////////// var NS4 = document.layers ? true : false; var NS6 = !document.all && document.getElementById ? true : false; // this includes Safari var IE4 = document.all && !document.getElementById ? true : false; var IE5 = document.all && document.getElementById ? true : false; // includes Opera var mouseX = 0; var mouseY = 0; function FindLayer(layerID) { var layer = null; if (NS4) layer = document[layerID]; else if (NS6 || IE5) layer = document.getElementById(layerID).style; else if (IE4) layer = document.all[layerID].style; return layer; } function ShowLayer(layerID) { if (NS4) document[layerID].visibility = "visible"; // or "show"; else if (NS6 || IE5) document.getElementById(layerID).style.visibility = "visible"; else if (IE4) document.all[layerID].style.visibility = "visible"; } function HideLayer(layerID) { if (NS4) document[layerID].visibility = "hidden"; // or "hide"; else if (NS6 || IE5) document.getElementById(layerID).style.visibility = "hidden"; else if (IE4) document.all[layerID].style.visibility = "hidden"; } function GetObjLeft(obj) { var left = 0; if (IE4) { if (obj && obj.tagName.toUpperCase() == "TR") obj = obj.children[0]; while (obj && obj.tagName.toUpperCase() != "BODY") { left += obj.offsetLeft ? parseInt(obj.offsetLeft) : 0; obj = obj.parentElement; } } else { while (obj) { left += parseInt(obj.offsetLeft); obj = obj.offsetParent; } } return left; } function GetObjTop(obj) { var top = 0; if (IE4) { if (obj && obj.tagName.toUpperCase() == "TR") obj = obj.children[0]; while (obj && obj.tagName.toUpperCase() != "BODY") { top += obj.offsetTop ? parseInt(obj.offsetTop) : 0; obj = obj.parentElement; } } else { if (NS6) { if (obj && obj.tagName.toUpperCase() == "TR" && obj.children) obj = obj.children[0]; } while (obj) { top += parseInt(obj.offsetTop); obj = obj.offsetParent; } } return top; } function GetObjectLeft(obj) { var left = 0; if (NS4) left = parseInt(obj.x); else left = GetObjLeft(obj); if (!left) left = 0; return left; } function GetObjectTop(obj) { var top = 0; if (NS4) top = parseInt(obj.y); else top = GetObjTop(obj); if (!top) top = 0; return top; } function GetObjectWidth(obj) { if (!obj) return 0; var width = 0; if (NS4) width = parseInt(obj.clip.width); else if (NS6) { if (obj.offsetWidth) width = parseInt(obj.offsetWidth); else { for (var i = 0; i < obj.children.length; i++) if (obj.children[i].tagName.toUpperCase() == "TD") width += parseInt(obj.children[i].offsetWidth); } } else if (IE5) { if (obj.offsetWidth) // Opera 7+ width = parseInt(obj.offsetWidth); else width = parseInt(obj.clientWidth); } else if (IE4) { if (obj.tagName.toUpperCase() == "TR") { for (var i = 0; i < obj.children.length; i++) width += parseInt(obj.children[i].clientWidth); } } if (!width) width = 0; return width; } function GetObjectHeight(obj) { if (!obj) return 0; var height = 0; if (NS4) height = parseInt(obj.clip.height); else if (NS6) { if (obj.offsetHeight) height = parseInt(obj.offsetHeight); else height = parseInt(obj.children[0].offsetHeight); } else if (IE5) height = parseInt(obj.clientHeight); else if (IE4) { if (obj.tagName.toUpperCase() == "TR") height = parseInt(obj.children[0].clientHeight); } if (!height) height = 0; return height; } function GetLayerLeft(layerID) { var left = 0; if (NS4) left = parseInt(document[layerID].left); else if (IE4) left = parseInt(document.all[layerID].style.left); else if (IE5 || NS6) left = parseInt(document.getElementById(layerID).style.left); if (!left) left = 0; return left; } function GetLayerTop(layerID) { var top = 0; if (NS4) top = parseInt(document[layerID].top); else if (IE4) top = parseInt(document.all[layerID].style.left); else if (IE5 || NS6) top = parseInt(document.getElementById(layerID).style.left); if (!top) top = 0; return top; } function GetLayerWidth(layerID) { var width = 0; if (NS4) width = parseInt(document[layerID].clip.width); else if (NS6) width = parseInt(document.getElementById(layerID).offsetWidth); else if (IE4) width = parseInt(document.all[layerID].clientWidth); else if (IE5) width = parseInt(document.getElementById(layerID).clientWidth); if (!width) width = 0; return width; } function GetLayerHeight(layerID) { var height = 0; if (NS4) height = parseInt(document[layerID].clip.height); else if (NS6) height = parseInt(document.getElementById(layerID).offsetHeight); else if (IE4) height = parseInt(document.all[layerID].clientHeight); else if (IE5) height = parseInt(document.getElementById(layerID).clientHeight); if (!height) height = 0; return height; } function GetWindowTop() { var top = 0; if (NS4 || NS6) top = parseInt(window.pageYOffset); else if (document.documentElement && document.documentElement.scrollTop) top = parseInt(document.documentElement.scrollTop); else if (document.body) top = parseInt(document.body.scrollTop); if (!top) top = 0; return top; } function GetWindowLeft() { var left = 0; if (NS4 || NS6) left = parseInt(window.pageXOffset); else if (document.documentElement && document.documentElement.scrollLeft) left = parseInt(document.documentElement.scrollLeft); else if (document.body) left = parseInt(document.body.scrollLeft); if (!left) left = 0; return left; } function GetWindowWidth() { var width = 0; if (NS4 || NS6) width = parseInt(window.innerWidth); else if (document.documentElement && document.documentElement.clientWidth) width = parseInt(document.documentElement.clientWidth); else if (document.body) width = parseInt(document.body.clientWidth); if (!width) width = 0; return width; } function GetWindowHeight() { var height = 0; if (NS4 || NS6) height = parseInt(window.innerHeight); else if (document.documentElement && document.documentElement.clientHeight) height = parseInt(document.documentElement.clientHeight); else if (document.body) height = parseInt(document.body.clientHeight); if (!height) height = 0; return height; } function GetMousePosition(e) { if (IE4 || IE5) { mouseX = parseInt(event.clientX) + GetWindowLeft(); mouseY = parseInt(event.clientY) + GetWindowTop(); } else if (e) { mouseX = parseInt(e.pageX); mouseY = parseInt(e.pageY); } }