$(document).ready(function() {  
  // Product Photos Javascript
  $('.product-photos img').click(function() {
    source = $(this).attr('src');
    source = source.replace('/product_gallery/', '/product/');
    $('.product-image img').attr('src', source);
    
    // Enlarge Link
    source_plain = source.replace('/sites/files/imagecache/product', '');
    source_plain = source.replace('\'', "\\'");
    $('.product-enlarge').attr('href', "javascript:popUp('"+ source_plain +"')");
  })

  // Hover Javascript
	$("#block-search-0 input#edit-submit").hover(function() {
	    $(this).addClass('hover');
	  },
	  function() {
	    $(this).removeClass('hover');
	  }
	);
	
	$(".add_to_cart input.form-submit").hover(function() {
	    $(this).addClass('hover');
	  },
	  function() {
	    $(this).removeClass('hover');
	  }
	);
	
	$(".buy-button input.form-submit").hover(function() {
	    $(this).addClass('hover');
	  },
	  function() {
	    $(this).removeClass('hover');
	  }
	);
	
	$("#block-block-2 .newsletter").hover(function() {
	    $(this).addClass('hover');
	  },
	  function() {
	    $(this).removeClass('hover');
	  }
	);
	
  // Menu Javascript (MOVING THIS WILL BREAK ALL JS)
/*
	$("#header ul").superfish({
	  hoverClass: 'hover',
	  animation: {height:"show"},
	  speed: 1,
	  delay: 0
	});
*/
})

// Enlarge Pop-out Window
function popUp(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400');");
}

