function _O(o){return document.getElementById(o);}//shortcut for getting document objects
var _U=new function U(){}//global function to stick stuff into
function _fr(f){return f.style?f.style:f;}//gets frame styles frame.style.property works for moz, for IE its just frame.property
function _wi(f){return f.contentDocument?f.contentDocument:f.contentWindow.document;}

//sets the frame src, the resizePrompt works onload, since page needs to be loaded first, before you resize
function loadPrompt(page){
	_U.scrollTop=document.body.scrollTop;//issue with getting scrollTop after iframe loads? - must set before hand

	var i=document.createElement("iframe");
	i.id='promptFrame';
	i.name='promptFrame';
	i.scrolling='no';
	i.frameBorder="0";
	i.allowTransparency='true';
	i.onload=i.onreadystatechange=function(){setTimeout("resizePrompt(_O('promptFrame'))",10);}
	i.src=page+"&ms="+new Date().getTime();
	i.style.position='absolute';
	i.style.border='none';
	i.style.zIndex='31';
	document.body.appendChild(i);
	_O('transDiv').style.visibility="";
	//must check browser version here as you get didfferent heights for the full page
	_O('transDiv').style.height=Math.max(document.body.clientHeight,navigator.appName=='Netscape'?document.body.offsetHeight:document.body.scrollHeight-150);//no idea where this 150 is coming from (IE fix), but if its not there you get a bad value for the body height
}

//resizes prompt with default prompt being used
function resizePromptQuick(){resizePrompt(_O('promptFrame'));}

//sets the promt size based on the size of the contents in the iframe
function resizePrompt(frame){
    //gets objects for mozilla/ie
    var fr=_fr(frame);
    var innerDoc=_wi(frame);
    
    //set prompt demensions    
    try{//IE sucks - this is a fix for refreshing prompts
    	fr.height=frH=innerDoc.body.scrollHeight;
		fr.width=frW=innerDoc.body.scrollWidth;
    }catch(e){}
	
	//center prompt
	fr.top=parseInt(document.body.clientHeight*0.5)-parseInt(0.5*frH)+_U.scrollTop;
	fr.left=parseInt(document.body.clientWidth*0.5)-parseInt(0.5*frW);
	
	//reset the scrollbar position
	window.scrollTo(0,_U.scrollTop);
}

//hide the prompt frame, called as parent.closePrompt() from iframe
function closePrompt(command){
	try{
		document.body.removeChild(_O('promptFrame'));
		_O('transDiv').style.visibility='hidden';
		if(command!=undefined)eval(command);
	}catch(e){}
}
