// JavaScript Document


// Jquery
$(document).ready(function(){
	//check to see if we have a top attribute on our page
	if ( $("#top").length > 0 ) {
		//take a copy of our current URL
		var currURL = location.href;

		//check to see if we have #top in our URL already
		if ( currURL.indexOf("#") == -1 ) {
			//check to see if we are on the index page
			if ( currURL.indexOf("index") == -1 ) {
				//check to see if we are at the website root (no page name)
				if ( currURL != "http://www.mergers.com.au/" && currURL != "http://www.mergers.com.au" && currURL != "http://localhost/"  && currURL != "http://localhost" ) {
					//tell the browser to go down to that location
					location.href = location.href + "#top";
				}
			}
		}
	}


	// Hover class for navigation items			
	$('#navigation ul li').hover(function() {
	  $(this).addClass('hover');
	}, function() {
	  $(this).removeClass('hover');
	});
	
	
	// Adds a margin to the right of the left hand transaction li's
	$("#significant-transactions ul").find("li:even").addClass("gutter");
	

	// Changes the color of the background of the states info box on rollover of the map link
	$('a#link-wa').hover(function() {
	  $('#western-australia').addClass('highlight');
	}, function() {
	  $('#western-australia').removeClass('highlight');
	});
	
	$('a#link-nsw').hover(function() {
	  $('#new-south-wales').addClass('highlight');
	}, function() {
	  $('#new-south-wales').removeClass('highlight');
	});
	
	$('a#link-qld').hover(function() {
	  $('#queensland').addClass('highlight');
	}, function() {
	  $('#queensland').removeClass('highlight');
	});	

	 $('a[@rel="external"]').click(function(){
		this.target = "_blank";
	  });
});

function linkopener(a) {
	var b = a ? "_blank" : "_self";
	var c = document.links;
	for (var i=0; i < c.length; i++) {
	  if (c[i].href.search("webfirm.com.au/demo/mergers/") == -1) c[i].target = b;
	}
}


