//jquery adapter
if(typeof jQuery=="undefined"){throw"Unable to load Shadowbox, jQuery library not found."}var Shadowbox={};Shadowbox.lib={getStyle:function(B,A){return jQuery(B).css(A)},setStyle:function(C,B,D){if(typeof B!="object"){var A={};A[B]=D;B=A}jQuery(C).css(B)},get:function(A){return(typeof A=="string")?document.getElementById(A):A},remove:function(A){jQuery(A).remove()},getTarget:function(A){return A.target},preventDefault:function(A){A=A.browserEvent||A;if(A.preventDefault){A.preventDefault()}else{A.returnValue=false}},addEvent:function(C,A,B){jQuery(C).bind(A,B)},removeEvent:function(C,A,B){jQuery(C).unbind(A,B)},animate:function(A,D,C,F){C=Math.round(C*1000);var E={};for(var B in D){switch(B){case"opacity":E.opacity=String(D.opacity.to);break;default:E[B]=String(D[B].to)+"px"}}jQuery(A).animate(E,C,null,F)}}

//shadowbox
if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox, no base library adapter found."}(function(){var options={loadingImage:"../images/icon-loading.gif",animate:true,flvPlayer:"flvplayer.swf",overlayColor:"#000",overlayOpacity:0.85,overlayBgImage:"images/overlay-85.png",autoplayMovies:true,showMovieControls:true,resizeDuration:0.35,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:"default",viewportPadding:20,resizeLgImages:false,initialHeight:160,initialWidth:320,enableKeys:true,keysClose:["c","q",27],keysNext:["n",39],keysPrev:["p",37],onOpen:null,onClose:null,handleUnsupported:"link",errors:{templates:{single:'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',shared:'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',either:'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'},fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}},
    //set up the shadowbox html
    skin:
    {
        main:'<div id="shadowbox_overlay"></div>' + 
            '<div id="shadowbox_container">' +
                '<div id="shadowbox">' +
                    '<div id="shadowbox_title">' +
                        '<div id="shadowbox_title_inner"></div>' +
                    '</div>' +
                    '<div id="shadowbox_body">' +
                        '<div id="shadowbox_body_inner"></div>' +
                        '<div id="shadowbox_loading">' +
                            '<img src="{loading_img_replace}" alt="loading" />' +
                            '<span><a href="javascript:Shadowbox.close();">Cancel</a></span>' +
                        '</div>' +
                        '<div id="shadowbox_meta">' +
                            '<div id="shadowbox_desc"></div>' +
                            '<div id="shadowbox_credit"></div>' +
                        '</div>' +
                    '</div>' +
                    '<div id="shadowbox_toolbar">' +
                        '<div id="shadowbox_toolbar_inner"></div>' +
                    '</div>' +
                '</div>' +
            '</div>',
        counter:'<div id="shadowbox_counter"></div>',
        nav:
        {
            close:'<div id="shadowbox_nav_close"><a href="javascript:Shadowbox.close();"><span class="shortcut">C</span>lose</a></div>',
            next:'<div id="shadowbox_nav_next"><a href="javascript:Shadowbox.next();"><span class="shortcut">N</span>ext</a></div>',
            prev:'<div id="shadowbox_nav_previous"><a href="javascript:Shadowbox.previous();"><span class="shortcut">P</span>revious</a></div>'
        }
    }};
