function calcSize(sID)	
{
	var the_height = document.getElementById(sID).contentWindow.document.body.scrollHeight;
	document.getElementById(sID).height=the_height;
	var the_width=document.getElementById(sID).contentWindow.document.body.scrollWidth;
	document.getElementById(sID).width=the_width;
}
function reportSize() {
		  myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth;
		    myHeight = window.innerHeight;
		  } else {
		    if( document.documentElement &&
		        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		      //IE 6+ in 'standards compliant mode'
		      myWidth = document.documentElement.clientWidth;
		      myHeight = document.documentElement.clientHeight;
		    } else {
		      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		        //IE 4 compatible
		        myWidth = document.body.clientWidth;
		        myHeight = document.body.clientHeight;
		      }
		    }
		  }
		}
		function setInnerWidth(w,h){
			window.resizeTo(800,800);
			reportSize();
			var oX = 800-myWidth;
			var oY = 800-myHeight;
			window.resizeTo( (w+oX) , (h+oY) );
		}
function setSize(sID, iW, iH, scroll)	
{
	if(iW != -1 && iH != -1)
	{
		document.getElementById(sID).height = iH;
		document.getElementById(sID).width = iW;
	}
	else
	{
		myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth;
		    myHeight = window.innerHeight;
			myWidth = myWidth - myWidth * 0.03;
		  } else {
		    if( document.documentElement &&
		        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		      //IE 6+ in 'standards compliant mode'
		      myWidth = document.documentElement.clientWidth;
		      myHeight = document.documentElement.clientHeight;
		    } else {
		      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		        //IE 4 compatible
		        myWidth = document.body.clientWidth;
		        myHeight = document.body.clientHeight;
			myWidth = myWidth - myWidth * 0.03;
		      }
		    }
		  }
		
		
		if(myHeight < 768)
			myHeight = 768;
		if(myWidth < 1024)
			myWidth = 1024;

		document.getElementById(sID).height = myHeight;
		document.getElementById(sID).width = myWidth;
	}
	if(scroll != false)
		document.getElementById(sID).scrollIntoView();
}
function MoveAtoB(objA, objB, left, top)
{
	var obj = document.getElementById(objA);
	var rect = document.getElementById(objB).getClientRects()[0]
	
	obj.style.left = rect.left + left;
	obj.style.top = rect.top + top;
}
function MoveAtoB_SnC(objA, objB, left, top, left2, top2)
{
	var obj = document.getElementById(objA);
	
	try
	{
		var rect = document.getElementById(objB).getClientRects()[0]
		
		obj.style.left = rect.left + left;
		obj.style.top = rect.top + top;
		//alert('Position found:' + rect);
	}
	catch(TypeError)
	{
		obj.style.left = left2;
		obj.style.top = top2;
		//alert('Position: N/A');
	}
	
}
function onIFrameLoad(sID, iW, iH, scroll, objA, objB, left, top)
{
	setSize(sID, iW, iH, scroll);
	MoveAtoB(objA, objB, left, top);
}
