//common script throughout site

//set up jquery no conflict mode
var $j = jQuery.noConflict();

$j(document).ready(function(){

  //Function to hide email addresses
  $j('span.mailme').each(function(){
    var $this = $j(this);
    var at = / where /;
    var dot = / dot /g;
    var addr = $j($this).text().replace(at,"@").replace(dot,".");
    $j($this).after('<a href="mailto:'+addr+'">'+ addr +'</a>');
    $j($this).remove();
  });

  // Add external link icon to text hyperlinks
	$j("a").filter(function() {
		return this.hostname && this.hostname !== location.hostname;
	}).attr("target", "_blank");

  //make plane graphics fly across sky
  $j("#plane").fly();
  $j("#plane_sm").fly({
    direction: "right",
    duration: 150000,
    height: 130
  });

  //equal height
  $j(".home .widget-container-inner").equalHeights();

  // iSelect Popup
	$j('#iselect_design').hover(function() {
		$j(this).find('#iselect_promo:hidden').fadeIn(500);
	}, function() {
		$j(this).find('#iselect_promo:visible').fadeOut(500);
	});

});
