$(function() {
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
});

$(document).ready(function(){
						   
	$("#twoColSpecialist #leftColumn, #twoColSpecialist #rightColumn").equalHeights();
	
	if ($('#rightColumn').length != 0) { // implies *not* zero
		$("#twoColInternal #leftColumn, #twoColInternal #rightColumn").equalHeights();
  	}

	$('#target').fold({
		directory: 'images',
		side: 'right',           
		maxHeight: 140,
		startingWidth: 20,
		startingHeight: 20,
		autoCurl: true
	});
	
	$(".homeProductsCell a").colorbox({
		transition: 'elastic',
		iframe: true,
		//onOpen:function(){$('object, embed').hide();},
		//onClosed:function(){$('object, embed').show();},							  
		innerWidth:920,
		innerHeight:480
	});
	
	// GALLERY COLORBOX
	$("a[rel='gallery']").colorbox({
		slideshow:false
	});
	
	// NEWSLETTER COLORBOX
	$("a[href='signup']").colorbox({
		iframe: true,				  
		innerWidth:600,
		innerHeight:525
	});
	
	// FADING IMAGES
	$('#about-us #rightColumn, #downloads #rightColumn').innerfade({ 
 	  speed: 'slow', 
 	  timeout: '5000', 
 	  type: 'sequence'
  	}); 
	
	// product detail hovers
	var orig = $("#detailImage").attr("src");
	
	$("#rightColumn td a").hover(
		function () {
			var link = $(this).attr("href");
			$("#detailImage").attr("src", link);
			$("#detailImage").load(function() {
				var hei = $("#detailImage").height();
				$(".WMimage").css( { "top": ((hei/2)-113) + "px" } );
			});
		}, 
		function () {
			$("#detailImage").attr("src", orig);
		}
	);
	
	$("#rightColumn td a").click(function() {
		return false;
	});
});
