/*
Scripts written by Alex Dickson for Acura Multimedia (http://www.acura.com.au)

All scripts leverage the jQuery framework (http://www.jquery.com) by John Resig (http://www.ejohn.org)

*/



// global stuff 



var GOOGLE_ANALYTICS_KEY = 'UA-693909-45';



// add this class to specify .javascript * in css for quicker css application

$('html').addClass('javascript');

// on DOM ready

$(document).ready(function(){
	$('html').addClass('dom-loaded');

 
	
	$('a').newWindow();

	

});



// on window loaded

$(window).load(function(){  // window load
	$('html').addClass('window-loaded');

	//google analytics

	try {
		var pageTracker = _gat._getTracker(GOOGLE_ANALYTICS_KEY);
		pageTracker._trackPageview();

	} catch(err) {};

	

});



// plugin to open links with new window
// author: Alex Dickson
 (function($){  
  $.fn.newWindow = function(options) {   
    var defaults = {
		titleText: 'Link opens in a new window'		
	};	
	var options = $.extend(defaults, options);   
     return this.each(function() {  
	   var obj = $(this);	   
	   if (options.titleText) {   
		   if (obj.attr('title')) {
				var newTitle = obj.attr('title') + ' (' + options.titleText + ')';
		   } else {
				var newTitle = options.titleText;   
		   };		   
		   obj.attr('title', newTitle);		   
	   };
	   obj.click(function(event) {
	   	  event.preventDefault();  
		  var newBlankWindow = window.open(obj.attr('href'), '_blank');
		  newBlankWindow.focus();
		}); 
	   });
  };  
 })(jQuery); 
 
 





