function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function GetWindowHeight() {
	if (self.innerWidth) {
		return self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientHeight;
	}
	else if (document.body) {
		return document.body.clientHeight;
	}
}

function GetWindowWidth() {
	if (self.innerWidth) {
		return self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
	}
	else if (document.body) {
		return document.body.clientWidth;
	}
}

function AdjustHeight(objImg) {
	var winHeight = GetWindowHeight();
	var winWidth = GetWindowWidth();
	
//	var objImg = this;
//	var inImg = this.id.substr(3);
//	var objCnt = document.getElementById('cnt' + inImg);
//not resizing image "container" but image itself
	
	var imgWidth = objImg.width;
	var imgHeight = objImg.height;

	var negOffsetX = 0; //(imgWidth/2) > 50 ? 50 : (imgWidth/2);
	var negOffsetY = 0; //(imgHeight/2) > 20 ? 20 : (imgHeight/2);
	
	//get images top/left coordinates?
	var currLrgX = findPosX(objImg);
	var currLrgY = findPosY(objImg);
	
	//get images top/left coordinates
	var currX = currLrgX - negOffsetX; //findPosX(objImg);
	var currY = currLrgY - negOffsetY; //findPosY(objImg);
	
	var iebody = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;

	var dsocleft = document.all ? iebody.scrollLeft : pageXOffset;
	//var dsocleft = 0;
	var dsoctop = document.all ? iebody.scrollTop : pageYOffset;

	//debug('(currX + objImg.width + 23) = ' + (currX + objImg.width + 23));
	//debug('(winWidth + dsocleft) = ' + (winWidth + dsocleft));
	
	if ((currX + objImg.width + 23) > (winWidth + dsocleft)) {
		currX = (winWidth - imgWidth) - 23 + dsocleft;
	} else if (currX < 0) {
		currX = 0;
	}
	
	//debug('(currY + objImg.height + 10) = ' + (currY + objImg.height + 10));
	//debug('(winHeight + dsoctop) = ' + (winHeight + dsoctop));
	
	if ((currY + objImg.height + 10) > (winHeight + dsoctop)) {
		currY = (winHeight - imgHeight) - 10 + dsoctop;
	} else if (currY < 0) {
		currY = 0;
	}
	
	objImg.style.left = currX + 'px';
	objImg.style.top = currY + 'px';
	
	objImg.style.visibility = 'visible';
	
	//setLyr(this,'cls'+inImg);
	//document.getElementById('cls'+inImg).style.display = '';
}