
function doPreview( PreviewWindow) 
{ 

	if (PreviewWindow != null) 
	{ 
		tempDocument = PreviewWindow.document;
		tempDocument.open();
		tempDocument.writeln('<html><body>');
		tempDocument.writeln(document.getElementById('EditBox').value); 
		tempDocument.writeln('</body></html>'); 
		tempDocument.close(); 
		if (PreviewWindow.execScript != null) PreviewWindow.setTimeout('BindMemberInfo();', 100);
	} 
	else 
	{
		var previewDiv = document.getElementById('PreviewDiv'); 
		previewDiv.innerHTML = document.getElementById('EditBox').value; 
		BindMemberInfo(); 
	} 
	return true; 
} 
function BindMemberInfo( mDocument) 
{ 
	if (mDocument == null) mDocument = document; 
	LinkInnerHTML(mDocument, 'AcctID', AcctIDString);
	LinkInnerHTML(mDocument, 'ClientID', ClientIDString);
	LinkImgSrc(mDocument, 'Photo', PhotoString);
	LinkInnerHTML(mDocument, 'Headline', HeadlineString);
	LinkInnerHTML(mDocument, 'ShortHeadline', (HeadlineString.length>30?HeadlineString.substring(0,30):HeadlineString));
	LinkInnerHTML(mDocument, 'Location', LocationString);
	LinkInnerHTML(mDocument, 'Age', AgeString);
	
	LinkHerf(mDocument, 'ImageLink', ProfileLinkString);
	LinkHerf(mDocument, 'ProfileLink', ProfileLinkString);
	LinkHerf(mDocument, 'MoreLink', ProfileLinkString);
	return; 
}
function LinkImgSrc(mDocument, ElementName, Value)
{
	if (mDocument.getElementById(ElementName) != null) mDocument.getElementById(ElementName).src = Value; 
}
function LinkInnerHTML(mDocument, ElementName, Value)
{
	if (mDocument.getElementById(ElementName) != null) mDocument.getElementById(ElementName).innerHTML = Value; 
}
function LinkHerf(mDocument, ElementName, Value)
{
	if (mDocument.getElementById(ElementName) != null)  mDocument.getElementById(ElementName).href = Value; 
}


