home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2004 March
/
PCWMAR04.iso
/
javascript
/
functions.js
< prev
next >
Wrap
Text File
|
2003-09-03
|
2KB
|
94 lines
// GLOBAL VARIABLES
var globalPath = "Software";
// BROWSER DETECTION
var IE4, old, NN4, NN6, ND;
if (document.all) {
IE4 = true;
if (navigator.appVersion.indexOf("MSIE 5") == -1)
old = true;
} else if (document.layers) {
NN4 = true;
origWidth = innerWidth;
origHeight = innerHeight;
onresize = reArrange;
} else if (navigator.appName == "Netscape" && navigator.appVersion.indexOf("5.") != -1)
NN6 = true;
else
ND = true;
function reArrange() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();
}
// CROSS BROWSER API FUNCTIONS
function getObject(obj,bossObj) {
var theObj;
if (IE4)
{
theObj = eval("document.all." + obj + ".style");
}
else if (NN4)
{
if (bossObj)
{
theObj = eval("document." + bossObj + ".document." + bossObj + ".document." + obj + ".document." + obj + "x");
}
else
{
theObj = eval("document." + obj);
}
}
else if (NN6)
{
theObj = document.getElementById(obj).style;
}
return theObj;
}
function findImage(obj,d) {
var img;
if (!d)
d = document;
if (!(img = d[obj]) && d.all)
img = d.all[obj];
for (var i = 0; !img && d.layers && i < d.layers.length; i++) {
img = findImage(obj,d.layers[i].document);
}
return img;
}
// END CROSS BROWSER API
// FUNCTIONS FOR EVERY PAGE
function mouseHighlight(name,n,arr) {
var theimg = document.images[name + n].src;
var imgout = (typeof(eval(arr + "Out")[n]) != "undefined"?eval(arr + "Out")[n].src:eval(arr + "Out").src);
var imgover = (typeof(eval(arr + "Over")[n]) != "undefined"?eval(arr + "Over")[n].src:eval(arr + "Over").src);
document.images[name + n].src = (theimg.indexOf(imgout) != -1?imgover:imgout);
}
function fastHiLoLight(name,test) {
document.images[name].src = (test?hilight[name].src:lolight[name].src);
}
function hiLoLight(name,arr1,arr2) {
var myimage = findImage(name);
for (var i = 0; i < arr1.length; i++) {
if (myimage.src == arr1[i].src) {
myimage.src = arr2[i].src;
break;
} else if (myimage.src == arr2[i].src) {
myimage.src = arr1[i].src;
break;
}
}
}