function DisplaySideCar()
{
	if(document.getElementById('sidecar_empty') == null)
	{
		if(document.body.clientWidth > 994)
			document.getElementById('SideCarCell').style.display = 'block';
		else
			document.getElementById('SideCarCell').style.display = 'none';
		if(document.body.clientWidth >= 1266)
			document.getElementById('GrandContainerTable').style.width = 1266;
		else	
			document.getElementById('GrandContainerTable').style.width = '100%';
	}
	SetKeyboardInputFocus();

}

function SetKeyboardInputFocus()
{
	try
	{
		if (100 > document.body.scrollTop)
		{
			document.searchFrm.search_encarta.focus();
		}
	}
	catch(err){}
	
}

function initOvertureFrame()
{
	if (document.all.ovtrfrm.readyState == "complete")
	{
		var objEnd = document.frames("ovtrfrm").document.all.ovtrEnd;
		if (objEnd==null)
		{
			document.all.ovtrfrm.height =0;
		}
		else
		{
			if (objEnd.offsetTop > 0)
				document.all.ovtrfrm.height = objEnd.offsetTop;
		}
	}
	
}


function LinkToUrl(url,sflag)
{
	window.open(url,sflag);
}


function encodeQueryString(query)
{
	var encodedQuery="";
	var i=0;
	while(i<query.length)
	{
		var c = query.charCodeAt(i);
		encodedQuery += query.charCodeAt(i)+" ";
		i++;
	}
	return encodedQuery;
}

function UTF8UrlEncode(input)
{
	var output = "";
	var currentChar = '';
	
	for(var counter = 0; counter < input.length; counter++) 
	{
		currentChar = input.charCodeAt(counter);
		
		if((48 <= currentChar) && (currentChar <= 57))
			output = output + input.charAt(counter);
		else if((65 <= currentChar) && (currentChar <= 90))
			output = output + input.charAt(counter);
		else if((97 <= currentChar) && (currentChar <= 122))
			output = output + input.charAt(counter);
		else
			output =  output + UTF8UrlEncodeChar(currentChar); 
	}
	return output;
}

function UTF8UrlEncodeChar(input)
{
	if(input <= 0x7F) return "%" + input.toString(16);

	var leadByte = 0xFF80; var hexString = ""; var leadByteSpace = 5;
	while(input > (Math.pow(2, leadByteSpace + 1) - 1))
	{
		hexString = "%" + ((input & 0x3F) | 0x80).toString(16) + hexString;
		leadByte = (leadByte >> 1);
		leadByteSpace--;
		input = input >> 6;
	} 
	
	return ("%" + (input | (leadByte & 0xFF)).toString(16) + hexString).toUpperCase();
}

function DisplayPrintWarning(PageCount,PageLimit,URL,Message)
{
	var strWarning = "";
	if(PageCount >PageLimit) {
	
		LowerLimit = PageCount - 3;
		UpperLimit = PageCount + 3;
		var RegExpLo = /\{0\}/gi;
		var RegExpUp = /\{1\}/gi;
		strWarning= Message.replace(RegExpLo,LowerLimit);
		strWarning = strWarning.replace(RegExpUp,UpperLimit);
		alert(strWarning);
	}
	window.open(URL,'_self');
}