/* st2 angepasste verseion! */
jQuery(function($){var q=navigator.userAgent.toLowerCase();var r=(q.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/)||[0,'0'])[1];var s=(/msie/.test(q)&&!/opera/.test(q)&&parseInt(r)<7&&(!window.XMLHttpRequest||typeof(XMLHttpRequest)==='function'));var t=$('body');var u;var v;var x=false;var y={};var z=false;var A;var B;var C={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition:false,resizing:false,closing:false,error:false,blocker:null,blockerVars:null,full:null,bg:null,loading:null,tmp:null,content:null,wrapper:null,contentWrapper:null,scripts:new Array(),scriptsShown:new Array()};var D={width:false,height:false,windowResizing:false};var E={width:null,height:null,windowResizing:true};var F;$.fn.nyroModal=function(b){if(!this)return false;return this.each(function(){var a=$(this);if(this.nodeName.toLowerCase()=='form'){a.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(e.isDefaultPrevented())return false;if(a.data('nyroModalprocessing'))return true;if(this.enctype=='multipart/form-data'){processModal($.extend(b,{from:this}));return true}e.preventDefault();processModal($.extend(b,{from:this}));return false})}else{a.unbind('click.nyroModal').bind('click.nyroModal',function(e){if(e.isDefaultPrevented())return false;e.preventDefault();processModal($.extend(b,{from:this}));return false})}})};$.fn.nyroModalManual=function(a){if(!this.length)processModal(a);return this.each(function(){processModal($.extend(a,{from:this}))})};$.nyroModalManual=function(a){processModal(a)};$.nyroModalSettings=function(a,b,c){setCurrentSettings(a,b,c);if(!b&&C.started){if(C.bg&&a.bgColor)u.updateBgColor(C,u,function(){});if(C.contentWrapper&&a.title)setTitle();if(!C.error&&(a.windowResizing||(!C.resizing&&(('width'in a&&a.width==u.width)||('height'in a&&a.height==u.height))))){C.resizing=true;if(C.contentWrapper)calculateSize(true);if(C.contentWrapper&&C.contentWrapper.is(':visible')&&!C.animContent){if(z)C.content.css({position:''});u.resize(C,u,function(){u.windowResizing=false;C.resizing=false;if(z)C.content.css({position:'fixed'});if($.isFunction(u.endResize))u.endResize(C,u)})}}}};$.nyroModalRemove=function(){removeModal()};$.nyroModalNext=function(){var a=getGalleryLink(1);if(a)return a.nyroModalManual(getCurrentSettingsNew());return false};$.nyroModalPrev=function(){var a=getGalleryLink(-1);if(a)return a.nyroModalManual(getCurrentSettingsNew());return false};$.fn.nyroModal.settings={getTitleFromAttr:'rev',debug:false,blocker:false,windowResize:true,modal:false,type:'',forceType:null,from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:400,minHeight:250,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',addImageDivTitle:true,defaultImgAlt:'Bild',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Zur&uuml;ck</a><a href="#"  class="nyroModalNext">Weiter</a>',galleryCounts:galleryCounts,galleryLoop:false,zIndexStart:100,css:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'50%',left:'50%'},wrapper2:{},content:{},loading:{position:'absolute',top:'50%',left:'50%',marginTop:'-50px',marginLeft:'-50px'}},wrap:{div:'<div class="wrapper"></div>',ajax:'<div class="wrapper"></div>',form:'<div class="wrapper"></div>',formData:'<div class="wrapper"></div>',image:'<div class="wrapperImg"></div>',swf:'<div class="wrapperSwf"></div>',iframe:'<div class="wrapperIframe"></div>',iframeForm:'<div class="wrapperIframe"></div>',manual:'<div class="wrapper"></div>'},closeButton:'<a href="#" class="nyroModalClose" id="closeBut" title="Schlie&szlig;en">Schlie&szlig;en</a>',title:null,titleFromIframe:true,openSelector:'.nyroModal',closeSelector:'.nyroModalClose',contentLoading:'<a href="#" class="nyroModalClose">Abbruch</a>',errorClass:'error',contentError:'Der angeforderte Inhalt konnte nicht geladen werden.<br />Bitte versuchen Sie es sp&auml;ter noch einmal.<br /><a href="#" class="nyroModalClose">Schlie&szlig;en</a>',handleError:null,showBackground:showBackground,hideBackground:hideBackground,endFillContent:null,showContent:showContent,endShowContent:null,beforeHideContent:null,hideContent:hideContent,showTransition:showTransition,hideTransition:hideTransition,showLoading:showLoading,hideLoading:hideLoading,resize:resize,endResize:null,updateBgColor:updateBgColor,endRemove:null};function processModal(c){if(C.loadingShown||C.transition||C.anim)return;debug('processModal');C.started=true;v=$.extend(true,c);setDefaultCurrentSettings(c);if(!C.full)C.blockerVars=C.blocker=null;C.error=false;C.closing=false;C.dataReady=false;C.scripts=new Array();C.scriptsShown=new Array();u.type=fileType();if(u.forceType){if(!u.content)u.from=true;u.type=u.forceType;u.forceType=null}if($.isFunction(u.processHandler))u.processHandler(u);var d=u.from;var e=u.url;E.width=u.width;E.height=u.height;if(u.type=='swf'){setCurrentSettings({overflow:'visible'},'css','content');u.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+u.width+'" height="'+u.height+'"><param name="movie" value="'+e+'"></param>';var f='';$.each(u.swf,function(a,b){u.content+='<param name="'+a+'" value="'+b+'"></param>';f+=' '+a+'="'+b+'"'});u.content+='<embed src="'+e+'" type="application/x-shockwave-flash" width="'+u.width+'" height="'+u.height+'"'+f+'></embed></object>'}if(d){var g=$(d).blur();if(u.type=='form'){var i=$(d).serializeArray();i.push({name:u.formIndicator,value:1});if(u.selector)i.push({name:u.selIndicator,value:u.selector.substring(1)});$.ajax($.extend({},u.ajax,{url:e,data:i,type:g.attr('method')?g.attr('method'):'get',success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+g.attr('action'));showModal()}else if(u.type=='formData'){initModal();g.attr('target','nyroModalIframe');g.attr('action',e);g.prepend('<input type="hidden" name="'+u.formIndicator+'" value="1" />');if(u.selector)g.prepend('<input type="hidden" name="'+u.selIndicator+'" value="'+u.selector.substring(1)+'" />');C.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:\'\';"></iframe>');$('iframe',C.tmp).css({width:u.width,height:u.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+g.attr('action'));showModal();showContentOrLoading()}else if(u.type=='image'){debug('Image Load: '+e);var j=g.attr('title')||u.defaultImgAlt;initModal();C.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',j);C.tmp.css({lineHeight:0});$('img',C.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=C.tmp.width();var h=C.tmp.height();C.tmp.css({lineHeight:''});D.width=w;D.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});E.width=w;E.height=h;setCurrentSettings({overflow:'visible'},'css','content');C.dataReady=true;if(C.loadingShown||C.transition)showContentOrLoading()}).attr('src',e);showModal()}else if(u.type=='iframeForm'){initModal();C.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+e);$('iframe',C.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);C.dataReady=true;showModal()}else if(u.type=='iframe'){initModal();C.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+e);$('iframe',C.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);C.dataReady=true;showModal()}else if(u.type){debug('Content: '+u.type);initModal();C.tmp.html(u.content);var w=C.tmp.width();var h=C.tmp.height();var k=$(u.type);if(k.length){setCurrentSettings({type:'div'});w=k.width();h=k.height();if(A)B=A;A=k;C.tmp.append(k.contents())}E.width=w;E.height=h;setCurrentSettings({width:w,height:h});if(C.tmp.html())C.dataReady=true;else loadingError();if(!C.ready)showModal();else endHideContent()}else{debug('Ajax Load: '+e);setCurrentSettings({type:'ajax'});var i=u.ajax.data||{};if(u.selector){if(typeof i=="string"){i+='&'+u.selIndicator+'='+u.selector.substring(1)}else{i[u.selIndicator]=u.selector.substring(1)}}$.ajax($.extend(true,u.ajax,{url:e,success:ajaxLoaded,error:loadingError,data:i}));showModal()}}else if(u.content){debug('Content: '+u.type);setCurrentSettings({type:'manual'});initModal();C.tmp.html($('<div/>').html(u.content).contents());if(C.tmp.html())C.dataReady=true;else loadingError();showModal()}else{}}function setDefaultCurrentSettings(a){debug('setDefaultCurrentSettings');u=$.extend(true,{},$.fn.nyroModal.settings,a);setMargin()}function setCurrentSettings(a,b,c){if(C.started){if(b&&c){$.extend(true,u[b][c],a)}else if(b){$.extend(true,u[b],a)}else{if(C.animContent){if('width'in a){if(!C.resizing){a.setWidth=a.width;x=true}delete a['width']}if('height'in a){if(!C.resizing){a.setHeight=a.height;x=true}delete a['height']}}$.extend(true,u,a)}}else{if(b&&c){$.extend(true,$.fn.nyroModal.settings[b][c],a)}else if(b){$.extend(true,$.fn.nyroModal.settings[b],a)}else{$.extend(true,$.fn.nyroModal.settings,a)}}}function setMarginScroll(){if(s&&!C.blocker){if(document.documentElement){u.marginScrollLeft=document.documentElement.scrollLeft;u.marginScrollTop=document.documentElement.scrollTop}else{u.marginScrollLeft=document.body.scrollLeft;u.marginScrollTop=document.body.scrollTop}}else{u.marginScrollLeft=0;u.marginScrollTop=0}}function setMargin(){setMarginScroll();u.marginLeft=-(u.width+u.borderW)/2;u.marginTop=-(u.height+u.borderH)/2;if(!C.blocker){u.marginLeft+=u.marginScrollLeft;u.marginTop+=u.marginScrollTop}}function setMarginLoading(){setMarginScroll();var a=getOuter(C.loading);u.marginTopLoading=-(C.loading.height()+a.h.border+a.h.padding)/2;u.marginLeftLoading=-(C.loading.width()+a.w.border+a.w.padding)/2;if(!C.blocker){u.marginLefttLoading+=u.marginScrollLeft;u.marginTopLoading+=u.marginScrollTop}}function setTitle(){var a=$('h1#nyroModalTitle',C.contentWrapper);if(a.length)a.text(u.title);else C.contentWrapper.prepend('<h1 id="nyroModalTitle">'+u.title+'</h1>')}function initModal(){debug('initModal');if(!C.full){if(u.debug)setCurrentSettings({color:'white'},'css','bg');var b={zIndex:u.zIndexStart,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var c=t;var f='';if(u.blocker){C.blocker=c=$(u.blocker);var g=C.blocker.offset();var w=C.blocker.outerWidth();var h=C.blocker.outerHeight();if(s){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'css','bg')}C.blockerVars={top:g.top,left:g.left,width:w,height:h};var i=(/msie/.test(q)?0:getCurCSS(t.get(0),'borderTopWidth'));var j=(/msie/.test(q)?0:getCurCSS(t.get(0),'borderLeftWidth'));b={position:'absolute',top:g.top+i,left:g.left+j,width:w,height:h}}else if(s){t.css({height:(t.height()+200)+'px',width:(t.width()+200)+'px',position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({css:{bg:{position:'absolute',zIndex:u.zIndexStart+1,height:'110%',width:'110%',top:u.marginScrollTop+'px',left:u.marginScrollLeft+'px'},wrapper:{zIndex:u.zIndexStart+2},loading:{zIndex:u.zIndexStart+3}}});f=$('<iframe id="nyroModalIframeHideIe" src="javascript:\'\';"></iframe>').css($.extend({},u.css.bg,{opacity:0,zIndex:50,border:'none'}))}c.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide());C.full=$('#nyroModalFull').css(b).show();C.bg=$('#nyroModalBg').css($.extend({backgroundColor:u.bgColor},u.css.bg)).before(f);C.bg.bind('click.nyroModal',clickBg);C.loading=$('#nyroModalLoading').css(u.css.loading).hide();C.contentWrapper=$('#nyroModalWrapper').css(u.css.wrapper).hide();C.content=$('#nyroModalContent');C.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){C.content.mousewheel(function(e,d){var a=C.content.get(0);if((d>0&&a.scrollTop==0)||(d<0&&a.scrollHeight-a.scrollTop==a.clientHeight)){e.preventDefault();e.stopPropagation()}})}$(document).bind('keydown.nyroModal',keyHandler);C.content.css({width:'auto',height:'auto'});C.contentWrapper.css({width:'auto',height:'auto'});if(!u.blocker&&u.windowResize){$(window).bind('resize.nyroModal',function(){window.clearTimeout(F);F=window.setTimeout(windowResizeHandler,200)})}}}function windowResizeHandler(){$.nyroModalSettings(E)}function showModal(){debug('showModal');if(!C.ready){initModal();C.anim=true;u.showBackground(C,u,endBackground)}else{C.anim=true;C.transition=true;u.showTransition(C,u,function(){endHideContent();C.anim=false;showContentOrLoading()})}}function clickBg(e){if(!u.modal)removeModal()}function keyHandler(e){if(e.keyCode==27){if(!u.modal)removeModal()}else if(u.gallery&&C.ready&&C.dataReady&&!C.anim&&!C.transition){if(e.keyCode==39||e.keyCode==40){e.preventDefault();$.nyroModalNext();return false}else if(e.keyCode==37||e.keyCode==38){e.preventDefault();$.nyroModalPrev();return false}}}function fileType(){var a=u.from;var b;if(a&&a.nodeName){var c=$(a);b=c.attr(a.nodeName.toLowerCase()=='form'?'action':'href');if(!b)b=location.href.substring(window.location.host.length+7);u.url=b;if(c.attr('rev')=='modal')u.modal=true;u.title=c.attr('title');if(u.getTitleFromAttr.length){u.title=c.attr(u.getTitleFromAttr)}if(u.title.length){u.title=u.title.split("|br|").join("<br/>")}if(a&&a.rel&&a.rel.toLowerCase()!='nofollow'){var d=a.rel.indexOf(' ');u.gallery=d>0?a.rel.substr(0,d):a.rel}var e=imageType(b,a);if(e)return e;if(isSwf(b))return'swf';var f=false;if(a.target&&a.target.toLowerCase()=='_blank'||(a.hostname&&a.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){f=true}if(a.nodeName.toLowerCase()=='form'){if(f)return'iframeForm';setCurrentSettings(extractUrlSel(b));if(c.attr('enctype')=='multipart/form-data')return'formData';return'form'}if(f)return'iframe'}else{b=u.url;if(!u.content)u.from=true;if(!b)return null;if(isSwf(b))return'swf';var g=new RegExp("^http://|https://","g");if(b.match(g))return'iframe'}var e=imageType(b,a);if(e)return e;var h=extractUrlSel(b);setCurrentSettings(h);if(!h.url)return h.selector}function imageType(a,b){var c=new RegExp(u.regexImg,'i');if(c.test(a)){return'image'}}function isSwf(a){var b=new RegExp('[^\.]\.(swf)\s*$','i');return b.test(a)}function extractUrlSel(a){var b={url:null,selector:null};if(a){var c=getHash(a);var d=getHash(window.location.href);var e=window.location.href.substring(0,window.location.href.length-d.length);var f=a.substring(0,a.length-c.length);if(f==e||f==$('base').attr('href')){b.selector=c}else{b.url=f;b.selector=c}}return b}function loadingError(){debug('loadingError');C.error=true;if(!C.ready)return;if($.isFunction(u.handleError))u.handleError(C,u);C.loading.addClass(u.errorClass).html(u.contentError);$(u.closeSelector,C.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();C.loading.css({marginTop:u.marginTopLoading+'px',marginLeft:u.marginLeftLoading+'px'})}function fillContent(){debug('fillContent');if(!C.tmp.html())return;C.content.html(C.tmp.contents());C.tmp.empty();wrapContent();if(u.type=='iframeForm'){$(u.from).attr('target','nyroModalIframe').data('nyroModalprocessing',1).submit().attr('target','_blank').removeData('nyroModalprocessing')}C.wrapper.prepend(u.closeButton);if($.isFunction(u.endFillContent))u.endFillContent(C,u);C.content.append(C.scripts);$(u.closeSelector,C.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal',removeModal);$(u.openSelector,C.contentWrapper).nyroModal(getCurrentSettingsNew());$("iframe",C.content).show()}function getCurrentSettingsNew(){return v;var a=$.extend(true,{},u);if(D.width)a.width=null;else a.width=E.width;if(D.height)a.height=null;else a.height=E.height;a.css.content.overflow='auto';return a}function wrapContent(){debug('wrapContent');var a=$(u.wrap[u.type]);C.content.append(a.children().remove());C.contentWrapper.wrapInner(a);if(u.gallery){C.content.append(u.galleryLinks);y.links=$('[rel="'+u.gallery+'"], [rel^="'+u.gallery+' "]');y.index=y.links.index(u.from);if(u.galleryCounts&&$.isFunction(u.galleryCounts))u.galleryCounts(y.index+1,y.links.length,C,u);var b=getCurrentSettingsNew();var c=getGalleryLink(-1);if(c){var d=$('.nyroModalPrev',C.contentWrapper).attr('href',c.attr('href')).click(function(e){e.preventDefault();$.nyroModalPrev();return false});if(s&&u.type=='swf'){d.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:\'\';"></iframe>').css({position:d.css('position'),top:d.css('top'),left:d.css('left'),width:d.width(),height:d.height(),opacity:0,border:'none'}))}}else{$('.nyroModalPrev',C.contentWrapper).remove()}var f=getGalleryLink(1);if(f){var g=$('.nyroModalNext',C.contentWrapper).attr('href',f.attr('href')).click(function(e){e.preventDefault();$.nyroModalNext();return false});if(s&&u.type=='swf'){g.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:\'\';"></iframe>').css($.extend({},{position:g.css('position'),top:g.css('top'),left:g.css('left'),width:g.width(),height:g.height(),opacity:0,border:'none'})))}}else{$('.nyroModalNext',C.contentWrapper).remove()}}calculateSize()}function getGalleryLink(a){if(u.gallery){if(!u.ltr)a*=-1;var b=y.index+a;if(b>=0&&b<y.links.length)return y.links.eq(b);else if(u.galleryLoop){if(b<0)return y.links.eq(y.links.length-1);else return y.links.eq(0)}}return false}function calculateSize(a){debug('calculateSize');C.wrapper=C.contentWrapper.children('div:first');D.width=false;D.height=false;if(false&&!u.windowResizing){E.width=u.width;E.height=u.height}if(u.autoSizable&&(!u.width||!u.height)){C.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var b={width:'auto',height:'auto'};if(u.width){b.width=u.width}else if(u.type=='iframe'){b.width=u.minWidth}if(u.height){b.height=u.height}else if(u.type=='iframe'){b.height=u.minHeight}C.content.css(b);if(!u.width){u.width=C.content.outerWidth(true);D.width=true}if(!u.height){u.height=C.content.outerHeight(true);D.height=true}C.contentWrapper.css({opacity:1});if(!a)C.contentWrapper.hide()}if(u.type!='image'&&u.type!='swf'){u.width=Math.max(u.width,u.minWidth);u.height=Math.max(u.height,u.minHeight)}var c=getOuter(C.contentWrapper);var d=getOuter(C.wrapper);var e=getOuter(C.content);var b={content:{width:u.width,height:u.height},wrapper2:{width:u.width+e.w.total,height:u.height+e.h.total},wrapper:{width:u.width+e.w.total+d.w.total,height:u.height+e.h.total+d.h.total}};if(u.resizable){var f=C.blockerVars?C.blockerVars.height:$(window).height()-c.h.border-(b.wrapper.height-u.height);var g=C.blockerVars?C.blockerVars.width:$(window).width()-c.w.border-(b.wrapper.width-u.width);f-=u.padding*2;g-=u.padding*2;if(b.content.height>f||b.content.width>g){if(u.type=='image'||u.type=='swf'){var h=u.imgWidth?u.imgWidth:u.width;var i=u.imgHeight?u.imgHeight:u.height;var j=b.content.width-h;var k=b.content.height-i;if(k<0)k=0;if(j<0)j=0;var l=f-k;var m=g-j;var n=Math.min(l/i,m/h);m=Math.floor(h*n);l=Math.floor(i*n);b.content.height=l+k;b.content.width=m+j}else{b.content.height=Math.min(b.content.height,f);b.content.width=Math.min(b.content.width,g)}b.wrapper2={width:b.content.width+e.w.total,height:b.content.height+e.h.total};b.wrapper={width:b.content.width+e.w.total+d.w.total,height:b.content.height+e.h.total+d.h.total}}}if(u.type=='swf'){$('object, embed',C.content).attr('width',b.content.width).attr('height',b.content.height)}else if(u.type=='image'){$('img',C.content).css({width:b.content.width,height:b.content.height})}C.content.css($.extend({},b.content,u.css.content));C.wrapper.css($.extend({},b.wrapper2,u.css.wrapper2));if(!a)C.contentWrapper.css($.extend({},b.wrapper,u.css.wrapper));if(u.type=='image'&&u.addImageDivTitle){$('img',C.content).removeAttr('alt');var o=$('div',C.content);if(u.title!=u.defaultImgAlt&&u.title){if(o.length==0){o=$('<div>'+u.title+'</div>');C.content.append(o)}if(u.setWidthImgTitle){var p=getOuter(o);o.css({width:(b.content.width+e.w.padding-p.w.total)+'px'})}}else if(o.length=0){o.remove()}}if(u.title)setTitle();b.wrapper.borderW=c.w.border;b.wrapper.borderH=c.h.border;setCurrentSettings(b.wrapper);setMargin()}function removeModal(e){debug('removeModal');if(e)e.preventDefault();if(C.full&&C.ready){$(document).unbind('keydown.nyroModal');if(!u.blocker)$(window).unbind('resize.nyroModal');C.ready=false;C.anim=true;C.closing=true;if(C.loadingShown||C.transition){u.hideLoading(C,u,function(){C.loading.hide();C.loadingShown=false;C.transition=false;u.hideBackground(C,u,endRemove)})}else{if(z)C.content.css({position:''});C.wrapper.css({overflow:'hidden'});C.content.css({overflow:'hidden'});$('iframe',C.content).hide();if($.isFunction(u.beforeHideContent)){u.beforeHideContent(C,u,function(){u.hideContent(C,u,function(){endHideContent();u.hideBackground(C,u,endRemove)})})}else{u.hideContent(C,u,function(){endHideContent();u.hideBackground(C,u,endRemove)})}}}if(e)return false}function showContentOrLoading(){debug('showContentOrLoading');if(C.ready&&!C.anim){if(C.dataReady){if(C.tmp.html()){C.anim=true;if(C.transition){fillContent();C.animContent=true;u.hideTransition(C,u,function(){C.loading.hide();C.transition=false;C.loadingShown=false;endShowContent()})}else{u.hideLoading(C,u,function(){C.loading.hide();C.loadingShown=false;fillContent();setMarginLoading();setMargin();C.animContent=true;u.showContent(C,u,endShowContent)})}}}else if(!C.loadingShown&&!C.transition){C.anim=true;C.loadingShown=true;if(C.error)loadingError();else C.loading.html(u.contentLoading);$(u.closeSelector,C.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();u.showLoading(C,u,function(){C.anim=false;showContentOrLoading()})}}}function ajaxLoaded(a){debug('AjaxLoaded: '+this.url);C.tmp.html(u.selector?filterScripts($('<div>'+a+'</div>').find(u.selector).contents()):filterScripts(a));if(C.tmp.html()){C.dataReady=true;showContentOrLoading()}else loadingError()}function formDataLoaded(){debug('formDataLoaded');var a=$(u.from);a.attr('action',a.attr('action')+u.selector);a.attr('target','');$('input[name='+u.formIndicator+']',u.from).remove();var b=C.tmp.children('iframe');var c=b.unbind('load').contents().find(u.selector||'body').not('script[src]');b.attr('src','about:blank');C.tmp.html(c.html());if(C.tmp.html()){C.dataReady=true;showContentOrLoading()}else loadingError()}function iframeLoaded(){if((window.location.hostname&&u.url.indexOf(window.location.hostname)>-1)||u.url.indexOf('http://')){var a=$('iframe',C.full).contents();var b={};if(u.titleFromIframe)b.title=a.find('title').text();if(!b.title){try{b.title=a.find('title').html()}catch(err){}}var c=a.find('body');if(!u.height&&c.height())b.height=c.height();if(!u.width&&c.width())b.width=c.width();$.extend(E,b);$.nyroModalSettings(b)}}function galleryCounts(a,b,c,d){if(b>1)d.title+=(d.title?' - ':'')+a+'/'+b}function endHideContent(){debug('endHideContent');C.anim=false;if(B){B.append(C.content.contents());B=null}else if(A){A.append(C.content.contents());A=null}C.content.empty();y={};C.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(C.closing||C.transition)C.contentWrapper.hide();C.contentWrapper.css(u.css.wrapper).append(C.content);showContentOrLoading()}function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);C.anim=false;C.full.remove();C.full=null;if(s){t.css({height:'',width:'',position:'',overflow:''});$('html').css({overflow:''})}if($.isFunction(u.endRemove))u.endRemove(C,u)}function endBackground(){debug('endBackground');C.ready=true;C.anim=false;showContentOrLoading()}function endShowContent(){debug('endShowContent');C.anim=false;C.animContent=false;C.contentWrapper.css({opacity:''});z=/mozilla/.test(q)&&!/(compatible|webkit)/.test(q)&&parseFloat(r)<1.9&&u.type!='image';if(z)C.content.css({position:'fixed'});C.content.append(C.scriptsShown);if(u.type=='iframe')C.content.find('iframe').attr('src',u.url);if($.isFunction(u.endShowContent))u.endShowContent(C,u);if(x){x=false;$.nyroModalSettings({width:u.setWidth,height:u.setHeight});delete u['setWidth'];delete u['setHeight']}if(D.width)setCurrentSettings({width:null});if(D.height)setCurrentSettings({height:null})}function getHash(a){if(typeof a=='string'){var b=a.indexOf('#');if(b>-1)return a.substring(b)}return''}function filterScripts(a){if(typeof a=='string')a=a.replace(/<\/?(html|head|body)([^>]*)>/gi,'');var b=new Array();$.each($.clean({0:a},this.ownerDocument),function(){if($.nodeName(this,"script")){if(!this.src||$(this).attr('rel')=='forceLoad'){if($(this).attr('rev')=='shown')C.scriptsShown.push(this);else C.scripts.push(this)}}else b.push(this)});return b}function getOuter(a){a=a.get(0);var b={h:{margin:getCurCSS(a,'marginTop')+getCurCSS(a,'marginBottom'),border:getCurCSS(a,'borderTopWidth')+getCurCSS(a,'borderBottomWidth'),padding:getCurCSS(a,'paddingTop')+getCurCSS(a,'paddingBottom')},w:{margin:getCurCSS(a,'marginLeft')+getCurCSS(a,'marginRight'),border:getCurCSS(a,'borderLeftWidth')+getCurCSS(a,'borderRightWidth'),padding:getCurCSS(a,'paddingLeft')+getCurCSS(a,'paddingRight')}};b.h.outer=b.h.margin+b.h.border;b.w.outer=b.w.margin+b.w.border;b.h.inner=b.h.padding+b.h.border;b.w.inner=b.w.padding+b.w.border;b.h.total=b.h.outer+b.h.padding;b.w.total=b.w.outer+b.w.padding;return b}function getCurCSS(a,b){var c=parseInt($.curCSS(a,b,true));if(isNaN(c))c=0;return c}function debug(a){if($.fn.nyroModal.settings.debug||u&&u.debug)nyroModalDebug(a,C,u||{})}function showBackground(a,b,c){a.bg.css({opacity:0}).fadeTo(500,0.5,c)}function hideBackground(a,b,c){a.bg.fadeOut(300,c)}function showLoading(a,b,c){a.loading.css({marginTop:b.marginTopLoading+'px',marginLeft:b.marginLeftLoading+'px',opacity:0}).show().animate({opacity:1},{complete:c,duration:400})}function hideLoading(a,b,c){c()}function showContent(a,b,c){a.loading.css({marginTop:b.marginTopLoading+'px',marginLeft:b.marginLeftLoading+'px'}).show().animate({width:b.width+'px',height:b.height+'px',marginTop:b.marginTop+'px',marginLeft:b.marginLeft+'px'},{duration:350,complete:function(){a.contentWrapper.css({width:b.width+'px',height:b.height+'px',marginTop:b.marginTop+'px',marginLeft:b.marginLeft+'px'}).show();a.loading.fadeOut(200,c)}})}function hideContent(a,b,c){a.contentWrapper.animate({height:'50px',width:'50px',marginTop:(-(25+b.borderH)/2+b.marginScrollTop)+'px',marginLeft:(-(25+b.borderW)/2+b.marginScrollLeft)+'px'},{duration:350,complete:function(){a.contentWrapper.hide();c()}})}function showTransition(a,b,c){a.loading.css({marginTop:a.contentWrapper.css('marginTop'),marginLeft:a.contentWrapper.css('marginLeft'),height:a.contentWrapper.css('height'),width:a.contentWrapper.css('width'),opacity:0}).show().fadeTo(400,1,function(){a.contentWrapper.hide();c()})}function hideTransition(a,b,c){a.contentWrapper.hide().css({width:b.width+'px',height:b.height+'px',marginLeft:b.marginLeft+'px',marginTop:b.marginTop+'px',opacity:1});a.loading.animate({width:b.width+'px',height:b.height+'px',marginLeft:b.marginLeft+'px',marginTop:b.marginTop+'px'},{complete:function(){a.contentWrapper.show();a.loading.fadeOut(400,function(){a.loading.hide();c()})},duration:350})}function resize(a,b,c){a.contentWrapper.animate({width:b.width+'px',height:b.height+'px',marginLeft:b.marginLeft+'px',marginTop:b.marginTop+'px'},{complete:c,duration:400})}function updateBgColor(a,b,c){if(!$.fx.step.backgroundColor){a.bg.css({backgroundColor:b.bgColor});c()}else a.bg.animate({backgroundColor:b.bgColor},{complete:c,duration:400})}$($.fn.nyroModal.settings.openSelector).nyroModal()});function nyroModalDebug(a,b,c){if(b.full)b.bg.prepend(a+'<br />')}
