var myPopup = null;
function ResizeHelpWindow()
{
		var height;
		var right;
		var width;
		var values;
		
		height = screen.height - 80;
		width = screen.width;
		right = width/2;
		
		values='height=' + height + ',width=' + (right - 10) + ',left=' + right;
		if(myPopup)
		{
			if(myPopup.closed)
				myPopup=window.open('/cortexdotnet/help/HelpPage.aspx', null, values + ',top=0,resizable=yes,status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no');
				myPopup.focus();
			
		}
		else
			myPopup=window.open('/cortexdotnet/help/HelpPage.aspx', null, values + ',top=0,resizable=yes,status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no');

		window.resizeTo((right),height + 60);
		window.moveTo(0,0);
}

function SizeFrame(size,id,framesize) {
	var newsize;
	newsize=0;
	//debugger;
	if(size==0)
	{
		newsize=0;
		document.getElementById(pagePrefix + 'hypManage').href="javascript:SizeFrame(350,'order',1)"
	}
	else
	{
		document.getElementById(pagePrefix + 'hypManage').href="javascript:SizeFrame(0,'order',1)"
		if (document.all('fr' + id).contentWindow.document.body!=null)
		{
			newsize=document.all('fr' + id).contentWindow.document.body.scrollHeight;
		}
		
	}
	document.all('fr' + id).height=newsize;
	document.all('fr' + id).frameborder=framesize;
	//GridSize(size,id);
} 
function GridSize(size,id) {
//debugger;
	document.all('fr' + id).height=size;//document.all('fr' + id).contentWindow.document.body.offsetHeight;
	if(document.all('fr' + id).contentWindow.document.body.scrollWidth > 800)
	{
		document.all('fr' + id).width = document.all('fr' + id).contentWindow.document.body.scrollWidth;
		//document.all('fr' + id).scrolling='auto'
	}

	if (document.all('divwait' + id) != null)
	{
		document.all('divwait' + id).outerText='';
	}
	
} 

function replace(string,text,by) {
// Replaces text with by in string
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return string;

	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) return string;
	if (i == -1) return string;

	var newstr = string.substring(0,i) + by;

	if (i+txtLength < strLength)
		newstr += replace(string.substring(i+txtLength,strLength),text,by);

	return newstr;
}
function ChangeSource(source,id) {
	//debugger;
	document.all(id).src='';
	document.all(id).src=source;
}
function IncreaseFrame(id){
	var newsize = parseInt(document.all('fr' + id).height) + 50;
	document.all('fr' + id).height = newsize;
}
function DecreaseFrame(id){
	var newsize = parseInt(document.all('fr' + id).height) - 50;
	document.all('fr' + id).height = newsize;
}
			