function changeHover(imgBlock, hoverType)
{
	var Offset = 35;
	var leftPos = document.getElementById(imgBlock).style.left;
	var topPos = document.getElementById(imgBlock).style.top;
	leftPos = leftPos.replace('px', '');
	topPos = topPos.replace('px', '');
	if(hoverType == 'over')
	{
		NewLeftPos = eval(parseFloat(leftPos) - parseFloat(Offset));
		NewTopPos = eval(parseFloat(topPos) - parseFloat(Offset));
	}
	else
	{
		NewLeftPos = eval(parseFloat(leftPos) + parseFloat(Offset));
		NewTopPos = eval(parseFloat(topPos) + parseFloat(Offset));
	}
	document.getElementById(imgBlock).style.top = NewTopPos+'px';
	document.getElementById(imgBlock).style.left = NewLeftPos+'px';
}

function changeImg(ImgId, imgTitle)
{
	$('#bgImgBlk').css('display', 'none');
	$("#bgImgBlk").fadeIn("500");
	$('#bgImgBlk').html('<img id="bgImg" src="images/ajax-loader.gif" style="margin:180px 0px 0px 560px;" />');
	$("#bgImgBlk").delay("30").fadeIn("500");
	$('#bgImgBlk').html('<img id="bgImg" src="flash/'+ImgId+'.jpg" alt="" title="" />');
	$("#bgImg").attr("alt", imgTitle);
	$("#bgImg").attr("title", imgTitle);
}

$(document).ready(function(){

    $("#circle div a").hover(function()
    {
		var currImg = document.getElementById('bgImg').title;
		currImg = currImg.toLowerCase();
		currImg = currImg.replace(' ', '_');

		var imgBlock = $(this).attr("id");
		imgBlock = imgBlock.replace('Img', '');
		var imgTitle = $(this).attr("title");
		if(imgBlock != 'pm_web')
		{
			$('#'+imgBlock)[0].className = imgBlock+'_o';
		}
		if(currImg != imgBlock)
			changeImg(imgBlock, imgTitle);
    },

    function()
    {
		var imgBlock = $(this).attr("id");
		imgBlock = imgBlock.replace('Img', '');
		$('#bgImgBlk').css('display', 'none');
		$("#bgImgBlk").fadeIn("500");
		$('#bgImgBlk').html('<img id="bgImg" src="images/ajax-loader.gif" style="margin:180px 0px 0px 560px;" />');
		$("#bgImgBlk").delay("30").fadeIn("500");
		$('#bgImgBlk').html('<img id="bgImg" src="flash/hill_pci.jpg" alt="" title="" />');
		if(imgBlock != 'pm_web')
		{
			$('#'+imgBlock)[0].className = imgBlock;
		}
    });
});

function preloadImages(images)
{
    if(document.images)
    {
        var imageArray = new Array();
        imageArray = images.split(', ');
        var imageObj = new Image();
        for(i=0; i<=imageArray.length-1; i++)
        {
            //document.write('<img src="' + imageArray[i] + '" />');// Write to page (uncomment to check images)
            imageObj.src=images[i];
        }
    }
}
