diff --git a/frontbox/fbox.css b/frontbox/fbox.css deleted file mode 100644 index c8819d5..0000000 --- a/frontbox/fbox.css +++ /dev/null @@ -1,118 +0,0 @@ -/* images are blocky under internet explorer when downsized -I must apply a global rule, otherwise behavior is random -*/ -img{ - -ms-interpolation-mode:bicubic; -} - -span.frontbox { - display:none; -} - -/* by default for all elements defined by the script :*/ -#fbox_bg, #fbox_progress, #fbox_fg, #fbox_content, #fbox_spacer, #fbox_bar, #fbox_title, #fbox_sys, #fbox_content_img, #fbox_content_iframe { - margin:0px; - padding:0px; - border-width:0px; -} - -/* for strict mode */ -#fbox_content_img, #fbox_content_iframe { - display:block; -} - -/* now working with absolute positionned elements */ - -#fbox_bg, #fbox_progress, #fbox_fg { - position: absolute; - top: 0px; - left: 0px; -} - -#fbox_bg{ - z-index:998; - background-color: #000000; -} - -#fbox_progress { - z-index:999; -} - -#fbox_fg { - z-index:1000; - background-color:#999999; - padding:5px; - border:solid #000000 1px; -} - -/* non positionned elements */ - -#fbox_fg_inner { - background-color:#FFFFFF; - -} - -#fbox_content { - padding:3px; -} - -#fbox_spacer { -height:3px; -overflow:hidden; -background-image:url(spacer.gif); -font-size:8px; /* ie5 bug */ -} - -#fbox_bar td{ - padding:3px 8px; /*v,h*/ - color:black; - font-size: 12px; - font-weight:normal; - line-height: 1.45; - font-family:Arial, Helvetica, sans-serif; -} - -#fbox_sys, #fbox_navig { -white-space:nowrap; -} - -#fbox_sys { - float:right; -} - -#fbox_title { - float:left; - background-color:whitesmoke; - text-align:justify; -} - -a#fbox_resize_a:link, a#fbox_resize_a:hover, a#fbox_resize_a:visited { - text-decoration: none; - color:#999999; - font-weight: bold; -} - -a#fbox_close_a:link, a#fbox_close_a:hover, a#fbox_close_a:visited { - text-decoration: none; - color:#999999; - font-weight: bold; -} - -#fbox_navig { - margin-top:3px; - clear:left; - float:left; -} - -a#fbox_prev_a:link, a#fbox_prev_a:hover, a#fbox_prev_a:visited { - text-decoration: none; - color:#999999; - font-weight: bold; -} - -a#fbox_next_a:link, a#fbox_next_a:hover, a#fbox_next_a:visited { - text-decoration: none; - color:#999999; - font-weight: bold; -} - diff --git a/frontbox/fbox_conf.js b/frontbox/fbox_conf.js deleted file mode 100644 index 9a3796a..0000000 --- a/frontbox/fbox_conf.js +++ /dev/null @@ -1,12 +0,0 @@ -function fbox_conf(){}; -fbox_conf.prototype = { - disable_fadin:false, -//--------------------------------- - progress_src : 'indicator.gif', - nbsp_count: 4, //IE5 ... - close_txt : 'Lukk vindu uten å lagre', - max_txt: 'Maksimer', - min_txt: 'Minimer', - prev_txt: '« Forrige', - next_txt: 'Neste »' -} \ No newline at end of file diff --git a/frontbox/fbox_engine-min.js b/frontbox/fbox_engine-min.js deleted file mode 100644 index 2c7d7af..0000000 --- a/frontbox/fbox_engine-min.js +++ /dev/null @@ -1 +0,0 @@ -function fbox_engine(){if(typeof(fbox_conf)!="function"){return;}var j,an;var ag,d,al;var n,A;var Z;var u=0;var o;var K,H;var R,V,am;var x,Q,aa;var G,O;var S,I,v;var T,l,ae;var aq;var ab;var ac=0,aj=0,f=0,ao=0;var t=false;var M=false;var p;var P=null;var ak="";var B,g;var N=false;var D=[];function Y(){return false;}function r(at){return;}function b(at){if(!at){return"";}at=at.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");return(at);}function w(at){return document.getElementById(at);}function m(at){return document.createElement(at);}function k(av,au,at){if(av.addEventListener){av.addEventListener(au,at,false);return true;}if(av.attachEvent){av.detachEvent("on"+au,at);return av.attachEvent("on"+au,at);}return false;}function c(av,au,at){if(av.removeEventListener){av.removeEventListener(au,at,false);return true;}if(av.detachEvent){return av.detachEvent("on"+au,at);}return false;}function ar(ay){var aw=false;function at(){if(!aw){aw=true;ay();}}if(window.ActiveXObject){var au;var av=null;var ax;au=document.createElement("div");ax=function(){var az;az=false;try{au.doScroll("left");}catch(aA){az=true;}if(!az||aw){if(av){window.clearInterval(av);av=null;}au=null;at();}};av=window.setInterval(ax,30);}else{if(document.addEventListener){document.addEventListener("DOMContentLoaded",at,false);}}k(window,"load",at);}function F(){var at=document.documentElement;this.left=window.pageXOffset||(at&&at.scrollLeft)||K.scrollLeft;this.top=window.pageYOffset||(at&&at.scrollTop)||K.scrollTop;}function C(){var az=document.documentElement;var au,aB,ax;var ay,at,aC;var aA=0,aw=0;var av;au=az?az.clientHeight:0;aB=K.clientHeight?K.clientHeight:0;ax=window.innerHeight?window.innerHeight:0;ay=az?az.clientWidth:0;at=K.clientWidth?K.clientWidth:0;aC=window.innerWidth?window.innerWidth:0;if(au&&aB&&ax){if(au==aB){aA=aC;aw=ax;}else{if(aB=100){aw.style.opacity="";aw.style.filter="";aw.style.display="";}else{if(aD<=0){aw.style.display="none";aw.style.opacity=0;aw.style.filter="alpha(opacity=0)";}else{aw.style.opacity=aD*0.01;aw.style.filter="alpha(opacity="+aD+")";aw.style.display="";}}}function ay(aE){var aD=ax?true:false;if(aD){window.clearInterval(ax);ax=null;}at=0;aE=aE-0;if(!isNaN(aE)){aA=aE;av(aE);}return aD;}function aB(){if(at===0){ay();}else{if((at>0&&aA>=az)||(at<0&&aA<=az)){ay();aA=az;}}av(aA);}function aC(){if((at>0&&aAaz)){av(aA);aA+=at;return true;}aB();return false;}function au(aG,aD,aF,aE){if(Z){ay(aD);return;}if(!ay()){aA=aG;}az=aD;at=aF;if(aC()){ax=window.setInterval(aC,aE);}}this.halt=ay;this.animate=au;this.redisplay=aB;}function h(av){if(!av){Q.innerHTML="";Q.style.overflow="hidden";return;}var au=null;if(P.type===0){var at=m("a");at.href="#";au=P.objImg;au.id="fbox_content_img";au.style.border="0px";at.appendChild(au);Q.appendChild(at);}else{if(P.type==3){av='';}else{if(typeof(av)!="string"){av="";}}Q.innerHTML=av;if(P.type==3){au=w("fbox_content_iframe");}}Q.style.overflow="auto";if(au){au.style.width=P.width+"px";au.style.height=P.height+"px";}}function af(at){var aw,av,au,ax;for(av=0;av>1;var au=(at.height-V.offsetHeight)>>1;if(N){V.style.position="fixed";}else{var aw=new F();V.style.position="absolute";av=aw.left+av;au=aw.top+au;}V.style.left=av+"px";V.style.top=au+"px";}function y(){var aw=false;var ax=new F();var at=new C();x.style.display="";var av=(at.width-x.offsetWidth)>>1;var au=(at.height-x.offsetHeight)>>1;g.redisplay();if(N){if(av<=0||au<=0){aw=false;x.style.position="absolute";}else{aw=true;x.style.position="fixed";}}if(av<=0){if(!t){t=true;av=ax.left+av;if(av<0){av=0;}x.style.left=av+"px";}}else{t=false;if(!aw){av=ax.left+av;}x.style.left=av+"px";}if(au<=0){if(!M){M=true;au=ax.top+au;if(au<0){au=0;}x.style.top=au+"px";}}else{M=false;if(!aw){au=ax.top+au;}x.style.top=au+"px";}}function z(at){var aA=P.width;var au=P.height;var ax=b(P.title)?true:false;var ay=P.next||P.prev?true:false;var aC=false;if(!at){aC=ax||ay;}else{if(at==1){aC=true;}}if(aC&&aA<200){aA=200;}if(aC){aa.style.visibility="visible";aa.style.display="";G.style.visibility="visible";G.style.display="";if(ax){O.style.styleFloat=O.style.cssFloat="left";O.style.visibility="visible";O.style.height="auto";O.style.overflow="visible";T.style.marginTop=3+"px";}else{O.style.styleFloat=O.style.cssFloat="right";O.style.visibility="hidden";O.style.height=1+"px";O.style.overflow="hidden";T.style.marginTop=0+"px";}}else{aa.style.visibility="hidden";aa.style.display="none";G.style.visibility="hidden";G.style.display="none";}if(ay){if(P.prev){l.style.visibility="visible";}else{l.style.visibility="hidden";}if(P.next){ae.style.visibility="visible";}else{ae.style.visibility="hidden";}T.style.visibility="visible";T.style.display="";}else{T.style.visibility="hidden";T.style.display="none";}if(p){x.style.width=(aA+18)+"px";Q.style.width=(aA+6)+"px";Q.style.height=(au+6)+"px";}else{x.style.width=(aA+6)+"px";Q.style.width=aA+"px";Q.style.height=au+"px";}if(aC){aa.style.width=(aA+6)+"px";G.style.width=(aA+6)+"px";O.style.width="auto";x.style.height="auto";G.style.height="auto";x.style.display="";var az=S.offsetWidth;var av=O.offsetWidth;x.style.display="none";az=aA-az-25;var aB=az<=190?aA-10:az>av?av:az;O.style.width=aB+"px";x.style.display="";var aw=x.offsetHeight;x.style.display="none";aw=aw-12;x.style.height=aw+"px";G.style.height=aw-au-15+"px";}else{if(p){x.style.height=(au+18)+"px";}else{x.style.height=(au+6)+"px";}}y();}function E(){var aw=P.objImg;var ax=0;switch(P.imgType){case 0:var au=new C();var at=Math.max(au.width-125,200);var ay=Math.max(au.height-125,200);var av=Math.max(1,Math.max(P.exactImgWidth/at,P.exactImgHeight/ay));if(av>1){v.style.visibility="visible";v.style.display="";ab.style.visibility="visible";ab.style.display="";ax=1;}else{v.style.visibility="hidden";v.style.display="none";ab.style.visibility="hidden";ab.style.display="none";}if(P.imgState===0){v.innerHTML=d;P.width=aw.width=Math.round(P.exactImgWidth/av);P.height=aw.height=Math.round(P.exactImgHeight/av);}else{v.innerHTML=al;P.width=aw.width=P.exactImgWidth;P.height=aw.height=P.exactImgHeight;}break;case 1:P.height=aw.height=Math.round(P.exactImgHeight*P.width/P.exactImgWidth);aw.width=P.width;break;case 2:P.width=aw.width=Math.round(P.exactImgWidth*P.height/P.exactImgHeight);aw.height=P.height;break;case 3:aw.width=P.width;aw.height=P.height;}z(ax);}function a(){function av(){if((u&1)==1){c(window,"scroll",a);return;}if((u&8)==8){y();}if((u&2)==2){X();}if((u&4)==4){J();}var ax=new Date();var aw=ax.getTime();aj=aw;k(window,"scroll",a);var ay=new F();f=ay.left;ao=ay.top;}c(window,"scroll",a);var au=new Date();var at=au.getTime()-aj;if(at>=200){av();}else{window.setTimeout(av,200-at);}}function ap(){var av=new F();if(Math.abs(av.left-f)>50||Math.abs(av.top-ao>50)){if((u&8)==8){y();}if((u&2)==2){X();}if((u&4)==4){J();}f=av.left;ao=av.top;var au=new Date();var at=au.getTime();aj=at;}}function ah(){function av(){if((u&1)==1){c(window,"resize",ah);return;}R.style.display="none";x.style.display="none";if((u&8)==8){if(P.imgType===0){h(false);E();h(true);}else{y();}}if((u&2)==2){X();}if((u&4)==4){J();}var ax=new Date();var aw=ax.getTime();aj=ac=aw;k(window,"resize",ah);var ay=new F();f=ay.left;ao=ay.top;}c(window,"resize",ah);var au=new Date();var at=au.getTime()-ac;if(at>=200){av();}else{window.setTimeout(av,200-at);}}function W(){u=u&(~4);V.style.display="none";V.onclick=null;}function s(){u=u|1;g.halt(0);if(o){o.onreadystatechange=Y;}if(P.objImg){P.objImg.onload=null;if(!P.imgReadyTest){P.objImg.src=null;P.objImg=null;}}if((u&4)==4){W();}u=u&(~8);if((u&2)==2){U();}x.style.display="none";h(false);c(window,"resize",ah);c(window,"scroll",a);c(window,"scroll",ap);if(typeof(K.style.cssText)!="undefined"){K.style.cssText=ak;}else{K.setAttribute("style",ak);}return false;}function i(){V.style.display="";J();V.onclick=s;u=u|4;}function q(){if(((u&8)==8)&&(P.imgType===0)){P.imgState=P.imgState?0:1;h(false);E();h(true);if((u&2)==2){X();}}return false;}function ai(au){function aw(){ai(P.next);return false;}function av(){ai(P.prev);return false;}if(!au||(typeof(au)!="object")){return;}if(P&&(typeof(P)=="object")&&P.objImg&&(typeof(P.objImg)=="object")){P.objImg.id=null;}P=au;var at=P.src;K.style.width="auto";K.style.height="auto";t=M=false;f=0;ao=0;v.style.visibility="hidden";v.style.display="none";ab.style.visibility="hidden";ab.style.display="none";h(false);var ax=b(P.title);if(!ax||ax=="."){ax=" ";}O.innerHTML=ax;ax=null;g.halt(0);u=u&2;if((u&2)===0){e();}ah();a();if(!N){k(window,"scroll",ap);}if(P.type===0||P.type==2){i();}if(P.type===0){Q.onclick=s;v.onclick=q;}else{Q.onclick=null;v.onclick=Y;}l.onclick=P.prev?av:Y;ae.onclick=P.next?aw:Y;switch(P.type){case 0:var ay=function(){var aC=P.imgReadyTest;P.imgReadyTest=true;if((u&1)!=1){W();if(!aC){P.exactImgWidth=P.objImg.width;P.exactImgHeight=P.objImg.height;}E();h(true);if(aC){g.animate(0,100,25,20);}else{g.animate(0,100,10,35);}u=u|8;}};if(P.imgReadyTest){ay();}else{var aB=new Image();P.objImg=aB;aB.onload=function(){this.onload=null;this.onerror=null;ay();};aB.onerror=function(){this.onerror=null;s();};aB.src=at;}break;case 1:z(1);var az=P.tagContent.innerHTML;h(az);g.animate(0,100,10,30);u=u|8;break;case 2:try{o.open("GET",at,true);}catch(aA){P.tagLink.onclick=Y;s();break;}o.onreadystatechange=function(){if((u&1)==1){o.onreadystatechange=Y;o.abort();}else{if(o.readyState==4){o.onreadystatechange=Y;if(o.status==200||!o.status){W();z(1);var aC=o.responseText;h(aC);g.animate(0,100,10,30);u=u|8;}else{P.tagLink.onclick=Y;s();}}}};o.send(null);break;case 3:z(1);h(true);g.animate(0,100,10,30);u=u|8;}}function L(){if(w("fbox_world")){return;}o=null;try{if(window.XMLHttpRequest){o=new XMLHttpRequest();}else{if(window.ActiveXObject){o=new ActiveXObject("Microsoft.XMLHTTP");}}}catch(ay){}var aw=new fbox_conf();Z=aw.disable_fadin;j=aw.progress_src;ag=aw.close_txt;n=aw.prev_txt;A=aw.next_txt;d=aw.max_txt;al=aw.min_txt;an="";for(var au=0;au'+an+''+ag+'
 