var SL=Shadowbox.lib;var galleries=[];var current_gallery=null;var current=null;var current_height=options.initialHeight;var current_width=options.initialWidth;var preloader=null;var activated=false;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isIE=ua.indexOf("msie")>-1,isIE7=ua.indexOf("msie 7")>-1,isBorderBox=isIE&&!isStrict,isSafari=(/webkit|khtml/).test(ua),isSafari3=isSafari&&!!(document.evaluate),isGecko=!isSafari&&ua.indexOf("gecko")>-1,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isLinux=(ua.indexOf("linux")!=-1);var getViewportHeight=function(){var height=window.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=isStrict?document.documentElement.clientHeight:document.body.clientHeight}return height};var getViewportWidth=function(){var width=window.innerWidth;var mode=document.compatMode;if(mode||isIE){width=isStrict?document.documentElement.clientWidth:document.body.clientWidth}return width};var getDocumentHeight=function(){var scrollHeight=isStrict?document.documentElement.scrollHeight:document.body.scrollHeight;return Math.max(scrollHeight,getViewportHeight())};var getDocumentWidth=function(){var scrollWidth=isStrict?document.documentElement.scrollWidth:document.body.scrollWidth;return Math.max(scrollWidth,getViewportWidth())};var clearOpacity=function(el){if(isIE){if(typeof el.style.filter=="string"&&(/alpha/i).test(el.style.filter)){el.style.filter=""}}else{el.style.opacity="";el.style["-moz-opacity"]="";el.style["-khtml-opacity"]=""}};var fadeIn=function(el,endingOpacity,duration,callback){if(options.animate){SL.setStyle(el,"opacity",0);el.style.visibility="visible";SL.animate(el,{opacity:{to:endingOpacity}},duration,function(){if(endingOpacity==1){clearOpacity(el)}if(typeof callback=="function"){callback()}})}else{if(endingOpacity==1){clearOpacity(el)}else{SL.setStyle(el,"opacity",endingOpacity)}el.style.visibility="visible";if(typeof callback=="function"){callback()}}};var fadeOut=function(el,duration,callback){var cb=function(){el.style.visibility="hidden";clearOpacity(el);if(typeof callback=="function"){callback()}};if(options.animate){SL.animate(el,{opacity:{to:0}},duration,cb)}else{cb()}};var plugins=null;if(navigator.plugins&&navigator.plugins.length){var detectPlugin=function(plugin_name){var detected=false;for(var i=0,len=navigator.plugins.length;i<len;++i){if(navigator.plugins[i].name.indexOf(plugin_name)>-1){detected=true;break}}return detected};var f4m=detectPlugin("Flip4Mac");var plugins={fla:detectPlugin("Shockwave Flash"),qt:detectPlugin("QuickTime"),wmp:!f4m&&detectPlugin("Windows Media"),f4m:f4m}}else{var detectPlugin=function(plugin_name){var detected=false;try{var axo=new ActiveXObject(plugin_name);if(axo){detected=true}}catch(e){}return detected};var plugins={fla:detectPlugin("ShockwaveFlash.ShockwaveFlash"),qt:detectPlugin("QuickTime.QuickTime"),wmp:detectPlugin("wmplayer.ocx"),f4m:false}}var absolute_pos=isIE&&!isIE7;var appendHTML=function(el,html){el=SL.get(el);if(el.insertAdjacentHTML){el.insertAdjacentHTML("BeforeEnd",html);return el.lastChild}if(el.lastChild){var range=el.ownerDocument.createRange();range.setStartAfter(el.lastChild);var frag=range.createContextualFragment(html);el.appendChild(frag);return el.lastChild}else{el.innerHTML=html;return el.lastChild}};var overwriteHTML=function(el,html){el=SL.get(el);el.innerHTML=html;return el.firstChild};var getComputedHeight=function(el){var h=Math.max(el.offsetHeight,el.clientHeight);if(!h){h=parseInt(SL.getStyle(el,"height"),10)||0;if(!isBorderBox){h+=parseInt(SL.getStyle(el,"padding-top"),10)+parseInt(SL.getStyle(el,"padding-bottom"),10)+parseInt(SL.getStyle(el,"border-top-width"),10)+parseInt(SL.getStyle(el,"border-bottom-width"),10)}}return h};var getComputedWidth=function(el){var w=Math.max(el.offsetWidth,el.clientWidth);if(!w){w=parseInt(SL.getStyle(el,"width"),10)||0;if(!isBorderBox){w+=parseInt(SL.getStyle(el,"padding-left"),10)+parseInt(SL.getStyle(el,"padding-right"),10)+parseInt(SL.getStyle(el,"border-left-width"),10)+parseInt(SL.getStyle(el,"border-right-width"),10)}}return w};var file_types={img:["png","jpg","jpeg","gif","bmp"],qt:["dv","mov","moov","movie","mp4"],wmp:["asf","wm","wmv"],qtwmp:["avi","mpg","mpeg"],external:["asp","aspx","cgi","cfm","htm","html","pl","php","php3","php4","php5","phtml","rb","rhtml","shtml","txt","vbs"]};var img_re=new RegExp(".("+file_types.img.join("|")+")s*$","i");var qt_re=new RegExp(".("+file_types.qt.join("|")+")s*$","i");var wmp_re=new RegExp(".("+file_types.wmp.join("|")+")s*$","i");var qtwmp_re=new RegExp(".("+file_types.qtwmp.join("|")+")s*$","i");var external_re=new RegExp(".("+file_types.external.join("|")+")s*$","i");var swf_re=/\.swf\s*$/i;var flv_re=/\.flv\s*$/i;var domain_re=/:\/\/(.*?)[:\/]/;var getPlayerType=function(url){if(img_re.test(url)){return"img"}var this_domain=(domain_match=url.match(domain_re))?(document.domain==domain_match[1]):false;var q_index=url.indexOf("?");if(q_index>-1){url=url.substring(0,q_index)}if(swf_re.test(url)){return(plugins.fla)?"swf":"unsupported-swf"}else{if(flv_re.test(url)){return(plugins.fla)?"flv":"unsupported-flv"}else{if(qt_re.test(url)){return(plugins.qt)?"qt":"unsupported-qt"}else{if(wmp_re.test(url)){if(plugins.wmp){return"wmp"}else{if(plugins.f4m){return"qt"}else{if(isMac){return(plugins.qt)?"unsupported-f4m":"unsupported-qtf4m"}return"unsupported-wmp"}}}else{if(qtwmp_re.test(url)){if(plugins.qt){return"qt"}else{if(plugins.wmp){return"wmp"}else{return(isMac)?"unsupported-qt":"unsupported-qtwmp"}}}else{if(!this_domain||external_re.test(url)){return"external"}}}}}}return"unsupported"};var gallery_re=/^shadowbox\[(.*?)\]/i;var getGalleryName=function(link){if(!(rel=link.getAttribute("rel"))){return null}var match=rel.match(gallery_re);return(match?escape(match[1]):null)};var setupLink=function(link){if(name=getGalleryName(link)){if(!galleries[name]){galleries[name]=[]}galleries[name].push(Shadowbox.buildLinkObj(link))}if(Shadowbox.isSetup){SL.removeEvent(link,"click",handleClick)}SL.addEvent(link,"click",handleClick)};var unsupported_re=/^unsupported-(\w+)/;var handleClick=function(ev){var link;if(typeof this.tagName=="string"&&this.tagName.toUpperCase()=="A"){link=this}else{link=SL.getTarget(ev);while(link.tagName.toUpperCase()!="A"&&link.parentNode){link=link.parentNode}}var name=getGalleryName(link);if(name){current_gallery=galleries[name];var href=link.href;for(var i=0,len=current_gallery.length;i<len;++i){if(current_gallery[i].href==href){current=i;break}}}else{current_gallery=[Shadowbox.buildLinkObj(link)];current=0}var match;for(var i=0;i<current_gallery.length;++i){if(match=unsupported_re.exec(current_gallery[i].type)){if(options.handleUnsupported=="link"){current_gallery[i].type="msg";switch(match[1]){case"qtwmp":current_gallery[i].message=String.format(options.errors.templates["either"],options.errors["qt"].url,options.errors["qt"].name,options.errors["wmp"].url,options.errors["wmp"].name);break;case"qtf4m":current_gallery[i].message=String.format(options.errors.templates["shared"],options.errors["qt"].url,options.errors["qt"].name,options.errors["f4m"].url,options.errors["f4m"].name);break;default:if(match[1]=="swf"||match[1]=="flv"){match[1]="fla"}current_gallery[i].message=String.format(options.errors.templates["single"],options.errors[match[1]].url,options.errors[match[1]].name)}}else{var removed=current_gallery.splice(i,1);if(i<current){--current}--i}}}if(current_gallery.length){SL.preventDefault(ev);Shadowbox.open(link)}};var buildBars=function(){var link=current_gallery[current];if(!link){return }var title_i=SL.get("shadowbox_title_inner");title_i.innerHTML=(link.title)?link.title:"";var tool_i=SL.get("shadowbox_toolbar_inner");tool_i.innerHTML="";
    //set up the image description and credits
    var meta_i=SL.get("shadowbox_meta");
    var desc_i=SL.get("shadowbox_desc");
    var credit_i=SL.get("shadowbox_credit");
    if (link.desc == '' && link.credit == ''){$(meta_i).slideUp();}
    else
    {
        if(link.desc == ''){$(desc_i).hide();}
        else{$(desc_i).text(link.desc);$(desc_i).show();}
        if(link.credit == ''){$(credit_i).hide();}
        else{$(credit_i).text('Credit: ' + link.credit);$(credit_i).show();}
        $(meta_i).slideDown();
    }
if(options.displayNav){tool_i.innerHTML=options.skin.nav.close;if(current_gallery.length>1){if(options.continuous){appendHTML(tool_i,options.skin.nav.next);appendHTML(tool_i,options.skin.nav.prev)}else{if((current_gallery.length-1)>current){appendHTML(tool_i,options.skin.nav.next)}if(current>0){appendHTML(tool_i,options.skin.nav.prev)}}}}if(current_gallery.length>1&&options.displayCounter){appendHTML(tool_i,options.skin.counter);var counter="";if(options.counterType=="skip"){for(var i=0,len=current_gallery.length;i<len;++i){counter+='<a href="javascript:Shadowbox.change('+i+');"';if(i==current){counter+=' class="shadowbox_counter_current"'}counter+=">"+(i+1)+"</a>"}}else{counter=(current+1)+" of "+current_gallery.length}overwriteHTML("shadowbox_counter",counter)}};var hideBars=function(callback){var title_m=getComputedHeight(SL.get("shadowbox_title"));var tool_m=0-getComputedHeight(SL.get("shadowbox_toolbar"));var title_i=SL.get("shadowbox_title_inner");var tool_i=SL.get("shadowbox_toolbar_inner");if(callback){SL.animate(title_i,{marginTop:{to:title_m}},0.2);SL.animate(tool_i,{marginTop:{to:tool_m}},0.2,callback)}else{SL.setStyle(title_i,"marginTop",title_m+"px");SL.setStyle(tool_i,"marginTop",tool_m+"px")}};var showBars=function(callback){var title_i=SL.get("shadowbox_title_inner");if(options.animate){if(title_i.innerHTML!=""){SL.animate(title_i,{marginTop:{to:0}},0.35)}SL.animate(SL.get("shadowbox_toolbar_inner"),{marginTop:{to:0}},0.35,callback)}else{if(title_i.innerHTML!=""){SL.setStyle(title_i,"margin-top","0px")}SL.setStyle(SL.get("shadowbox_toolbar_inner"),"margin-top","0px");callback()}};var setContent=function(obj){var id="shadowbox_content";var content=SL.get(id);if(content){switch(content.tagName.toUpperCase()){case"OBJECT":var link=current_gallery[(obj?current-1:current)];if(link.type=="wmp"&&isIE){try{shadowbox_content.controls.stop();shadowbox_content.URL="non-existent.wmv";window.shadowbox_content=function(){}}catch(e){}}else{if(link.type=="qt"&&isSafari){try{document.shadowbox_content.Stop()}catch(e){}content.innerHTML=""}}setTimeout(function(){SL.remove(content)},10);break;case"IFRAME":SL.remove(content);if(isGecko){delete window.frames[id]}break;default:SL.remove(content)}}if(obj){obj.id=id;return appendHTML("shadowbox_body_inner",Shadowbox.createHTML(obj))}return null};var loadContent=function(){var link=current_gallery[current];if(!link){return }buildBars();switch(link.type){case"img":preloader=new Image();preloader.onload=function(){resizeContent(preloader.height,preloader.width,function(dims){showBars(function(){setContent({tag:"img",height:dims.i_height,width:dims.i_width,src:link.href});finishContent()})});preloader.onload=function(){}};preloader.src=link.href;break;case"swf":case"flv":case"qt":case"wmp":var markup=Shadowbox.movieMarkup(link);resizeContent(markup.height,markup.width,function(){showBars(function(){setContent(markup);finishContent()})});break;case"external":var height=link.height?parseInt(link.height,10):getViewportHeight();var width=link.width?parseInt(link.width,10):getViewportWidth();var content={tag:"iframe",name:"shadowbox_content",height:"100%",width:"100%",frameborder:"0",marginwidth:"0",marginheight:"0",scrolling:"auto"};resizeContent(height,width,function(){showBars(function(){setContent(content);var win=(isIE)?SL.get("shadowbox_content").contentWindow:window.frames["shadowbox_content"];win.location=link.href;finishContent()})});break;case"msg":var height=options.initialHeight;var width=options.initialWidth;var content={tag:"div",cls:"shadowbox_message",html:link.message};resizeContent(height,width,function(){showBars(function(){setContent(content);finishContent()})});break;case"unsupported":throw"Content type cannot be determined for "+link.href;break}if(current_gallery.length>0){var next=current_gallery[current+1];if(!next){next=current_gallery[0]}if(next.type=="img"){var preload_next=new Image();preload_next.src=next.href}var prev=current_gallery[current-1];if(!prev){prev=current_gallery[current_gallery.length-1]}if(prev.type=="img"){var preload_prev=new Image();preload_prev.src=prev.href}}};var finishContent=function(){var link=current_gallery[current];if(!link){return }hideLoading(function(){if(options.onClose&&typeof options.onClose=="function"){options.onClose(SL.get(link.id))}listenKeyboard(true)})};var resizeContent=function(height,width,callback){if(height&&width){current_height=height;current_width=width}var dims=getDimensions(current_height,current_width);if(callback){adjustWidth(dims.width,true,function(){adjustHeight(dims.height,dims.top,true,function(){callback(dims)})})}else{adjustWidth(dims.width,false);adjustHeight(dims.height,dims.top,false)}};var getDimensions=function(o_height,o_width){var height=o_height=parseInt(o_height);var width=o_width=parseInt(o_width);var shadowbox_b=SL.get("shadowbox_body");var view_height=getViewportHeight();var extra_height=parseInt(SL.getStyle(shadowbox_b,"border-top-width"),10)+parseInt(SL.getStyle(shadowbox_b,"border-bottom-width"),10)+parseInt(SL.getStyle(shadowbox_b,"margin-top"),10)+parseInt(SL.getStyle(shadowbox_b,"margin-bottom"),10)+getComputedHeight(SL.get("shadowbox_title"))+getComputedHeight(SL.get("shadowbox_toolbar"))+(2*options.viewportPadding);if((height+extra_height)>=view_height){height=view_height-extra_height}var view_width=getViewportWidth();var extra_body_width=parseInt(SL.getStyle(shadowbox_b,"border-left-width"),10)+parseInt(SL.getStyle(shadowbox_b,"border-right-width"),10)+parseInt(SL.getStyle(shadowbox_b,"margin-left"),10)+parseInt(SL.getStyle(shadowbox_b,"margin-right"),10);var extra_width=extra_body_width+(2*options.viewportPadding);if((width+extra_width)>=view_width){width=view_width-extra_width}if(options.resizeLgImages){var change_h=(o_height-height)/o_height;var change_w=(o_width-width)/o_width;if(change_h>change_w){width=Math.round((o_width/o_height)*height)}else{if(change_w>change_h){height=Math.round((o_height/o_width)*width)}}}var i_height=(options.resizeLgImages)?height:o_height;var i_width=(options.resizeLgImages)?width:o_width;return{height:height,width:width+extra_body_width,i_height:i_height,i_width:i_width,top:((view_height-(height+extra_height))/2)+options.viewportPadding}};var centerVertically=function(){var shadowbox=SL.get("shadowbox");var scroll=document.documentElement.scrollTop;var s_top=scroll+Math.round((getViewportHeight()-(shadowbox.offsetHeight||0))/2);SL.setStyle(shadowbox,"top",s_top+"px")};var adjustHeight=function(height,top,animate,callback){height=parseInt(height);var sbi=SL.get("shadowbox_body_inner");if(animate&&options.animate){SL.animate(sbi,{height:{to:height}},options.resizeDuration,callback)}else{SL.setStyle(sbi,"height",height+"px");if(typeof callback=="function"){callback()}}if(absolute_pos){centerVertically();SL.addEvent(window,"scroll",centerVertically);top+=document.documentElement.scrollTop}var shadowbox=SL.get("shadowbox");if(animate&&options.animate){SL.animate(shadowbox,{top:{to:top}},options.resizeDuration)}else{SL.setStyle(shadowbox,"top",top+"px")}};var adjustWidth=function(width,animate,callback){width=parseInt(width);var shadowbox=SL.get("shadowbox");if(animate&&options.animate){SL.animate(shadowbox,{width:{to:width}},options.resizeDuration,callback)}else{SL.setStyle(shadowbox,"width",width+"px");if(typeof callback=="function"){callback()}}};var listenKeyboard=function(on){if(!options.enableKeys){return }if(on){document.onkeydown=handleKey}else{document.onkeydown=""}};var assertKey=function(valid,key,code){return(valid.indexOf(key)!=-1||valid.indexOf(code)!=-1)};var handleKey=function(e){var code=e?e.which:event.keyCode;var key=String.fromCharCode(code).toLowerCase();if(assertKey(options.keysClose,key,code)){Shadowbox.close()}else{if(assertKey(options.keysPrev,key,code)){Shadowbox.previous()}else{if(assertKey(options.keysNext,key,code)){Shadowbox.next()}}}};var toggleTroubleElements=function(on){var vis=(on?"visible":"hidden");var selects=document.getElementsByTagName("select");for(i=0,len=selects.length;i<len;++i){selects[i].style.visibility=vis}var objects=document.getElementsByTagName("object");for(i=0,len=objects.length;i<len;++i){objects[i].style.visibility=vis}var embeds=document.getElementsByTagName("embed");for(i=0,len=embeds.length;i<len;++i){embeds[i].style.visibility=vis}};var showLoading=function(){var loading=SL.get("shadowbox_loading");loading.style.visibility="visible"};var hideLoading=function(callback){var content=current_gallery[current];var anim=(content.type=="img");var loading=SL.get("shadowbox_loading");if(anim){fadeOut(loading,0.35,callback)}else{loading.style.visibility="hidden";callback()}};var resizeOverlay=function(){var overlay=SL.get("shadowbox_overlay");SL.setStyle(overlay,{height:"100%",width:"100%"});SL.setStyle(overlay,{height:getDocumentHeight()+"px"})};var checkOverlayImgNeeded=function(){if(!(isGecko&&isMac)){return false}var type;for(var i=0,len=current_gallery.length;i<len;++i){type=current_gallery[i].type;if(type!="img"&&type!="msg"){return true}}return false};var overlay_img_needed=null;var toggleOverlay=function(callback){var overlay=SL.get("shadowbox_overlay");if(overlay_img_needed==null){overlay_img_needed=checkOverlayImgNeeded()}if(callback){resizeOverlay();if(overlay_img_needed){SL.setStyle(overlay,{visibility:"visible",backgroundColor:"transparent",backgroundImage:"url("+options.overlayBgImage+")",backgroundRepeat:"repeat",opacity:1});callback()}else{SL.setStyle(overlay,{visibility:"visible",backgroundColor:options.overlayColor,backgroundImage:"none"});fadeIn(overlay,options.overlayOpacity,options.fadeDuration,callback)}}else{if(overlay_img_needed){SL.setStyle(overlay,"visibility","hidden")}else{fadeOut(overlay,options.fadeDuration)}overlay_img_needed=null}};var applyProps=function(orig,ext){for(var p in ext){orig[p]=ext[p]}return orig};var isInitialized=false;Shadowbox.init=function(default_options){if(isInitialized){return }options=applyProps(options,default_options||{});Shadowbox.setup();options.skin.main=options.skin.main.replace(/\{loading_img_replace\}/,options.loadingImage);appendHTML(document.body,options.skin.main);SL.addEvent(window,"resize",function(){if(activated){resizeOverlay();resizeContent(current_height,current_width)}});SL.addEvent(SL.get("shadowbox_overlay"),"click",function(){Shadowbox.close()});if(absolute_pos){SL.setStyle(SL.get("shadowbox_container"),"position","absolute");SL.setStyle("shadowbox_body","zoom",1);SL.addEvent(SL.get("shadowbox_container"),"click",function(e){var target=SL.getTarget(e);if(target.id&&target.id=="shadowbox_container"){Shadowbox.close()}})}isInitialized=true};Shadowbox.isSetup=false;Shadowbox.setup=function(){galleries=[];var links=document.getElementsByTagName("a");var rel_re=/^shadowbox/i,rel;for(var i=0,len=links.length;i<len;++i){rel=links[i].getAttribute("rel");if(rel&&rel_re.test(rel)){setupLink(links[i])}}this.isSetup=true};var default_options=null;Shadowbox.open=function(link){if(activated){return }activated=true;if(default_options){options=default_options;default_options=null}if(current_gallery[current].options){default_options=applyProps({},options);options=applyProps(options,current_gallery[current].options)}if(options.onOpen&&typeof options.onOpen=="function"){options.onOpen(link)}SL.setStyle(SL.get("shadowbox"),"display","block");toggleTroubleElements(false);var dims=getDimensions(options.initialHeight,options.initialWidth);adjustHeight(dims.height,dims.top);adjustWidth(dims.width);hideBars(false);toggleOverlay(function(){SL.setStyle(SL.get("shadowbox"),"visibility","visible");showLoading();loadContent()})};Shadowbox.change=function(num){if(!current_gallery){return }if(!current_gallery[num]){if(!options.continuous){return }else{num=(num<0)?(current_gallery.length-1):0}}setContent(null);listenKeyboard(false);current=num;showLoading();hideBars(loadContent)};Shadowbox.next=function(){this.change(current+1)};Shadowbox.previous=function(){this.change(current-1)};Shadowbox.close=function(){if(!activated){return }listenKeyboard(false);SL.setStyle(SL.get("shadowbox"),{display:"none",visibility:"hidden"});toggleTroubleElements(true);if(absolute_pos){SL.removeEvent(window,"scroll",centerVertically)}setContent(null);if(preloader){preloader.onload=function(){};preloader=null}toggleOverlay(false);activated=false};var param_re=/\s*([a-z_]*?)\s*=\s*(.+)\s*/;var extension_re=/\.([a-z]+)(\?|#|$)/;Shadowbox.buildLinkObj=function(link){
    //set up the link object
    var href=link.href;
    var match=href.match(extension_re);
    var ext=(match?match[1].toLowerCase():"");
    var desc=$(link).find('.Desc').val();
    var credit=$(link).find('.Credit').val();
    var obj=
    {
        id:link.id,
        title:link.getAttribute("title"),
        href:href,
        type:getPlayerType(href),
        extension:ext,
        desc:desc,
        credit:credit
    };
var params=link.getAttribute("rel").split(";");if(params.length>1){params.shift();var match;for(var i=0,len=params.length;i<len;++i){match=params[i].match(param_re);if(match){if(match[1]=="options"){eval("obj.options = "+match[2])}else{obj[match[1]]=match[2]}}}}return obj};Shadowbox.movieMarkup=function(link){var height=link.height?parseInt(link.height):300;var width=link.width?parseInt(link.width):300;var autoplay=options.autoplayMovies;var controls=options.showMovieControls;if(link.options){if(link.options.autoplayMovies!=null){autoplay=link.options.autoplayMovies}if(link.options.showMovieControls!=null){controls=link.options.showMovieControls}}var markup={tag:"object",name:"shadowbox_content"};switch(link.type){case"swf":markup.type="application/x-shockwave-flash";markup.data=link.href;markup.children=[{tag:"param",name:"movie",value:link.href}];break;case"flv":autoplay=autoplay?"true":"false";var displayheight=height;var showicons="false";if(controls){showicons="true";height+=20}
    var flashvars = 
        [
            "file="+link.href,"height="+height,"width="+width,"autostart="+autoplay,"displayheight="+displayheight,"showicons="+showicons,
            "backcolor=0x111111&amp;frontcolor=0xFFFFFF&amp;lightcolor=0xBB9999",
            "type=flv"
        ];
markup.type="application/x-shockwave-flash";markup.data=options.flvPlayer;markup.children=[{tag:"param",name:"movie",value:options.flvPlayer},{tag:"param",name:"flashvars",value:flashvars.join("&amp;")},{tag:"param",name:"allowfullscreen",value:"true"}];break;case"qt":autoplay=autoplay?"true":"false";if(controls){controls="true";height+=16}else{controls="false"}markup.children=[{tag:"param",name:"src",value:link.href},{tag:"param",name:"scale",value:"aspect"},{tag:"param",name:"controller",value:controls},{tag:"param",name:"autoplay",value:autoplay}];if(navigator.plugins&&navigator.plugins.length){markup.type="video/quicktime";markup.data=link.href}else{markup.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";markup.codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"}break;case"wmp":autoplay=autoplay?1:0;markup.children=[{tag:"param",name:"autostart",value:autoplay}];if(navigator.plugins&&navigator.plugins.length){if(controls){controls=1;height+=45}else{controls=0}markup.type="video/x-ms-wmv";markup.data=link.href;markup.children[markup.children.length]={tag:"param",name:"showcontrols",value:controls}}else{if(controls){controls="full";height+=70}else{controls="none"}markup.classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6";markup.children[markup.children.length]={tag:"param",name:"url",value:link.href};markup.children[markup.children.length]={tag:"param",name:"uimode",value:controls}}break}markup.height=height;markup.width=width;return markup};var empty_re=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;Shadowbox.createHTML=function(obj){var html="<"+obj.tag;for(var attr in obj){if(attr=="tag"||attr=="children"){continue}if(attr=="cls"){html+=' class="'+obj["cls"]+'"'}else{html+=" "+attr+'="'+obj[attr]+'"'}}if(empty_re.test(obj.tag)){html+="/>\n"}else{html+=">\n";var cn=obj.children;if(cn){for(var i=0,len=cn.length;i<len;++i){html+=this.createHTML(cn[i])}}html+="</"+obj.tag+">\n"}return html};Shadowbox.getPlugins=function(){return plugins};Shadowbox.getOptions=function(){return options}})();Array.prototype.indexOf=Array.prototype.indexOf||function(C){for(var B=0,A=this.length;B<A;++B){if(this[B]==C){return B}}return -1};String.format=String.format||function(B){var A=Array.prototype.slice.call(arguments,1);return B.replace(/\{(\d+)\}/g,function(C,D){return A[D]})}

//initialization
$(document).ready(function()
{
    if (typeof(Shadowbox) != 'undefined')
    {
        var strRootURL = $('.RootURL').val();
    
        //shadowbox init
        var options = {
            loadingImage:       strRootURL + 'images/icon-loading-dark.gif', 
            flvPlayer:          strRootURL + 'flash/mediaplayer.swf', 
            overlayColor:       '#000000', 
            initialHeight:      150, 
            initialWidth:       300, 
            resizeLgImages:     true, 
            handleUnsupported:  'remove'
        };

        Shadowbox.init(options);
    }
});
