/********************************************************************************************************************
* PopBox.js, v2.7a Copyright (c) 2009, C6 Software, Inc. (http://www.c6software.com/)
* PopBox is released under the Creative Commons GNU GPL license (http://creativecommons.org/licenses/GPL/2.0/)
* and is free to use in both commercial and non-commercial work, provided this header remains at the top.
* The latest version and documentation can be found at http://www.c6software.com/products/popbox/default.aspx.
* Questions and suggestions can be sent to john.reid@c6software.com. Please put "PopBox" somewhere in the
* email subject so I can easily filter. Send me your URL and I may post it!
* PopBox relies on many methods from Danny Goodman's (www.dannyg.com) javascript library DHTMLAPI.js
* and his books, without which scores of web developers would be totally lost. Thanks Danny.
********************************************************************************************************************/
function SeekLayer(a,b){var c;for(var i=0;i<a.layers.length;i++){if(a.layers[i].name==b){c=a.layers[i];break}if(a.layers[i].document.layers.length>0){c=SeekLayer(document.layers[i].document,b)}}return c}function GetRawObject(a){var b;if(typeof a=="string"){var c=(document.body&&document.body.style)?true:false;if(c&&document.getElementById){b=document.getElementById(a)}else if(c&&document.all){b=document.all(a)}else if(document.layers){b=SeekLayer(document,a)}}else{b=a}return b}function GetInsideWindowSize(){if(window.innerWidth){return{x:window.innerWidth,y:window.innerHeight}}else{var a=document.getElementsByTagName("base");if(a.length==0){if(document.compatMode&&document.compatMode.indexOf("CSS1")>=0){return{x:document.body.parentNode.clientWidth,y:document.body.parentNode.clientHeight}}else if(document.body&&document.body.clientWidth){return{x:document.body.clientWidth,y:document.body.clientHeight}}}else{if(document.body&&document.body.clientWidth){return{x:document.body.clientWidth,y:document.body.clientHeight}}else if(document.compatMode&&document.compatMode.indexOf("CSS1")>=0){return{x:document.body.parentNode.clientWidth,y:document.body.parentNode.clientHeight}}}}return{x:0,y:0}}function GetObjectPadding(a){var c=GetRawObject(a);var l=0;var r=0;var t=0;var b=0;if(c.currentStyle){if(c.currentStyle.paddingLeft)l=parseInt(c.currentStyle.paddingLeft,10);if(c.currentStyle.paddingRight)r=parseInt(c.currentStyle.paddingRight,10);if(c.currentStyle.paddingTop)t=parseInt(c.currentStyle.paddingTop,10);if(c.currentStyle.paddingBottom)b=parseInt(c.currentStyle.paddingBottom,10)}else if(window.getComputedStyle){l=parseInt(window.getComputedStyle(c,null).paddingLeft,10);r=parseInt(window.getComputedStyle(c,null).paddingRight,10);t=parseInt(window.getComputedStyle(c,null).paddingTop,10);b=parseInt(window.getComputedStyle(c,null).paddingBottom,10)}if(isNaN(l)==true)l=0;if(isNaN(r)==true)r=0;if(isNaN(t)==true)t=0;if(isNaN(b)==true)b=0;return{l:(l),r:(r),t:(t),b:(b)}}function GetObjectSize(a){var b=GetRawObject(a);var w=0;var h=0;if(b.offsetWidth){w=b.offsetWidth;h=b.offsetHeight}else if(b.clip&&b.clip.width){w=b.clip.width;h=b.clip.height}else if(b.style&&b.style.pixelWidth){w=b.style.pixelWidth;h=b.style.pixelHeight}w=parseInt(w,10);h=parseInt(h,10);var c=GetObjectPadding(b);w-=(c.l+c.r);h-=(c.t+c.b);return{w:(w),h:(h)}}function GetElementPosition(a){var b=GetRawObject(a);var c=0;var d=0;var e=GetObjectPadding(b);c=e.l;d=e.t;if(b.offsetParent){c+=b.offsetLeft;d+=b.offsetTop;var f=b.offsetParent;while(f){c+=f.offsetLeft;d+=f.offsetTop;if(f.style&&f.style.overflow&&f.style.overflow!=""){c-=f.scrollLeft;d-=f.scrollTop}var g=f.tagName.toLowerCase();if(g!="table"&&g!="body"&&g!="html"&&g!="div"&&f.clientTop&&f.clientLeft){c+=f.clientLeft;d+=f.clientTop}f=f.offsetParent}}else if(b.left&&b.top){c=b.left;d=b.top}else{if(b.x)c=b.x;if(b.y)d=b.y}return{x:c,y:d}}function GetScrollOffset(){if(window.pageYOffset){return{x:window.pageXOffset,y:window.pageYOffset}}else if(document.compatMode&&document.compatMode.indexOf("CSS1")>=0){return{x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}}else if(document.body&&document.body.clientWidth){return{x:document.body.scrollLeft,y:document.body.scrollTop}}return{x:0,y:0}}function CreateRandomId(){var a=0.0;while(a==0.0)a=Math.random();var b=a+"";return"id"+b.substr(2)}function MouseMoveRevert(e){if(pbMouseMoveRevert!=null&&pbMouseMoveRevert.length!=0){var a=(e)?e:window.event;var b={x:0,y:0};if(a.pageX||a.pageY){b.x=a.pageX;b.y=a.pageY}else if(a.clientX||a.clientY){var c=GetScrollOffset();b.x=a.clientX+c.x;b.y=a.clientY+c.y}for(var x=0;x<pbMouseMoveRevert.length;){if(pbMouseMoveRevert[x]!=null){var d=pbMouseMoveRevert[x].id;if(typeof popBox[d]!="undefined"&&popBox[d]!=null&&popBox[d].hTarg!=0){if(b.x<popBox[d].xTarg||b.x>(popBox[d].xTarg+popBox[d].wTarg)||b.y<popBox[d].yTarg||b.y>(popBox[d].yTarg+popBox[d].hTarg)){var f=pbMouseMoveRevert[x].className;pbMouseMoveRevert.splice(x,1);Revert(d,null,f);continue}}}x++}}}var popBox=new Array();var popBoxIds=new Array();var popBoxZ=100;var pbSrc=new Array();var pbPopBarFunc=new Array();var pbMouseMoveRevert=null;if(typeof window.onload=='function'){var func=window.onload;window.onload=function(){func();InitPbSrc();InitPbPopBar()}}else{window.onload=function(){InitPbSrc();InitPbPopBar()}}function InitPbSrc(){var a=null;if(document.body){if(document.body.getElementsByTagName)a=document.body.getElementsByTagName("img");else if(document.body.all)a=document.body.all.tags("img")}if(a!=null){for(var x=0;x<a.length;x++){var b=a[x].getAttribute('pbSrc');if(b!=null){if(a[x].id=="")a[x].id=CreateRandomId();if(pbSrc[a[x].id]==null){pbSrc[a[x].id]=new Image();pbSrc[a[x].id].src=b}}}}}function InitPbPopBar(){var a=null;if(document.body){if(document.body.getElementsByTagName)a=document.body.getElementsByTagName("img");else if(document.body.all)a=document.body.all.tags("img")}if(a!=null){var b=new Array();for(var x=0;x<a.length;x++){if(a[x].id=="")a[x].id=CreateRandomId();b[x]=a[x]}for(var x=0;x<b.length;x++)CreatePopBar(b[x])}}function InitPopBox(a){a=GetRawObject(a);if(typeof popBox[a.id]!="undefined"&&popBox[a.id]!=null)return a;var b=document.body;if(a.id=="")a.id=CreateRandomId();var c=a;var d=GetElementPosition(c);var f=GetObjectSize(c);if(c.style.position=="absolute"||c.style.position=="relative"){b=c.parentNode;d.x=parseInt(c.style.left,10);d.y=parseInt(c.style.top,10)}if(pbSrc[c.id]!=null||(c.style.position!="absolute"&&c.style.position!="relative")){var g=(pbSrc[c.id]!=null)?pbSrc[c.id].src:c.src;var h=null;try{h=document.createElement("<img src='"+g+"' />")}catch(ex){h=document.createElement("img");h.src=g}h.border=c.border;h.className=c.className;h.height=c.height;h.id="popcopy"+c.id;h.alt=c.alt;h.title=c.title;h.width=c.width;h.onclick=c.onclick;h.ondblclick=c.ondblclick;h.onmouseout=c.onmouseout;c.onmouseout=null;h.style.width=f.w;h.style.height=f.h;h.style.position="absolute";h.style.left=d.x+"px";h.style.top=d.y+"px";h.style.cursor=c.style.cursor;b.appendChild(h);c.style.visibility="hidden";c=h}popBoxIds.push(c.id);popBox[c.id]={elemId:c.id,xCurr:0.0,yCurr:0.0,xTarg:0.0,yTarg:0.0,wCurr:0.0,hCurr:0.0,wTarg:0.0,hTarg:0.0,xStep:0.0,yStep:0.0,wStep:0.0,hStep:0.0,xDelta:0.0,yDelta:0.0,wDelta:0.0,hDelta:0.0,xTravel:0.0,yTravel:0.0,wTravel:0.0,hTravel:0.0,velM:1.0,velS:1.0,interval:null,isAnimating:false,xOriginal:d.x,yOriginal:d.y,wOriginal:parseFloat(f.w),hOriginal:parseFloat(f.h),isPopped:false,fnClick:null,fnDone:null,fnPre:null,originalId:null,cursor:""};if(typeof a.onclick=="function"){popBox[c.id].fnClick=c.onclick;if(popBoxAutoClose==true&&(typeof a.ondblclick!="function"||a.ondblclick==null)&&typeof a.onmouseover!="function")c.ondblclick=function(){Revert(c.id,null,c.className)}}if(popBoxAutoClose==true&&typeof a.onmouseover=="function"&&(typeof a.onmouseout!="function"||a.onmouseout==null)){if(popBoxMouseMoveRevert==true){if(pbMouseMoveRevert==null){pbMouseMoveRevert=new Array();if(typeof document.onmousemove=='function'){var i=document.onmousemove;document.onmousemove=function(e){i(e);MouseMoveRevert(e)}}else{document.onmousemove=MouseMoveRevert}}pbMouseMoveRevert.push({id:c.id,className:c.className})}else{c.onmouseout=function(){Revert(c.id,null,c.className)}}}if(a.id!=c.id)popBox[c.id].originalId=a.id;return c}function DoPopBox(a){if(typeof a=="string")a=GetRawObject(a);try{var b=false;var c=false;if((popBox[a.id].xTravel+Math.abs(popBox[a.id].xStep))<popBox[a.id].xDelta){var x=popBox[a.id].xCurr+popBox[a.id].xStep;a.style.left=parseInt(x,10)+"px";popBox[a.id].xTravel+=Math.abs(popBox[a.id].xStep);popBox[a.id].xCurr=x}else{popBox[a.id].xTravel+=Math.abs(popBox[a.id].xStep);a.style.left=parseInt(popBox[a.id].xTarg,10)+"px";b=true}if((popBox[a.id].yTravel+Math.abs(popBox[a.id].yStep))<popBox[a.id].yDelta){var y=popBox[a.id].yCurr+popBox[a.id].yStep;a.style.top=parseInt(y,10)+"px";popBox[a.id].yTravel+=Math.abs(popBox[a.id].yStep);popBox[a.id].yCurr=y;b=false}else{popBox[a.id].yTravel+=Math.abs(popBox[a.id].yStep);a.style.top=parseInt(popBox[a.id].yTarg,10)+"px"}if((popBox[a.id].wTravel+Math.abs(popBox[a.id].wStep))<popBox[a.id].wDelta){var w=popBox[a.id].wCurr+popBox[a.id].wStep;a.style.width=parseInt(w,10)+"px";popBox[a.id].wTravel+=Math.abs(popBox[a.id].wStep);popBox[a.id].wCurr=w}else{popBox[a.id].wTravel+=Math.abs(popBox[a.id].wStep);a.style.width=parseInt(popBox[a.id].wTarg,10)+"px";c=true}if((popBox[a.id].hTravel+Math.abs(popBox[a.id].hStep))<popBox[a.id].hDelta){var h=popBox[a.id].hCurr+popBox[a.id].hStep;a.style.height=parseInt(h,10)+"px";popBox[a.id].hTravel+=Math.abs(popBox[a.id].hStep);popBox[a.id].hCurr=h;c=false}else{popBox[a.id].hTravel+=Math.abs(popBox[a.id].hStep);a.style.height=parseInt(popBox[a.id].hTarg,10)+"px"}var d=a;if(b==true&&c==true){clearInterval(popBox[a.id].interval);a.style.cursor=popBox[a.id].cursor;var e=null;if(popBox[a.id].fnDone!=null&&typeof popBox[a.id].fnDone=="function")e=popBox[a.id].fnDone;if(popBox[a.id].isPopped==true){a.style.zIndex="";if(popBox[a.id].originalId!=null){d=GetRawObject(popBox[a.id].originalId);d.onmouseout=a.onmouseout;d.style.visibility="visible";a.parentNode.removeChild(a)}else{a.style.width=parseInt(popBox[a.id].wOriginal,10)+"px";a.style.height=parseInt(popBox[a.id].hOriginal,10)+"px";if(typeof popBox[a.id].fnClick=="function")a.onclick=popBox[a.id].fnClick}delete popBox[a.id];popBox[a.id]=null;CreatePopBar(d)}else{popBox[a.id].isPopped=true;popBox[a.id].isAnimating=false;CreateRevertBar(a)}if(e!=null&&typeof e=="function")e(d)}}catch(ex){}}function HasRevertBar(a){if(typeof a=="string")a=GetRawObject(a);var b=a;if(popBox[b.id]!=null&&popBox[b.id].originalId!=null)b=GetRawObject(popBox[b.id].originalId);var c=b.getAttribute('pbShowRevertBar');var d=b.getAttribute('pbShowRevertText');var e=b.getAttribute('pbShowRevertImage');c=(c!=null)?(c=="true"||c==true):popBoxShowRevertBar;d=(d!=null)?(d=="true"||d==true):popBoxShowRevertText;e=(e!=null)?(e=="true"||e==true):popBoxShowRevertImage;return(c||d||e)}function HasCaption(a){if(typeof a=="string")a=GetRawObject(a);var b=a;if(popBox[b.id]!=null&&popBox[b.id].originalId!=null)b=GetRawObject(popBox[b.id].originalId);var c=b.getAttribute('pbShowCaption');c=(c!=null)?(c=="true"||c==true):popBoxShowCaption;var d=null;if(c==true){d=b.getAttribute('pbCaption');if(d==null&&b.title!="")d=b.title}return(d!=null&&d!="")}function CreateRevertBar(a){if(typeof a=="string")a=GetRawObject(a);var b=a;if(popBox[b.id]!=null&&popBox[b.id].originalId!=null)b=GetRawObject(popBox[b.id].originalId);var c=b.getAttribute('pbShowRevertBar');var d=b.getAttribute('pbShowRevertText');var e=b.getAttribute('pbShowRevertImage');var f=b.getAttribute('pbRevertText');var g=b.getAttribute('pbRevertImage');c=(c!=null)?(c=="true"||c==true):popBoxShowRevertBar;d=(d!=null)?(d=="true"||d==true):popBoxShowRevertText;e=(e!=null)?(e=="true"||e==true):popBoxShowRevertImage;if(f==null)f=popBoxRevertText;if(g==null)g=popBoxRevertImage;var h=b.getAttribute('pbShowCaption');h=(h!=null)?(h=="true"||h==true):popBoxShowCaption;var i=null;if(h==true){i=b.getAttribute('pbCaption');if(i==null&&b.title!="")i=b.title}CreatePbBar(a,c,d,e,f,g,popBoxRevertBarAbove,true,i)}function CreatePopBar(a){if(typeof a=="string")a=GetRawObject(a);if(typeof pbPopBarFunc[a.id]!='undefined'&&pbPopBarFunc[a.id]!=null)return;var b=a.getAttribute('pbShowPopBar');if(b!=null){var c=a.getAttribute('pbShowPopText');var d=a.getAttribute('pbShowPopImage');var e=a.getAttribute('pbPopText');var f=a.getAttribute('pbPopImage');b=(b=="true"||b==true);c=(c!=null)?(c=="true"||c==true):popBoxShowPopText;d=(d!=null)?(d=="true"||d==true):popBoxShowPopImage;if(e==null)e=popBoxPopText;if(f==null)f=popBoxPopImage;CreatePbBar(a,b,c,d,e,f,popBoxPopBarAbove,false,null)}}function CreatePbBar(a,b,c,d,e,f,g,h,i){if(b==false&&c==false&&d==false&&i==null)return;if(typeof a=="string")a=GetRawObject(a);var j="hand";if(a.currentStyle)j=a.currentStyle.cursor;else if(window.getComputedStyle)j=window.getComputedStyle(a,null).cursor;var k=function(){if(typeof a.onclick=='function')a.onclick()};var l=function(){if(typeof a.onmouseout=='function')a.onmouseout()};var m=function(){if(typeof a.onmouseover=='function')a.onmouseover()};var n=new Array();var o=(a.style.position=="absolute"||a.style.position=="relative");var p=0;var q=0;var r=a.parentNode;var s=null;if(o==true){p=parseInt(a.style.left,10);q=parseInt(a.style.top,10);var t=GetObjectPadding(a);p+=t.l;q+=t.t}else{s=document.createElement("span");s=(a.nextSibling!=null)?r.insertBefore(s,a.nextSibling):r.appendChild(s);s.style.position="relative";s.style.left="0px";s.style.top="0px";var u="";if(a.align=="left")u="left";else if(a.align=="right")u="right";u=(a.style.styleFloat&&a.style.styleFloat!="")?a.style.styleFloat:(a.style.cssFloat&&a.style.cssFloat!="")?a.style.cssFloat:u;if(typeof a.style.styleFloat!="undefined")s.style.styleFloat=u;else if(typeof a.style.cssFloat!="undefined")s.style.cssFloat=u;var v=GetElementPosition(a);var w=GetElementPosition(s);s.style.left=(v.x-w.x)+"px";s.style.top=(u!="")?"1px":(v.y-w.y)+"px";r=s}var y=parseInt(a.style.width,10);var A=parseInt(a.style.height,10);var B=GetObjectSize(a);if(isNaN(y)==true)y=B.w;else if(B.w>y)p+=((B.w-y)/2);if(isNaN(A)==true)A=B.h;else if(B.h>A)q+=((B.h-A)/2);if(g==true)q-=20;var z=a.style.zIndex+1;if(b==true){var C=document.createElement("div");C.id="popBoxDivTrans"+z;C.style.width=y+"px";C.style.height="20px";C.style.borderStyle="none";C.style.padding="0px";C.style.margin="0px";C.style.position="absolute";C.style.left=p+"px";C.style.top=q+"px";C.style.backgroundColor="#000000";C.style.cursor=j;C.style.zIndex=z;if(g==false){if(typeof C.style.filter!='undefined')C.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=20)";if(typeof C.style.opacity!='undefined')C.style.opacity="0.2"}C.onclick=k;if(h==true)C.onmouseout=l;else C.onmouseover=m;r.appendChild(C);n.push(function(){C.parentNode.removeChild(C)})}if(c==true){var D=document.createElement("div");D.id="popBoxDivText"+z;D.style.width=y+"px";D.style.height="20px";D.style.borderStyle="none";D.style.padding="0px";D.style.margin="0px";D.style.position="absolute";D.style.left=p+"px";D.style.top=q+"px";D.style.cursor=j;D.style.textAlign="center";D.style.fontFamily="Arial, Verdana, Sans-Serif";D.style.fontSize="10pt";D.style.backgroundColor="Transparent";D.style.color="#ffffff";D.style.zIndex=z;D.innerHTML=e;D.onclick=k;if(h==true)D.onmouseout=l;else D.onmouseover=m;r.appendChild(D);n.push(function(){D.parentNode.removeChild(D)})}if(d==true){var E=null;try{E=document.createElement("<img src='"+f+"' />")}catch(ex){E=document.createElement("img");E.src=f}E.id="popBoxImgPopped"+z;E.style.width="20px";E.style.height="20px";E.style.borderStyle="none";E.style.padding="0px";E.style.margin="0px";E.style.position="absolute";E.style.left=(p+y-20)+"px";E.style.top=q+"px";E.style.cursor=j;E.style.zIndex=z;E.onclick=k;if(h==true)E.onmouseout=l;else E.onmouseover=m;r.appendChild(E);n.push(function(){E.parentNode.removeChild(E)})}if(i!=null&&i!=""){q+=(A-20);if(g==true)q+=20;if(popBoxCaptionBelow==true)q+=20;var F=document.createElement("div");F.id="popBoxDivCapTrans"+z;F.style.width=y-2+"px";F.style.height="20px";F.style.borderStyle="solid";F.style.borderWidth="1px";F.style.borderColor="#999999";F.style.padding="0px";F.style.margin="0px";F.style.position="absolute";F.style.left=p+"px";F.style.top=q-1+"px";F.style.backgroundColor="#ffffdd";F.style.zIndex=z;if(popBoxCaptionBelow==false){if(typeof F.style.filter!='undefined')F.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=70)";if(typeof F.style.opacity!='undefined')F.style.opacity="0.7"}r.appendChild(F);n.push(function(){F.parentNode.removeChild(F)});var G=document.createElement("div");G.id="popBoxDivCapText"+z;G.style.width=y-20+"px";G.style.height="20px";G.style.borderStyle="none";G.style.padding="0px";G.style.margin="0px";G.style.position="absolute";G.style.left=p+10+"px";G.style.top=q+"px";G.style.textAlign="center";G.style.fontFamily="Arial, Verdana, Sans-Serif";G.style.fontSize="10pt";G.style.overflowY="hidden";G.style.backgroundColor="Transparent";G.style.color="#000000";G.style.zIndex=z;r.appendChild(G);n.push(function(){G.parentNode.removeChild(G)});AddCaptionText(F,G,i);if(popBoxExpandCaptions==true&&G.hasChildNodes()==true){var H=G.lastChild;if(H&&H.onclick){H.id=CreateRandomId();setTimeout(new Function("","var spanMore = GetRawObject('"+H.id+"'); if (spanMore != null && spanMore.onclick) { spanMore.onclick(); }"),10)}}}if(n.length!=0){if(s!=null)n.push(function(){s.parentNode.removeChild(s)});if(h==true){if(popBox[a.id].fnPre!=null&&typeof(popBox[a.id].fnPre)=='function')n.push(popBox[a.id].fnPre);popBox[a.id].fnPre=function(){for(var x=0;x<n.length;x++){n[x]()}}}else{pbPopBarFunc[a.id]=function(){for(var x=0;x<n.length;x++){n[x]()}}}}}function AddCaptionText(a,b,c){var d=parseInt(b.style.width,10);var e=document.createElement("div");e.style.position="absolute";e.style.width=d+"px";e.style.margin="0px";e.style.fontFamily=b.style.fontFamily;e.style.fontSize=b.style.fontSize;e.style.visibility="hidden";e.innerHTML=c;document.body.appendChild(e);var f=GetObjectSize(e);if(f.h>20){e.innerHTML=c+"..."+popBoxCaptionLessText;f=GetObjectSize(e);var g=c;var h=parseInt(d*0.14,10)-5;b.innerHTML=c.substr(0,h)+"...";var i=document.createElement("span");i.style.color="#0000ff";i.style.textDecoration="underline";i.style.cursor="pointer";i.onclick=function(){i.parentNode.removeChild(i);ResizeCaption(a.id,b.id,f.h,g)};i.innerHTML=popBoxCaptionMoreText;b.appendChild(i)}else b.innerHTML=c;document.body.removeChild(e)}function ResizeCaption(a,b,c,d){if(typeof a=="string")a=GetRawObject(a);if(typeof b=="string")b=GetRawObject(b);var h=parseInt(b.style.height,10);var e=parseInt(b.style.top,10);if(h<c){if(h==20){c+=10;b.style.paddingTop="5px";b.innerHTML=d+"...";var f=document.createElement("span");f.style.color="#0000ff";f.style.textDecoration="underline";f.style.cursor="pointer";f.onclick=function(){f.parentNode.removeChild(f);b.innerHTML=d;ResizeCaption(a.id,b.id,20,d)};f.innerHTML=popBoxCaptionLessText;b.appendChild(f);if(popBoxCaptionBelow==false){if(typeof a.style.filter!='undefined')a.style.filter="";if(typeof a.style.opacity!='undefined')a.style.opacity="1.0"}}if((h+10)>=c){if(popBoxExpandCaptionsBelow==false)e-=(c-h);h=c}else{if(popBoxExpandCaptionsBelow==false)e-=10;h+=10}a.style.height=h+"px";b.style.height=h+"px";a.style.top=(e-1)+"px";b.style.top=e+"px";if(h!=c)setTimeout("ResizeCaption(\""+a.id+"\",\""+b.id+"\","+c+",\""+d+"\")",10)}else{if((h-10)<=c){if(popBoxExpandCaptionsBelow==false)e+=(h-c);h=c}else{if(popBoxExpandCaptionsBelow==false)e+=10;h-=10}a.style.height=h+"px";b.style.height=h+"px";a.style.top=(e-1)+"px";b.style.top=e+"px";b.style.paddingTop="0px";if(h==c){if(popBoxCaptionBelow==false){if(typeof a.style.filter!='undefined')a.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=70)";if(typeof a.style.opacity!='undefined')a.style.opacity="0.7"}AddCaptionText(a,b,d)}else{setTimeout("ResizeCaption(\""+a.id+"\",\""+b.id+"\","+c+",\""+d+"\")",10)}}}function CreateWaitImage(a){if(typeof a=="string")a=GetRawObject(a);var b="popBoxImgWait"+a.id;var c=GetRawObject(b);if(c!=null)return c;var d=0;var e=0;if(a.style.position=="absolute"||a.style.position=="relative"){d=parseInt(a.style.left,10);e=parseInt(a.style.top,10)}else{var f=GetElementPosition(a);d=f.x;e=f.y;var g=GetObjectPadding(a);d-=g.l;e-=g.t}var h=parseInt(a.style.width,10);var i=parseInt(a.style.height,10);var j=GetObjectSize(a);if(isNaN(h)==true)h=j.w;else if(j.w>h)d+=((j.w-h)/2);if(isNaN(i)==true)i=j.h;else if(j.h>i)e+=((j.h-i)/2);var k=a.parentNode;try{c=document.createElement("<img src='"+popBoxWaitImage.src+"' />")}catch(ex){c=document.createElement("img");c.src=popBoxWaitImage.src}c.id=b;c.style.position="absolute";c.style.left=(d+(h/2)-(popBoxWaitImage.width/2))+"px";c.style.top=(e+(i/2)-(popBoxWaitImage.height/2))+"px";c.style.cursor=a.style.cursor;c.style.zIndex=a.style.zIndex+1;k.appendChild(c);return c}function CalculateImageDimensions(a,b,c,d,e){if(a==null){if(b==null){a=c;b=d}else if(b==0){b=Math.min(e.y,d);var f=parseFloat(b)/parseFloat(d);a=parseInt(c*f)}else{var f=parseFloat(b)/parseFloat(d);a=parseInt(c*f)}}else if(a==0){if(b==null){a=Math.min(e.x,c);var f=parseFloat(a)/parseFloat(c);b=parseInt(d*f)}else if(b==0){if(e.x<c||e.y<d){var f=Math.min(parseFloat(e.x)/parseFloat(c),parseFloat(e.y)/parseFloat(d));a=parseInt(c*f);b=parseInt(d*f)}else{a=c;b=d}}else{var f=parseFloat(b)/parseFloat(d);a=Math.min(e.x,parseInt(c*f))}}else{if(b==null){var f=parseFloat(a)/parseFloat(c);b=parseInt(d*f)}else if(b==0){var f=parseFloat(a)/parseFloat(c);b=Math.min(e.y,parseInt(d*f))}}return{x:a,y:b}}function GetObjectToPop(a){if(typeof a=="string")a=GetRawObject(a);if(a.id=="")a.id=CreateRandomId();var b=a.getAttribute('pbSrcNL');if(b==null&&pbSrc[a.id]==null)b=a.getAttribute('pbSrc');if(b!=null&&pbSrc[a.id]==null){var c=new Image();c.src=b;if(pbSrc[a.id]!=null)delete pbSrc[a.id];pbSrc[a.id]=c}return(pbSrc[a.id]!=null)?pbSrc[a.id]:a}function GetPoppedImageSize(a){var b={x:0,y:0};if(a!=null&&typeof a.id!='undefined'){if(pbSrc[a.id]!=null){b.x=pbSrc[a.id].width;b.y=pbSrc[a.id].height}else if(a.naturalWidth&&a.naturalHeight){b.x=a.naturalWidth;b.y=a.naturalHeight}else{var c=new Image();c.src=a.src;b.x=c.width;b.y=c.height;delete c}}return b}var popBoxAutoClose=true;var popBoxMouseMoveRevert=true;var popBoxWaitImage=new Image();var popBoxShowRevertBar=true;var popBoxShowRevertText=true;var popBoxShowRevertImage=false;var popBoxRevertText="Click on the image to restore it";var popBoxRevertImage=false;var popBoxRevertBarAbove=false;var popBoxShowPopText=true;var popBoxShowPopImage=false;var popBoxPopText="Click to show the full image";var popBoxPopImage="magplus.gif";var popBoxPopBarAbove=false;var popBoxShowCaption=true;var popBoxCaptionBelow=false;var popBoxCaptionMoreText="mer";var popBoxCaptionLessText="mindre";var popBoxExpandCaptions=false;var popBoxExpandCaptionsBelow=false;function PopBox(a,b,c,d,e,f,g,h,i,j,k,l,m){if(typeof a=="string")a=GetRawObject(a);if(a==null||typeof a!="object"||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(e)||isNaN(f)||isNaN(g)||isNaN(h)||isNaN(i)||isNaN(j)||isNaN(k))return;var n=InitPopBox(a);if(popBox[n.id].isAnimating==true){var o="PopBox('"+n.id+"',"+b+","+c+","+d+","+e+","+f+","+g+","+h+","+i+","+j+","+k+",'"+l+"');";setTimeout(o,10)}else{popBox[n.id].isAnimating=true;popBox[n.id].xCurr=parseFloat(b);popBox[n.id].yCurr=parseFloat(c);popBox[n.id].wCurr=parseFloat(f);popBox[n.id].hCurr=parseFloat(g);popBox[n.id].xTarg=parseFloat(d);popBox[n.id].yTarg=parseFloat(e);popBox[n.id].wTarg=parseFloat(h);popBox[n.id].hTarg=parseFloat(i);popBox[n.id].xDelta=Math.abs(parseFloat(d)-parseFloat(b));popBox[n.id].yDelta=Math.abs(parseFloat(e)-parseFloat(c));popBox[n.id].wDelta=Math.abs(parseFloat(h)-parseFloat(f));popBox[n.id].hDelta=Math.abs(parseFloat(i)-parseFloat(g));popBox[n.id].velM=(j)?Math.abs(parseFloat(j)):1.0;popBox[n.id].velS=(k)?Math.abs(parseFloat(k)):1.0;popBox[n.id].xTravel=0.0;popBox[n.id].yTravel=0.0;popBox[n.id].wTravel=0.0;popBox[n.id].hTravel=0.0;n.style.position="absolute";n.style.left=b+"px";n.style.top=c+"px";n.style.width=f+"px";n.style.height=g+"px";n.style.display="inline";var p=Math.sqrt((Math.pow((b-d),2))+(Math.pow((c-e),2)));var q=Math.sqrt((Math.pow((f-h),2))+(Math.pow((g-i),2)));if(popBox[n.id].velM==popBox[n.id].velS)p=q=Math.sqrt(Math.pow(p,2)+Math.pow(q,2));popBox[n.id].xStep=((popBox[n.id].xTarg-popBox[n.id].xCurr)/p)*popBox[n.id].velM;popBox[n.id].yStep=((popBox[n.id].yTarg-popBox[n.id].yCurr)/p)*popBox[n.id].velM;popBox[n.id].wStep=((popBox[n.id].wTarg-popBox[n.id].wCurr)/q)*popBox[n.id].velS;popBox[n.id].hStep=((popBox[n.id].hTarg-popBox[n.id].hCurr)/q)*popBox[n.id].velS;popBox[n.id].fnDone=m;if(l!=null)n.className=l;popBox[n.id].cursor=n.style.cursor;n.style.cursor="default";if(popBox[n.id].isPopped==false)n.style.zIndex=++popBoxZ;var r=n.id;if(popBox[n.id].originalId!=null)r=popBox[n.id].originalId;if(pbPopBarFunc[r]!=null){pbPopBarFunc[r]();pbPopBarFunc[r]=null}if(popBox[n.id].fnPre!=null&&typeof popBox[n.id].fnPre=='function')popBox[n.id].fnPre();popBox[n.id].interval=setInterval("DoPopBox('"+n.id+"')",10)}}function Pop(a,b,c){PopEx(a,null,null,0,0,b,c)}function PopEx(a,b,c,d,e,f,g){if(typeof a=="string")a=GetRawObject(a);var h=GetObjectToPop(a);var i=(typeof h.readyState!='undefined')?(h.readyState=="complete"):((typeof h.complete!='undefined')?(h.complete==true):true);if(i==false){var j=null;var k="var imgWait = GetRawObject('"+j.id+"'); if (imgWait != null) { imgWait.parentNode.removeChild(imgWait); } PopEx('"+a.id+"',";if(b==null)k+=b+",";else k+="'"+b+"',";if(c==null)k+=c+",";else k+="'"+c+"',";k+=d+","+e+","+f+",'"+g+"');";h.onload=new Function("",k);return}var l=InitPopBox(a);if(popBox[l.id].isPopped==true)return;if(typeof l.ondblclick=="function")l.onclick=l.ondblclick;var m=parseInt(l.style.left);var n=parseInt(l.style.top);var o=GetInsideWindowSize();var p=HasRevertBar(a);var q=HasCaption(a);if(p==true&&popBoxRevertBarAbove==true)o.y-=20;if(q==true&&popBoxCaptionBelow==true)o.y-=20;var r={x:d,y:e};if(d==0||e==0||d==null||e==null){r=GetPoppedImageSize(l);if(r.x==0||r.y==0){var s=Math.min(parseFloat(o.x)/parseFloat(l.width),parseFloat(o.y)/parseFloat(l.height));r.x=parseInt(l.width*s);r.y=parseInt(l.height*s)}}if(b!=null){if(typeof b=="string"&&b.indexOf("A")==(b.length-1))b=parseInt(b,10);else b=popBox[l.id].xOriginal+parseInt(b,10);o.x-=b}if(c!=null){if(typeof c=="string"&&c.indexOf("A")==(c.length-1))c=parseInt(c,10);else c=popBox[l.id].yOriginal+parseInt(c,10);o.y-=c}if(d==null&&e==0&&r.x>(o.x-20))o.y-=20;else if(d==0&&e==null&&r.y>(o.y-4))o.x-=4;var t=CalculateImageDimensions(d,e,r.x,r.y,o);if(b==null||c==null){var u=GetScrollOffset();if(b==null){b=((o.x/2)+u.x)-(t.x/2);if(b<0)b=0}if(c==null){c=((o.y/2)+u.y)-(t.y/2);if(p==true&&popBoxRevertBarAbove==true)c+=10;if(q==true&&popBoxCaptionBelow==true)c-=10;if(c<0)c=0}}var v=null;if(typeof PostPopProcessing=="function")v=PostPopProcessing;if(typeof PrePopProcessing=="function")PrePopProcessing(a);PopBox(l,m,n,b,c,popBox[l.id].wOriginal,popBox[l.id].hOriginal,t.x,t.y,f,f,g,v)}function PopInPlace(a,b,c){if(typeof a=="string")a=GetRawObject(a);var d=GetObjectToPop(a);var e=(typeof d.readyState!='undefined')?(d.readyState=="complete"):((typeof d.complete!='undefined')?(d.complete==true):true);if(e==false){var f=null;var g="var imgWait = GetRawObject('"+f.id+"'); if (imgWait != null) { imgWait.parentNode.removeChild(imgWait); } PopInPlace('"+a.id+"',"+b+",'"+c+"');";d.onload=new Function("",g);return}var h=InitPopBox(a);if(popBox[h.id].isPopped==true)return;if(typeof h.ondblclick=="function")h.onclick=h.ondblclick;var i=parseInt(h.style.left);var j=parseInt(h.style.top);var k=GetInsideWindowSize();var l=HasRevertBar(a);var m=HasCaption(a);if(l==true&&popBoxRevertBarAbove==true)k.y-=20;if(m==true&&popBoxCaptionBelow==true)k.y-=20;var n=GetPoppedImageSize(h);if(n.x==0||n.y==0){var o=Math.min(parseFloat(k.x)/parseFloat(h.width),parseFloat(k.y)/parseFloat(h.height));n.x=parseInt(h.width*o);n.y=parseInt(h.height*o)}var p=CalculateImageDimensions(0,0,n.x,n.y,k);var q=i-parseInt(((p.x-popBox[h.id].wOriginal)/2),10);var r=j-parseInt(((p.y-popBox[h.id].hOriginal)/2),10);var s=GetScrollOffset();if(s.x>q){q=s.x}else{var t=((q+p.x)-(k.x+s.x));if(t>0)q-=t}if(s.y>r){r=s.y}else{var u=((r+p.y)-(k.y+s.y));if(u>0)r-=u}if(l==true&&popBoxRevertBarAbove==true)r+=10;if(m==true&&popBoxCaptionBelow==true)r-=10;if(r<0)r=0;var v=null;if(typeof PostPopProcessing=="function")v=PostPopProcessing;if(typeof PrePopProcessing=="function")PrePopProcessing(a);PopBox(h,i,j,q,r,popBox[h.id].wOriginal,popBox[h.id].hOriginal,p.x,p.y,b,b,c,v)}function Revert(a,b,c){if(typeof a=="string")a=GetRawObject(a);if(a==null||typeof popBox[a.id]=="undefined"||popBox[a.id]==null)return;if(typeof b=='undefined'||b==null||b==0)b=Math.max(popBox[a.id].velM,popBox[a.id].velS);if(typeof c=='undefined')c=popBox[a.id].originalClassName;var d=null;if(typeof PostRevertProcessing=="function")d=PostRevertProcessing;if(typeof PreRevertProcessing=="function")PreRevertProcessing(a);PopBox(a,popBox[a.id].xTarg,popBox[a.id].yTarg,popBox[a.id].xOriginal,popBox[a.id].yOriginal,popBox[a.id].wTarg,popBox[a.id].hTarg,popBox[a.id].wOriginal,popBox[a.id].hOriginal,b,b,c,d)}function RevertAll(a,b){for(var i=0;i<popBoxIds.length;i++)Revert(popBoxIds[i],a,b)}
