/* ### st2 angepasste version! ### */
/*
 * nyroModal - jQuery Plugin
 * http://nyromodal.nyrodev.com
 *
 * Copyright (c) 2008 Cedric Nirousset (nyrodev.com)
 * Licensed under the MIT license
 *
 * $Date: 2009-02-19 (Thu, 19 Feb 2009) $
 * $version: 1.4.2
 */
jQuery(function($){var p=navigator.userAgent.toLowerCase();var q=(p.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1];var r=(/msie/.test(p)&&!/opera/.test(p)&&parseInt(q)<7);var s=$('body');var t;var u=false;var v=false;var x;var y;var z={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition: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 A={width:false,height:false};$.fn.nyroModal=function(a){if(!this)return false;return this.each(function(){if(this.nodeName.toLowerCase()=='form'){$(this).submit(function(e){if($(this).data('processing'))return true;if(this.enctype=='multipart/form-data'){processModal($.extend(a,{from:this}));return true}e.preventDefault();processModal($.extend(a,{from:this}));return false})}else{$(this).click(function(e){e.preventDefault();processModal($.extend(a,{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&&z.started){if(z.bg&&a.bgColor)t.updateBgColor(z,t,function(){});if(z.contentWrapper&&a.title)setTitle();if(((a.width&&a.width==t.width)||(a.height&&a.height==t.height))){if(z.contentWrapper)calculateSize(true);if(z.contentWrapper&&z.contentWrapper.is(':visible')&&!z.animContent){if(v)z.content.css({position:''});t.resize(z,t,function(){if(v)z.content.css({position:'fixed'});if($.isFunction(t.endResize))t.endResize(z,t)})}}}};$.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={debug:false,blocker:false,modal:false,type:'',from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:200,minHeight:100,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',defaultImgAlt:'Bild',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Zur&uuml;ck</a><a href="#"  class="nyroModalNext">Weiter</a>',css:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'50%',left:'50%'},wrapper2:{},content:{overflow:'auto'},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 gew&uuml;nschte Inhalt konnte nicht geladen werden<br />Bitte versuchen Sie es zu einem sp&auml;teren Zeitpunkt erneut.<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(z.loadingShown||z.transition||z.anim)return;debug('processModal');z.started=true;setDefaultCurrentSettings(c);if(!z.full)z.blockerVars=z.blocker=null;z.error=false;z.closing=false;z.dataReady=false;z.scripts=new Array();z.scriptsShown=new Array();t.type=fileType();if($.isFunction(t.processHandler))t.processHandler(t);from=t.from;url=t.url;if(t.type=='swf'){t.resizable=false;setCurrentSettings({overflow:'hidden'},'css','content');t.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+t.width+'" height="'+t.height+'"><param name="movie" value="'+url+'"></param>';var d='';$.each(t.swf,function(a,b){t.content+='<param name="'+a+'" value="'+b+'"></param>';d+=' '+a+'="'+b+'"'});t.content+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+t.width+'" height="'+t.height+'"'+d+'></embed></object>'}if(from){var f=$(from);if(t.type=='form'){var g=$(from).serializeArray();g.push({name:t.formIndicator,value:1});if(t.selector)g.push({name:t.selIndicator,value:t.selector.substring(1)});$.ajax($.extend({},t.ajax,{url:url,data:g,type:from.method,success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+f.attr('action'));showModal()}else if(t.type=='formData'){initModal();f.attr('target','nyroModalIframe');f.attr('action',url);f.prepend('<input type="hidden" name="'+t.formIndicator+'" value="1" />');if(t.selector)f.prepend('<input type="hidden" name="'+t.selIndicator+'" value="'+t.selector.substring(1)+'" />');z.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe"></iframe>');$('iframe',z.tmp).css({width:t.width,height:t.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+f.attr('action'));showModal();showContentOrLoading()}else if(t.type=='image'){var i=f.attr('title')||t.defaultImgAlt;initModal();z.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',i);debug('Image Load: '+url);z.tmp.css({lineHeight:0});$('img',z.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=z.tmp.width();var h=z.tmp.height();z.tmp.css({lineHeight:''});A.width=w;A.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});setCurrentSettings({overflow:'hidden'},'css','content');z.dataReady=true;if(z.loadingShown||z.transition)showContentOrLoading()}).attr('src',url);showModal()}else if(t.type=='iframeForm'){initModal();z.tmp.html('<iframe frameborder="0" hspace="0" src="" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+url);$('iframe',z.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(function(e){if(t.titleFromIframe&&url.indexOf(window.location.hostname)>-1)$.nyroModalSettings({title:$('iframe',z.full).contents().find('title').text()})});z.dataReady=true;showModal()}else if(t.type=='iframe'){initModal();z.tmp.html('<iframe frameborder="0" hspace="0" src="'+url+'" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+url);$('iframe',z.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(function(e){if(t.titleFromIframe&&url.indexOf(window.location.hostname)>-1)$.nyroModalSettings({title:$('iframe',z.full).contents().find('title').text()})});z.dataReady=true;showModal()}else if(t.type){debug('Content: '+t.type);initModal();z.tmp.html(t.content);var w=z.tmp.width();var h=z.tmp.height();var j=$(t.type);if(j.length){setCurrentSettings({type:'div'});w=j.width();h=j.height();if(x)y=x;x=j;z.tmp.append(j.contents())}setCurrentSettings({width:w,height:h});if(z.tmp.html())z.dataReady=true;else loadingError();if(!z.ready)showModal();else endHideContent()}else{debug('Ajax Load: '+url);setCurrentSettings({type:'ajax'});var g=t.ajax.data||{};if(t.selector){if(typeof g=="string"){g+='&'+t.selIndicator+'='+t.selector.substring(1)}else{g[t.selIndicator]=t.selector.substring(1)}}$.ajax($.extend(true,t.ajax,{url:url,success:ajaxLoaded,error:loadingError,data:g}));showModal()}}else if(t.content){debug('Content: '+t.type);setCurrentSettings({type:'manual'});initModal();z.tmp.html($('<div/>').html(t.content).contents());if(z.tmp.html())z.dataReady=true;else loadingError();showModal()}else{}}function setDefaultCurrentSettings(a){debug('setDefaultCurrentSettings');t=$.extend(true,{},$.fn.nyroModal.settings,a);t.selector='';t.borderW=0;t.borderH=0;t.resizable=true;setMargin()}function setCurrentSettings(a,b,c){if(z.started){if(b&&c){$.extend(true,t[b][c],a)}else if(b){$.extend(true,t[b],a)}else{if(z.animContent){if(a.width){a.setWidth=a.width;delete a['width'];u=true}if(a.height){a.setHeight=a.height;delete a['height'];u=true}}$.extend(true,t,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(r&&!z.blocker){if(document.documentElement){t.marginScrollLeft=document.documentElement.scrollLeft;t.marginScrollTop=document.documentElement.scrollTop}else{t.marginScrollLeft=document.body.scrollLeft;t.marginScrollTop=document.body.scrollTop}}else{t.marginScrollLeft=0;t.marginScrollTop=0}}function setMargin(){setMarginScroll();t.marginLeft=-(t.width+t.borderW)/2;t.marginTop=-(t.height+t.borderH)/2;if(!z.blocker){t.marginLeft+=t.marginScrollLeft;t.marginTop+=t.marginScrollTop}}function setMarginLoading(){setMarginScroll();var a=getOuter(z.loading);t.marginTopLoading=-(z.loading.height()+a.h.border+a.h.padding)/2;t.marginLeftLoading=-(z.loading.width()+a.w.border+a.w.padding)/2;if(!z.blocker){t.marginLefttLoading+=t.marginScrollLeft;t.marginTopLoading+=t.marginScrollTop}}function setTitle(){var a=$('h1#nyroModalTitle',z.contentWrapper);if(a.length)a.text(t.title);else z.contentWrapper.prepend('<h1 id="nyroModalTitle">'+t.title+'</h1>')}function initModal(){debug('initModal');if(!z.full){if(t.debug)setCurrentSettings({color:'white'},'css','bg');var b={zIndex:100,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var c=s;var f='';if(t.blocker){z.blocker=c=$(t.blocker);var g=z.blocker.offset();var w=z.blocker.outerWidth();var h=z.blocker.outerHeight();if(r){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'css','bg')}z.blockerVars={top:g.top,left:g.left,width:w,height:h};var i=(/msie/.test(p)?0:getCurCSS(s.get(0),'borderTopWidth'));var j=(/msie/.test(p)?0:getCurCSS(s.get(0),'borderLeftWidth'));b={position:'absolute',top:g.top+i,left:g.left+j,width:w,height:h}}else if(r){s.css({height:s.height()+'px',width:s.width()+'px',position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({css:{bg:{position:'absolute',zIndex:101,height:'110%',width:'110%',top:t.marginScrollTop+'px',left:t.marginScrollLeft+'px'},wrapper:{zIndex:102},loading:{zIndex:103}}});f=$('<iframe id="nyroModalIframeHideIe"></iframe>').css($.extend({},t.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());z.full=$('#nyroModalFull').css(b).show();z.bg=$('#nyroModalBg').css($.extend({backgroundColor:t.bgColor},t.css.bg)).before(f);if(!t.modal)z.bg.click(removeModal);z.loading=$('#nyroModalLoading').css(t.css.loading).hide();z.contentWrapper=$('#nyroModalWrapper').css(t.css.wrapper).hide();z.content=$('#nyroModalContent');z.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){z.content.mousewheel(function(e,d){var a=z.content.get(0);if((d>0&&a.scrollTop==0)||(d<0&&a.scrollHeight-a.scrollTop==a.clientHeight)){e.preventDefault();e.stopPropagation()}})}$(document).keydown(keyHandler);z.content.css({width:'auto',height:'auto'});z.contentWrapper.css({width:'auto',height:'auto'})}}function showModal(){debug('showModal');if(!z.ready){initModal();z.anim=true;t.showBackground(z,t,endBackground)}else{z.anim=true;z.transition=true;t.showTransition(z,t,function(){endHideContent();z.anim=false;showContentOrLoading()})}}function keyHandler(e){if(e.keyCode==27){if(!t.modal)removeModal()}else if(t.gallery&&z.ready&&z.dataReady&&!z.anim&&!z.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(){if(t.forceType){var a=t.forceType;if(!t.content)t.from=true;t.forceType=null;return a}var b=t.from;var c;if(b&&b.nodeName){var d=$(b);t.url=c=b.nodeName.toLowerCase()=='form'?d.attr('action'):b.href;if(d.attr('rev')=='modal')t.modal=true;t.title=d.attr('title');if(b&&b.rel)t.gallery=b.rel;var e=imageType(c,b);if(e)return e;var f=false;if(b.target&&b.target.toLowerCase()=='_blank'||(b.hostname&&b.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){f=true}if(b.nodeName.toLowerCase()=='form'){if(f)return'iframeForm';setCurrentSettings(extractUrlSel(c));if(d.attr('enctype')=='multipart/form-data')return'formData';return'form'}if(f)return'iframe'}else{c=t.url;if(!t.content)t.from=true;if(!c)return null;var g=new RegExp("^http://","g");if(c.match(g))return'iframe'}var e=imageType(c,b);if(e)return e;var h=new RegExp('[^\.]\.(swf)\s*$','i');if(h.test(c))return'swf';var a=extractUrlSel(c);setCurrentSettings(a);if(!a.url)return a.selector}function imageType(a,b){var c=new RegExp(t.regexImg,'i');if(c.test(a)){return'image'}}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){b.selector=c}else{b.url=f;b.selector=c}}return b}function loadingError(){debug('loadingError');z.error=true;if(!z.ready)return;if($.isFunction(t.handleError))t.handleError(z,t);z.loading.addClass(t.errorClass).html(t.contentError);$(t.closeSelector,z.loading).click(removeModal);setMarginLoading();z.loading.css({marginTop:t.marginTopLoading+'px',marginLeft:t.marginLeftLoading+'px'})}function fillContent(){debug('fillContent');if(!z.tmp.html())return;z.content.html(z.tmp.contents());z.tmp.empty();wrapContent();if(t.type=='iframeForm'){$(t.from).attr('target','nyroModalIframe').data('processing',1).submit().attr('target','_blank').removeData('processing')}if($.isFunction(t.endFillContent))t.endFillContent(z,t);z.content.append(z.scripts);$(t.closeSelector,z.contentWrapper).click(removeModal);$(t.openSelector,z.contentWrapper).nyroModal(getCurrentSettingsNew())}function getCurrentSettingsNew(){var a=$.extend(true,{},t);if(A.width)a.width=null;if(A.height)a.height=null;a.css.content.overflow='auto';return a}function wrapContent(){debug('wrapContent');var a=$(t.wrap[t.type]);z.content.append(a.children().remove());z.contentWrapper.wrapInner(a);if(t.gallery){z.content.append(t.galleryLinks);var b=getCurrentSettingsNew();var c=getGalleryLink(-1);if(c){var d=$('.nyroModalPrev',z.contentWrapper).attr('href',c.attr('href')).click(function(e){e.preventDefault();c.nyroModalManual(b);return false});if(r&&t.type=='swf'){d.before($('<iframe id="nyroModalIframeHideIeGalleryPrev"></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',z.contentWrapper).remove()}var f=getGalleryLink(1);if(f){var g=$('.nyroModalNext',z.contentWrapper).attr('href',f.attr('href')).click(function(e){e.preventDefault();f.nyroModalManual(b);return false});if(r&&t.type=='swf'){g.before($('<iframe id="nyroModalIframeHideIeGalleryNext"></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',z.contentWrapper).remove()}}calculateSize()}function getGalleryLink(a){if(t.gallery){if(!t.ltr)a*=-1;var b=$('[rel="'+t.gallery+'"]');var c=b.index(t.from);var d=c+a;if(d>=0&&d<b.length)return b.eq(d)}return false}function calculateSize(a){debug('calculateSize');if(!z.wrapper)z.wrapper=z.contentWrapper.children(':first');A.width=false;A.height=false;if(t.autoSizable&&(!t.width||!t.height)){z.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var b={width:'auto',height:'auto'};if(t.width){b.width=t.width}else if(t.type=='iframe'){b.width=t.minWidth}if(t.height){b.height=t.height}else if(t.type=='iframe'){b.height=t.minHeight}z.content.css(b);if(!t.width){t.width=z.content.outerWidth(true);A.width=true}if(!t.height){t.height=z.content.outerHeight(true);A.height=true}z.contentWrapper.hide().css({opacity:1})}t.width=Math.max(t.width,t.minWidth);t.height=Math.max(t.height,t.minHeight);var c=getOuter(z.contentWrapper);var d=getOuter(z.wrapper);var e=getOuter(z.content);var b={content:{width:t.width,height:t.height},wrapper2:{width:t.width+e.w.total,height:t.height+e.h.total},wrapper:{width:t.width+e.w.total+d.w.total,height:t.height+e.h.total+d.h.total}};if(t.resizable){var f=z.blockerVars?z.blockerVars.height:$(window).height()-c.h.border-(b.wrapper.height-t.height);var g=z.blockerVars?z.blockerVars.width:$(window).width()-c.w.border-(b.wrapper.width-t.width);f-=t.padding*2;g-=t.padding*2;if(b.content.height>f||b.content.width>g){if(t.type=='image'){var h=b.content.width-t.imgWidth;var i=b.content.height-t.imgHeight;if(i<0)i=0;if(h<0)h=0;var j=f-i;var k=g-h;var l=Math.min(j/t.imgHeight,k/t.imgWidth);j=Math.floor(t.imgHeight*l);k=Math.floor(t.imgWidth*l);$('img#nyroModalImg',z.content).css({height:j+'px',width:k+'px'});b.content.height=j+i;b.content.width=k+h}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}}}z.content.css($.extend({},b.content,t.css.content));z.wrapper.css($.extend({},b.wrapper2,t.css.wrapper2));if(!a){z.contentWrapper.css($.extend({},b.wrapper,t.css.wrapper));if(t.type=='image'){var m=$('img',z.content).attr('alt');$('img',z.content).removeAttr('alt');if(m!=t.defaultImgAlt){var n=$('<div>'+m+'</div>');z.content.append(n);if(t.setWidthImgTitle){var o=getOuter(n);n.css({width:(b.content.width+e.w.padding-o.w.total)+'px'})}}}if(!t.modal)z.contentWrapper.prepend(t.closeButton)}if(t.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(z.full&&z.ready){z.ready=false;z.anim=true;z.closing=true;if(z.loadingShown||z.transition){t.hideLoading(z,t,function(){z.loading.hide();z.loadingShown=false;z.transition=false;t.hideBackground(z,t,endRemove)})}else{if(v)z.content.css({position:''});z.wrapper.css({overflow:'hidden'});z.content.css({overflow:'hidden'});if($.isFunction(t.beforeHideContent)){t.beforeHideContent(z,t,function(){t.hideContent(z,t,function(){endHideContent();t.hideBackground(z,t,endRemove)})})}else{t.hideContent(z,t,function(){endHideContent();t.hideBackground(z,t,endRemove)})}}}if(e)return false}function showContentOrLoading(){debug('showContentOrLoading');if(z.ready&&!z.anim){if(z.dataReady){if(z.tmp.html()){z.anim=true;if(z.transition){fillContent();z.animContent=true;t.hideTransition(z,t,function(){z.loading.hide();z.transition=false;z.loadingShown=false;endShowContent()})}else{t.hideLoading(z,t,function(){z.loading.hide();z.loadingShown=false;fillContent();setMarginLoading();setMargin();z.animContent=true;t.showContent(z,t,endShowContent)})}}}else if(!z.loadingShown&&!z.transition){z.anim=true;z.loadingShown=true;if(z.error)loadingError();else z.loading.html(t.contentLoading);$(t.closeSelector,z.loading).click(removeModal);setMarginLoading();t.showLoading(z,t,function(){z.anim=false;showContentOrLoading()})}}}function ajaxLoaded(a){debug('AjaxLoaded: '+this.url);z.tmp.html(t.selector?filterScripts($('<div>'+a+'</div>').find(t.selector).contents()):filterScripts(a));if(z.tmp.html()){z.dataReady=true;showContentOrLoading()}else loadingError()}function formDataLoaded(){debug('formDataLoaded');var a=$(t.from);a.attr('action',a.attr('action')+t.selector);a.attr('target','');$('input[name='+t.formIndicator+']',t.from).remove();var b=z.tmp.children('iframe');var c=b.unbind('load').contents().find(t.selector||'body').not('script[src]');b.attr('src','about:blank');z.tmp.html(c.html());if(z.tmp.html()){z.dataReady=true;showContentOrLoading()}else loadingError()}function endHideContent(){debug('endHideContent');z.anim=false;if(y){y.append(z.content.contents());y=null}else if(x){x.append(z.content.contents());x=null}z.content.empty();z.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(z.closing||z.transition)z.contentWrapper.hide();z.contentWrapper.css(t.css.wrapper).append(z.content);showContentOrLoading()}function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);z.anim=false;z.full.remove();z.full=null;if(r){s.css({height:'',width:'',position:'',overflow:''});$('html').css({overflow:''})}if($.isFunction(t.endRemove))t.endRemove(z,t)}function endBackground(){debug('endBackground');z.ready=true;z.anim=false;showContentOrLoading()}function endShowContent(){debug('endShowContent');z.anim=false;z.animContent=false;z.contentWrapper.css({opacity:''});v=/mozilla/.test(p)&&!/(compatible|webkit)/.test(p)&&parseFloat(q)<1.9&&t.type!='image';if(v)z.content.css({position:'fixed'});z.content.append(z.scriptsShown);if(t.autoSizable&&t.type=='iframe'){var b=z.content.find('iframe');if(b.length&&b.attr('src').indexOf(window.location.hostname)!==-1){var c=b.contents().find('body');if(c.height()>0){var h=c.outerHeight(true)+25;var w=c.outerWidth(true)+25;if(h<300){h=550}$.nyroModalSettings({height:h,width:w})}else{b.bind('load',function(){var a=b.contents().find('body');if(a.length&&a.height()>0){var h=a.outerHeight(true)+25;var w=a.outerWidth(true)+25;$.nyroModalSettings({height:h,width:w})}})}}}if($.isFunction(t.endShowContent))t.endShowContent(z,t);if(u){u=false;$.nyroModalSettings({width:t.setWidth,height:t.setHeight});delete t['setWidth'];delete t['setHeight']}if(A.width)setCurrentSettings({width:null});if(A.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')z.scriptsShown.push(this);else z.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||t&&t.debug)nyroModalDebug(a,z,t||{})}function showBackground(a,b,c){a.bg.css({opacity:0}).fadeTo(500,0.4,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 />')}