var DL_HideSelects = true;
var DL_HideObjects = false;
var DL_HideIframes = false;
var DL_Banner; // Will be bound to the DIV element representing the layer
var DL_ScrollState = 0;
var DL_width, DL_height, DL_dimension, DL_insert;
var DL_imgWidth = 240, DL_imgHeight = 240;
var DL_Space_Coord = 0;
var DL_loop=0;
function DL_GetWH() {
//
// per: http://www.quirksmode.org/viewport/compatibility.html
//
if (self.innerWidth) {
// Mozilla, Safari, Opera, Netscape 4.0
DL_width = self.innerWidth;
DL_height = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight > 0) {
// IE6 in Strict Mode
DL_width = document.documentElement.clientWidth;
DL_height = document.documentElement.clientHeight;
} else if (document.getElementsByTagName("body").length > 0) {
var b = document.getElementsByTagName("body")[0];
DL_width = b.clientWidth;
DL_height = b.clientHeight;
}
// Default to 640x480 if the above information is missing or not well-formed
if(parseInt(DL_width) == 0 || parseInt(DL_height) == 0) {
DL_width = 640;
DL_height = 480;
}
DL_dimension = DL_height;
}
DL_GetWH();
function DL_reposition(){
// Make sure the layer is where it should be vertically.
// This is executed in a loop.
var scrollpos;
var edge = 0;
//
// Scroll Pos per: http://www.quirksmode.org/viewport/compatibility.html
//
if (self.innerHeight) {// all except Explorer
// somehow self.pageYOffset is zero at times which messes up for us :(
scrollx = self.pageXOffset;
scrolly = self.pageYOffset;
edge = self.innerWidth;
} else if (document.documentElement && document.documentElement.clientHeight > 0) {
// IE 6 in strict mode
scrollx = document.documentElement.scrollLeft;
scrolly = document.documentElement.scrollTop;
edge = document.documentElement.clientWidth;
} else if (document.getElementsByTagName("body").length > 0) {
// relative sanity
var b = document.getElementsByTagName("body")[0];
scrollx = b.scrollLeft;
scrolly = b.scrollTop;
edge = b.clientWidth;
}
if (document.getElementById){
DL_Banner.style.left = (parseInt(scrollx) + ((edge-DL_imgWidth)/2))+'px';
DL_Banner.style.top = (parseInt(scrolly) + DL_Banner.absolute)+'px';
}
}
function DL_DoHideSelects() {
// Optional: Hide all the Select (drop-down menu) controls on the page.
// If this isn't done, selects can be visible on top of the invitation layer.
var selects = document.getElementsByTagName('select');
for(i = 0; i < selects.length; i++) {
selects[i].style.visibility = 'hidden';
}
}
function DL_DoHideIframes() {
var objects = document.getElementsByTagName('iframe');
for(i = 0; i < objects.length; i++) {
objects[i].style.visibility = 'hidden';
}
}
function DL_DoHideObjects() {
var objects = document.getElementsByTagName('object');
for(i = 0; i < objects.length; i++) {
if (objects[i].id != 'DL_object')
objects[i].style.visibility = 'hidden';
}
objects = document.getElementsByTagName('embed');
for(i = 0; i < objects.length; i++) {
if (objects[i].id != 'DL_embed')
objects[i].style.visibility = 'hidden';
}
}
function DL_DoShowSelects() {
// The reverse of DL_DoHideSelects
selects = document.getElementsByTagName('select');
for(i = 0; i < selects.length; i++) {
selects[i].style.visibility = 'visible';
}
}
function DL_DoShowIframes() {
var objects = document.getElementsByTagName('iframe');
for(i = 0; i < objects.length; i++) {
objects[i].style.visibility = 'visible';
}
}
function DL_DoShowObjects() {
// The reverse of DL_DoHideObjects
objects = document.getElementsByTagName('object');
for(i = 0; i < objects.length; i++) {
objects[i].style.visibility = 'visible';
}
objects = document.getElementsByTagName('embed');
for(i = 0; i < objects.length; i++) {
objects[i].style.visibility = 'visible';
}
}
var DL_PauseStart = 0;
function DL_Scroll() {
// Moves the layer
// The global DL_ScrollState governs where the layer is in its trajectory.
// States:
// 0 - Layer has not yet appeared.
// 1 - Layer is moving to target location.
// 2 - Layer disappears.
// 3 - Only for gutter layer, layer is moving to stop at the edge of the screen (in the gutter).
// 4 - Layer is pausing at target location.
// 5 - Only for gutter layer, layer never disapperas and hovers forever in gutter.
// 6 - Flash object is pausing so start it playing.
// 7 - For In-Layer invites only. This effectively cancels the close timer.
// -1 - Invite is finished and layer should not appear again.
DL_GetWH();
switch (DL_ScrollState) {
case 0: // Layer has not yet appeared
DL_PauseStart = new Date();
DL_ScrollState = 4;
DL_Banner.absolute = (DL_dimension-DL_imgHeight)/2;
DL_reposition();
if(DL_HideSelects) {
DL_DoHideSelects();
}
if(DL_HideIframes) {
DL_DoHideIframes();
}
if(DL_HideObjects) {
DL_DoHideObjects();
}
DL_Banner.style.visibility = 'visible';
setTimeout(DL_Scroll, (DL_ScrollState == 6) ? 500: 50);
break;
case 1: // Layer is moving to target location.
DL_GetWH();
DL_reposition();
var x = DL_Banner.absolute;
if (x<(DL_dimension-DL_imgHeight)/2) {
x = x +0 ;
if (!(x<(DL_dimension-DL_imgHeight)/2))
x = (DL_dimension-DL_imgHeight)/2;
DL_Banner.absolute = x;
setTimeout(DL_Scroll,15);
} else {
DL_ScrollState = 4; // end movement
DL_PauseStart = new Date();
setTimeout(DL_Scroll, 50);
}
break;
case 2: // Layer disappears
DL_Banner.style.left = (-DL_imgWidth) + 'px';
DL_Banner.style.top = (-DL_imgHeight) + 'px';
DL_Banner.style.visibility = 'hidden';
if(DL_HideSelects) {
DL_DoShowSelects();
}
if(DL_HideIframes) {
DL_DoShowIframes();
}
if(DL_HideObjects) {
DL_DoShowObjects();
}
DL_ScrollState = -1;
//document.body.removeChild(DL_insert);
break;
case 3: // Only for gutter layer, layer is moving to stop at the edge of the screen (in the gutter).
DL_GetWH();
var x = DL_Banner.absolute;
// If it's not at the right edge yet, shift right
if (x < DL_width - DL_imgWidth - 4) {
x = x + 0;
DL_reposition();
DL_Banner.absolute = x;
setTimeout(DL_Scroll,15);
} else {
// Otherwise, finish up:
// Restore the