";H=document.createElement("div");H.setAttribute("id","fbox_world");H.innerHTML=ax;K=document.getElementsByTagName("body")[0];K.appendChild(H);ak=typeof(K.style.cssText)!="undefined"?K.style.cssText:K.getAttribute("style");R=w("fbox_bg");V=w("fbox_progress");x=w("fbox_fg");Q=w("fbox_content");aa=w("fbox_spacer");G=w("fbox_bar");O=w("fbox_title");S=w("fbox_sys");I=w("fbox_close_a");v=w("fbox_resize_a");T=w("fbox_navig");l=w("fbox_prev_a");ae=w("fbox_next_a");aq=w("fbox_fg_inner");ab=w("fbox_resize_nbsp");I.onclick=s;g=new ad(x);B=new ad(R);Q.style.visibility="hidden";x.style.width=100+"px";Q.style.width="auto";x.style.left=-200+"px";x.style.top=-200+"px";x.style.display="";p=Q.offsetWidth<100;x.style.display="none";Q.style.visibility="visible";x.style.left=0+"px";x.style.top=0+"px";N=!p;if(window.ActiveXObject&&!window.XMLHttpRequest){N=false;}am=new Image();var at=false;am.onload=function(){this.onload=null;this.onerror=null;this.style.width=this.width+"px";this.style.height=this.height+"px";this.style.border="0px";if(!at){at=true;V.appendChild(this);}};am.onerror=function(){this.onerror=null;if(!at){at=true;V.appendChild(this);}};am.src=j;D=["select","object","embed"];var av=[];function aA(aQ){var aN=this;this.tagLink=aQ.parentNode;this.title=aQ.getAttribute("title");var aC=b(aQ.getAttribute("src"));if(!aC){aC=b(this.tagLink.getAttribute("href"));}this.src=aC;this.type=3;var aO=b(aQ.getAttribute("type")).toLowerCase();switch(aO){case"image":this.type=0;break;case"inline":this.type=1;break;case"ajax":this.type=2;break;case"iframe":this.type=3;break;default:if(aC.indexOf("#")>=0){this.type=1;break;}var aF=aC.lastIndexOf(".");if(aF<1){break;}var aG=aC.substr(aF+1,aC.length).toLowerCase();if(aG=="jpg"||aG=="jpeg"||aG=="png"||aG=="gif"){this.type=0;}}this.tagContent=null;if(this.type==1){var aI=aC.substr(aC.indexOf("#")+1,1000);this.tagContent=w(aI);if(this.tagContent){var aL,aK,aE;for(aK=0;aK0){this.imgType+=1;}else{this.width=200;}if(this.height&&this.height>0){this.imgType+=2;}else{this.height=150;}this.imgState=this.imgType?1:0;if(!b(this.title)){var aM=this.tagLink.getElementsByTagName("img");if(aM[0]){var aJ=aM[0].getAttribute("title");if(b(aJ)){this.title=aJ;}}}}else{if(!this.width){this.width=400;}if(!this.height){this.height=300;}}this.next=null;this.prev=null;var aD=b(aQ.getAttribute("name")).toLowerCase();if(aD&&this.type!=-1){if(av[aD]){var aH=av[aD].length;this.prev=av[aD][aH-1];this.prev.next=this;av[aD][aH]=this;}else{av[aD]=[];av[aD][0]=this;}}function aP(){ai(aN);return false;}this.tagLink.onclick=this.type==-1?Y:aP;}var az=document.getElementsByTagName("span");for(au=0;au=100) { - elem.style.opacity =''; - elem.style.filter=''; //remove style, avoid bugs in explorer and selects - elem.style.display=''; - } else if (blend<=0) { - elem.style.display='none'; //avoid some flicker - elem.style.opacity = 0; //problem is that we display elements that are supposed to be hidden, in order to calculate size - elem.style.filter= 'alpha(opacity=0)'; - } else { - elem.style.opacity = blend*0.01; - elem.style.filter= 'alpha(opacity=' + blend + ')'; - elem.style.display=''; - } - }//end function setBlend - - function halt(val) { - var isBusy= intervalID ? true: false; - if (isBusy) { - window.clearInterval(intervalID); - intervalID = null; - } - - i_incr=0; //no begin, no end, avoid bug with redisplay - val=val-0; //NaN if val undefined - if (!isNaN(val)) { // warning typeof(NaN) is number ! - curr_i=val; //don't forget to memorize state - setBlend(val); - } - - return isBusy; - } //end function halt() - - function redisplay() { - if (i_incr===0) { - halt(); - } else { - if ( (i_incr>0 && curr_i>=i_end) || (i_incr<0 && curr_i<=i_end) ) { - halt(); - curr_i = i_end; - } - } - setBlend(curr_i); - }//end function redisplay - - function majorTask() { - if ( (i_incr>0 && curr_ii_end ) ) { - setBlend(curr_i); - curr_i+=i_incr; - return true; - } - - redisplay(); - return false; - }//end function majorTask - - function animate(j_begin,j_end,j_incr,delay) { - if (fbox_disable_fadin) { - halt(j_end); - return; - } - if (!halt()) { - curr_i = j_begin; - } - i_end=j_end; - i_incr=j_incr; - //------- let's go ----------------- - //first iteration is immediate - if (majorTask()) { - intervalID=window.setInterval(majorTask,delay); - } - }//end function animate - - //---------------- - //------ making some method publicly available - this.halt=halt; - this.animate=animate; - this.redisplay=redisplay; - } //end function blendingTransition - - //------------------------------------------------------------------------------- - function setContent(str) { - if (!str) { - fbox_content.innerHTML = ""; - fbox_content.style.overflow = "hidden"; - return; - } - - var elem=null; - if (currFbox.type===0) { //image - var a=createElem('a'); - a.href="#"; - //----------------------- - elem=currFbox.objImg; - elem.id='fbox_content_img'; - elem.style.border='0px'; - //------------------------ - a.appendChild(elem); - fbox_content.appendChild(a); - } else {//if NOT image - if (currFbox.type==3) { //iframe - str= ''; - } else { - if (typeof(str) != 'string') { - str=''; - } - } - //------------------------- - fbox_content.innerHTML = str; - //------------------------ - if (currFbox.type==3) { - elem = getElem("fbox_content_iframe"); - } - }//end if NOT image - - fbox_content.style.overflow = "auto"; - - if (elem) { - elem.style.width=currFbox.width+'px'; - elem.style.height=currFbox.height+'px'; - } - }//end function setContent - - //-------------------------------------------------------------------------- - function fixSpecialTagsVisibility(fix) { - var i,j,elems,elem; - for (j=0;j>1; - var top = (pageSize.height - fbox_progress.offsetHeight)>>1; - if (posfix_enabled) { - fbox_progress.style.position="fixed"; - } else { - var scrollPos = new getScrollPos(); - fbox_progress.style.position="absolute"; - left=scrollPos.left+ left; - top=scrollPos.top+ top; - } - - fbox_progress.style.left = left+'px'; - fbox_progress.style.top = top+'px'; - } //end function centerProgress - - //---- much complicated centering for Fg - function centerFg() { - var posfix_fg=false; - var scrollPos = new getScrollPos(); - var pageSize = new getPageSize(); - fbox_fg.style.display=""; - var left= (pageSize.width - fbox_fg.offsetWidth)>>1; - var top = (pageSize.height - fbox_fg.offsetHeight)>>1; - blending_fg.redisplay(); - - if (posfix_enabled) { - if (left<=0 || top<=0) { - posfix_fg=false; - fbox_fg.style.position="absolute"; - } else { - posfix_fg=true; - fbox_fg.style.position="fixed"; - } - }//end if posfix_enabled - - if (left<=0) {//disable centering - if (!lockHoriz) { //not horizontally locked - lockHoriz=true; - left= scrollPos.left+ left; - if (left<0) { - left=0; - } - fbox_fg.style.left = left+'px'; - }//end if not horizontally locked - } else { - lockHoriz=false; - if (!posfix_fg) { - left=scrollPos.left+ left; - } - fbox_fg.style.left = left+'px'; - } - - if (top<=0) {//disable centering - if (!lockVertic) { - lockVertic=true; - top= scrollPos.top+ top; - if (top<0) { - top=0; - } - fbox_fg.style.top = top+'px'; - } - } else { - lockVertic=false; - if (!posfix_fg) { - top=scrollPos.top+ top; - } - fbox_fg.style.top =top+'px'; - } - }//end function centerFg - - - //----- set correctly width, height of fg even when explorer in Quirks mode --- - //----- also recenter fg -------------------------------------------------------- - //----- forceCaption: -1, hide, - //------------------ 0, auto - //------------------ 1, show - - function adjustFg(forceCaption) { - var fboxWidth = currFbox.width; - var fboxHeight = currFbox.height; - var showTitle = trim(currFbox.title) ? true:false; - var showNavig = currFbox.next || currFbox.prev ? true:false; - var showCaption = false; - - if (!forceCaption) { - showCaption = showTitle || showNavig; - } else if (forceCaption == 1) { - showCaption= true; - } - - if (showCaption && fboxWidth<200) { - fboxWidth=200; //not less than 200 when caption - } - - if (showCaption) { - fbox_spacer.style.visibility='visible'; - fbox_spacer.style.display=''; - fbox_bar.style.visibility='visible'; - fbox_bar.style.display=''; - if (showTitle) { - fbox_title.style.styleFloat=fbox_title.style.cssFloat= 'left'; - fbox_title.style.visibility='visible'; - fbox_title.style.height='auto'; - fbox_title.style.overflow='visible'; - fbox_navig.style.marginTop =3+'px'; - } else { - fbox_title.style.styleFloat=fbox_title.style.cssFloat= 'right'; - fbox_title.style.visibility='hidden'; - fbox_title.style.height=1+'px'; - fbox_title.style.overflow='hidden'; - fbox_navig.style.marginTop =0+'px'; - } - }//end if(showCaption) - else { - fbox_spacer.style.visibility='hidden'; //silly bug in IE6 - fbox_spacer.style.display='none'; - fbox_bar.style.visibility='hidden'; - fbox_bar.style.display='none'; - } //end else if(showCaption) - - if (showNavig) { - if (currFbox.prev) { - fbox_prev_a.style.visibility= 'visible'; - } else { - fbox_prev_a.style.visibility= 'hidden'; - } - - if (currFbox.next) { - fbox_next_a.style.visibility= 'visible'; - } else { - fbox_next_a.style.visibility= 'hidden'; - } - - fbox_navig.style.visibility = 'visible'; //bug or not I do it - fbox_navig.style.display=''; - } else { - fbox_navig.style.visibility = 'hidden'; //bug or not I do it - fbox_navig.style.display='none'; - } - - if (ieQkMd) { - fbox_fg.style.width= (fboxWidth+18) +'px'; - fbox_content.style.width= (fboxWidth+6) +'px'; - fbox_content.style.height= (fboxHeight+6) +'px'; - } else { - fbox_fg.style.width= (fboxWidth+6) +'px'; - fbox_content.style.width= fboxWidth +'px'; - fbox_content.style.height= fboxHeight +'px'; - } - - if (showCaption) { - fbox_spacer.style.width= (fboxWidth+6)+'px'; //no padding so stay same - - fbox_bar.style.width = (fboxWidth+6) +'px'; //fboxWidth-10 without table/strict - - fbox_title.style.width = 'auto'; - fbox_fg.style.height = 'auto'; - fbox_bar.style.height = 'auto'; - - fbox_fg.style.display = ""; - var w1= fbox_sys.offsetWidth; - var w2=fbox_title.offsetWidth; - fbox_fg.style.display = "none"; - w1= fboxWidth-w1-25; //what is remaining when removing everything except "title width" ? - var w = w1<=190 ? fboxWidth-10 : w1>w2 ? w2:w1; - fbox_title.style.width = w+ 'px'; - - fbox_fg.style.display = ""; - var h=fbox_fg.offsetHeight; - fbox_fg.style.display = "none"; - - h=h-12; //h-9 without table/strict - - fbox_fg.style.height=h+'px'; - fbox_bar.style.height=h-fboxHeight-15+ 'px'; - } //end if(showCaption) - else { //no caption - if (ieQkMd) { - fbox_fg.style.height= (fboxHeight+18) +'px'; - } else { - fbox_fg.style.height= (fboxHeight+6) +'px'; - } - } //end if no caption - - centerFg(); - }//end function adjustFg - - - //adjustImage ---> adjustFg ---> (display)+ centerFg - function adjustImage() { - var objImg= currFbox.objImg; - var forceCaption=0; - - switch (currFbox.imgType) { - case 0: //auto; - var pagesize = new getPageSize(); - var x = Math.max(pagesize.width - 125,200); //not less than 200 or it is exasperating - var y = Math.max(pagesize.height - 125,200); - var ratio = Math.max(1,Math.max(currFbox.exactImgWidth/x,currFbox.exactImgHeight/y)); - - if (ratio>1) { - fbox_resize_a.style.visibility="visible"; - fbox_resize_a.style.display=""; - fbox_resize_nbsp.style.visibility="visible"; - fbox_resize_nbsp.style.display=""; - forceCaption=1; - } else { - fbox_resize_a.style.visibility="hidden"; - fbox_resize_a.style.display="none"; - fbox_resize_nbsp.style.visibility="hidden"; - fbox_resize_nbsp.style.display="none"; - } - - if (currFbox.imgState===0) { - fbox_resize_a.innerHTML=fbox_max_txt; - currFbox.width=objImg.width = Math.round(currFbox.exactImgWidth / ratio); - currFbox.height=objImg.height = Math.round(currFbox.exactImgHeight/ ratio); - } else { - fbox_resize_a.innerHTML= fbox_min_txt; - currFbox.width=objImg.width = currFbox.exactImgWidth; - currFbox.height=objImg.height = currFbox.exactImgHeight; - } - break; - case 1: //width is set, keep the ratio - currFbox.height= objImg.height = Math.round(currFbox.exactImgHeight * currFbox.width/currFbox.exactImgWidth); - objImg.width = currFbox.width; - break; - case 2: //height is set, keep the ratio - currFbox.width=objImg.width = Math.round(currFbox.exactImgWidth * currFbox.height/currFbox.exactImgHeight); - objImg.height =currFbox.height; - break; - case 3: //width and height set, nothing to compute - objImg.width = currFbox.width; - objImg.height = currFbox.height; - }//end switch (currFbox.imgType) - - adjustFg(forceCaption); - }//end function adjustImage - - - //------------------------------------------------------------------------------ - //--- Remark: the scrolling event can be induced when popup size change -------- - //--- popup exceeds window --> scroll appears ---> background size change --> repostion other elements (wtf ?) - - function adjustOnScrollTime() { - function majorTask() { - if ((loadState&1) == 1) { - removeEvent(window,'scroll',adjustOnScrollTime); - return; - } - if ((loadState&8) == 8) { - centerFg(); - } - if ((loadState&2) == 2) { - adjustBg(); //size of background depends of popup, so do that after - } - if ((loadState&4) == 4) { - centerProgress(); //wtf ? - } - //---------------------------------- - var now = new Date(); - var currTime = now.getTime(); - lastScrollTime=currTime; - addEvent(window,'scroll',adjustOnScrollTime); - //-------------------------------- - var scrollPos = new getScrollPos(); - lastScrollPosLeft=scrollPos.left; //delay adjustOnScrollPos - lastScrollPosTop=scrollPos.top; - }//end function majorTask - - /* must use removeEvent or doesn't work */ - removeEvent(window,'scroll',adjustOnScrollTime); - - var now = new Date(); - var deltaTime = now.getTime()-lastScrollTime; - if (deltaTime>=200) { - majorTask(); - } else { - window.setTimeout(majorTask,200-deltaTime); - } - }//end function adjustOnScrollTime - - function adjustOnScrollPos() { - var scrollPos = new getScrollPos(); - if (Math.abs(scrollPos.left-lastScrollPosLeft)>50 || Math.abs(scrollPos.top - lastScrollPosTop>50)) { - if ((loadState&8) == 8) { - centerFg(); - } - if ((loadState&2) == 2) { - adjustBg(); //size of background depends of popup, so do that after - } - if ((loadState&4) == 4) { - centerProgress(); //wtf ? - } - lastScrollPosLeft=scrollPos.left; - lastScrollPosTop=scrollPos.top; - //---------------------------- - var now = new Date(); - var currTime = now.getTime(); - lastScrollTime= currTime; //delay also adjustOnScrollTime - } - }//end function adjustOnScrollPos - - //we excessive flicker by introducing a timer - //and prevent browser from being too busy - function adjustOnResizeTime() { - function majorTask() { - if ((loadState&1) == 1) { - removeEvent(window,'resize',adjustOnResizeTime); - return; - } - - fbox_bg.style.display="none"; //reason of flicker, necessary to compute accurately page size - fbox_fg.style.display="none"; - - if ((loadState&8) == 8) { - if (currFbox.imgType === 0) { - setContent(false); - adjustImage(); - setContent(true); - } else { - centerFg(); - } - } - if ((loadState&2) == 2) { - adjustBg(); //size of background depends of popup, so do that after - } - if ((loadState&4) == 4) { - centerProgress(); //wtf ? - } - - //------------------------------ - var now = new Date(); - var currTime = now.getTime(); - lastScrollTime=lastResizeTime=currTime; //delay also adjustOnScrollTime - addEvent(window,'resize',adjustOnResizeTime); - //-------------------------------- - var scrollPos = new getScrollPos(); - lastScrollPosLeft=scrollPos.left; //delay adjustOnScrollPos - lastScrollPosTop=scrollPos.top; - }//end function majorTask - - /* must use removeEvent or doesn't work */ - removeEvent(window,'resize',adjustOnResizeTime); - - var now = new Date(); - var deltaTime = now.getTime()-lastResizeTime; - if (deltaTime>=200) { - majorTask(); - } else { - window.setTimeout(majorTask,200-deltaTime); - } - }//end function adjustOnResizeTime - //-------------------------------------------------------------------------- - function hideProgress() { - loadState= loadState&(~4); - fbox_progress.style.display = "none"; - fbox_progress.onclick = null; - } - - function hideFbox() { - loadState = loadState|1; //termination - blending_fg.halt(0); - if (http) { - http.onreadystatechange = nope; //IE doesn't accept null - } - if (currFbox.objImg) { - currFbox.objImg.onload=null; - if (!currFbox.imgReadyTest) { //try to abort image loading - currFbox.objImg.src=null; - currFbox.objImg=null; - }//end if try to abort image loading - } - if ((loadState&4)==4) { - hideProgress(); - } - loadState= loadState & (~8); //remove fbox - if ((loadState&2) == 2) { - hideBg(); - } - fbox_fg.style.display = "none"; - setContent(false); - removeEvent(window,'resize',adjustOnResizeTime); - removeEvent(window,'scroll', adjustOnScrollTime); - removeEvent(window,'scroll', adjustOnScrollPos); - //---- restore original body style: - if (typeof(body.style.cssText) != 'undefined') { - body.style.cssText=body_style_begin; - } else { - body.setAttribute("style",body_style_begin); - } - return false;//link is # - }//end function hideFbox - - function showProgress() { - fbox_progress.style.display = ""; - centerProgress(); - fbox_progress.onclick = hideFbox; - loadState= loadState|4; - } - -//--------------------------------------------------------------------------------------- - function toggleImgState() { - if ( ((loadState&8) == 8)&& (currFbox.imgType === 0) ) { - currFbox.imgState = currFbox.imgState ? 0:1; - setContent(false); - adjustImage(); - setContent(true); - if ((loadState&2) == 2) { - adjustBg(); //size of background depends of popup, so do that after - } - } - return false; - }//end function toggleImgState - - -//------------------------------------------------------------------------------ - function showFbox(fbObj) { - function showNext() { - showFbox(currFbox.next); - return false; //link is # - }//end function showNext - - function showPrev() { - showFbox(currFbox.prev); - return false; //link is # - }//end function showPrev - - if (!fbObj || (typeof(fbObj)!='object')) { - return; - } - //--- works even without this, but according to standard each id ----- - //--- is only for one element (but if not rendered inside DOM ?) ----- - if (currFbox && (typeof(currFbox)=='object') && currFbox.objImg && (typeof(currFbox.objImg)=='object')) { - currFbox.objImg.id=null; - } - //----- ok, now the current fbox, is the one shown --------------- - currFbox=fbObj; - - var src= currFbox.src; - - body.style.width='auto';//don't let external css change default behavior - body.style.height='auto'; - - lockHoriz=lockVertic= false; //prevent centering when fbox exceeds page size - lastScrollPosLeft=0; - lastScrollPosTop=0; - fbox_resize_a.style.visibility="hidden"; - fbox_resize_a.style.display="none"; - fbox_resize_nbsp.style.visibility="hidden"; - fbox_resize_nbsp.style.display="none"; - - setContent(false); - // set title here - var tmp_title= trim(currFbox.title); - if (!tmp_title || tmp_title=='.') { - tmp_title=" "; - } - fbox_title.innerHTML = tmp_title; - tmp_title= null; - - blending_fg.halt(0); - loadState= loadState & 2; //remove all except background - - if ((loadState&2) === 0) { - showBg(); - } - - adjustOnResizeTime(); - adjustOnScrollTime(); - if (!posfix_enabled) { - addEvent(window,'scroll', adjustOnScrollPos); - } - - if (currFbox.type === 0 || currFbox.type == 2) { - showProgress(); - } - if (currFbox.type === 0) { - fbox_content.onclick= hideFbox; - fbox_resize_a.onclick=toggleImgState; - } else { - fbox_content.onclick= null; - fbox_resize_a.onclick=nope; // facultative, but safer - } - - //--------- set prev and next actions ------------ - fbox_prev_a.onclick = currFbox.prev ? showPrev: nope; - fbox_next_a.onclick = currFbox.next ? showNext: nope; - - //---------- now the "loading part" ------------- - //----------------------------------------------- - - switch (currFbox.type) { - case 0: //picture - - var imgReadyFunc = function() { - var tmpImgReadyTest=currFbox.imgReadyTest; - currFbox.imgReadyTest=true; - if ((loadState&1) != 1) { - hideProgress(); - if (!tmpImgReadyTest) { - currFbox.exactImgWidth=currFbox.objImg.width; - currFbox.exactImgHeight=currFbox.objImg.height; - } - adjustImage(); - setContent(true); - if (tmpImgReadyTest) { - blending_fg.animate(0,100,25,20); - } else { - blending_fg.animate(0,100,10,35); - } - loadState=loadState|8; - } - };//end function imgReadyFunc - - if (currFbox.imgReadyTest) { - imgReadyFunc(); - } else { - var imgPreloader = new Image(); - currFbox.objImg=imgPreloader; - - imgPreloader.onload = function() { - this.onload=null; - this.onerror=null; - imgReadyFunc(); - }; - - imgPreloader.onerror = function() { - this.onerror=null; - hideFbox(); - }; - - imgPreloader.src = src; - } - break; - - case 1: //Support for overlay of div on existing page - //nothing to load - adjustFg(1); - var strHTML = currFbox.tagContent.innerHTML; - setContent(strHTML); - blending_fg.animate(0,100,10,30); - loadState=loadState|8; - break; - - case 2: //using ajax to retrieve a file - try { - http.open('GET',src,true); - } catch (e) { - currFbox.tagLink.onclick=nope; - hideFbox(); - break; - } - - http.onreadystatechange = function() { - if ((loadState&1) == 1) { - // see http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_a_1.html - http.onreadystatechange = nope; - http.abort(); - } else if (http.readyState == 4) { - http.onreadystatechange = nope; //IE ... - if (http.status == 200 || !http.status) { - hideProgress(); - adjustFg(1); - var response = http.responseText; - setContent(response); - blending_fg.animate(0,100,10,30); - loadState=loadState|8; - } else { - currFbox.tagLink.onclick= nope; - hideFbox(); - } - }//end if (http.readyState == 4) - }; - - http.send(null); - break; - case 3://iframe - adjustFg(1); - setContent(true); - blending_fg.animate(0,100,10,30); - loadState=loadState|8; - }//end switch - }//end function showFbox - -//------------------------------------------------ - function init_fbox() { - if (getElem("fbox_world")) { - return; - } //note: fbox_engine should be called only once - - //how to make/use http request properly, see there: - // http://blogs.msdn.com/ie/archive/2006/01/23/516393.aspx - // http://keelypavan.blogspot.com/2006/03/reusing-xmlhttprequest-object-in-ie.html - //remark: window.XMLHttpRequest works only if target file truly online with IE7beta3 - - http = null; - try { - if (window.XMLHttpRequest) { // If IE7, Mozilla, Safari, etc: Use native object - http=new XMLHttpRequest(); - } else if (window.ActiveXObject) {// ...otherwise, use the ActiveX control for IE5.x and IE6 - http=new ActiveXObject("Microsoft.XMLHTTP"); - } - } catch (e) {} - - var cst= new fbox_conf(); - fbox_disable_fadin=cst.disable_fadin; - fbox_progress_src = cst.progress_src; - fbox_close_txt = cst.close_txt; - fbox_prev_txt = cst.prev_txt; - fbox_next_txt = cst.next_txt; - fbox_max_txt = cst.max_txt; - fbox_min_txt = cst.min_txt; - - fbox_nbsp_txt=''; - for (var i=0; i