var fsa=fsa||{};fsa={loaderImage:"/Assets/Images/loading_icon1.gif",vars:{},init:function(){$("#fileupload").hide();$(".addWriter").hide();$(".upload ul li a").click(function(a){a.preventDefault()});fsa.print.init();fsa.eraseInput.init();fsa.like.init();fsa.calendar.init();fsa.commentsBox.init();fsa.filtersearch.init();fsa.toolTip.init()},toolTip:{init:function(){$(".trigger").unbind("mouseover");$(".trigger").bind("mouseover",function(a){a.preventDefault();if($.support.opacity){$(".tip").animate({opacity:"show",top:"0"},400)}else{$(".tip").show()}});$(".trigger").unbind("mouseout");$(".trigger").bind("mouseout",function(a){a.preventDefault();if($.support.opacity){$(".tip").animate({opacity:"hide",top:"0"},400)}else{$(".tip").hide()}})}},eraseInput:{init:function(){$("#search input").focus(function(){if($(this).val()===$(this).attr("title")){$(this).val("")}}).blur(function(){if($(this).val()===""){$(this).val($(this).attr("title"))}});$("form").submit(function(){if($("#search .search-main").val()==$("#search .search-main").attr("title")){$("#search .search-main").val("")}})}},print:{init:function(){$(".print").show().click(function(){window.print();return false})}},imageGallery:{init:function(){$("#toggle").toggle(function(){$("#feature_list").animate({height:"634px"},500);$("#toggle").addClass("active");$("#output li img").animate({opacity:"hide"},{duration:"slow"});$("ul#tabs li a").addClass("stop");$("#small-picture").animate({opacity:"show"},{duration:"slow"});$("#output li img").hide()},function(){$("#feature_list").animate({height:"360px"},500);$("#toggle").removeClass("active");$("#output li img").animate({opacity:"show"},{duration:"slow"});$("#small-picture").delay(400).animate({opacity:"hide"},{duration:"slow"});$("ul#tabs li a").removeClass("stop")})}},filtersearch:{init:function(){$("#search-filter-tags a").not("ul li a").click(function(a){a.preventDefault();if(!$(this).hasClass("active")&&!$(this).hasClass("limit")&&$("#search-filter-tags a.active").size()>=3){return}$(this).toggleClass("active")});$("#search-filter-tags a.all").click(function(a){a.preventDefault();$("a").not("ul li a").addClass("active")});$("#search-filter-tags a.reset").click(function(a){a.preventDefault();$("a").not("ul li a").removeClass("active")})}},like:{init:function(){$(".like").click(function(c){c.preventDefault();var b=JSON.stringify({pageId:$(this).attr("id")});var a=$(this);$.ajax({url:"/services/ajaxservice.svc/AddLike",data:b,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){a.text(d.d)}})});$(".likeComment").click(function(c){c.preventDefault();var b=JSON.stringify({commentId:$(this).attr("id")});var a=$(this);$.ajax({url:"/services/ajaxservice.svc/AddCommentLike",data:b,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){console.log(d);a.text(d.d)}})});$(".reportComment").click(function(c){c.preventDefault();var b=JSON.stringify({commentId:$(this).attr("id"),pageId:$(this).data("page-id")});var a=$(this);$.ajax({url:"/services/ajaxservice.svc/AddReport",data:b,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){console.log(d);a.text(d.d)}})});$(".shopping-cart-units").change(function(c){c.preventDefault();var b=JSON.stringify({productId:$(this).attr("id"),quantity:$(this).attr("value")});var a=$(this);$.ajax({url:"/services/ajaxservice.svc/UpdateShoppingCart",data:b,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){console.log(d);a.text(d.d)}})})}},calendarPage:{init:function(){$("#all").change(function(){if(!$(this).is(":checked")){$("#calender-sort input[type=checkbox]").attr("checked",false);$("#calender-sort label").removeClass("checked");fsa.calendarPage.updateAllCheckboxStates()}else{$("#calender-sort input[type=checkbox]").attr("checked",true);$("#calender-sort label").addClass("checked");fsa.calendarPage.updateAllCheckboxStates()}});$("#course").change(function(){fsa.calendarPage.toggleEventType(this,"kurser");fsa.calendarPage.updateCheckBoxAllState()});$("#internal").change(function(){fsa.calendarPage.toggleEventType(this,"internt");fsa.calendarPage.updateCheckBoxAllState()});$("#external").change(function(){fsa.calendarPage.toggleEventType(this,"externt");fsa.calendarPage.updateCheckBoxAllState()});$("#sort-city").change(function(){var a=$(this).val();$(".event").hide();fsa.calendarPage.filterByLocation(a)})},updateAllCheckboxStates:function(){fsa.calendarPage.toggleEventType($("#course"),"kurser");fsa.calendarPage.toggleEventType($("#internal"),"internt");fsa.calendarPage.toggleEventType($("#external"),"externt")},updateCheckBoxAllState:function(){var a=true;$("#calender-sort input[type=checkbox]:not(#all)").each(function(){if(!$(this).is(":checked")){a=false}});if(a){$("#all").attr("checked",true).next().addClass("checked")}else{$("#all").attr("checked",false).next().removeClass("checked")}},toggleEventType:function(b,a){if($(b).is(":checked")){$("."+a).show()}else{$("."+a).hide()}},filterByLocation:function(a){if(a!=null&&a!=""){$(".event[data-location="+a+"]").show()}else{$(".event").show()}}},commentsBox:{currentPage:1,currentArticlePage:1,category:"something",init:function(){fsa.commentsBox.category=$("#updates li.active").children("a").html()},changeCategory:function(a,c){fsa.commentsBox.currentPage=1;fsa.commentsBox.category=a;fsa.commentsBox.currentArticlePage=1;var b=JSON.stringify({category:a,page:1,count:4});$.ajax({url:"/services/ajaxservice.svc/GetCommentsForCategory",data:b,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){$("#latest-comments-article").html(d.d.split("|||")[0]);$("#updates-facts p").html(d.d.split("|||")[1]+" kommentarer, "+d.d.split("|||")[2]+" artiklar i detta &auml;mne")}});$("#latest-comments-article").html('<img src="'+fsa.loaderImage+'"/>');fsa.commentsBox.getMoreArticles(a,1,4);$("#updates ul li").removeClass("active");$(c).parent().addClass("active")},getMoreArticles:function(b,c,a){var d=JSON.stringify({category:b,page:c,count:a});$.ajax({url:"/services/ajaxservice.svc/GetArticlesForCategory",data:d,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){$("#latest-comments-related-articles .read-more").remove();if(c==1){$("#latest-comments-related-articles ul").html(e.d)}else{$("#latest-comments-related-articles ul").append(e.d);fsa.commentsBox.currentArticlePage++}$("#latest-comments-related-articles img").remove()}});if(c==1){$("#latest-comments-related-articles ul").html('<img src="'+fsa.loaderImage+'"/>')}else{$("#latest-comments-related-articles .read-more").parent().remove();$("#latest-comments-related-articles ul").append('<br/><br/><img src="'+fsa.loaderImage+'"/>')}},getMoreComments:function(b,c,a){var d=JSON.stringify({category:b,page:c,count:a});$.ajax({url:"/services/ajaxservice.svc/GetCommentsForCategory",data:d,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){$("#latest-comments-article .read-more").remove();$("#latest-comments-article").append(e.d.split("|||")[0]);$("#latest-comments-article img").remove();fsa.commentsBox.currentPage++}});$("#latest-comments-article .read-more").remove();$("#latest-comments-article").append('<img src="'+fsa.loaderImage+'"/>')}},calendar:{month:1,year:2010,day:1,eventElements:new Array(),init:function(){fsa.calendar.month=new Date().getMonth();fsa.calendar.year=new Date().getFullYear();fsa.calendar.day=new Date().getDay();fsa.calendar.hookEvents();$("#checkBoxAll").change(function(){if(!$(this).is(":checked")){$("#calendar-options input[type=checkbox]").attr("checked",false);$("#calendar-options label").removeClass("checked");fsa.calendar.updateAllCheckboxStates()}else{$("#calendar-options input[type=checkbox]").attr("checked",true);$("#calendar-options label").addClass("checked");fsa.calendar.updateAllCheckboxStates()}});$("#checkboxInternt").change(function(){fsa.calendar.toggleEventType(this,0,"internt")});$("#checkboxKurser").change(function(){fsa.calendar.toggleEventType(this,1,"kurser")});$("#checkboxExterna").change(function(){fsa.calendar.toggleEventType(this,2,"externt")});fsa.calendar.eventElements[0]=$("td.internt");fsa.calendar.eventElements[1]=$("td.kurser");fsa.calendar.eventElements[2]=$("td.externt")},updateAllCheckboxStates:function(){fsa.calendar.toggleEventType($("#checkboxInternt"),0,"internt");fsa.calendar.toggleEventType($("#checkboxKurser"),1,"kurser");fsa.calendar.toggleEventType($("#checkboxExterna"),2,"externt")},toggleEventType:function(a,b,c){if($(a).is(":checked")){fsa.calendar.eventElements[b].addClass(c)}else{fsa.calendar.eventElements[b].removeClass(c)}},hookEvents:function(){$("#calendar, tbody td").click(function(d){$("#calendar, tbody td").removeClass("selected");$(this).addClass("selected");var a,c,b;a=$(this).html();c=fsa.calendar.month;b=fsa.calendar.year;if($(this).parent().index()==0){if(a>20){c--}}else{if($(this).parent().index()==4){if(a<10){c++}}}fsa.calendar.selectDate(a,c,b)})},selectDate:function(a,d,b){var c=JSON.stringify({day:a,month:d,year:b});$.ajax({url:"/services/ajaxservice.svc/GetEventsForDate",data:c,type:"POST",processData:false,contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){$("#SelectedDayEvents").html(e.d)}});$("#SelectedDayEvents").html('<img src="'+fsa.loaderImage+'"/> ')},changeMonth:function(a,k){$("#calendar, tbody td").removeClass();var g=new Date();g.setDate(1);g.setFullYear(k);g.setMonth(a);fsa.calendar.day=1;fsa.calendar.month=g.getMonth();fsa.calendar.year=g.getFullYear();var l=new Array(12);l[0]="Januari";l[1]="Februari";l[2]="Mars";l[3]="April";l[4]="Maj";l[5]="Juni";l[6]="Juli";l[7]="Augusti";l[8]="September";l[9]="Oktober";l[10]="November";l[11]="December";$("#monthHeader").html(l[fsa.calendar.month]+" "+fsa.calendar.year);var e=g.getDay()-2;if(e==-2){e=6}g.setDate(-e);var d=new Date();d.setYear(k);d.setMonth(a);d.setDate(g.getDate()-e);$("#calendar, tbody tr").remove();for(var b=0;b<5;b++){var c=$(document.createElement("tr"));for(var f=0;f<7;f++){var h=$(document.createElement("td"));if(b==0&&f==0){h.addClass("selected");fsa.calendar.selectDate(g.getDate(),g.getMonth(),g.getFullYear())}var m=JSON.stringify({day:g.getDate(),month:g.getMonth(),year:g.getFullYear()});h.html(g.getDate());$.ajax({url:"/services/ajaxservice.svc/GetEventClassForDate",data:m,type:"POST",processData:false,contentType:"application/json; charset=utf-8",context:h,dataType:"json",success:function(i){if(i.d!=null){$(this).addClass(i.d.toLowerCase());fsa.calendar.eventElements[0]=$("td.internt");fsa.calendar.eventElements[1]=$("td.kurser");fsa.calendar.eventElements[2]=$("td.externt")}}});g.setDate(g.getDate()+1);c.append(h)}$("#calendar, tbody").append(c)}fsa.calendar.hookEvents()}}};$(function(){fsa.init();$("input.custom").customInput();$(".customList input").customInput();$.featureList($("#tabs li a"),$("#output li"),{start_item:0})});function hideClass(a,b){if($(a).hasClass("active")){$(b).show()}else{$(b).hide()}}function showControl(c,a,b){$(a).show();$(b).hide()}function showAuthor(a,b){$(b).show()}function fetchTags(){var a=[];$("#search-filter-tags a.active").each(function(){a.push($(this).text())});$("#<%= TagsHiddenField.ClientID %>").val(a.join(","))}(function(a){a.featureList=function(i,g,c){var e;a(".feature-list-content").hide();a(a(".feature-list-content")[0]).show();var h=0;function d(k){if(typeof k=="undefined"){k=f+1;k=k>=b?0:k}var j=0;a(".feature-list-content").hide();if(k<3){j=0}else{j=-90*(k-2)}a(a(".feature-list-content")[k]).show();i.animate({top:j},500,function(){});i.removeClass("current").filter(":eq("+k+")").addClass("current");g.stop(true,true).filter(":visible").fadeOut();g.filter(":eq("+k+")").fadeIn(function(){f=k});h=k;if(h==i.length-1){a("#slider-btn-next").addClass("disabled")}else{a("#slider-btn-next").removeClass("disabled")}if(h<=0){a("#slider-btn-prev").addClass("disabled")}else{a("#slider-btn-prev").removeClass("disabled")}}var c=c||{};var b=i.length;var f=c.start_item||0;c.pause_on_hover=c.pause_on_hover||true;c.transition_interval=c.transition_interval||5000;g.hide().eq(f).show();i.eq(f).addClass("current");i.click(function(){if(a(this).hasClass("current")){return false}d(i.index(this))});a("#slider-btn-next").click(function(){if(a(this).hasClass("disabled")){return false}h++;d(h)});a("#slider-btn-prev").click(function(){if(a(this).hasClass("disabled")){return false}clearInterval(e);h--;d(h)});if(c.transition_interval>0){e=setInterval(function(){d()},c.transition_interval);if(c.pause_on_hover){i.mouseenter(function(){clearInterval(e)}).mouseleave(function(){clearInterval(e);e=setInterval(function(){d()},c.transition_interval)})}}}})(jQuery);jQuery.fn.customInput=function(){$(this).each(function(a){if($(this).is("[type=checkbox],[type=radio]")){var b=$(this);var c=$("label[for="+b.attr("id")+"]");var e=(b.is("[type=checkbox]"))?"checkbox":"radio";$('<div class="custom-'+e+'"></div>').insertBefore(b).append(b,c);var d=$("input[name="+b.attr("name")+"]");c.hover(function(){$(this).addClass("hover");if(e=="checkbox"&&b.is(":checked")){$(this).addClass("checkedHover")}},function(){$(this).removeClass("hover checkedHover")});b.bind("updateState",function(){if(b.is(":checked")){if(b.is(":radio")){d.each(function(){$("label[for="+$(this).attr("id")+"]").removeClass("checked")})}c.addClass("checked")}else{c.removeClass("checked checkedHover checkedFocus")}}).trigger("updateState").click(function(){$(this).trigger("updateState")}).focus(function(){c.addClass("focus");if(e=="checkbox"&&b.is(":checked")){$(this).addClass("checkedFocus")}}).blur(function(){c.removeClass("focus checkedFocus")})}})};
