$(document).ready(function() {

// Open rel=external links in new windows
    $('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });

// Open rel=popup links in a popup sized window.
    $('a[rel="popup"]').click( function() {
        window.open( $(this).attr('href'), 'popup', 'width=540,height=400,scrollbars=yes' );
        return false;
    });

// Initially hide all but the first product div.
// Configure the initial load Product Data anchor to the first item in the 
// product list. When a product in the menu is clicked, change the classes of 
// the previous and newly highlighted menu items and fade in the new main 
// product image. Then change the Product Data anchor to the new product URL. 

    $('#product-highlight div:not(#prd-fluke62-area)').hide();

    var initPrdUrl = $('#prd-fluke62 a').attr('rel');
    $('#lnk-product-data').attr({href : initPrdUrl});
	
	var initBuyUrl = $('#prd-fluke62 a').attr('buy');
    $('#lnk-buy-data').attr({href : initBuyUrl});

    $('#menu-products li a').click(function(){
        $('#menu-products li a').removeClass('tab-on').addClass('tab-off');
        $(this).removeClass('tab-off').addClass('tab-on');
        $('#product-highlight div').hide();
        var clicked = "#" + $(this).parent().attr('id') + "-area";
        $(clicked).fadeIn();

        var prdURL = $(this).attr('rel');
        $('#lnk-product-data').attr({href : prdURL});
		
		var buyURL = $(this).attr('buy');
        $('#lnk-buy-data').attr({href : buyURL});

        return false;
    });

});
