/*
  What is liquidizing?
  It's a technique used to make a webpage work with any screen resolution by 
  moving the object to the correct coordinates depending on the client's screen
  resolution. This is not needed for the average site where you could use the 
  <center>, tables etc to achieve this. However if you would like a bar at the 
  right side or the bottom of the screen this might be useful. It could also be
  used to centralize absolute positioned objects or to stretch the an object 
  over the entire window. 
	
	Insert the following code into your browser:

		<script language="JavaScript" src="include/js/Liquidizing.js" type="text/javascript"></script>
		<script language="JavaScript" type="text/javascript">
			<!-- Hide for old browsers
				function calcPos() {
					if (ie4 || ns4) {
						posObj('divBackground',0,0, 1)
					}
				}
				
				window.onload = calcPos;
				window.onresize = calcPos;
			//-->
		</script>
*/
ie4 = (document.all)?true:false;
ns4 = (document.layers)?true:false;

function posObj(objName,objLeft,objTop, numPositioning) {
	if (ie4) { objMove = document.all[objName].style;}
	else if (ns4) { objMove = document.layers[objName]; }
	windowWidth  = (ie4)?document.body.clientWidth:window.innerWidth;
	windowHeight = (ie4)?document.body.clientHeight:window.innerHeight;
	switch (numPositioning) {
		case 1: //Relative to a fixed size
			if (windowWidth >= 420) {
				xpos = ((windowWidth - 420) / 2) + objLeft;	
			} else {
				xpos = objLeft;
			}
			if (windowHeight >= 400) {
				ypos = ((windowHeight - 400) / 2) + objTop;
			} else {
				ypos = objTop;
			}
			break;
		case 2: // minus from page height/width
			xpos = windowWidth - objLeft;
			ypos = windowHeight - objTop;
			break;
		default :
			xpos = objLeft;
			ypos = objTop;
	}
//	document.frmDebug.txtRes.value=xpos + 'X' + ypos;
	objMove.left = xpos; objMove.top = ypos;
}
