if(PastelFloatBoxDefaultParams==null)var PastelFloatBoxDefaultParams={Class:"",Width:"auto",Height:"auto",Speed:500,Align:"center",DistanceFromWindowBorder:20,DistanceFromDocumentTopBorder:0,BodyPadding:15,BodyColor:"rgb(255,255,255)",BorderWidth:10,BorderColor:"rgb(163,163,163)",CloseOnBackgroundClick:true,CloseOnCloseButtonClick:true,FunctionOnClose:"",LoadInactiveClose:false,FunctionOnInactiveCloseClick:"",PluginPath:"/pastel/plugins/PastelFloatBox/v1.5"};
var PastelFloatBox_Speed=500,PastelFloatBox_NumOfBoxOpened=0,PastelFloatBox_DBPFBTAPFBM=15;function getOffsets(c){for(var a=c.offsetTop,d=c.offsetLeft;(c=c.offsetParent)!=null;){a+=c.offsetTop;d+=c.offsetLeft}return{offsetLeft:d,offsetTop:a}}
function openPastelFloatBox(c,a,d){if(typeof a.Class=="undefined")a.Class=PastelFloatBoxDefaultParams.Class;if(typeof a.Width=="undefined")a.Width=PastelFloatBoxDefaultParams.Width;if(typeof a.Height=="undefined")a.Height=PastelFloatBoxDefaultParams.Height;PastelFloatBox_Speed=typeof a.Speed=="undefined"?PastelFloatBoxDefaultParams.Speed:a.Speed;if(typeof a.Align=="undefined")a.Align=PastelFloatBoxDefaultParams.Align;if(typeof a.DistanceFromWindowBorder=="undefined")a.DistanceFromWindowBorder=PastelFloatBoxDefaultParams.DistanceFromWindowBorder;
if(typeof a.DistanceFromDocumentTopBorder=="undefined")a.DistanceFromDocumentTopBorder=PastelFloatBoxDefaultParams.DistanceFromDocumentTopBorder;if(typeof a.BodyPadding=="undefined")a.BodyPadding=PastelFloatBoxDefaultParams.BodyPadding;if(typeof a.BodyColor=="undefined")a.BodyColor=PastelFloatBoxDefaultParams.BodyColor;if(typeof a.BorderWidth=="undefined")a.BorderWidth=PastelFloatBoxDefaultParams.BorderWidth;if(typeof a.BorderColor=="undefined")a.BorderColor=PastelFloatBoxDefaultParams.BorderColor;
if(typeof a.CloseOnBackgroundClick=="undefined")a.CloseOnBackgroundClick=PastelFloatBoxDefaultParams.CloseOnBackgroundClick;if(typeof a.CloseOnCloseButtonClick=="undefined")a.CloseOnCloseButtonClick=PastelFloatBoxDefaultParams.CloseOnCloseButtonClick;if(typeof a.FunctionOnClose=="undefined")a.FunctionOnClose=PastelFloatBoxDefaultParams.FunctionOnClose;if(typeof a.LoadInactiveClose=="undefined")a.LoadInactiveClose=PastelFloatBoxDefaultParams.LoadInactiveClose;if(typeof a.FunctionOnInactiveCloseClick==
"undefined")a.FunctionOnInactiveCloseClick=PastelFloatBoxDefaultParams.FunctionOnInactiveCloseClick;if(typeof a.PluginPath=="undefined")a.PluginPath=PastelFloatBoxDefaultParams.PluginPath;if(a.DistanceFromDocumentTopBorder+PastelFloatBox_DBPFBTAPFBM<a.DistanceFromWindowBorder)PastelFloatBox_DBPFBTAPFBM=a.DistanceFromWindowBorder-a.DistanceFromDocumentTopBorder;var e=a.DistanceFromDocumentTopBorder>0?a.DistanceFromDocumentTopBorder+PastelFloatBox_DBPFBTAPFBM:a.DistanceFromWindowBorder;if(a.Width==
"auto")a.Width=$(window).width()-a.DistanceFromWindowBorder*2-a.BorderWidth*2;if(a.Height=="auto")a.Height=$(window).height()-a.DistanceFromWindowBorder-e-a.BorderWidth*2;PastelFloatBox_NumOfBoxOpened++;var b=PastelFloatBox_NumOfBoxOpened;if(typeof c=="object"){var f=getOffsets(c);e=f.offsetLeft+$(c).width()/2;c=f.offsetTop+$(c).height()/2}else{e=$(window).width()/2;c=$(window).height()/2}if(a.Align=="center")var h=$(window).width()/2-a.Width/2-a.BorderWidth+$(document).scrollLeft(),g=$(window).height()/
2-a.Height/2-a.BorderWidth+$(document).scrollTop();if(a.Align=="auto"){h=e-a.Width/2;g=c-a.Height/2;if(h+a.Width+a.BorderWidth*2>$(window).width()-a.DistanceFromWindowBorder+$(document).scrollLeft())h=$(window).width()-a.DistanceFromWindowBorder+$(document).scrollLeft()-a.Width-a.BorderWidth*2;if(g+a.Height+a.BorderWidth*2>$(window).height()-a.DistanceFromWindowBorder+$(document).scrollTop())g=$(window).height()-a.DistanceFromWindowBorder+$(document).scrollTop()-a.Height-a.BorderWidth*2}if(h<a.DistanceFromWindowBorder+
$(document).scrollLeft())h=a.DistanceFromWindowBorder+$(document).scrollLeft();if(g<a.DistanceFromWindowBorder+$(document).scrollTop())g=a.DistanceFromWindowBorder+$(document).scrollTop();if(g<a.DistanceFromDocumentTopBorder+$(document).scrollTop()+PastelFloatBox_DBPFBTAPFBM)g=a.DistanceFromDocumentTopBorder+$(document).scrollTop()+PastelFloatBox_DBPFBTAPFBM;f="png";if($.browser.msie&&parseInt($.browser.version)<=6)f="gif";var i="";if(a.LoadInactiveClose==true)i='<div class="PastelFloatBoxClose PastelFloatBoxCloseInactive '+
b+'"><img src="'+a.PluginPath+'/close_inactive.png" alt="close" /></div>';a.DistanceFromDocumentTopBorder>0&&$("body").prepend('<div id="PastelFloatBoxTop_'+b+'" class="PastelFloatBoxTop '+b+'"></div>');$("body").prepend('<div id="PastelFloatBoxMain_'+b+'" class="PastelFloatBoxMain '+b+" "+a.Class+'"><div class="PastelFloatBoxBorder '+b+'"><div id="PastelFloatBoxAjax_'+b+'" class="PastelFloatBoxAjax PastelFloatBoxBody '+b+'"></div><iframe id="PastelFloatBoxIframe_'+b+'" class="PastelFloatBoxIframe PastelFloatBoxBody '+
b+'"></iframe><div class="PastelFloatBoxWaitingLayer PastelFloatBoxBody '+b+'"></div></div><div class="PastelFloatBoxClose PastelFloatBoxCloseActive '+b+'"><img src="'+a.PluginPath+"/close."+f+'" alt="close" /></div>'+i+'</div><div id="PastelFloatBoxBackground_'+b+'" class="PastelFloatBoxBackground '+b+'"></div>');$("#PastelFloatBoxBackground_"+b).css("z-index",parseInt($(".PastelFloatBoxBackground").css("z-index"))+b*2);$("#PastelFloatBoxBackground_"+b).css("width",$(document).width()+"px");$("#PastelFloatBoxBackground_"+
b).css("height",$(document).height()+"px");$.browser.msie&&parseInt($.browser.version)<=6&&$("#PastelFloatBoxBackground_"+b).css("position","absolute");$("#PastelFloatBoxMain_"+b).css("z-index",parseInt($(".PastelFloatBoxMain").css("z-index"))+b*2);$("#PastelFloatBoxMain_"+b).css("margin-left",e);$("#PastelFloatBoxMain_"+b).css("margin-top",c);$(".PastelFloatBoxBorder."+b).css("padding",a.BorderWidth+"px");$(".PastelFloatBoxBorder."+b).css("background-color",a.BorderColor);$(".PastelFloatBoxBody."+
b).css("padding",a.BodyPadding+"px");f=a.Width-a.BodyPadding*2;i=a.Height-a.BodyPadding*2;if(a.Type=="iframe"){f-=3;i-=3}$(".PastelFloatBoxBody."+b).css("background-color",a.BodyColor);$(".PastelFloatBoxBody."+b).css("width",f+"px");$(".PastelFloatBoxBody."+b).css("height",i+"px");$(".PastelFloatBoxClose."+b).css("margin-left",a.Width+a.BorderWidth-3+"px");$(".PastelFloatBoxClose."+b).css("margin-top","-"+(a.BorderWidth+5)+"px");if(a.DistanceFromDocumentTopBorder>0){$("#PastelFloatBoxTop_"+b).css("z-index",
parseInt($(".PastelFloatBoxTop").css("z-index"))+b*2);$("#PastelFloatBoxTop_"+b).css("height",a.DistanceFromDocumentTopBorder+"px")}a.CloseOnBackgroundClick==true&&$("#PastelFloatBoxBackground_"+b).click(function(){closePastelFloatBox(b,a.FunctionOnClose)});a.CloseOnCloseButtonClick==true&&$(".PastelFloatBoxCloseActive."+b).click(function(){closePastelFloatBox(b,a.FunctionOnClose)});typeof a.FunctionOnInactiveCloseClick=="function"&&$(".PastelFloatBoxCloseInactive."+b).click(a.FunctionOnInactiveCloseClick);
$("#PastelFloatBoxMain_"+b).data("BoxNumber",b);$("#PastelFloatBoxMain_"+b).data("FromMarginLeft",e);$("#PastelFloatBoxMain_"+b).data("FromMarginTop",c);$("#PastelFloatBoxMain_"+b).animate({width:a.Width+"px",height:a.Height+"px",marginLeft:h+"px",marginTop:g+"px"},PastelFloatBox_Speed,function(){$("#PastelFloatBoxBackground_"+b).show();$(".PastelFloatBoxWaitingLayer."+b).show();if(a.Type=="ajax"){$(".PastelFloatBoxAjax."+b).show();if(typeof a.Data=="undefined")a.Data={ajaxMode:true};else if(typeof a.Data.AjaxMode==
"undefined")a.Data.ajaxMode=true;$(".PastelFloatBoxAjax."+b).load(a.Url,a.Data,function(){$(".PastelFloatBoxWaitingLayer."+b).hide();typeof d=="function"&&d(b);typeof pastelFloatBoxOnLoadFunction=="function"&&pastelFloatBoxOnLoadFunction(b)})}if(a.Type=="iframe"){$(".PastelFloatBoxIframe."+b).show();a.Url=a.Url.indexOf("?")==-1?a.Url+"?ajaxMode=true":a.Url+"&ajaxMode=true";$(".PastelFloatBoxIframe."+b).attr("src",a.Url);$(".PastelFloatBoxIframe."+b).load(function(){$(".PastelFloatBoxWaitingLayer."+
b).hide();$(this).contents().find("html").data("BoxNumber",b);typeof d=="function"&&d(b);typeof pastelFloatBoxOnLoadFunction=="function"&&pastelFloatBoxOnLoadFunction(b)})}})}
function closePastelFloatBox(c,a){if(typeof c=="number")var d=c;else{d=$(c).parents(".PastelFloatBoxMain").data("BoxNumber");if(typeof d=="undefined")d=$(c).parents("html").data("BoxNumber")}var e=$("#PastelFloatBoxMain_"+d).data("FromMarginLeft"),b=$("#PastelFloatBoxMain_"+d).data("FromMarginTop");if(typeof a=="undefined")a=PastelFloatBoxDefaultParams.FunctionOnClose;typeof a=="function"&&a(d);$("#PastelFloatBoxMain_"+d).animate({width:"0px",height:"0px",marginLeft:e+"px",marginTop:b+"px"},PastelFloatBox_Speed,
function(){$("#PastelFloatBoxBackground_"+d).remove();$("#PastelFloatBoxMain_"+d).remove();$("#PastelFloatBoxTop_"+d).remove()})};
