/* --- BoxOver ---
/* --- v 2.1 17th June 2006
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org */
if(typeof document.attachEvent!="undefined"){
window.attachEvent("onload",init);
document.attachEvent("onmousemove",moveMouse);
document.attachEvent("onclick",checkMove);
}else{
window.addEventListener("load",init,false);
document.addEventListener("mousemove",moveMouse,false);
document.addEventListener("click",checkMove,false);
}
var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;
function init(){
oDv.appendChild(dvHdr);
oDv.appendChild(dvBdy);
oDv.style.position="absolute";
oDv.style.visibility="hidden";
document.body.appendChild(oDv);
}
function defHdrStyle(){
dvHdr.innerHTML=dvHdr.innerHTML;
dvHdr.style.fontWeight="bold";
dvHdr.style.width="";
dvHdr.style.fontFamily="arial";
dvHdr.style.border="1px solid #AAAAAA";
dvHdr.style.padding="0";
dvHdr.style.fontSize="11";
dvHdr.style.color="#333333";
dvHdr.style.background="#CCCCCC";
dvHdr.style.filter="alpha(opacity=85)";
dvHdr.style.opacity="0.85";
}
function defBdyStyle(){
dvBdy.style.borderBottom="1px solid #AAAAAA";
dvBdy.style.borderLeft="1px solid #AAAAAA";
dvBdy.style.borderRight="1px solid #AAAAAA";
dvBdy.style.width="";
dvBdy.style.fontFamily="arial";
dvBdy.style.fontSize="11";
dvBdy.style.padding="0";
dvBdy.style.color="#333333";
dvBdy.style.background="#EEEEEE";
dvBdy.style.filter="alpha(opacity=85)";
dvBdy.style.opacity="0.85";
}
function checkElemBO(_1){
if(!_1||typeof (_1)!="string"){
return false;
}
if((_1.indexOf("header")>-1)&&(_1.indexOf("body")>-1)&&(_1.indexOf("[")>-1)&&(_1.indexOf("[")>-1)){
return true;
}else{
return false;
}
}
function scanBO(_2){
if(checkElemBO(_2.title)){
_2.boHDR=getParam("header",_2.title);
_2.boBDY=getParam("body",_2.title);
_2.boCSSBDY=getParam("cssbody",_2.title);
_2.boCSSHDR=getParam("cssheader",_2.title);
_2.IEbugfix=(getParam("hideselects",_2.title)=="on")?true:false;
_2.fixX=parseInt(getParam("fixedrelx",_2.title));
_2.fixY=parseInt(getParam("fixedrely",_2.title));
_2.absX=parseInt(getParam("fixedabsx",_2.title));
_2.absY=parseInt(getParam("fixedabsy",_2.title));
_2.offY=(getParam("offsety",_2.title)!="")?parseInt(getParam("offsety",_2.title)):10;
_2.offX=(getParam("offsetx",_2.title)!="")?parseInt(getParam("offsetx",_2.title)):10;
_2.fade=true;
_2.fadespeed=0.1;
_2.delay=(getParam("delay",_2.title)!="")?parseInt(getParam("delay",_2.title)):0;
if(getParam("requireclick",_2.title)=="on"){
_2.requireclick=true;
document.all?_2.attachEvent("onclick",showHideBox):_2.addEventListener("click",showHideBox,false);
document.all?_2.attachEvent("onmouseover",hideBox):_2.addEventListener("mouseover",hideBox,false);
}else{
if(getParam("doubleclickstop",_2.title)!="off"){
document.all?_2.attachEvent("ondblclick",pauseBox):_2.addEventListener("dblclick",pauseBox,false);
}
if(getParam("singleclickstop",_2.title)=="on"){
document.all?_2.attachEvent("onclick",pauseBox):_2.addEventListener("click",pauseBox,false);
}
}
_2.windowLock=getParam("windowlock",_2.title).toLowerCase()=="off"?false:true;
_2.title="";
_2.hasbox=1;
}else{
_2.hasbox=2;
}
}
function getParam(_3,_4){
var _5=new RegExp("([^a-zA-Z]"+_3+"|^"+_3+")\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]");
var _6=_5.exec(_4);
var _7;
if(_6){
return _6[2].replace("[[","[").replace("]]","]");
}else{
return "";
}
}
function Left(_8){
var x=0;
if(_8.calcLeft){
return _8.calcLeft;
}
var _a=_8;
while(_8){
if((_8.currentStyle)&&(!isNaN(parseInt(_8.currentStyle.borderLeftWidth)))&&(x!=0)){
x+=parseInt(_8.currentStyle.borderLeftWidth);
}
x+=_8.offsetLeft;
_8=_8.offsetParent;
}
_a.calcLeft=x;
return x;
}
function Top(_b){
var x=0;
if(_b.calcTop){
return _b.calcTop;
}
var _d=_b;
while(_b){
if((_b.currentStyle)&&(!isNaN(parseInt(_b.currentStyle.borderTopWidth)))&&(x!=0)){
x+=parseInt(_b.currentStyle.borderTopWidth);
}
x+=_b.offsetTop;
_b=_b.offsetParent;
}
_d.calcTop=x;
return x;
}
var ah,ab;
function applyStyles(){
if(ab){
oDv.removeChild(dvBdy);
}
if(ah){
oDv.removeChild(dvHdr);
}
dvHdr=document.createElement("div");
dvBdy=document.createElement("div");
CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
dvHdr.innerHTML="<div style=\"padding: 2px;\"><img src=\"images/info.gif\" style=\"vertical-align:middle\" border=\"0\">&nbsp;"+CBE.boHDR+"</div>";
dvBdy.innerHTML="<div style=\"padding: 2px;\">"+CBE.boBDY+"</div>";
ah=false;
ab=false;
if(CBE.boHDR!=""){
oDv.appendChild(dvHdr);
ah=true;
}
if(CBE.boBDY!=""){
oDv.appendChild(dvBdy);
ab=true;
}
}
var CSE,iterElem,LSE,CBE,LBE,totalScrollLeft,totalScrollTop,width,height;
var ini=false;
function SHW(){
if(document.body&&(document.body.clientWidth!=0)){
width=document.body.clientWidth;
height=document.body.clientHeight;
}
if(document.documentElement&&(document.documentElement.clientWidth!=0)&&(document.body.clientWidth+20>=document.documentElement.clientWidth)){
width=document.documentElement.clientWidth;
height=document.documentElement.clientHeight;
}
return [width,height];
}
var ID=null;
function moveMouse(e){
e?evt=e:evt=event;
CSE=evt.target?evt.target:evt.srcElement;
if(!CSE.hasbox){
iElem=CSE;
while((iElem.parentNode)&&(!iElem.hasbox)){
scanBO(iElem);
iElem=iElem.parentNode;
}
}
if((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){
if(!CSE.boxItem){
iterElem=CSE;
while((iterElem.hasbox==2)&&(iterElem.parentNode)){
iterElem=iterElem.parentNode;
}
CSE.boxItem=iterElem;
}
iterElem=CSE.boxItem;
if(CSE.boxItem&&(CSE.boxItem.hasbox==1)){
LBE=CBE;
CBE=iterElem;
if(CBE!=LBE){
applyStyles();
if(!CBE.requireclick){
if(CBE.fade){
if(ID!=null){
clearTimeout(ID);
}
ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay);
}else{
if(ID!=null){
clearTimeout(ID);
}
COL=1;
ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay);
}
}
if(CBE.IEbugfix){
hideSelects();
}
fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;
fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;
lockX=0;
lockY=0;
boxMove=true;
ox=CBE.offX?CBE.offX:10;
oy=CBE.offY?CBE.offY:10;
}
}else{
if(!isChild(CSE,dvHdr)&&!isChild(CSE,dvBdy)&&(boxMove)){
if((!isChild(CBE,CSE))||(CSE.tagName!="TABLE")){
CBE=null;
if(ID!=null){
clearTimeout(ID);
}
fadeOut();
showSelects();
}
}
}
LSE=CSE;
}else{
if(((isChild(CSE,dvHdr)||isChild(CSE,dvBdy))&&(boxMove))){
totalScrollLeft=0;
totalScrollTop=0;
iterElem=CSE;
while(iterElem){
if(!isNaN(parseInt(iterElem.scrollTop))){
totalScrollTop+=parseInt(iterElem.scrollTop);
}
if(!isNaN(parseInt(iterElem.scrollLeft))){
totalScrollLeft+=parseInt(iterElem.scrollLeft);
}
iterElem=iterElem.parentNode;
}
if(CBE!=null){
boxLeft=Left(CBE)-totalScrollLeft;
boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;
boxTop=Top(CBE)-totalScrollTop;
boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;
doCheck();
}
}
}
if(boxMove&&CBE){
bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;
mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;
if((CBE)&&(CBE.windowLock)){
mouseY<-oy?lockY=-mouseY-oy:lockY=0;
mouseX<-ox?lockX=-mouseX-ox:lockX=0;
mouseY>(SHW()[1]-oDv.offsetHeight-oy)?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;
mouseX>(SHW()[0]-dvBdy.offsetWidth-ox)?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX;
}
oDv.style.left=((fixposx)||(fixposx==0))?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";
oDv.style.top=((fixposy)||(fixposy==0))?fixposy:bodyScrollTop+mouseY+oy+lockY+"px";
}
}
function doCheck(){
if((mouseX<boxLeft)||(mouseX>boxRight)||(mouseY<boxTop)||(mouseY>boxBottom)){
if(!CBE.requireclick){
fadeOut();
}
if(CBE.IEbugfix){
showSelects();
}
CBE=null;
}
}
function pauseBox(e){
e?evt=e:evt=event;
boxMove=false;
evt.cancelBubble=true;
}
function showHideBox(e){
oDv.style.visibility=(oDv.style.visibility!="visible")?"visible":"hidden";
}
function hideBox(e){
oDv.style.visibility="hidden";
}
var COL=0;
var stopfade=false;
function fadeIn(fs){
ID=null;
COL=0;
oDv.style.visibility="visible";
fadeIn2(fs);
}
function fadeIn2(fs){
COL=COL+fs;
COL=(COL>1)?1:COL;
oDv.style.filter="alpha(opacity="+parseInt(100*COL)+")";
oDv.style.opacity=COL;
if(COL<1){
setTimeout("fadeIn2("+fs+")",20);
}
}
function fadeOut(){
oDv.style.visibility="hidden";
}
function isChild(s,d){
while(s){
if(s==d){
return true;
}
s=s.parentNode;
}
return false;
}
var cSrc;
function checkMove(e){
e?evt=e:evt=event;
cSrc=evt.target?evt.target:evt.srcElement;
if((!boxMove)&&(!isChild(cSrc,oDv))){
fadeOut();
if(CBE&&CBE.IEbugfix){
showSelects();
}
boxMove=true;
CBE=null;
}
}
function showSelects(){
var _17=document.getElementsByTagName("select");
for(i=0;i<_17.length;i++){
_17[i].style.visibility="visible";
}
}
function hideSelects(){
var _18=document.getElementsByTagName("select");
for(i=0;i<_18.length;i++){
_18[i].style.visibility="hidden";
}
}

