﻿function IE5_setBlurredImage(type, imgWidth, imgHeight) 
{	
    var position = findPos(document.getElementById("outterTable"));
    var dimensions = getPageSizeWithScroll();
    
    //alert("Type : " + document.body.scrollTop);
    
    var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0)
	{
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	//alert("ScrollTop : " + ScrollTop);
    
    if(type == "TL")
    {
		var offsetX = parseInt(position[0] * -1);
		var offsetY = parseInt(position[1] * -1 + ScrollTop);
		positionBackground("outterTable", offsetX, offsetY);
    }
    
    if(type == "ML")
    {
		var offsetX = parseInt(position[0] * -1);
		var offsetY = (document.documentElement.clientHeight / 2) - (imgHeight / 2) - position[1] + ScrollTop;
		positionBackground("outterTable", offsetX, offsetY);
    }
    
    if(type == "BL")
    {
		var offsetX = parseInt(position[0] * -1);
		var offsetY = document.documentElement.clientHeight - imgHeight - position[1] + ScrollTop;
		positionBackground("outterTable", offsetX, offsetY);
    }
}


function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}


function findPos(obj) 
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
	{
		do 
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} 
		while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function positionBackground(frame, xOffset, yOffset) 
{
	//alert("Positioning : " + xOffset + " x " + yOffset);
	document.getElementById(frame).style.backgroundPosition = xOffset + "px " + yOffset + "px"; 
	//alert("Done!");
}