function megaHoverOver(){$(this).find("a").addClass('selected');$(this).find(".sub").stop().fadeTo('fast',1).show();(function($){jQuery.fn.calcSubWidth=function(){rowWidth=0;$(this).find("ul").each(function(){rowWidth+=$(this).width();});};jQuery.fn.getSubWidth=function(){rowWidth=0;$(this).find("ul").each(function(){rowWidth=$(this).width();});};})(jQuery);if($(this).find(".row").length>0){var biggestRow=0;$(this).find(".row").each(function(){$(this).calcSubWidth();if(rowWidth>biggestRow){biggestRow=rowWidth;}});$(this).getSubWidth();$(this).find(".sub").css({'width':biggestRow,'margin-left':'-'+rowWidth+'px'});$(this).find(".row:last").css({'margin':'0'});}else{$(this).calcSubWidth();$(this).find(".sub").css({'width':rowWidth});}}
function megaHoverOut(){$(this).find("a").removeClass('selected');$(this).find(".sub").stop().fadeTo('fast',0,function(){$(this).hide();});}
var popupStatus=0;function loadPopup(){if(popupStatus==0){$("#backgroundPopup").css({"opacity":"0.7"});$("#backgroundPopup").fadeIn("slow");$("#popupProd").fadeIn("slow");popupStatus=1;}}
function disablePopup(){if(popupStatus==1){$("#backgroundPopup").fadeOut("slow");$("#popupProd").fadeOut("slow");popupStatus=0;}
$("#popupProd").find("#contentareapopup").empty();}
function centerPopup(){var windowWidth=document.documentElement.clientWidth;var windowHeight=document.documentElement.clientHeight;var popupHeight=$("#popupProd").position().top;var popupWidth=$("#popupProd").width();$("#popupProd").css({"position":"absolute","top":popupHeight+(windowHeight/3),"left":windowWidth/2-popupWidth/2});$("#backgroundPopup").css({"height":windowHeight});}
$(document).ready(function(){var config={sensitivity:2,interval:50,over:megaHoverOver,timeout:300,out:megaHoverOut};$("ul#topnav li .sub").css({'opacity':'0'});$("ul#topnav li").hoverIntent(config);var $popup=$("#popupProd");$("li.oneproductcontainer").hover(function(){$(this).addClass("oneproductcontainerhover");},function(){$(this).removeClass("oneproductcontainerhover");});$("li.oneproductcontainer").click(function(){$popup.insertAfter("li.oneproductcontainer");var html=$.ajax({url:$(this).attr('href'),async:false}).responseText;$popup.find("#contentareapopup").empty().append(html);centerPopup();loadPopup();});$("#popupProdClose").click(function(){disablePopup();});$("#backgroundPopup").click(function(){disablePopup();});$(document).keypress(function(e){if(e.keyCode==27&&popupStatus==1){disablePopup();}});$("#s-input").one("focus",function(){$(this).val("");});$(".jqzoom").jqzoom({zoomWidth:250,zoomHeight:250,zoomType:'reverse'});$("#results-sortBy").change(function(){var url=$(this).attr('href')+"?order="+$(this).val();$(location).attr('href',url);return false;});});
