﻿$(document).ready(function() {
      imagePreview();
      $(".picImage").click(function(){
        $("#picLarge").attr("src", $(this).attr("image"));
      });
    });

function printPage(styleNo){
  if(location.href.indexOf("?") > -1) {
    printWin=window.open(location.href+'&Printerfriendly='+styleNo,'printit','');
  } else { 
    printWin=window.open(location.href+'?Printerfriendly='+styleNo,'printit','');
  }
}




am = "copyright Haarup®";
// do not edit below this line
// ===========================
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;


// Tooltip

   
    this.imagePreview = function() {
      /* CONFIG */

      xOffset = 20;
      yOffset = 20;
      var lastRollOverContent = null;
      var htmlWidth = $("html").width();

      /* END CONFIG */
      $(".rolloverMe").hover(function(e) {
        var id = "rollOverContent" + this.id.replace("rolloverMe", "");
        lastRollOverContent = $("#" + id);
        if (lastRollOverContent != null && lastRollOverContent.length > 0) {

          var c = lastRollOverContent.html();
          $("body").append("<p id='preview'>" + c + "</p>");
          var placing = findItemPlace(e.pageY, e.pageX);

          $("#preview")
			    .css("top", (placing.top) + "px")
			    .css("left", (placing.left) + "px")
			    .fadeIn("medium");
        }
      },
	    function() {
	      lastRollOverContent = null;
	      $("#preview").remove();
	    });
      $(".rolloverMe").mousemove(function(e) {
        var placing = findItemPlace(e.pageY, e.pageX);
          $("#preview")
			    .css("top", placing.top + "px")
			    .css("left", placing.left + "px");

      });

      this.findItemPlace = function(pageY, pageX) {
        var yPlace = pageY - yOffset;
        var xPlace = pageX + xOffset;

        var htmlTop = $("html")[0].offsetHeight + $("html").offset().top;
        var preview = $("#preview");
        var previewHeight = $("#preview").height();
        var previewWidth = $("#preview").outerWidth();

        var toolTipBottom = pageY + previewHeight;
        var toolTipRight = pageX + previewWidth + xOffset;
        if (toolTipBottom > htmlTop - yOffset) {
          var difference = toolTipBottom - htmlTop;
          yPlace = pageY - difference - yOffset;
        }
        if (toolTipRight > htmlWidth - xOffset) {
          xPlace = pageX - previewWidth - xOffset;
        }

        return { top: yPlace, left: xPlace };
      }

      $(window).bind("resize", function() {
        htmlWidth = $("html").width();
      });
    };