

// Take over any a.xe_pca links and cuase as popups
jQuery(document).ready(function($){
	if ($('a.xe_pca').size() < 1) { return; }
	$('a.xe_pca').click(function(ev) {
		ev.preventDefault();
		xeWin = window.open('', 'XECurrencyWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,height=200,width=620');
		xeWin.focus();
		xeWin.location.href = $(this).attr('href');		
	});
	// Also do a div.xe_pca so that we can have a floating block that is NOT a link?
	// See if that proves neccessary
	/*
	<script language="javascript" src="http://www.xe.com/pca/link.php?Amount=275&FromSelect=AUD&ToSelect=USD"></script>
	<noscript><a href="http://www.xe.com/pca/input.php?Amount=275&FromSelect=AUD&ToSelect=USD" target="_blank">XE Personal Currency Assistant</a></noscript>
	*/
});



// Homepage:  Even up the three-box area
jQuery(document).ready(function($){
	if ($('.home_boxes .homebox').size() < 2) { return; }
	$('.home_boxes .homebox').equalHeight();
});


// Homepage:  Image Slider
jQuery(document).ready(function($) {
	$('#photo_rotate').easySlider({
		continuous:true,
		auto:true,
		speed:900,
		pause:3000
	});
});




// Plugin from:	http://andreaslagerkvist.com/jquery/equal-height/
jQuery.fn.equalHeight = function () {
    var height        = 0;
    var maxHeight    = 0;

    // Store the tallest element's height
    this.each(function () {
        height        = jQuery(this).outerHeight();
        maxHeight    = (height > maxHeight) ? height : maxHeight;
    });

    // Set element's min-height to tallest element's height
    return this.each(function () {
        var t            = jQuery(this);
        var innerHeight    = t.innerHeight();
        var outerHeight    = t.outerHeight();
        var notHeight    = outerHeight - innerHeight;
        var minHeight    = maxHeight - notHeight;
        var property    = jQuery.browser.msie && jQuery.browser.version < 7 ? 'height' : 'min-height';

        t.css(property, minHeight + 'px');
    });
};