// define preoloader function

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}


function commonSetup() {
	//console.debug("In commonSetup ");

	// center layers if browser.width>1024
	if ($(window).width()>1024) {
		var offset = ($(window).width()-1024)/2;
		$("#Container").css("left", offset + "px");
		//alert("Width: "+$(window).width()+" Offset=" +offset);
	}

    // TODO optimisation point, could check browser is <=IE6 before use pngfix 
    $(document).pngFix();
	
	// set active button to always on
//	console.debug($("#navBar img.active").get(0).src.replace("_off","_on"));
//	$("#navBar img.active").get(0).src = $("#navBar img.active").get(0).src.replace("_off","_on");

	$("#navBar img").hover(	
		function() {
			this.src = this.src.replace("_off","_on");
		},
		function() {
			this.src = this.src.replace("_on","_off");
		}
	);
	
	$("#footer").mouseenter(
		function() {
			$("#shareIcons").css('visibility', 'visible');
		}
	);

	$("#footer").mouseleave(
		function() {
			$("#shareIcons").css('visibility', 'hidden');
		}
	);

	$("#shareIcons").mouseover(
		function() {
			$("#shareIcons").css('visibility', 'visible');
	} );

	$("#shareIcons").mouseleave(
		function() {
			$("#shareIcons").css('visibility', 'hidden');
	} );
}
