$(function() {
		var selectedURL;
		$('#externalLinkConfirmation').dialog(
		{
			autoOpen:false, modal:true, draggable:false, resizable:false, height:170, title:'External Link', width:500, buttons:
			{
				'No, stay on this site.':function(){$('#externalLinkConfirmation').dialog("close");},
				'Yes, I want to continue anyway.':function()
				{
					window.open(selectedURL);
					$('#externalLinkConfirmation').dialog("close");
				}
			}
		});
		
		$('.externalLink').click(function()
		{
			selectedURL = $(this).attr('href');
			$('#externalLinkConfirmation').dialog("open");
			return false;
		}
		);		
});

$(document).ready(function() {
	$('img.rightImg').live('mouseover', function() {
		var imgSrc = $(this).attr('src');
		$(this).attr('src', imgSrc.replace('.jpg', '-over.jpg'));
	});
	$('img.rightImg').live('mouseout', function() {
		var imgSrc = $(this).attr('src');
		$(this).attr('src', imgSrc.replace('-over.jpg', '.jpg'));
	});
	
	/*
	fileNames = new Array();
	fileNames[0] = '/uploads/images/money-matters-in-divorce-over.jpg';
	fileNames[1] = '/uploads/images/wealth-management-over.jpg';
	fileNames[2] = '/uploads/images/trust-investments-over.jpg';
	fileNames[3] = '/uploads/images/corporate-solutions-over.jpg';
	preloadImages(fileNames);
	*/
});

function preloadImages(fileNames) {
	var imgContainer = document.createElement('div');
	imgContainer.css('display', 'none');
	imgContainer.attr('id', 'dummyContainer');
  for (var x = 0; x < fileNames.length; x++) {
    $("<img>").attr({
      id: fileNames[x],
      src: fileNames[x],
      title: ""
    }).appendTo("#dummyContainer").css('display', 'none');
  }
  imgContainer.appendTo('body');
};
