$(document).ready(function () {
  $(".productimg img").cjObjectScaler({
    destObj: $(".productimg img").parent("div"), // must be a jQuery object (required)
    method: "fit", // can either be fit or fill (default fill)
    fade: 500 // if a positive integer, will hide and fadeIn object n duration (default 0)
  });
  
  
  $('.mainnav a').each(function() {
    if(this.href == 'http://' + window.location.host + window.location.pathname) $(this).addClass('current');
  });
    
  $('.clickable').fitted();
  
  $('.star').rating('enable');

  $('a.info').click(function(e) {
    window.location = this.href;
  });
   
  $('a.reviewlink').click(function(e) {
     	e.preventDefault();
    	var $this = $(this);
    	var horizontalPadding = 30;
    	var verticalPadding = 30;
          $('<iframe id="externalSite" class="externalSite" src="' + this.href + '" />').dialog({
              title: ($this.attr('title')) ? $this.attr('title') : 'Schrijf een review',
              autoOpen: true,
              width: 600,
              height: 350,
              modal: true,
              resizable: true,
    		      autoResize: true,
              overlay: {
                  opacity: 0.5,
                  background: "black"
              }
          }).width(600 - horizontalPadding).height(350 - verticalPadding);	
          return false;        
    });
 	 	    
 	$('a.reviewlink').hover(
 	  function() { 
 	    $("span", this).show();
 	    $(this).css('border-bottom', '1px solid #666').css('background', '#fff').css('opacity', .8);
 	  },
 	  function() { 
 	    $("span", this).hide();
 	    $(this).css('border-bottom', 'none').css('background', 'none').css('opacity', 1);
 	  });
});
