/*
 * Copyright (c) Cognethos Pty Ltd
 */
(function()
{
preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
	jQuery("<img>").attr("src", arguments[i]);
  }
};
$(document).ready(function(){
  $.each($('#icons img'), function() { preloadImages($(this).attr("src").match(/[^\.]+/) + "h.png"); });
  if (!navigator.userAgent.match(/iPhone/i))
  {
	  $('#icons img').hover(
		function() { 
			var src = $(this).attr("src").match(/[^\.]+/) + "h.png";
			$(this).attr("src", src);
			var id = $(this).attr("src").replace("h.png", "").replace("images/btn_","");
				$("#"+id).css("display", "block");
		},
		function() {
			var src = $(this).attr("src").replace("h.png", ".png");
			$(this).attr("src", src);
			var id = $(this).attr("src").replace(".png", "").replace("images/btn_","");
			$("#"+id).css("display", "none");
		}
	  );
	  
	  $("#contact").hover(
		function()
		{
			$("#details").css("display", "block");
		}, 
		function()
		{
			$("#details").css("display", "none");
		}
	  );
  }
  else
  {
	  $('#icons img').click(
		function() { 
			var src = $(this).attr("src").match(/[^\.]+/) + "h.png";
			$(this).attr("src", src);
			return true;
		}
	  );
	  
	  $("#contact").click(
		function()
		{
			$("#details").toggle();
		}
	  );  
  }
  $("dd a").click(function(){
	var href = $(this).attr("href").replace("_NOSPAM", "").replace("2e939f7c5de79b690e6eb3b465711e27", "email");	
	$(this).attr("href", href);
  });
});
})();