/* General shared jquery code. Only put jQuery code that can be used across any site in here */

$(function() {

	// Open link in new window
	$(".new-win").attr({target:"_blank", rel:"ext"});
	
	// Append ajax to href
	$("a.thickbox").each(function(i) {
	
		var href = $(this).attr("href");
		var separator = "&";
		
		if (href.indexOf("?") == -1) {
			separator = "?";
		}
	
		$(this).attr("href", $(this).attr("href") + separator + "ajax=true");
		
	});
	
});

// Moved into a function so it can be called after document ready has fired
function bindNewWin() {
	$("a.new-win").attr({target:"_blank", rel:"ext"});
	return false;
}

function bindCorner() {
	try {
		$("a.rounded").corner("5px");
	} catch (e) {
		// Do nowt
	}
}
function receiveFocus(){
  $(".focused").focus();
  }

$(document).ready(function(){

   bindNewWin();
   bindCorner();
	 receiveFocus();
});

// thickbox ajax url argument 
// leaves hardcoded link to function as normal if scripting disabled
//   $(document).ready(function(){
//    $("a.thickbox").attr("href", function() { return this.href + "?height=460&width=460&ajax=true"});
//		$("a.thickbox2").attr("href", function() { return  "/includes/signup-form.cfm?height=360&width=360&ajax=true"});
//   return false;
//
// });