(function(a){var b=null;a.fn.innerfade=function(c){return this.each(function(){a.innerfade(this,c,null)})};a.fn.innerfade=function(c,d){return this.each(function(){a.innerfade(this,c,d)})};a.innerfade=function(k,e,f){var d={animationtype:"fade",speed:"normal",type:"sequence",timeout:2000,containerheight:"auto",runningclass:"innerfade",children:null};if(e){a.extend(d,e)}if(d.children===null){var h=a(k).children()}else{var h=a(k).children(d.children)}if(h.length>1){a(k).css("position","relative").css("height",d.containerheight).addClass(d.runningclass);for(var g=0;g<h.length;g++){a(h[g]).css("z-index",String(h.length-g)).css("position","absolute").hide()}if(d.type=="sequence"){b=setTimeout(function(){a.innerfade.next(h,d,1,0,f)},d.timeout);a(h[0]).show()}else{if(d.type=="random"){var c=Math.floor(Math.random()*(h.length));b=setTimeout(function(){do{j=Math.floor(Math.random()*(h.length))}while(c==j);a.innerfade.next(h,d,j,c,f)},d.timeout);a(h[c]).show()}else{if(d.type=="random_start"){d.type="sequence";var j=Math.floor(Math.random()*(h.length));b=setTimeout(function(){a.innerfade.next(h,d,(j+1)%h.length,j,f)},d.timeout);a(h[j]).show()}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}}}};a.innerfade.next=function(e,c,f,d,g){if(g!=null){g(f,e[f],d,e[d])}if(c.animationtype=="slide"){a(e[d]).slideUp(c.speed);a(e[f]).slideDown(c.speed)}else{if(c.animationtype=="fade"){a(e[d]).fadeOut(c.speed);a(e[f]).fadeIn(c.speed,function(){removeFilter(a(this)[0])})}else{alert("Innerfade-animationtype must either be 'slide' or 'fade'")}}if(c.type=="sequence"){if((f+1)<e.length){f=f+1;d=f-1}else{f=0;d=e.length-1}}else{if(c.type=="random"){d=f;while(f==d){f=Math.floor(Math.random()*e.length)}}else{alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}b=setTimeout((function(){a.innerfade.next(e,c,f,d,g)}),c.timeout)};a.fn.innerfadeStop=function(){if(b){clearTimeout(b)}}})(jQuery);function removeFilter(a){if(a.style.removeAttribute){a.style.removeAttribute("filter")}};(function(a){a.fn.hoverIntent=function(e,h){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,h?{over:e,out:h}:e);var j,b,i,c;var k=function(f){j=f.pageX;b=f.pageY};var d=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(i-j)+Math.abs(c-b))<m.sensitivity){a(f).unbind("mousemove",k);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{i=j;c=b;f.hoverIntent_t=setTimeout(function(){d(g,f)},m.interval)}};var n=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var l=function(g){var f=jQuery.extend({},g);var o=this;if(o.hoverIntent_t){o.hoverIntent_t=clearTimeout(o.hoverIntent_t)}if(g.type=="mouseenter"){i=f.pageX;c=f.pageY;a(o).bind("mousemove",k);if(o.hoverIntent_s!=1){o.hoverIntent_t=setTimeout(function(){d(f,o)},m.interval)}}else{a(o).unbind("mousemove",k);if(o.hoverIntent_s==1){o.hoverIntent_t=setTimeout(function(){n(f,o)},m.timeout)}}};return this.bind("mouseenter",l).bind("mouseleave",l)}})(jQuery);var popupStatus=0;var movieplaying;function removeAllRequiredStuff(){$("span.requiredspan").remove();$("input.clearrequired").unbind("click",removeRequiredStuff)}function removeRequired(a){$(this).next(".requiredspan").remove();if(a){$(this).change()}}function applyRequiredValidators(){$(".required").one("blur",true,removeRequired).one("change",false,removeRequired).after("<span class='requiredspan'>*</span>");$("input.clearrequired").one("click",removeAllRequiredStuff)}$(document).ready(function(){$(".jQ_expand_menu_levels").click(function(){$(this).toggleClass("expand");$(this).toggleClass("collapse");$("#jQ_menu_levels").toggle()});$("li.film > a").click(function(){centerPopup(this);loadPopUp(this);return false});$("a.popupMovieClose").click(function(){disablePopup()});$(document).keypress(function(a){if(a.keyCode==27&&popupStatus==1){disablePopup()}});$("#backgroundPopup").click(function(){disablePopup()});$("#utilitymenu .searchfield").keypress(function(a){if(a.keyCode==13){$("#utilitymenu .searchbutton").click();return false}});$("#rightcolumn > .banner").each(function(){var b=$(this).children("div:first").height()+20;var c=$(this).children("img:first").height()+5;var a;if(b>c){a=b}else{a=c}if($(this).height()<a){$(this).height(a)}});$("div.jqExpandableContent").hide();$("ul.jqExpandableList .jqTrigger").removeClass("open").click(function(){$(this).parent().find(".jqExpandableContent").slideToggle("fast");$(this).toggleClass("open");return false});$(".watermark").each(function(){$tb=$(this);if($tb.val()!=this.title){$tb.removeClass("watermark")}});$(".watermark").focus(function(){$tb=$(this);if($tb.val()==this.title){$tb.val("");$tb.removeClass("watermark")}});$(".watermark").blur(function(){$tb=$(this);if($.trim($tb.val())==""){$tb.val(this.title);$tb.addClass("watermark")}})});function loadPopUp(a){if(popupStatus==0){$("#backgroundPopup").css({opacity:"0.7"});$("#backgroundPopup").fadeIn("slow");$(a).siblings(".popupMovie").fadeIn("slow");movieplaying=getFlashMovieObject(a.id+"Movie");if(movieplaying){setTimeout(function(){movieplaying.Play()},2000)}popupStatus=1}}function centerPopup(a){var b=$(a).siblings(".popupMovie").height();var d=$(a).siblings(".popupMovie").width();var c={width:0,height:0};if(document.documentElement){c.height=document.documentElement.offsetHeight;c.width=document.documentElement.offsetWidth}else{if(window.innerWidth&&window.innerHeight){c.height=window.innerHeight;c.width=window.innerWidth}}$(a).siblings(".popupMovie").css({position:"absolute",top:50,left:(700-(d/2))/2})}function OpenPopupWindow(d){var c=480,e=340;if(document.all){c=document.body.clientWidth;e=document.body.clientHeight}else{if(document.layers){c=window.innerWidth;e=window.innerHeight}}var a=650,b=500;var g=(c-a)/2,f=(e-b)/2;window.open(d,"popup","width="+a+",height="+b+",top="+f+",left="+g+",scrollbars=yes")}function disablePopup(){if(popupStatus==1){popupStatus=0;$("#backgroundPopup").fadeOut("slow");$("div.popupMovie").fadeOut("slow");if(movieplaying){setTimeout(function(){movieplaying.Rewind()},2000)}}}function printArea(e){var b=document.getElementById(e);if(b){var c='<html><head><link rel="stylesheet" type="text/css" href="/templates/NMD/Styles/NMD/style.css"><link rel="stylesheet" type="text/css" href="/templates/NMD/Styles/NMD/print.css"></head><body onload="if(window.print)window.print();">  <div id="content"><div class="main"><img class=\'printImage\' src=\'/Templates/NMD/Images/logo.gif\' alt=\'Vitusapotek\' />';sStop=" <div class='printFooter'> Farmas&oslash;yter i Vitusapotek jobber kontinuerlig for &aring; oppdatere og kvalitetssikre nettstedet. Vi kan allikevel ikke garantere at vi alltid har helt fullstendige og oppdaterte opplysninger innenfor alle omr&aring;der. Dersom du mener &aring; finne mangler h:&oslash;rer vi gjerne fra deg p&aring; redaksjon@vitusapotek.no.  <br /><br />Gode r&aring;d f&aring;r du p&aring; apoteket - finn ditt n&aelig;rmeste apotek p&aring; www.vitusapotek.no </div></div></div></body></html>";var a=c+b.innerHTML;var d=window.open("about:blank","printWin","width=580,height=500,scrollbars=yes,toolbar=no");wdoc=d.document;wdoc.open();wdoc.write(a);wdoc.writeln(sStop);wdoc.close()}}function getFlashMovieObject(a){if(window.document[a]){return window.document[a]}if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds&&document.embeds[a]){return document.embeds[a]}}else{return document.getElementById(a)}}function GetSted(a,b,c){if($("#"+b).val().length==4){document.getElementById(c).readOnly=true;$.get(a+"?nr="+$("#"+b).val(),function(d){if(d==""){$("#"+c).val("Ukjent poststed")}else{$("#"+c).val(d)}document.getElementById(c).readOnly=false})}}function showMoreInfo(a,d){var c=0;var b=0;if(!a){var a=window.event}if(a.pageX||a.pageY){c=a.pageX;b=a.pageY}else{if(a.clientX||a.clientY){c=a.clientX+document.body.scrollLeft;b=a.clientY+document.body.scrollTop}}var f=document.getElementById(d);f.style.display="block";f.style.left=parseInt(c+15)+"px";f.style.top=parseInt(b+25)+"px";f.style.zIndex=9999}function hideMoreInfo(a,c){var b=document.getElementById(c);b.style.display="none"};$(document).ready(function(){var d={over:b,out:g,timeout:100,interval:50};$("#topmenu li.haschildren").hoverIntent(d);function b(){$(".level2",this).fadeIn("fast")}function g(){$(".level2",this).fadeOut("fast")}$(".productlist").each(function(){var l=$(this);var h=l.find(".products li").size();l.find("span.total").text(h);var k=1;for(var j=4;j<14;j+=3){k++;if(j>h){l.find(".pager li:contains('"+k+"')").hide()}}if(h<4){l.find(".next").addClass("inactive");l.find(".productsfooter span.expansion").hide()}if(h<3){l.find("span.part").text("1-"+h)}});function a(k,j){var i=k*3;var h=i-2;if(i>$(j).find(".products li").size()){i=h}$(j).find(".part").text(h+"-"+i);if(h==1){j.find(".previous").addClass("inactive");j.find(".pager li").removeClass("selected");j.find(".pager li").first().addClass("selected")}}function e(){var i=$(".productlist .products");if(i.find("li").size()<1){$(".productlist .carousel").hide()}else{if(i.find("li.relatedproduct").size()<1){$("a.relatedswitch").parent().hide()}else{if(i.find("li.bestseller").size()<1){$("a.relatedswitch").click();$("a.topsellerswitch").parent().hide();$("li.relatedproduct").show()}}}var h=$(".productsfooter.regular");if(h.size()>0){h.children().hide();h.addClass("related");$("#col_main > .productlist .previous").addClass("inactive");$("#col_main > .productlist .next").addClass("inactive")}}$(e());$("a.relatedswitch").click(function(){var h=$(".productsfooter");h.children().hide();h.addClass("related");$("#col_main > .productlist .previous").addClass("inactive");$("#col_main > .productlist .next").addClass("inactive");var i=$("#col_main > .productlist .products");i.css("left","0px");$(".categories li").removeClass("selected");$(this).parent().addClass("selected");$("li.bestseller").hide();$("li.relatedproduct").show();return false});$("a.topsellerswitch").click(function(){var h=$(".productsfooter");h.children().show();h.removeClass("related");$(".categories li").removeClass("selected");$(this).parent().addClass("selected");$("li.bestseller").show();$("li.relatedproduct").hide();var i=$("#col_main > .productlist .products");i.css("left","0px");if(i.find("li.bestseller").size()>3){$("#col_main > .productlist .next").removeClass("inactive")}return false});$(".productlist .expansion").click(function(){var j=$(this);var k=j.parent().parent();var i=k.find(".products");i.css("left","0px");var h=i.find("li.bestseller:gt(2)");if(j.hasClass("open")){j.removeClass("open");h.slideUp("medium",function(){k.removeClass("expanded");h.show()});k.find("span.part").text("1-3");a(1,k)}else{j.addClass("open");k.addClass("expanded");h.hide();h.slideDown("medium");k.find(".part").text(i.find("li").size())}$(".previous.imagebutton").fadeToggle();$(".next.imagebutton").fadeToggle();$(".pager").fadeToggle()});$("#col_main > .productlist .previous").click(function(){var i=$(this);var j=$(this).parent();if(!i.hasClass("inactive")){var h=j.find(".next");h.removeClass("inactive");var j=$(this).parent();var k=j.find(".products");k.animate({left:"+=657px"},500);var m=parseInt(j.find(".pager li.selected a").text());m--;j.find(".pager li").removeClass("selected");var l=j.find(".pager li:contains('"+m+"')").filter(function(){return $(this).text()==m});l.addClass("selected");if(m==1){$(this).addClass("inactive")}a(m,j)}});$("#col_main > .productlist .next").click(function(){var h=$(this);var j=$(this).parent();if(!h.hasClass("inactive")){var i=j.find(".previous");i.removeClass("inactive");var k=j.find(".products");k.animate({left:"-=657px"},500);var n=parseInt(j.find(".pager li.selected a").text());n++;j.find(".pager li").removeClass("selected");var m=j.find(".pager li:contains('"+n+"')").filter(function(){return $(this).text()==n});m.addClass("selected");var l=j.find(".pager li:last-child");if(m.text()==l.text()){$(this).addClass("inactive")}a(n,j)}});$(".pager li a").click(function(){var k=$(this).parentsUntil(".productlist").parent();var i=k.attr("id");var p=parseInt(k.find(".pager li.selected a").text());var o=parseInt($(this).text());var j=k.find(".previous.imagebutton");var h=k.find(".next.imagebutton");var m=k.find(".pager li:last-child a");var l=1-o;var n=657*l;var q=k.find(".products");q.animate({left:n+"px"},500);if(q.find("li").size()>3){j.removeClass("inactive");h.removeClass("inactive")}k.find(".pager li").removeClass("selected");$(this).parent().addClass("selected");if(o==1){j.addClass("inactive")}else{if(o==m.html()){h.addClass("inactive")}}a(o,k);return false});$(".col_secondary .productlist .previous").click(function(){var h=$(this).find(".imagebutton");if(!h.hasClass("inactive")){var j=$(this).parent();var i=j.find(".products");i.animate({left:"+=219px"},500)}});$(".col_secondary .productlist .next").click(function(){var j=$(this).parent();var h=j.find(".previous .imagebutton");h.removeClass("inactive");var i=j.find(".products");i.animate({left:"-=219px"},500)});$(".slideshow .items").innerfade({speed:"slow",timeout:5000,type:"sequence",containerheight:"394px"},function(h,i,j,k){$(k).parentsUntil(".slideshow").parent().parent().find(".thumbnails ."+(j+1).toString()).removeClass("selected");$(i).parentsUntil(".slideshow").parent().parent().find(".thumbnails ."+(h+1).toString()).addClass("selected")});$(".slideshow .thumbnails img.thumbnail").click(function(i){var h=$(i.target).parent();var k=h.attr("class");h.parent().children().removeClass("selected");h.addClass("selected");var j=h.parent().parent().find(".items");j.innerfadeStop();j.find("li").fadeOut("slow");j.find("."+k).fadeIn("slow",function(){removeFilter($(this)[0])});return false});$("div.close").live("click",(function(h){$(this).parent().hide();return false}));var c=0;var f=new Array();$(".addtocart").click(function(h){if($("span.otc").length>0){c++}if(c<=1){$(".popup-purchase.fullproduct").fadeToggle().delay(5000).fadeToggle()}else{$(".invalid.fullproduct").fadeToggle().delay(5000).fadeToggle()}return true});$(".carousel-addtocart").click(function(l){var j=$(this).data("id");var k=false;if($(this).data("otc")==true){for(var m=0;m<f.length;m++){if(f[m]==j){k=true}else{f[f.length]=j;break}}if(f.length==0){f[0]=j}}var h="";if($(this).hasClass("related")){h=".related"}var n;if(!k){n=$(".popup-purchase"+h+"[data-id="+j+"]")}else{n=$(".invalid"+h+"[data-id="+j+"]")}n.fadeToggle();n.delay(5000);if(n.is(":visible")){n.fadeOut()}else{n.hide()}return true});$(".slideshow .thumbnails li").first().addClass("selected");$("a.secondaryexpand").click(function(h){var i=$(this).parent();if(i.hasClass("open")){i.removeClass("open");i.find("ul").css("display","none")}else{i.addClass("open");i.find("ul").css("display","block")}})});
