var NS4 = (document.layers) ? true : false;
var IE4 = (document.all) ? true : false;
var maxZ = 1;
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curleft,curtop];
}
}
function popout(id, posY, width) {
this.id = id; // the element's name (and the variable's name)
this.posY = posY; // the element's top property
this.width = width; // the element's width
this.show = false; // do not show the element
this.lastClickTime = 0;
this.makeImage = makeImage;
this.makeElement = makeElement; // constructs the content box
this.showElement = showElement; // sets the element's visibility
this.testClick = testClick;
}
function makeElement(boxBg, boxColor, boxCode) {
var padding = (NS4) ? '' : 'padding: 3 0 3 3;';
document.write(
'',
'
',
boxCode,
'
'
);
}
/*
'position: absolute;',
'left: 0; top: ', this.posY, ';',
'z-index: 1',
*/
function makeImage(imgURL, imgHeight, imgWidth, imgAlt) {
document.write(
'',
''
);
boxImg = document.getElementById(this.id + 'img');
box = document.getElementById(this.id + 'box');
var i = findPos(boxImg);
box.style.left = (parseInt(i[0]) - (parseInt(this.width) - parseInt(imgWidth)) - 12) + "px";
box.style.width = this.width + "px";
// box.style.top = (parseInt(i[1]) + parseInt(imgHeight) + 48) + "px";
box.style.top = "188px";
}
function showElement() {
this.show = !this.show;
var pos = (this.show) ? this.width : 0;
box = document.getElementById(this.id + 'box');
box.style.zIndex = maxZ;
box.style.visibility = (this.show)?'visible':'hidden';
/*
if (NS4) {
var str = (this.show) ? 'show' : 'hide';
eval('document.' + this.id + 'box.zIndex = ' + maxZ);
eval('document.' + this.id + 'box.visibility = "' + str + '"');
box.visibility = str;
} else {
var str = (this.show) ? 'visible' : 'hidden';
eval(this.id + 'box.style.zIndex = ' + maxZ);
eval(this.id + 'box.style.visibility = "' + str + '"');
box.visibility = str;
} */
}
musicPlayer = new popout('musicPlayer', 200, 200);
musicPlayer.makeElement('#ffffff','#000000',' ');
function testClick() {
now = new Date();
thisClick = now.getTime();
if ((thisClick - this.lastClickTime) > 1000) {
this.lastClickTime = thisClick;
return true;
}
return false;
}
function popoutPlayer() {
if ((musicPlayer.testClick()) && (!musicPlayer.show))
musicPlayer.showElement();
}
function hidePlayer () {
if ((musicPlayer.testClick()) && (musicPlayer.show))
musicPlayer.showElement();
return true;
}
//document.onmousedown=hidePlayer;
//window.onmousedown=hidePlayer;
//document.onmouseup=hidePlayer;
//window.onmouseup=hidePlayer;