/*
** topslidebox jQuery Plugin
** http://github.com/pierre-lecocq/topslidebox
*/
(function(a){this.topslideboxClose=function(){a("#topslidebox_wrap").slideUp("normal",function(){a("#topslidebox_overlay").fadeOut("normal",function(){a(this).remove()})});return false};a.fn.topslidebox=function(b){var c={title:null,titleMarkup:"h1",width:600,height:null,fixed:false,closable:true,closeButtonContent:"close",ajaxOtions:{},errorMessage:"An error occured ...",overlayClass:"",wrapClass:"",contentClass:"",closeClass:""};var b=a.extend({},c,b);return this.each(function(){a(this).click(function(){var f=a.meta?a.extend({},b,$this.data()):b;var d=a(this).attr("href");var e='<div id="topslidebox_error">'+f.errorMessage+"</div>";a(document.createElement("div")).attr({id:"topslidebox_overlay","class":f.overlayClass}).css({display:"none",width:a(document).width(),height:a(document).height()}).appendTo("body");a(document.createElement("div")).attr({id:"topslidebox_wrap","class":f.wrapClass}).css({display:"none",width:f.width+"px",top:a(window).scrollTop()+"px",left:((a(document).width()/2)-(f.width/2))}).appendTo("#topslidebox_overlay");a(document.createElement("div")).attr({id:"topslidebox_content","class":f.contentClass}).appendTo("#topslidebox_wrap");a(document).unbind("keyup");a(document).unbind("scroll");if(d.indexOf("http")<0){a.ajax({type:"GET",url:d,dataType:"html",data:f.ajaxOtions,success:function(g){e="<div>"+g+"</div>"}})}else{e='<iframe src="'+d+'" />'}if(f.height!=null){a("#topslidebox_wrap").css("height",f.height+"px")}if(f.title!=null&&f.title.length>0){a(document.createElement("div")).attr({id:"topslidebox_title"}).html("<"+f.titleMarkup+">"+f.title+"</"+f.titleMarkup+">").insertBefore("#topslidebox_content")}if(f.fixed==false){a(document).scroll(function(g){a("#topslidebox_wrap").css({top:a(window).scrollTop()+"px"})})}if(f.closable==true){a(document.createElement("div")).attr({id:"topslidebox_close","class":f.closeClass}).html('<a href="#" onclick="topslideboxClose(); return false;">'+f.closeButtonContent+"</a>").insertAfter("#topslidebox_content");a(document).keyup(function(g){if(g.keyCode==27&&f.closable==true){topslideboxClose()}return false})}a("#topslidebox_content").html('<div id="topslidebox_loader">&nbsp;</div>');a("#topslidebox_overlay").fadeIn("normal",function(){a("#topslidebox_wrap").slideDown("normal",function(){a("#topslidebox_content").html(e)})});return false})})}})(jQuery);
