var GB_CURRENT=null;GB_hide=function(i){GB_CURRENT.hide(i)};GreyBox=new AJS.Class({init:function(l){var o=this;o.use_fx=AJS.fx;o.type="page";o.overlay_click_close=false;o.salt=0;o.root_dir=GB_ROOT_DIR;o.callback_fns=[];o.reload_on_close=false;o.src_loader=o.root_dir+"loader_frame.html";var I=window.location.hostname.indexOf("www"),i=o.src_loader.indexOf("www");if(I!=-1&&i==-1){o.src_loader=o.src_loader.replace("://","://www.")}if(I==-1&&i!=-1){o.src_loader=o.src_loader.replace("://www.","://")}o.show_loading=true;AJS.update(o,l)},addCallback:function(i){if(i){this.callback_fns.push(i)}},show:function(i){var l=this;GB_CURRENT=l;l.url=i;var I=[AJS.$bytc("object"),AJS.$bytc("select")];AJS.map(AJS.flattenList(I),function(i){i.style.visibility="hidden"});l.createElements();return false},hide:function(I){var i=this;AJS.callLater(function(){var l=i.callback_fns;if(l!=[]){AJS.map(l,function(i){i()})}i.onHide();if(i.use_fx){var O=i.overlay;AJS.fx.fadeOut(i.overlay,{onComplete:function(){AJS.removeElement(O);O=null},duration:300});AJS.removeElement(i.g_window)}else{AJS.removeElement(i.g_window,i.overlay)}i.removeFrame();AJS.REV(window,"scroll",_GB_setOverlayDimension);AJS.REV(window,"resize",_GB_update);var o=[AJS.$bytc("object"),AJS.$bytc("select")];AJS.map(AJS.flattenList(o),function(i){i.style.visibility="visible"});GB_CURRENT=null;if(i.reload_on_close){window.location.reload()}if(AJS.isFunction(I)){I()}},10)},update:function(){var i=this;i.setOverlayDimension();i.setFrameSize();i.setWindowPosition()},createElements:function(){var I=this;I.initOverlay();I.g_window=AJS.DIV({"id":"GB_window"});AJS.hideElement(I.g_window);AJS.getBody().insertBefore(I.g_window,I.overlay.nextSibling);I.initFrame();I.initHook();I.update();var i=I;if(I.use_fx){AJS.fx.fadeIn(I.overlay,{duration:300,to:0.7,onComplete:function(){i.onShow();AJS.showElement(i.g_window);i.startLoading()}})}else{AJS.setOpacity(I.overlay,0.7);AJS.showElement(I.g_window);I.onShow();I.startLoading()}AJS.AEV(window,"scroll",_GB_setOverlayDimension);AJS.AEV(window,"resize",_GB_update)},removeFrame:function(){var i=this;try{AJS.removeElement(i.iframe)}catch(e){}i.iframe=null},startLoading:function(){var i=this;i.iframe.src=i.src_loader+"?s="+i.salt++;AJS.showElement(i.iframe)},setOverlayDimension:function(){var l=this,i=AJS.getWindowSize();if(AJS.isMozilla()||AJS.isOpera()){AJS.setWidth(l.overlay,"100%")}else{AJS.setWidth(l.overlay,i.w)}var I=Math.max(AJS.getScrollTop()+i.h,AJS.getScrollTop()+l.height);if(I<AJS.getScrollTop()){AJS.setHeight(l.overlay,I)}else{AJS.setHeight(l.overlay,AJS.getScrollTop()+i.h)}},initOverlay:function(){var i=this;i.overlay=AJS.DIV({"id":"GB_overlay"});if(i.overlay_click_close){AJS.AEV(i.overlay,"click",GB_hide)}AJS.setOpacity(i.overlay,0);AJS.getBody().insertBefore(i.overlay,AJS.getBody().firstChild)},initFrame:function(){var i=this;if(!i.iframe){var I={"name":"GB_frame","class":"GB_frame","frameBorder":0};if(AJS.isIe()){I.src="javascript:false;document.write(\"\");"}i.iframe=AJS.IFRAME(I);i.middle_cnt=AJS.DIV({"class":"content"},i.iframe);i.top_cnt=AJS.DIV();i.bottom_cnt=AJS.DIV();AJS.ACN(i.g_window,i.top_cnt,i.middle_cnt,i.bottom_cnt)}},onHide:function(){},onShow:function(){},setFrameSize:function(){},setWindowPosition:function(){},initHook:function(){}});_GB_update=function(){if(GB_CURRENT){GB_CURRENT.update()}};_GB_setOverlayDimension=function(){if(GB_CURRENT){GB_CURRENT.setOverlayDimension()}};AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");script_loaded=true;var GB_SETS={};function decoGreyboxLinks(){var i=AJS.$bytc("a");AJS.map(i,function(c){if(c.getAttribute("href")&&c.getAttribute("rel")){var l=c.getAttribute("rel");if(l.indexOf("gb_")==0){var i=l.match(/\w+/)[0],I=l.match(/\[(.*)\]/)[1],O=0,o={"caption":c.title||"","url":c.href};if(i=="gb_pageset"||i=="gb_imageset"){if(!GB_SETS[I]){GB_SETS[I]=[]}GB_SETS[I].push(o);O=GB_SETS[I].length}if(i=="gb_pageset"){c.onclick=function(){GB_showFullScreenSet(GB_SETS[I],O);return false}}if(i=="gb_imageset"){c.onclick=function(){GB_showImageSet(GB_SETS[I],O);return false}}if(i=="gb_image"){c.onclick=function(){GB_showImage(o.caption,o.url);return false}}if(i=="gb_page"){c.onclick=function(){var i=I.split(/, ?/);GB_show(o.caption,o.url,parseInt(i[1]),parseInt(i[0]));return false}}if(i=="gb_page_fs"){c.onclick=function(){GB_showFullScreen(o.caption,o.url);return false}}if(i=="gb_page_center"){c.onclick=function(){var i=I.split(/, ?/);GB_showCenter(o.caption,o.url,parseInt(i[1]),parseInt(i[0]));return false}}}}})}AJS.AEV(window,"load",decoGreyboxLinks);GB_showImage=function(i,l,O){var o={width:300,height:300,type:"image",fullscreen:false,center_win:true,caption:i,callback_fn:O};var I=new GB_Gallery(o);return I.show(l)};GB_showPage=function(i,l,O){var o={type:"page",caption:i,callback_fn:O,fullscreen:true,center_win:false};var I=new GB_Gallery(o);return I.show(l)};GB_Gallery=GreyBox.extend({init:function(i){var I=this;I.parent({});I.img_close=I.root_dir+"g_close.gif";AJS.update(I,i);I.addCallback(I.callback_fn)},initHook:function(){var v=this;AJS.addClass(v.g_window,"GB_Gallery");var I=AJS.DIV({"class":"inner"});v.header=AJS.DIV({"class":"GB_header"},I);AJS.setOpacity(v.header,0);AJS.getBody().insertBefore(v.header,v.overlay.nextSibling);var O=AJS.TD({"id":"GB_caption","class":"caption","width":"40%"},v.caption),o=AJS.TD({"id":"GB_middle","class":"middle","width":"20%"}),i=AJS.IMG({"src":v.img_close});AJS.AEV(i,"click",GB_hide);var l=AJS.TD({"class":"close","width":"40%"},i),c=AJS.TBODY(AJS.TR(O,o,l)),C=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},c);AJS.ACN(I,C);if(v.fullscreen){AJS.AEV(window,"scroll",AJS.$b(v.setWindowPosition,v))}else{AJS.AEV(window,"scroll",AJS.$b(v._setHeaderPos,v))}},setFrameSize:function(){var l=this,i=l.overlay.offsetWidth,I=AJS.getWindowSize();if(l.fullscreen){l.width=i-40;l.height=I.h-80}AJS.setWidth(l.iframe,l.width);AJS.setHeight(l.iframe,l.height);AJS.setWidth(l.header,i)},_setHeaderPos:function(){AJS.setTop(this.header,AJS.getScrollTop()+10)},setWindowPosition:function(){var O=this,l=O.overlay.offsetWidth,o=AJS.getWindowSize();AJS.setLeft(O.g_window,((l-50-O.width)/2));var i=AJS.getScrollTop()+55;if(!O.center_win){AJS.setTop(O.g_window,i)}else{var I=((o.h-O.height)/2)+20+AJS.getScrollTop();if(I<0){I=0}if(i>I){I=i}AJS.setTop(O.g_window,I)}O._setHeaderPos()},onHide:function(){var i=this;AJS.removeElement(i.header);AJS.removeClass(i.g_window,"GB_Gallery")},onShow:function(){var i=this;if(i.use_fx){AJS.fx.fadeIn(i.header,{to:1})}else{AJS.setOpacity(i.header,1)}}});AJS.preloadImages(GB_ROOT_DIR+"g_close.gif");GB_showFullScreenSet=function(I,l,O){var o={type:"page",fullscreen:true,center_win:false};var i=new GB_Sets(o,I);i.addCallback(O);i.showSet(l-1);return false};GB_showImageSet=function(I,l,O){var o={type:"image",fullscreen:false,center_win:true,width:300,height:300};var i=new GB_Sets(o,I);i.addCallback(O);i.showSet(l-1);return false};GB_Sets=GB_Gallery.extend({init:function(I,i){var l=this;l.parent(I);if(!l.img_next){l.img_next=l.root_dir+"next.gif"}if(!l.img_prev){l.img_prev=l.root_dir+"prev.gif"}l.current_set=i},showSet:function(I){var l=this;l.current_index=I;var i=l.current_set[l.current_index];l.show(i.url);l._setCaption(i.caption);l.btn_prev=AJS.IMG({"class":"left",src:l.img_prev});l.btn_next=AJS.IMG({"class":"right",src:l.img_next});AJS.AEV(l.btn_prev,"click",AJS.$b(l.switchPrev,l));AJS.AEV(l.btn_next,"click",AJS.$b(l.switchNext,l));GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});AJS.ACN(AJS.$("GB_middle"),l.btn_prev,GB_STATUS,l.btn_next);l.updateStatus()},updateStatus:function(){var i=this;AJS.setHTML(GB_STATUS,(i.current_index+1)+" / "+i.current_set.length);if(i.current_index==0){AJS.addClass(i.btn_prev,"disabled")}else{AJS.removeClass(i.btn_prev,"disabled")}if(i.current_index==i.current_set.length-1){AJS.addClass(i.btn_next,"disabled")}else{AJS.removeClass(i.btn_next,"disabled")}},_setCaption:function(i){AJS.setHTML(AJS.$("GB_caption"),i)},updateFrame:function(){var I=this,i=I.current_set[I.current_index];I._setCaption(i.caption);I.url=i.url;I.startLoading()},switchPrev:function(){var i=this;if(i.current_index!=0){i.current_index--;i.updateFrame();i.updateStatus()}},switchNext:function(){var i=this;if(i.current_index!=i.current_set.length-1){i.current_index++;i.updateFrame();i.updateStatus()}}});AJS.AEV(window,"load",function(){AJS.preloadImages(GB_ROOT_DIR+"next.gif",GB_ROOT_DIR+"prev.gif")});GB_show=function(i,l,o,O,C){var c={caption:i,height:o||500,width:O||500,fullscreen:false,callback_fn:C};var I=new GB_Window(c);return I.show(l)};GB_showCenter=function(i,l,o,O,C){var c={caption:i,center_win:true,height:o||500,width:O||500,fullscreen:false,callback_fn:C};var I=new GB_Window(c);return I.show(l)};GB_showFullScreen=function(i,l,O){var o={caption:i,fullscreen:true,callback_fn:O};var I=new GB_Window(o);return I.show(l)};GB_Window=GreyBox.extend({init:function(i){var I=this;I.parent({});I.img_header=I.root_dir+"header_bg.gif";I.img_close=I.root_dir+"w_close.gif";I.show_close_img=true;AJS.update(I,i);I.addCallback(I.callback_fn)},initHook:function(){var c=this;AJS.addClass(c.g_window,"GB_Window");c.header=AJS.TABLE({"class":"header"});c.header.style.backgroundImage="url("+c.img_header+")";var o=AJS.TD({"class":"caption"},c.caption),l=AJS.TD({"class":"close"});if(c.show_close_img){var I=AJS.IMG({"src":c.img_close}),i=AJS.SPAN("Close"),O=AJS.DIV(I,i);AJS.AEV([I,i],"mouseover",function(){AJS.addClass(i,"on")});AJS.AEV([I,i],"mouseout",function(){AJS.removeClass(i,"on")});AJS.AEV([I,i],"mousedown",function(){AJS.addClass(i,"click")});AJS.AEV([I,i],"mouseup",function(){AJS.removeClass(i,"click")});AJS.AEV([I,i],"click",GB_hide);AJS.ACN(l,O)}tbody_header=AJS.TBODY();AJS.ACN(tbody_header,AJS.TR(o,l));AJS.ACN(c.header,tbody_header);AJS.ACN(c.top_cnt,c.header);if(c.fullscreen){AJS.AEV(window,"scroll",AJS.$b(c.setWindowPosition,c))}},setFrameSize:function(){var I=this;if(I.fullscreen){var i=AJS.getWindowSize();overlay_h=i.h;I.width=Math.round(I.overlay.offsetWidth-(I.overlay.offsetWidth/100)*10);I.height=Math.round(overlay_h-(overlay_h/100)*10)}AJS.setWidth(I.header,I.width+6);AJS.setWidth(I.iframe,I.width);AJS.setHeight(I.iframe,I.height)},setWindowPosition:function(){var l=this,i=AJS.getWindowSize();AJS.setLeft(l.g_window,((i.w-l.width)/2)-13);if(!l.center_win){AJS.setTop(l.g_window,AJS.getScrollTop())}else{var I=((i.h-l.height)/2)-20+AJS.getScrollTop();if(I<0){I=0}AJS.setTop(l.g_window,I)}}});AJS.preloadImages(GB_ROOT_DIR+"w_close.gif",GB_ROOT_DIR+"header_bg.gif");script_loaded=true;