$(document).ready(function() {
  // Add class for javascript enabled, allows for easy css manipulation etc.
  $("body").addClass("javascript-enabled");
  
  // Email replacement using .mailto technique
	$("span.mailto").each(function(){
		exp = $(this).text().search(/\((.*?)\)/) != -1 ? new RegExp(/(.*?) \((.*?)\)/) : new RegExp(/.*/);
		match = exp.exec($(this).text());
		addr = match[1] ? match[1].replace(/ at /,"@").replace(/ dot /g,".") : match[0].replace(/ at /,"@").replace(/ dot /g,".");
		link = match[2] ? match[2] : addr;
		subject = $(this).attr('title') ? "?subject="+$(this).attr('title').replace(/ /g,"%20") : "";
		$(this).after('<a href="mailto:'+addr+subject+'">'+ link + '</a>').remove();
	});
	
	// Open links in new window when rel="external" is present
	$('a[rel~=external]').each(function(){ this.target = "_blank"; });
	
	// Articles
	$(".article:first").css("border-top","0");
	$(".article:last").css("border-bottom","0");
	
	// Vessels
	$(".vessel:first").css("border-top","0");
	$(".vessel:last").css("border-bottom","0");
	
	// Banner
	$('#banner_image img:first').remove();
	for(i=1;i<5;i++) {
	  $('#banner_image').append('<img src="images/core/banner_slide_'+i+'.jpg" width="918" height="346" alt="Banner Image '+i+'" />');
  }
  $("#banner_image").cycle();
  
  // Contact Form
 $('form#contact-form').validate(); 
})
